input
stringlengths 30
10.8M
| output
stringlengths 30
15.4M
|
|---|---|
int hdflush(void)
{
unsigned int flags;
char *disk;
DIR *blk;
if ((blk = opendir("/sys/block")) == (DIR*)0)
return -1;
while ((disk = list_disks(blk, &flags)))
do_standby_disk(disk, (flags|0x00000020));
return closedir(blk);
}
static char *strstrip(char *str)
{
const size_t len = strlen(str);
if (len) {
char* end = str + len - 1;
while ((end != str) && (((*end)==' ')||((*end)=='\n')||((*end)=='\t')||((*end)=='\v')||((*end)=='\r')||((*end)=='\f')))
end--;
*(end + 1) = '\0';
}
return str;
}
static FILE *hdopen(const char* const format, const char* const name)
{
char buf[
255
+1];
FILE *fp = (FILE*)-1;
int fd, ret;
ret = snprintf(buf, sizeof(buf), format, name);
if ((ret >= (int)sizeof(buf)) || (ret < 0))
goto error;
fd = open(buf,
00
|
0400
);
if (fd < 0) {
if (
(*__errno_location ())
!=
2
)
goto error;
fp = (FILE*)0;
goto error;
}
fp = fdopen(fd, "r");
if (fp == (FILE*)0)
close(fd);
error:
return fp;
}
static int flush_cache_ext(const char *device)
{
unsigned char args[4+512];
unsigned short *id = (unsigned short*)(&args[4]);
char buf[
255
+1], *ptr;
int fd = -1, ret = 0;
FILE *fp;
fp = hdopen("/sys/block" "/%s/size", device);
if (0 == (long)fp || -1 == (long)fp) {
if (-1 == (long)fp)
return -1;
goto out;
}
ptr = fgets(buf, sizeof(buf), fp);
fclose(fp);
if (ptr == (char*)0)
goto out;
ptr = strstrip(buf);
if (*ptr == '\0')
goto out;
if ((size_t)atoll(buf) < (1<<28))
goto out;
ret = snprintf(buf, sizeof(buf), "/dev" "/%s", device);
if ((ret >= (int)sizeof(buf)) || (ret < 0))
return -1;
if ((fd = open(buf,
00
|
04000
)) < 0)
goto out;
memset(&args[0], 0, sizeof(args));
args[0] =
0xEC
;
args[3] = 1;
if (ioctl(fd,
0x031f
, &args))
goto out;
if ((id[83] & 0xE000) == 0x6000)
ret = 1;
out:
if (fd >= 0)
close(fd);
return ret;
}
|
int hdflush(void)
{
unsigned int flags;
char *disk;
DIR *blk;
if ((blk = opendir("/sys/block")) == (DIR*)0)
return -1;
while ((disk = list_disks(blk, &flags)))
do_standby_disk(disk, (flags|0x00000020));
return closedir(blk);
}
static char *strstrip(char *str)
{
const size_t len = strlen(str);
if (len) {
char* end = str + len - 1;
while ((end != str) && (((*end)==' ')||((*end)=='\n')||((*end)=='\t')||((*end)=='\v')||((*end)=='\r')||((*end)=='\f')))
end--;
*(end + 1) = '\0';
}
return str;
}
static FILE *hdopen(const char* const format, const char* const name)
{
char buf[
255
+1];
FILE *fp = (FILE*)-1;
int fd, ret;
ret = snprintf(buf, sizeof(buf), format, name);
if ((ret >= (int)sizeof(buf)) || (ret < 0))
goto error;
fd = open(buf,
00
|
0400
);
if (fd < 0) {
if (
(*__errno_location ())
!=
2
)
goto error;
fp = (FILE*)0;
goto error;
}
fp = fdopen(fd, "r");
if (fp == (FILE*)0)
close(fd);
error:
return fp;
}
static int flush_cache_ext(const char *device)
{
unsigned char args[4+512];
unsigned short *id = (unsigned short*)(&args[4]);
char buf[
255
+1], *ptr;
int fd = -1, ret = 0;
FILE *fp;
fp = hdopen("/sys/block" "/%s/size", device);
if (0 == (long)fp || -1 == (long)fp) {
if (-1 == (long)fp)
return -1;
goto out;
}
ptr = fgets(buf, sizeof(buf), fp);
fclose(fp);
if (ptr == (char*)0)
goto out;
ptr = strstrip(buf);
if (*ptr == '\0')
goto out;
if ((size_t)atoll(buf) < (1<<28))
goto out;
ret = snprintf(buf, sizeof(buf), "/dev" "/%s", device);
if ((ret >= (int)sizeof(buf)) || (ret < 0))
return -1;
if ((fd = open(buf,
00
|
04000
)) < 0)
goto out;
memset(&args[0], 0, sizeof(args));
args[0] =
0xEC
;
args[3] = 1;
if (ioctl(fd,
0x031f
, &args))
goto out;
if ((id[83] & 0xE000) == 0x6000)
ret = 1;
out:
if (fd >= 0)
close(fd);
return ret;
}
|
int print_cmd_completions(unsigned long long a0) {
[1760] struct_0 *v1; // rbx
[1760] unsigned long long v2; // rbp
[1760] void* v3; // rdi
[1760] void* v4; // rsi
[1760] unsigned int v5; // edx
[1760] unsigned long long v6; // rdi
[1760] unsigned long long v8; // rdi
[1760]
[1760] if (a0) {
v1 = a0;
[1771] v2 = 0;
[1774, 1776, 1780, 1783] while (true) {
[1776] v4 = progcomp_search(v1->field_8->field_0);
[1788, 1783] if (v4) {
print_one_completion(v1->field_8->field_0, v4);
[1800, 1803] v1 = v1->field_0;
[1808] if (v1)
continue;
[1811, 1814] v6 = v2;
[1816, 1820] return sh_chkwrite();
[1824, 3945, 3947, 1822, 1823] } else {
v5 = 5;
[1832, 1835] v2 = 1;
[1857, 1860, 1862, 1854] builtin_error(dcgettext(NULL, "%s: no completion specification", 0x5), v1->field_8->field_0);
[1840, 1847, 1849, 1867] v1 = v1->field_0;
[1872] if (v1)
continue;
[1875, 1878] v8 = 1;
[1880, 1884] return sh_chkwrite();
[1824, 3945, 3947, 1822, 1823] }
}
} else {
v3 = 0;
[1896, 1898, 1902] return sh_chkwrite();
[1824, 3945, 3947, 1822, 1823] }
}
|
int print_cmd_completions(unsigned long a0) {
[4194] unsigned int v0; // [bp-0x2c]
[4194] struct_0 *v1; // [bp-0x28]
[4194] unsigned long long v2; // [bp-0x20]
[4194]
[4194] v0 = 0;
[4194, 4198, 4199, 4202, 4203, 4207, 4211] for (v1 = a0; v1; v1 = v1->field_0) {
[4332, 4336, 4339, 4343, 4218, 4348, 4222] v2 = progcomp_search(v1->field_8->field_0);
[4242, 4247] if (v2) {
print_one_completion(v1->field_8->field_0, v2);
[4258, 4262, 4266, 4269, 4273, 4276, 4279] } else {
builtin_error(gettext("%s: no completion specification"), v1->field_8->field_0);
[4320, 4297, 4304, 4309, 4312, 4315] v0 = 1;
[4325, 4332, 4336, 4339, 4343, 4348] }
}
return sh_chkwrite(v0);
}
|
int buf_equal(unsigned long long a0, unsigned long long a1) {
[3088] unsigned int v1; // eax
[3088]
[3088] if (!sshbuf_ptr()) {
[3104] v1 = -10;
[3232] return v1;
[3203, 3204, 3205, 3207, 3209, 3199] } else if (!sshbuf_ptr()) {
[3117] v1 = -10;
[3232] return v1;
[3203, 3204, 3205, 3207, 3209, 3199] } else if (sshbuf_len(a0) != sshbuf_len(a1)) {
[3141, 3130, 3149, 3146] v1 = -0x4;
[3216] return v1;
[3203, 3204, 3205, 3207, 3209, 3199] } else {
v1 = timingsafe_bcmp(sshbuf_ptr(), sshbuf_ptr(), sshbuf_len(a0));
[3176, 3181, 3184, 3154, 3187, 3190, 3165] if (v1) {
v1 = -0x4;
[3216] return v1;
[3203, 3204, 3205, 3207, 3209, 3199] }
return v1;
[3203, 3204, 3205, 3207, 3209, 3199] }
}
|
int buf_equal(unsigned long long a0, unsigned long long a1) {
[6768] unsigned int v1; // eax
[6768]
[6768] if (!sshbuf_ptr(a0)) {
[6798] v1 = -10;
[6825] return v1;
[6947, 6948, 6950, 6951, 6943] } else if (!sshbuf_ptr(a1)) {
[6815] v1 = -10;
[6825] return v1;
[6947, 6948, 6950, 6951, 6943] } else {
v1 = (sshbuf_len(a0) == sshbuf_len(a1) ? -0x4 : (!timingsafe_bcmp(sshbuf_ptr(a0), sshbuf_ptr(a1), sshbuf_len(a0)) ? -0x4 : 0));
[6854, 6922, 6859, 6862, 6864, 6931, 6878, 6893, 6839, 6908] return v1;
[6947, 6948, 6950, 6951, 6943] }
}
|
void yyerror(unsigned long long a0) {
[64] unsigned long v0; // [bp-0x8]
[64] unsigned long v2; // rax
[64] unsigned long long v3; // rdx
[64] unsigned long long v4; // rax
[64]
[64] v0 = v2;
[64] sh_error("arithmetic expression: %s: \"%s\"", a0, arith_startbuf);
[65, 66, 68, 72, 79, 82, 89] v4 = do_binop("arithmetic expression: %s: \"%s\"", a0, v3);
[82, 94] return;
[94] }
|
void yyerror(unsigned long long a0) {
[0] sh_error("arithmetic expression: %s: \"%s\"", a0, arith_startbuf);
[0, 4, 5, 8, 12, 16, 23, 27, 30, 37, 42] }
|
static gnutls_pubkey_t _load_url_pubkey(const char *url)
{
int ret;
gnutls_pubkey_t pubkey;
unsigned int obj_flags = 0;
ret = gnutls_pubkey_init(&pubkey);
if (ret < 0) {
fprintf(
stderr
, "Error in %s:%d: %s\n", __func__, 238,
gnutls_strerror(ret));
app_exit(1);
}
ret = gnutls_pubkey_import_url(pubkey, url, obj_flags);
if (ret < 0) {
fprintf(
stderr
, "Error in %s:%d: %s: %s\n", __func__,
246, gnutls_strerror(ret), url);
app_exit(1);
}
return pubkey;
}
gnutls_privkey_t load_private_key(int mand, common_info_st * info)
{
gnutls_privkey_t key;
gnutls_datum_t dat;
size_t size;
if (!info->privkey && !mand)
return
((void *)0)
;
if (info->privkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-privkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->privkey) != 0)
return _load_url_privkey(info->privkey);
dat.data = (void *) _gnutls_read_file(info->privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-privkey: %s\n",
info->privkey);
app_exit(1);
}
key = _load_privkey(&dat, info);
free(dat.data);
return key;
}
gnutls_x509_privkey_t
load_x509_private_key(int mand, common_info_st * info)
{
gnutls_x509_privkey_t key;
int ret;
gnutls_datum_t dat;
size_t size;
unsigned int flags = 0;
const char *pass;
if (!info->privkey && !mand)
return
((void *)0)
;
if (info->privkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-privkey\n");
app_exit(1);
}
ret = gnutls_x509_privkey_init(&key);
if (ret < 0) {
fprintf(
stderr
, "privkey_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *) _gnutls_read_file(info->privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-privkey: %s\n",
info->privkey);
app_exit(1);
}
if (info->pkcs8) {
pass = get_password(info, &flags, 0);
ret =
gnutls_x509_privkey_import_pkcs8(key, &dat,
info->incert_format,
pass, flags);
} else {
ret =
gnutls_x509_privkey_import2(key, &dat,
info->incert_format,
((void *)0)
,
0);
if (ret == -24) {
pass = get_password(info, &flags, 0);
ret =
gnutls_x509_privkey_import2(key, &dat,
info->
incert_format,
pass, flags);
}
}
free(dat.data);
if (ret == -207) {
fprintf(
stderr
,
"import error: could not find a valid PEM header; "
"check if your key is PEM encoded\n");
app_exit(1);
}
if (ret < 0) {
fprintf(
stderr
, "error importing private key: %s: %s\n",
info->privkey, gnutls_strerror(ret));
app_exit(1);
}
return key;
}
gnutls_x509_crt_t load_cert(int mand, common_info_st * info)
{
gnutls_x509_crt_t *crt;
gnutls_x509_crt_t ret_crt;
size_t size, i;
crt = load_cert_list(mand, &size, info);
if (crt) {
ret_crt = crt[0];
for (i=1;i<size;i++)
gnutls_x509_crt_deinit(crt[i]);
gnutls_free((void *) (crt)), crt=
((void *)0)
;
return ret_crt;
}
return
((void *)0)
;
}
gnutls_x509_crt_t *load_cert_list(int mand, size_t * crt_size,
common_info_st * info)
{
FILE *fp;
static gnutls_x509_crt_t *crt;
int ret;
gnutls_datum_t dat;
unsigned size;
unsigned int crt_max;
unsigned flags = 0;
*crt_size = 0;
if (info->verbose)
fprintf(
stderr
, "Loading certificate list...\n");
if (info->cert ==
((void *)0)
) {
if (mand) {
fprintf(
stderr
, "missing --load-certificate\n");
app_exit(1);
} else
return
((void *)0)
;
}
fp = fopen(info->cert, "r");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "Could not open %s\n", info->cert);
app_exit(1);
}
fix_lbuffer(file_size(fp));
size = fread(lbuffer, 1, lbuffer_size - 1, fp);
lbuffer[size] = 0;
fclose(fp);
dat.data = (void *) lbuffer;
dat.size = size;
if (info->sort_chain)
flags |= GNUTLS_X509_CRT_LIST_SORT;
ret = gnutls_x509_crt_list_import2(&crt, &crt_max, &dat, GNUTLS_X509_FMT_PEM, flags);
if (ret < 0) {
fprintf(
stderr
, "Error loading certificates: %s\n", gnutls_strerror(ret));
app_exit(1);
}
*crt_size = crt_max;
if (info->verbose)
fprintf(
stderr
, "Loaded %d certificates.\n",
(int) crt_max);
return crt;
}
gnutls_x509_crl_t *load_crl_list(int mand, size_t * crl_size,
common_info_st * info)
{
FILE *fp;
static gnutls_x509_crl_t *crl;
unsigned int crl_max;
int ret;
gnutls_datum_t dat;
size_t size;
*crl_size = 0;
if (info->verbose)
fprintf(
stderr
, "Loading CRL list...\n");
if (info->crl ==
((void *)0)
) {
if (mand) {
fprintf(
stderr
, "missing --load-crl\n");
app_exit(1);
} else
return
((void *)0)
;
}
fp = fopen(info->crl, "r");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "Could not open %s\n", info->crl);
app_exit(1);
}
fix_lbuffer(file_size(fp));
size = fread(lbuffer, 1, lbuffer_size - 1, fp);
lbuffer[size] = 0;
fclose(fp);
dat.data = (void *) lbuffer;
dat.size = size;
ret = gnutls_x509_crl_list_import2(&crl, &crl_max, &dat, GNUTLS_X509_FMT_PEM, 0);
if (ret == -34) {
ret = gnutls_x509_crl_list_import2(&crl, &crl_max, &dat, GNUTLS_X509_FMT_DER, 0);
}
if (ret < 0) {
fprintf(
stderr
, "Error loading CRLs: %s\n", gnutls_strerror(ret));
app_exit(1);
}
*crl_size = crl_max;
if (info->verbose)
fprintf(
stderr
, "Loaded %d CRLs.\n",
(int) *crl_size);
return crl;
}
gnutls_x509_crq_t load_request(common_info_st * info)
{
gnutls_x509_crq_t crq;
int ret;
gnutls_datum_t dat;
size_t size;
if (!info->request)
return
((void *)0)
;
ret = gnutls_x509_crq_init(&crq);
if (ret < 0) {
fprintf(
stderr
, "crq_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *) _gnutls_read_file(info->request, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-request: %s\n",
info->request);
app_exit(1);
}
ret = gnutls_x509_crq_import(crq, &dat, info->incert_format);
if (ret == -207) {
fprintf(
stderr
,
"import error: could not find a valid PEM header\n");
app_exit(1);
}
free(dat.data);
if (ret < 0) {
fprintf(
stderr
, "error importing certificate request: %s: %s\n",
info->request, gnutls_strerror(ret));
app_exit(1);
}
return crq;
}
gnutls_privkey_t load_ca_private_key(common_info_st * info)
{
gnutls_privkey_t key;
gnutls_datum_t dat;
size_t size;
if (info->ca_privkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-ca-privkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->ca_privkey) != 0)
return _load_url_privkey(info->ca_privkey);
dat.data = (void *) _gnutls_read_file(info->ca_privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-ca-privkey: %s\n",
info->ca_privkey);
app_exit(1);
}
key = _load_privkey(&dat, info);
free(dat.data);
return key;
}
gnutls_x509_crt_t load_ca_cert(unsigned mand, common_info_st * info)
{
gnutls_x509_crt_t crt;
int ret;
gnutls_datum_t dat;
size_t size;
if (mand == 0 && info->ca ==
((void *)0)
) {
return
((void *)0)
;
}
if (info->ca ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-ca-certificate\n");
app_exit(1);
}
ret = gnutls_x509_crt_init(&crt);
if (ret < 0) {
fprintf(
stderr
, "crt_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (gnutls_url_is_supported(info->ca) != 0) {
ret = gnutls_x509_crt_import_url(crt, info->ca, 0);
if (ret < 0) {
fprintf(
stderr
, "error importing CA certificate: %s: %s\n",
info->ca, gnutls_strerror(ret));
app_exit(1);
}
return crt;
}
dat.data = (void *) _gnutls_read_file(info->ca, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-ca-certificate: %s\n",
info->ca);
app_exit(1);
}
ret = gnutls_x509_crt_import(crt, &dat, info->incert_format);
free(dat.data);
if (ret < 0) {
fprintf(
stderr
, "error importing CA certificate: %s: %s\n",
info->ca, gnutls_strerror(ret));
app_exit(1);
}
return crt;
}
gnutls_pubkey_t load_pubkey(int mand, common_info_st * info)
{
gnutls_pubkey_t key;
int ret;
gnutls_datum_t dat;
size_t size;
if (!info->pubkey && !mand)
return
((void *)0)
;
if (info->pubkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-pubkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->pubkey) != 0)
return _load_url_pubkey(info->pubkey);
ret = gnutls_pubkey_init(&key);
if (ret < 0) {
fprintf(
stderr
, "privkey_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *) _gnutls_read_file(info->pubkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-pubkey: %s\n", info->pubkey);
app_exit(1);
}
ret = gnutls_pubkey_import(key, &dat, info->incert_format);
if (ret == -207) {
ret = gnutls_pubkey_import_x509_raw(key, &dat, info->incert_format, 0);
if (ret < 0) {
fprintf(
stderr
,
"import error: could not find a valid PEM header; "
"check if your key has the PUBLIC KEY header\n");
app_exit(1);
}
} else if (ret < 0) {
fprintf(
stderr
, "importing public key: %s: %s\n",
info->pubkey, gnutls_strerror(ret));
app_exit(1);
}
free(dat.data);
return key;
}
gnutls_pubkey_t load_public_key_or_import(int mand,
gnutls_privkey_t privkey,
common_info_st * info)
{
gnutls_pubkey_t pubkey;
int ret;
ret = gnutls_pubkey_init(&pubkey);
if (ret < 0) {
fprintf(
stderr
, "gnutls_pubkey_init: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (!privkey || gnutls_pubkey_import_privkey(pubkey, privkey, 0, 0) < 0) {
gnutls_pubkey_deinit(pubkey);
pubkey = load_pubkey(0, info);
if (pubkey ==
((void *)0)
&& mand) {
fprintf(
stderr
, "Could not determine the public key for the operation.\nYou must specify --load-privkey or --load-pubkey if missing.\n");
app_exit(1);
}
}
return pubkey;
}
static const char *bits_to_sp(gnutls_pk_algorithm_t pk, unsigned int bits)
{
gnutls_sec_param_t s = gnutls_pk_bits_to_sec_param(pk, bits);
if (s == GNUTLS_SEC_PARAM_UNKNOWN) {
return gnutls_sec_param_get_name(GNUTLS_SEC_PARAM_MEDIUM);
}
return gnutls_sec_param_get_name(s);
}
int
get_bits(gnutls_pk_algorithm_t key_type, int info_bits,
const char *info_sec_param, int warn)
{
int bits;
if (info_bits != 0) {
static int warned = 0;
if (warned == 0 && warn != 0 && (((unsigned int)(info_bits)) & 0x80000000)==0) {
warned = 1;
fprintf(
stderr
,
"** Note: You may use '--sec-param %s' instead of '--bits %d'\n",
bits_to_sp(key_type, info_bits), info_bits);
}
bits = info_bits;
} else {
if (info_sec_param == 0) {
info_sec_param = "HIGH";
}
bits =
gnutls_sec_param_to_pk_bits(key_type,
str_to_sec_param
(info_sec_param));
}
return bits;
}
gnutls_sec_param_t str_to_sec_param(const char *str)
{
if (strcasecmp(str, "low") == 0) {
return GNUTLS_SEC_PARAM_LOW;
} else if (strcasecmp(str, "legacy") == 0) {
return GNUTLS_SEC_PARAM_LEGACY;
} else if (strcasecmp(str, "normal") == 0 || strcasecmp(str, "medium") == 0) {
return GNUTLS_SEC_PARAM_MEDIUM;
} else if (strcasecmp(str, "high") == 0) {
return GNUTLS_SEC_PARAM_HIGH;
} else if (strcasecmp(str, "ultra") == 0) {
return GNUTLS_SEC_PARAM_ULTRA;
} else if (strcasecmp(str, "future") == 0) {
return GNUTLS_SEC_PARAM_FUTURE;
} else {
fprintf(
stderr
, "Unknown security parameter string: %s\n",
str);
app_exit(1);
}
}
static void
print_hex_datum(FILE * outfile, gnutls_datum_t * dat, int cprint)
{
unsigned int j;
if (cprint != 0) {
fprintf(outfile, "\n" "\t" "\"");
for (j = 0; j < dat->size; j++) {
fprintf(outfile, "\\x%.2x",
(unsigned char) dat->data[j]);
if ((j + 1) % 16 == 0) {
fprintf(outfile, "\"\n" "\t" "\"");
}
}
fprintf(outfile, "\";\n\n");
return;
}
fprintf(outfile, "\n" "\t");
for (j = 0; j < dat->size; j++) {
if ((j + 1) % 16 == 0) {
fprintf(outfile, "%.2x", (unsigned char) dat->data[j]);
fprintf(outfile, "\n" "\t");
} else {
fprintf(outfile, "%.2x:", (unsigned char) dat->data[j]);
}
}
fprintf(outfile, "\n\n");
}
static void print_head(FILE * out, const char *txt, unsigned int size,
int cprint)
{
unsigned i;
char *p, *ntxt;
int ret;
if (cprint != 0) {
if (size > 0)
ret = asprintf(&ntxt, "const unsigned char %s[%u] =",
txt, size);
else
ret = asprintf(&ntxt, "const unsigned char %s[] =\n",
txt);
if (ret == -1) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
p = strstr(ntxt, "char");
p += 5;
for (i = 0; i < strlen(txt); i++)
if (p[i] == ' ')
p[i] = '_';
fprintf(out, "%s", ntxt);
free(ntxt);
return;
}
fprintf(out, "%s:", txt);
}
void
print_dsa_pkey(FILE * outfile, gnutls_datum_t * x, gnutls_datum_t * y,
gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g,
int cprint)
{
if (x) {
print_head(outfile, "private key", x->size, cprint);
print_hex_datum(outfile, x, cprint);
}
print_head(outfile, "public key", y->size, cprint);
print_hex_datum(outfile, y, cprint);
print_head(outfile, "p", p->size, cprint);
print_hex_datum(outfile, p, cprint);
print_head(outfile, "q", q->size, cprint);
print_hex_datum(outfile, q, cprint);
print_head(outfile, "g", g->size, cprint);
print_hex_datum(outfile, g, cprint);
}
gnutls_ecc_curve_t str_to_curve(const char *str)
{
unsigned num = 0;
const gnutls_ecc_curve_t *list, *p;
list = gnutls_ecc_curve_list();
p = list;
while(*p != 0) {
if (strcasecmp(str, gnutls_ecc_curve_get_name(*p)) == 0)
return *p;
p++;
num++;
}
fprintf(
stderr
, "Unsupported curve: %s\nAvailable curves:\n", str);
if (num == 0)
printf("none\n");
p = list;
while(*p != 0) {
fprintf(
stderr
, "\t- %s\n",
gnutls_ecc_curve_get_name(*p));
p++;
}
app_exit(1);
}
void
print_ecc_pkey(FILE * outfile, gnutls_ecc_curve_t curve,
gnutls_datum_t * k, gnutls_datum_t * x, gnutls_datum_t * y,
int cprint)
{
if (cprint != 0)
fprintf(outfile, "/* curve: %s */\n",
gnutls_ecc_curve_get_name(curve));
else
fprintf(outfile, "curve:\t%s\n",
gnutls_ecc_curve_get_name(curve));
if (k && k->data) {
print_head(outfile, "private key", k->size, cprint);
print_hex_datum(outfile, k, cprint);
}
if (x && x->data) {
print_head(outfile, "x", x->size, cprint);
print_hex_datum(outfile, x, cprint);
}
if (y && y->data) {
print_head(outfile, "y", y->size, cprint);
print_hex_datum(outfile, y, cprint);
}
}
static void reverse_datum(gnutls_datum_t *d)
{
unsigned int i;
unsigned char c;
for (i = 0; i < d->size / 2; i++) {
c = d->data[i];
d->data[i] = d->data[d->size - i - 1];
d->data[d->size - i - 1] = c;
}
}
void
print_gost_pkey(FILE * outfile, gnutls_ecc_curve_t curve,
gnutls_digest_algorithm_t digest, gnutls_gost_paramset_t paramset,
gnutls_datum_t * k, gnutls_datum_t * x, gnutls_datum_t * y,
int cprint)
{
if (cprint != 0)
fprintf(outfile, "/* curve: %s */\n",
gnutls_ecc_curve_get_name(curve));
else
fprintf(outfile, "curve:\t%s\n",
gnutls_ecc_curve_get_name(curve));
if (cprint != 0)
fprintf(outfile, "/* digest: %s */\n",
gnutls_digest_get_name(digest));
else
fprintf(outfile, "digest:\t%s\n",
gnutls_digest_get_name(digest));
if (cprint != 0)
fprintf(outfile, "/* paramset: %s */\n",
gnutls_gost_paramset_get_name(paramset));
else
fprintf(outfile, "paramset:\t%s\n",
gnutls_gost_paramset_get_name(paramset));
if (k) {
reverse_datum(k);
print_head(outfile, "private key", k->size, cprint);
print_hex_datum(outfile, k, cprint);
}
reverse_datum(x);
reverse_datum(y);
print_head(outfile, "x", x->size, cprint);
print_hex_datum(outfile, x, cprint);
print_head(outfile, "y", y->size, cprint);
print_hex_datum(outfile, y, cprint);
}
void
print_rsa_pkey(FILE * outfile, gnutls_datum_t * m, gnutls_datum_t * e,
gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q,
gnutls_datum_t * u, gnutls_datum_t * exp1,
gnutls_datum_t * exp2, int cprint)
{
print_head(outfile, "modulus", m->size, cprint);
print_hex_datum(outfile, m, cprint);
print_head(outfile, "public exponent", e->size, cprint);
print_hex_datum(outfile, e, cprint);
if (d) {
print_head(outfile, "private exponent", d->size, cprint);
print_hex_datum(outfile, d, cprint);
print_head(outfile, "prime1", p->size, cprint);
print_hex_datum(outfile, p, cprint);
print_head(outfile, "prime2", q->size, cprint);
print_hex_datum(outfile, q, cprint);
print_head(outfile, "coefficient", u->size, cprint);
print_hex_datum(outfile, u, cprint);
if (exp1 && exp2) {
print_head(outfile, "exp1", exp1->size, cprint);
print_hex_datum(outfile, exp1, cprint);
print_head(outfile, "exp2", exp2->size, cprint);
print_hex_datum(outfile, exp2, cprint);
}
}
}
void print_pubkey_info(gnutls_pubkey_t pubkey,
FILE *outfile,
gnutls_certificate_print_formats_t format,
gnutls_x509_crt_fmt_t outcert_format,
unsigned int outtext)
{
gnutls_datum_t data;
int ret;
size_t size;
if (outtext) {
ret = gnutls_pubkey_print(pubkey, format, &data);
if (ret < 0) {
fprintf(
stderr
, "pubkey_print error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fprintf(outfile, "%s\n\n", data.data);
gnutls_free((void *) (data.data)), data.data=
((void *)0)
;
}
fix_lbuffer(0);
size = lbuffer_size;
ret =
gnutls_pubkey_export(pubkey, outcert_format, lbuffer,
&size);
if (ret < 0) {
fprintf(
stderr
, "export error: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fwrite(lbuffer, 1, size, outfile);
}
static void
print_dh_info(FILE * outfile, gnutls_datum_t * p, gnutls_datum_t * g,
unsigned int q_bits, int cprint)
{
if (q_bits > 0) {
if (cprint != 0)
fprintf(outfile,
"\n /* recommended key length: %d bytes */\n\n",
(7 + q_bits) / 8);
else
fprintf(outfile,
"\nRecommended key length: %d bits\n\n",
q_bits);
}
print_head(outfile, "generator", g->size, cprint);
print_hex_datum(outfile, g, cprint);
print_head(outfile, "prime", p->size, cprint);
print_hex_datum(outfile, p, cprint);
}
static
int import_dsa_dh(gnutls_dh_params_t dh_params, gnutls_datum_t *params, gnutls_x509_crt_fmt_t format)
{
gnutls_x509_privkey_t pkey;
int ret;
ret = gnutls_x509_privkey_init(&pkey);
if (ret < 0)
return ret;
ret = gnutls_x509_privkey_import(pkey, params, format);
if (ret < 0)
return ret;
ret = gnutls_dh_params_import_dsa(dh_params, pkey);
gnutls_x509_privkey_deinit(pkey);
return ret;
}
void dh_info(FILE * infile, FILE * outfile, common_info_st * ci)
{
gnutls_datum_t params;
size_t size;
int ret, ret2;
gnutls_dh_params_t dh_params;
gnutls_datum_t p, g;
unsigned int q_bits = 0;
fix_lbuffer(0);
if (gnutls_dh_params_init(&dh_params) < 0) {
fprintf(
stderr
, "Error in dh parameter initialization\n");
app_exit(1);
}
params.data = (void *) _gnutls_fread_file(infile, 0, &size);
params.size = size;
if (params.data ==
((void *)0)
) {
fprintf(
stderr
, "Could not read input\n");
app_exit(1);
}
ret =
gnutls_dh_params_import_pkcs3(dh_params, ¶ms,
ci->incert_format);
if (ret < 0) {
ret2 = import_dsa_dh(dh_params, ¶ms, ci->incert_format);
if (ret2 < 0) {
fprintf(
stderr
, "Error parsing dh params: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
ret = gnutls_dh_params_export_raw(dh_params, &p, &g, &q_bits);
if (ret < 0) {
fprintf(
stderr
, "Error exporting parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (ci->outtext)
print_dh_info(outfile, &p, &g, q_bits, ci->cprint);
if (!ci->cprint) {
size_t len = lbuffer_size;
ret =
gnutls_dh_params_export_pkcs3(dh_params,
ci->outcert_format,
lbuffer, &len);
if (ret == 0) {
if (ci->outcert_format == GNUTLS_X509_FMT_PEM) {
fprintf(outfile, "\n%s", lbuffer);
} else {
fwrite(lbuffer, 1, len, outfile);
}
} else {
fprintf(
stderr
, "Error: %s\n",
gnutls_strerror(ret));
}
}
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (g.data)), g.data=
((void *)0)
;
gnutls_dh_params_deinit(dh_params);
}
int cipher_to_flags(const char *cipher)
{
if (cipher ==
((void *)0)
) {
return GNUTLS_PKCS_PBES2_AES_128;
} else if (strcasecmp(cipher, "3des") == 0) {
return GNUTLS_PKCS_PBES2_3DES;
} else if (strcasecmp(cipher, "3des-pkcs12") == 0) {
return GNUTLS_PKCS_PKCS12_3DES;
} else if (strcasecmp(cipher, "arcfour") == 0) {
return GNUTLS_PKCS_PKCS12_ARCFOUR;
} else if (strcasecmp(cipher, "aes-128") == 0) {
return GNUTLS_PKCS_PBES2_AES_128;
} else if (strcasecmp(cipher, "aes-192") == 0) {
return GNUTLS_PKCS_PBES2_AES_192;
} else if (strcasecmp(cipher, "aes-256") == 0) {
return GNUTLS_PKCS_PBES2_AES_256;
} else if (strcasecmp(cipher, "rc2-40") == 0) {
return GNUTLS_PKCS_PKCS12_RC2_40;
} else if (strcasecmp(cipher, "gost28147-tc26z") == 0) {
return GNUTLS_PKCS_PBES2_GOST_TC26Z;
} else if (strcasecmp(cipher, "gost28147-cpa") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPA;
} else if (strcasecmp(cipher, "gost28147-cpb") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPB;
} else if (strcasecmp(cipher, "gost28147-cpc") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPC;
} else if (strcasecmp(cipher, "gost28147-cpd") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPD;
} else if (strcasecmp(cipher, "none") == 0) {
return GNUTLS_PKCS_PLAIN;
}
fprintf(
stderr
, "unknown cipher %s\n", cipher);
app_exit(1);
}
static void privkey_info_int(FILE *outfile, common_info_st * cinfo,
gnutls_x509_privkey_t key)
{
int ret, key_type;
unsigned int bits = 0;
size_t size;
const char *cprint;
gnutls_x509_spki_t spki;
gnutls_digest_algorithm_t dig;
fprintf(outfile, "Public Key Info:\n");
ret = gnutls_x509_spki_init(&spki);
if (ret < 0) {
fprintf(
stderr
, "spki_init: %s\n", gnutls_strerror(ret));
return;
}
fprintf(outfile, "\tPublic Key Algorithm: ");
key_type = gnutls_x509_privkey_get_pk_algorithm2(key, &bits);
cprint = gnutls_pk_algorithm_get_name(key_type);
fprintf(outfile, "%s\n", cprint ? cprint : "Unknown");
if (key_type == GNUTLS_PK_RSA_PSS) {
unsigned int salt_size;
ret = gnutls_x509_privkey_get_spki(key, spki, 0);
if (ret == -56)
goto spki_skip;
if (ret < 0) {
fprintf(
stderr
, "spki_get: %s\n", gnutls_strerror(ret));
goto spki_skip;
}
ret = gnutls_x509_spki_get_rsa_pss_params(spki, &dig, &salt_size);
if (ret < 0) {
fprintf(
stderr
, "spki_get_rsa_pss_params: %s\n",
gnutls_strerror(ret));
} else {
fprintf(outfile, "\t\tHash Algorithm: %s\n",
gnutls_digest_get_name(dig));
fprintf(outfile, "\t\tSalt Length: %d\n", salt_size);
}
}
spki_skip:
gnutls_x509_spki_deinit(spki);
fprintf(outfile, "\tKey Security Level: %s (%u bits)\n\n",
gnutls_sec_param_get_name(gnutls_x509_privkey_sec_param
(key)), bits);
if (((key_type) == GNUTLS_PK_RSA || (key_type) == GNUTLS_PK_RSA_PSS)) {
gnutls_datum_t m, e, d, p, q, u, exp1, exp2;
ret =
gnutls_x509_privkey_export_rsa_raw2(key, &m, &e, &d,
&p, &q, &u, &exp1,
&exp2);
if (ret < 0)
fprintf(
stderr
,
"Error in key RSA data export: %s\n",
gnutls_strerror(ret));
else {
print_rsa_pkey(outfile, &m, &e, &d, &p, &q, &u,
&exp1, &exp2, cinfo->cprint);
gnutls_free((void *) (m.data)), m.data=
((void *)0)
;
gnutls_free((void *) (e.data)), e.data=
((void *)0)
;
gnutls_free((void *) (d.data)), d.data=
((void *)0)
;
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (q.data)), q.data=
((void *)0)
;
gnutls_free((void *) (u.data)), u.data=
((void *)0)
;
gnutls_free((void *) (exp1.data)), exp1.data=
((void *)0)
;
gnutls_free((void *) (exp2.data)), exp2.data=
((void *)0)
;
}
} else if (key_type == GNUTLS_PK_DSA) {
gnutls_datum_t p, q, g, y, x;
ret =
gnutls_x509_privkey_export_dsa_raw(key, &p, &q, &g, &y,
&x);
if (ret < 0)
fprintf(
stderr
,
"Error in key DSA data export: %s\n",
gnutls_strerror(ret));
else {
print_dsa_pkey(outfile, &x, &y, &p, &q, &g,
cinfo->cprint);
gnutls_free((void *) (x.data)), x.data=
((void *)0)
;
gnutls_free((void *) (y.data)), y.data=
((void *)0)
;
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (q.data)), q.data=
((void *)0)
;
gnutls_free((void *) (g.data)), g.data=
((void *)0)
;
}
} else if (key_type == GNUTLS_PK_ECDSA ||
key_type == GNUTLS_PK_EDDSA_ED25519 ||
key_type == GNUTLS_PK_EDDSA_ED448 ||
key_type == GNUTLS_PK_ECDH_X25519 ||
key_type == GNUTLS_PK_ECDH_X448) {
gnutls_datum_t y, x, k;
gnutls_ecc_curve_t curve;
ret =
gnutls_x509_privkey_export_ecc_raw(key, &curve, &x, &y,
&k);
if (ret < 0)
fprintf(
stderr
,
"Error in key ECC data export: %s\n",
gnutls_strerror(ret));
else {
print_ecc_pkey(outfile, curve, &k, &x, &y,
cinfo->cprint);
gnutls_free((void *) (x.data)), x.data=
((void *)0)
;
gnutls_free((void *) (y.data)), y.data=
((void *)0)
;
gnutls_free((void *) (k.data)), k.data=
((void *)0)
;
}
} else if (key_type == GNUTLS_PK_GOST_01 ||
key_type == GNUTLS_PK_GOST_12_256 ||
key_type == GNUTLS_PK_GOST_12_512) {
gnutls_datum_t y, x, k;
gnutls_ecc_curve_t curve;
gnutls_digest_algorithm_t digest;
gnutls_gost_paramset_t paramset;
ret =
gnutls_x509_privkey_export_gost_raw(key, &curve,
&digest,
¶mset,
&x, &y, &k);
if (ret < 0)
fprintf(
stderr
,
"Error in key GOST data export: %s\n",
gnutls_strerror(ret));
else {
print_gost_pkey(outfile, curve, digest, paramset,
&k, &x, &y,
cinfo->cprint);
gnutls_free((void *) (x.data)), x.data=
((void *)0)
;
gnutls_free((void *) (y.data)), y.data=
((void *)0)
;
gnutls_free((void *) (k.data)), k.data=
((void *)0)
;
}
}
size = lbuffer_size;
ret = gnutls_x509_privkey_get_seed(key, &dig, lbuffer, &size);
if (ret >= 0) {
fprintf(outfile, "Validation parameters:\n");
fprintf(outfile, "\tHash: %s\n",
gnutls_digest_get_name(dig));
fprintf(outfile, "\tSeed: %s\n",
raw_to_hex(lbuffer, size));
}
fprintf(outfile, "\n");
size = lbuffer_size;
ret =
gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA256, lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "Error in key id calculation: %s\n",
gnutls_strerror(ret));
} else {
fprintf(outfile, "Public Key PIN:\n\tpin-sha256:%s\n",
raw_to_base64(lbuffer, size));
fprintf(outfile, "Public Key ID:\n\tsha256:%s\n",
raw_to_hex(lbuffer, size));
size = lbuffer_size;
ret =
gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA1, lbuffer, &size);
if (ret >= 0) {
fprintf(outfile, "\tsha1:%s\n",
raw_to_hex(lbuffer, size));
}
}
fprintf(outfile, "\n");
}
void
print_private_key(FILE *outfile, common_info_st * cinfo, gnutls_x509_privkey_t key)
{
int ret;
size_t size;
if (!key)
return;
switch_to_pkcs8_when_needed(cinfo, key, gnutls_x509_privkey_get_pk_algorithm(key));
if (!cinfo->pkcs8) {
if (cinfo->outtext)
privkey_info_int(outfile, cinfo, key);
size = lbuffer_size;
ret = gnutls_x509_privkey_export(key, cinfo->outcert_format,
lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "privkey_export: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
} else {
unsigned int flags = 0;
const char *pass;
pass = get_password(cinfo, &flags, 0);
flags |= cipher_to_flags(cinfo->pkcs_cipher);
if (cinfo->outtext && (flags & GNUTLS_PKCS_PLAIN))
privkey_info_int(outfile, cinfo, key);
size = lbuffer_size;
ret =
gnutls_x509_privkey_export_pkcs8(key, cinfo->outcert_format,
pass, flags, lbuffer,
&size);
if (ret < 0) {
fprintf(
stderr
, "privkey_export_pkcs8: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
fwrite(lbuffer, 1, size, outfile);
}
int generate_prime(FILE * outfile, int how, common_info_st * info)
{
int ret;
gnutls_dh_params_t dh_params;
gnutls_datum_t p, g;
int bits = get_bits(GNUTLS_PK_DH, info->bits, info->sec_param, 1);
unsigned int q_bits = 0, key_bits = 0;
fix_lbuffer(0);
gnutls_dh_params_init(&dh_params);
if (how != 0) {
fprintf(
stderr
, "Generating DH parameters (%d bits)...\n",
bits);
fprintf(
stderr
, "(might take long time)\n");
} else
fprintf(
stderr
, "Retrieving DH parameters...\n");
if (how != 0) {
if (info->provable != 0) {
gnutls_x509_privkey_t pkey;
ret = gnutls_x509_privkey_init(&pkey);
if (ret < 0) {
fprintf(
stderr
,
"Error initializing key: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (info->seed_size > 0) {
gnutls_keygen_data_st data;
if (info->seed_size < 32) {
fprintf(
stderr
, "For DH parameter generation a 32-byte seed value or larger is expected (have: %d); use -d 2 for more information.\n", (int)info->seed_size);
app_exit(1);
}
data.type = GNUTLS_KEYGEN_SEED;
data.data = (void*)info->seed;
data.size = info->seed_size;
ret = gnutls_x509_privkey_generate2(pkey, GNUTLS_PK_DSA, bits, GNUTLS_PRIVKEY_FLAG_PROVABLE, &data, 1);
} else {
ret = gnutls_x509_privkey_generate(pkey, GNUTLS_PK_DSA, bits, GNUTLS_PRIVKEY_FLAG_PROVABLE);
}
if (ret < 0) {
fprintf(
stderr
,
"Error generating DSA parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (info->outcert_format == GNUTLS_X509_FMT_PEM) {
print_private_key(outfile, info, pkey);
}
ret = gnutls_dh_params_import_dsa(dh_params, pkey);
if (ret < 0) {
fprintf(
stderr
,
"Error importing DSA parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
gnutls_x509_privkey_deinit(pkey);
} else {
ret = gnutls_dh_params_generate2(dh_params, bits);
if (ret < 0) {
fprintf(
stderr
,
"Error generating parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
ret =
gnutls_dh_params_export_raw(dh_params, &p, &g,
&q_bits);
if (ret < 0) {
fprintf(
stderr
, "Error exporting parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
} else {
if (info->provable != 0) {
fprintf(
stderr
, "The DH parameters obtained via this option are not provable\n");
app_exit(1);
}
if (bits <= 2048) {
p = gnutls_ffdhe_2048_group_prime;
g = gnutls_ffdhe_2048_group_generator;
key_bits = gnutls_ffdhe_2048_key_bits;
} else if (bits <= 3072) {
p = gnutls_ffdhe_3072_group_prime;
g = gnutls_ffdhe_3072_group_generator;
key_bits = gnutls_ffdhe_3072_key_bits;
} else if (bits <= 4096) {
p = gnutls_ffdhe_4096_group_prime;
g = gnutls_ffdhe_4096_group_generator;
key_bits = gnutls_ffdhe_4096_key_bits;
} else if (bits <= 6144) {
p = gnutls_ffdhe_6144_group_prime;
g = gnutls_ffdhe_6144_group_generator;
key_bits = gnutls_ffdhe_6144_key_bits;
} else {
p = gnutls_ffdhe_8192_group_prime;
g = gnutls_ffdhe_8192_group_generator;
key_bits = gnutls_ffdhe_8192_key_bits;
}
ret = gnutls_dh_params_import_raw2(dh_params, &p, &g, key_bits);
if (ret < 0) {
fprintf(
stderr
, "Error exporting parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
if (info->outtext)
print_dh_info(outfile, &p, &g, q_bits, info->cprint);
if (!info->cprint) {
size_t len = lbuffer_size;
ret =
gnutls_dh_params_export_pkcs3(dh_params,
info->outcert_format,
lbuffer, &len);
if (ret == 0) {
if (info->outcert_format == GNUTLS_X509_FMT_PEM)
fprintf(outfile, "\n%s", lbuffer);
else
fwrite(lbuffer, 1, len, outfile);
} else {
fprintf(
stderr
, "Error: %s\n",
gnutls_strerror(ret));
}
}
if (how != 0) {
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (g.data)), g.data=
((void *)0)
;
}
gnutls_dh_params_deinit(dh_params);
return 0;
}
void decode_seed(gnutls_datum_t *seed, const char *hex, unsigned hex_size)
{
int ret;
size_t seed_size;
seed->size = hex_size;
seed->data = malloc(hex_size);
if (seed->data ==
((void *)0)
) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
seed_size = hex_size;
ret = gnutls_hex2bin(hex, hex_size, seed->data, &seed_size);
if (ret < 0) {
fprintf(
stderr
, "Could not hex decode data: %s\n", gnutls_strerror(ret));
app_exit(1);
}
seed->size = seed_size;
return;
}
gnutls_pk_algorithm_t figure_key_type(const char *key_type)
{
if (strcasecmp(key_type, "rsa") == 0)
return GNUTLS_PK_RSA;
else if (strcasecmp(key_type, "rsa-pss") == 0)
return GNUTLS_PK_RSA_PSS;
else if (strcasecmp(key_type, "ed25519") == 0 || strcasecmp(key_type, "eddsa") == 0)
return GNUTLS_PK_EDDSA_ED25519;
else if (strcasecmp(key_type, "ed448") == 0)
return GNUTLS_PK_EDDSA_ED448;
else if (strcasecmp(key_type, "x25519") == 0)
return GNUTLS_PK_ECDH_X25519;
else if (strcasecmp(key_type, "x448") == 0)
return GNUTLS_PK_ECDH_X448;
else if (strcasecmp(key_type, "dsa") == 0)
return GNUTLS_PK_DSA;
else if (strcasecmp(key_type, "ecdsa") == 0 || strcasecmp(key_type, "ecc") == 0)
return GNUTLS_PK_ECDSA;
else if (strcasecmp(key_type, "gost01") == 0)
return GNUTLS_PK_GOST_01;
else if (strcasecmp(key_type, "gost12-256") == 0)
return GNUTLS_PK_GOST_12_256;
else if (strcasecmp(key_type, "gost12-512") == 0)
return GNUTLS_PK_GOST_12_512;
else {
fprintf(
stderr
, "unknown key type: %s\n", key_type);
return GNUTLS_PK_UNKNOWN;
}
}
gnutls_digest_algorithm_t hash_to_id(const char *hash)
{
if (strcasecmp(hash, "md5") == 0) {
fprintf(
stderr
,
"Warning: MD5 is broken, and should not be used any more for digital signatures.\n");
return GNUTLS_DIG_MD5;
} else if (strcasecmp(hash, "sha1") == 0)
return GNUTLS_DIG_SHA1;
else if (strcasecmp(hash, "sha256") == 0)
return GNUTLS_DIG_SHA256;
else if (strcasecmp(hash, "sha224") == 0)
return GNUTLS_DIG_SHA224;
else if (strcasecmp(hash, "sha384") == 0)
return GNUTLS_DIG_SHA384;
else if (strcasecmp(hash, "sha512") == 0)
return GNUTLS_DIG_SHA512;
else if (strcasecmp(hash, "sha3-256") == 0)
return GNUTLS_DIG_SHA3_256;
else if (strcasecmp(hash, "sha3-224") == 0)
return GNUTLS_DIG_SHA3_224;
else if (strcasecmp(hash, "sha3-384") == 0)
return GNUTLS_DIG_SHA3_384;
else if (strcasecmp(hash, "sha3-512") == 0)
return GNUTLS_DIG_SHA3_512;
else if (strcasecmp(hash, "rmd160") == 0)
return GNUTLS_DIG_RMD160;
else {
return gnutls_digest_get_id(hash);
}
}
void sign_params_to_flags(common_info_st *cinfo, const char *params)
{
char *p, *sp;
sp = strdup(params);
if (sp ==
((void *)0)
) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
p = strtok(sp, ",");
while(p !=
((void *)0)
) {
if (strcasecmp(p, "rsa-pss")==0) {
cinfo->rsa_pss_sign = 1;
} else {
fprintf(
stderr
, "Unknown signature parameter: %s\n", p);
app_exit(1);
}
p=strtok(
((void *)0)
, ",");
}
free(sp);
}
|
static gnutls_pubkey_t _load_url_pubkey(const char *url)
{
int ret;
gnutls_pubkey_t pubkey;
unsigned int obj_flags = 0;
ret = gnutls_pubkey_init(&pubkey);
if (ret < 0) {
fprintf(
stderr
, "Error in %s:%d: %s\n", __func__, 238,
gnutls_strerror(ret));
app_exit(1);
}
ret = gnutls_pubkey_import_url(pubkey, url, obj_flags);
if (ret < 0) {
fprintf(
stderr
, "Error in %s:%d: %s: %s\n", __func__,
246, gnutls_strerror(ret), url);
app_exit(1);
}
return pubkey;
}
gnutls_privkey_t load_private_key(int mand, common_info_st * info)
{
gnutls_privkey_t key;
gnutls_datum_t dat;
size_t size;
if (!info->privkey && !mand)
return
((void *)0)
;
if (info->privkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-privkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->privkey) != 0)
return _load_url_privkey(info->privkey);
dat.data = (void *) _gnutls_read_file(info->privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-privkey: %s\n",
info->privkey);
app_exit(1);
}
key = _load_privkey(&dat, info);
free(dat.data);
return key;
}
gnutls_x509_privkey_t
load_x509_private_key(int mand, common_info_st * info)
{
gnutls_x509_privkey_t key;
int ret;
gnutls_datum_t dat;
size_t size;
unsigned int flags = 0;
const char *pass;
if (!info->privkey && !mand)
return
((void *)0)
;
if (info->privkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-privkey\n");
app_exit(1);
}
ret = gnutls_x509_privkey_init(&key);
if (ret < 0) {
fprintf(
stderr
, "privkey_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *) _gnutls_read_file(info->privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-privkey: %s\n",
info->privkey);
app_exit(1);
}
if (info->pkcs8) {
pass = get_password(info, &flags, 0);
ret =
gnutls_x509_privkey_import_pkcs8(key, &dat,
info->incert_format,
pass, flags);
} else {
ret =
gnutls_x509_privkey_import2(key, &dat,
info->incert_format,
((void *)0)
,
0);
if (ret == -24) {
pass = get_password(info, &flags, 0);
ret =
gnutls_x509_privkey_import2(key, &dat,
info->
incert_format,
pass, flags);
}
}
free(dat.data);
if (ret == -207) {
fprintf(
stderr
,
"import error: could not find a valid PEM header; "
"check if your key is PEM encoded\n");
app_exit(1);
}
if (ret < 0) {
fprintf(
stderr
, "error importing private key: %s: %s\n",
info->privkey, gnutls_strerror(ret));
app_exit(1);
}
return key;
}
gnutls_x509_crt_t load_cert(int mand, common_info_st * info)
{
gnutls_x509_crt_t *crt;
gnutls_x509_crt_t ret_crt;
size_t size, i;
crt = load_cert_list(mand, &size, info);
if (crt) {
ret_crt = crt[0];
for (i=1;i<size;i++)
gnutls_x509_crt_deinit(crt[i]);
gnutls_free((void *) (crt)), crt=
((void *)0)
;
return ret_crt;
}
return
((void *)0)
;
}
gnutls_x509_crt_t *load_cert_list(int mand, size_t * crt_size,
common_info_st * info)
{
FILE *fp;
static gnutls_x509_crt_t *crt;
int ret;
gnutls_datum_t dat;
unsigned size;
unsigned int crt_max;
unsigned flags = 0;
*crt_size = 0;
if (info->verbose)
fprintf(
stderr
, "Loading certificate list...\n");
if (info->cert ==
((void *)0)
) {
if (mand) {
fprintf(
stderr
, "missing --load-certificate\n");
app_exit(1);
} else
return
((void *)0)
;
}
fp = fopen(info->cert, "r");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "Could not open %s\n", info->cert);
app_exit(1);
}
fix_lbuffer(file_size(fp));
size = fread(lbuffer, 1, lbuffer_size - 1, fp);
lbuffer[size] = 0;
fclose(fp);
dat.data = (void *) lbuffer;
dat.size = size;
if (info->sort_chain)
flags |= GNUTLS_X509_CRT_LIST_SORT;
ret = gnutls_x509_crt_list_import2(&crt, &crt_max, &dat, GNUTLS_X509_FMT_PEM, flags);
if (ret < 0) {
fprintf(
stderr
, "Error loading certificates: %s\n", gnutls_strerror(ret));
app_exit(1);
}
*crt_size = crt_max;
if (info->verbose)
fprintf(
stderr
, "Loaded %d certificates.\n",
(int) crt_max);
return crt;
}
gnutls_x509_crl_t *load_crl_list(int mand, size_t * crl_size,
common_info_st * info)
{
FILE *fp;
static gnutls_x509_crl_t *crl;
unsigned int crl_max;
int ret;
gnutls_datum_t dat;
size_t size;
*crl_size = 0;
if (info->verbose)
fprintf(
stderr
, "Loading CRL list...\n");
if (info->crl ==
((void *)0)
) {
if (mand) {
fprintf(
stderr
, "missing --load-crl\n");
app_exit(1);
} else
return
((void *)0)
;
}
fp = fopen(info->crl, "r");
if (fp ==
((void *)0)
) {
fprintf(
stderr
, "Could not open %s\n", info->crl);
app_exit(1);
}
fix_lbuffer(file_size(fp));
size = fread(lbuffer, 1, lbuffer_size - 1, fp);
lbuffer[size] = 0;
fclose(fp);
dat.data = (void *) lbuffer;
dat.size = size;
ret = gnutls_x509_crl_list_import2(&crl, &crl_max, &dat, GNUTLS_X509_FMT_PEM, 0);
if (ret == -34) {
ret = gnutls_x509_crl_list_import2(&crl, &crl_max, &dat, GNUTLS_X509_FMT_DER, 0);
}
if (ret < 0) {
fprintf(
stderr
, "Error loading CRLs: %s\n", gnutls_strerror(ret));
app_exit(1);
}
*crl_size = crl_max;
if (info->verbose)
fprintf(
stderr
, "Loaded %d CRLs.\n",
(int) *crl_size);
return crl;
}
gnutls_x509_crq_t load_request(common_info_st * info)
{
gnutls_x509_crq_t crq;
int ret;
gnutls_datum_t dat;
size_t size;
if (!info->request)
return
((void *)0)
;
ret = gnutls_x509_crq_init(&crq);
if (ret < 0) {
fprintf(
stderr
, "crq_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *) _gnutls_read_file(info->request, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-request: %s\n",
info->request);
app_exit(1);
}
ret = gnutls_x509_crq_import(crq, &dat, info->incert_format);
if (ret == -207) {
fprintf(
stderr
,
"import error: could not find a valid PEM header\n");
app_exit(1);
}
free(dat.data);
if (ret < 0) {
fprintf(
stderr
, "error importing certificate request: %s: %s\n",
info->request, gnutls_strerror(ret));
app_exit(1);
}
return crq;
}
gnutls_privkey_t load_ca_private_key(common_info_st * info)
{
gnutls_privkey_t key;
gnutls_datum_t dat;
size_t size;
if (info->ca_privkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-ca-privkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->ca_privkey) != 0)
return _load_url_privkey(info->ca_privkey);
dat.data = (void *) _gnutls_read_file(info->ca_privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-ca-privkey: %s\n",
info->ca_privkey);
app_exit(1);
}
key = _load_privkey(&dat, info);
free(dat.data);
return key;
}
gnutls_x509_crt_t load_ca_cert(unsigned mand, common_info_st * info)
{
gnutls_x509_crt_t crt;
int ret;
gnutls_datum_t dat;
size_t size;
if (mand == 0 && info->ca ==
((void *)0)
) {
return
((void *)0)
;
}
if (info->ca ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-ca-certificate\n");
app_exit(1);
}
ret = gnutls_x509_crt_init(&crt);
if (ret < 0) {
fprintf(
stderr
, "crt_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (gnutls_url_is_supported(info->ca) != 0) {
ret = gnutls_x509_crt_import_url(crt, info->ca, 0);
if (ret < 0) {
fprintf(
stderr
, "error importing CA certificate: %s: %s\n",
info->ca, gnutls_strerror(ret));
app_exit(1);
}
return crt;
}
dat.data = (void *) _gnutls_read_file(info->ca, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-ca-certificate: %s\n",
info->ca);
app_exit(1);
}
ret = gnutls_x509_crt_import(crt, &dat, info->incert_format);
free(dat.data);
if (ret < 0) {
fprintf(
stderr
, "error importing CA certificate: %s: %s\n",
info->ca, gnutls_strerror(ret));
app_exit(1);
}
return crt;
}
gnutls_pubkey_t load_pubkey(int mand, common_info_st * info)
{
gnutls_pubkey_t key;
int ret;
gnutls_datum_t dat;
size_t size;
if (!info->pubkey && !mand)
return
((void *)0)
;
if (info->pubkey ==
((void *)0)
) {
fprintf(
stderr
, "missing --load-pubkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->pubkey) != 0)
return _load_url_pubkey(info->pubkey);
ret = gnutls_pubkey_init(&key);
if (ret < 0) {
fprintf(
stderr
, "privkey_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *) _gnutls_read_file(info->pubkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(
stderr
, "error reading file at --load-pubkey: %s\n", info->pubkey);
app_exit(1);
}
ret = gnutls_pubkey_import(key, &dat, info->incert_format);
if (ret == -207) {
ret = gnutls_pubkey_import_x509_raw(key, &dat, info->incert_format, 0);
if (ret < 0) {
fprintf(
stderr
,
"import error: could not find a valid PEM header; "
"check if your key has the PUBLIC KEY header\n");
app_exit(1);
}
} else if (ret < 0) {
fprintf(
stderr
, "importing public key: %s: %s\n",
info->pubkey, gnutls_strerror(ret));
app_exit(1);
}
free(dat.data);
return key;
}
gnutls_pubkey_t load_public_key_or_import(int mand,
gnutls_privkey_t privkey,
common_info_st * info)
{
gnutls_pubkey_t pubkey;
int ret;
ret = gnutls_pubkey_init(&pubkey);
if (ret < 0) {
fprintf(
stderr
, "gnutls_pubkey_init: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (!privkey || gnutls_pubkey_import_privkey(pubkey, privkey, 0, 0) < 0) {
gnutls_pubkey_deinit(pubkey);
pubkey = load_pubkey(0, info);
if (pubkey ==
((void *)0)
&& mand) {
fprintf(
stderr
, "Could not determine the public key for the operation.\nYou must specify --load-privkey or --load-pubkey if missing.\n");
app_exit(1);
}
}
return pubkey;
}
static const char *bits_to_sp(gnutls_pk_algorithm_t pk, unsigned int bits)
{
gnutls_sec_param_t s = gnutls_pk_bits_to_sec_param(pk, bits);
if (s == GNUTLS_SEC_PARAM_UNKNOWN) {
return gnutls_sec_param_get_name(GNUTLS_SEC_PARAM_MEDIUM);
}
return gnutls_sec_param_get_name(s);
}
int
get_bits(gnutls_pk_algorithm_t key_type, int info_bits,
const char *info_sec_param, int warn)
{
int bits;
if (info_bits != 0) {
static int warned = 0;
if (warned == 0 && warn != 0 && (((unsigned int)(info_bits)) & 0x80000000)==0) {
warned = 1;
fprintf(
stderr
,
"** Note: You may use '--sec-param %s' instead of '--bits %d'\n",
bits_to_sp(key_type, info_bits), info_bits);
}
bits = info_bits;
} else {
if (info_sec_param == 0) {
info_sec_param = "HIGH";
}
bits =
gnutls_sec_param_to_pk_bits(key_type,
str_to_sec_param
(info_sec_param));
}
return bits;
}
gnutls_sec_param_t str_to_sec_param(const char *str)
{
if (strcasecmp(str, "low") == 0) {
return GNUTLS_SEC_PARAM_LOW;
} else if (strcasecmp(str, "legacy") == 0) {
return GNUTLS_SEC_PARAM_LEGACY;
} else if (strcasecmp(str, "normal") == 0 || strcasecmp(str, "medium") == 0) {
return GNUTLS_SEC_PARAM_MEDIUM;
} else if (strcasecmp(str, "high") == 0) {
return GNUTLS_SEC_PARAM_HIGH;
} else if (strcasecmp(str, "ultra") == 0) {
return GNUTLS_SEC_PARAM_ULTRA;
} else if (strcasecmp(str, "future") == 0) {
return GNUTLS_SEC_PARAM_FUTURE;
} else {
fprintf(
stderr
, "Unknown security parameter string: %s\n",
str);
app_exit(1);
}
}
static void
print_hex_datum(FILE * outfile, gnutls_datum_t * dat, int cprint)
{
unsigned int j;
if (cprint != 0) {
fprintf(outfile, "\n" "\t" "\"");
for (j = 0; j < dat->size; j++) {
fprintf(outfile, "\\x%.2x",
(unsigned char) dat->data[j]);
if ((j + 1) % 16 == 0) {
fprintf(outfile, "\"\n" "\t" "\"");
}
}
fprintf(outfile, "\";\n\n");
return;
}
fprintf(outfile, "\n" "\t");
for (j = 0; j < dat->size; j++) {
if ((j + 1) % 16 == 0) {
fprintf(outfile, "%.2x", (unsigned char) dat->data[j]);
fprintf(outfile, "\n" "\t");
} else {
fprintf(outfile, "%.2x:", (unsigned char) dat->data[j]);
}
}
fprintf(outfile, "\n\n");
}
static void print_head(FILE * out, const char *txt, unsigned int size,
int cprint)
{
unsigned i;
char *p, *ntxt;
int ret;
if (cprint != 0) {
if (size > 0)
ret = asprintf(&ntxt, "const unsigned char %s[%u] =",
txt, size);
else
ret = asprintf(&ntxt, "const unsigned char %s[] =\n",
txt);
if (ret == -1) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
p = strstr(ntxt, "char");
p += 5;
for (i = 0; i < strlen(txt); i++)
if (p[i] == ' ')
p[i] = '_';
fprintf(out, "%s", ntxt);
free(ntxt);
return;
}
fprintf(out, "%s:", txt);
}
void
print_dsa_pkey(FILE * outfile, gnutls_datum_t * x, gnutls_datum_t * y,
gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g,
int cprint)
{
if (x) {
print_head(outfile, "private key", x->size, cprint);
print_hex_datum(outfile, x, cprint);
}
print_head(outfile, "public key", y->size, cprint);
print_hex_datum(outfile, y, cprint);
print_head(outfile, "p", p->size, cprint);
print_hex_datum(outfile, p, cprint);
print_head(outfile, "q", q->size, cprint);
print_hex_datum(outfile, q, cprint);
print_head(outfile, "g", g->size, cprint);
print_hex_datum(outfile, g, cprint);
}
gnutls_ecc_curve_t str_to_curve(const char *str)
{
unsigned num = 0;
const gnutls_ecc_curve_t *list, *p;
list = gnutls_ecc_curve_list();
p = list;
while(*p != 0) {
if (strcasecmp(str, gnutls_ecc_curve_get_name(*p)) == 0)
return *p;
p++;
num++;
}
fprintf(
stderr
, "Unsupported curve: %s\nAvailable curves:\n", str);
if (num == 0)
printf("none\n");
p = list;
while(*p != 0) {
fprintf(
stderr
, "\t- %s\n",
gnutls_ecc_curve_get_name(*p));
p++;
}
app_exit(1);
}
void
print_ecc_pkey(FILE * outfile, gnutls_ecc_curve_t curve,
gnutls_datum_t * k, gnutls_datum_t * x, gnutls_datum_t * y,
int cprint)
{
if (cprint != 0)
fprintf(outfile, "/* curve: %s */\n",
gnutls_ecc_curve_get_name(curve));
else
fprintf(outfile, "curve:\t%s\n",
gnutls_ecc_curve_get_name(curve));
if (k && k->data) {
print_head(outfile, "private key", k->size, cprint);
print_hex_datum(outfile, k, cprint);
}
if (x && x->data) {
print_head(outfile, "x", x->size, cprint);
print_hex_datum(outfile, x, cprint);
}
if (y && y->data) {
print_head(outfile, "y", y->size, cprint);
print_hex_datum(outfile, y, cprint);
}
}
static void reverse_datum(gnutls_datum_t *d)
{
unsigned int i;
unsigned char c;
for (i = 0; i < d->size / 2; i++) {
c = d->data[i];
d->data[i] = d->data[d->size - i - 1];
d->data[d->size - i - 1] = c;
}
}
void
print_gost_pkey(FILE * outfile, gnutls_ecc_curve_t curve,
gnutls_digest_algorithm_t digest, gnutls_gost_paramset_t paramset,
gnutls_datum_t * k, gnutls_datum_t * x, gnutls_datum_t * y,
int cprint)
{
if (cprint != 0)
fprintf(outfile, "/* curve: %s */\n",
gnutls_ecc_curve_get_name(curve));
else
fprintf(outfile, "curve:\t%s\n",
gnutls_ecc_curve_get_name(curve));
if (cprint != 0)
fprintf(outfile, "/* digest: %s */\n",
gnutls_digest_get_name(digest));
else
fprintf(outfile, "digest:\t%s\n",
gnutls_digest_get_name(digest));
if (cprint != 0)
fprintf(outfile, "/* paramset: %s */\n",
gnutls_gost_paramset_get_name(paramset));
else
fprintf(outfile, "paramset:\t%s\n",
gnutls_gost_paramset_get_name(paramset));
if (k) {
reverse_datum(k);
print_head(outfile, "private key", k->size, cprint);
print_hex_datum(outfile, k, cprint);
}
reverse_datum(x);
reverse_datum(y);
print_head(outfile, "x", x->size, cprint);
print_hex_datum(outfile, x, cprint);
print_head(outfile, "y", y->size, cprint);
print_hex_datum(outfile, y, cprint);
}
void
print_rsa_pkey(FILE * outfile, gnutls_datum_t * m, gnutls_datum_t * e,
gnutls_datum_t * d, gnutls_datum_t * p, gnutls_datum_t * q,
gnutls_datum_t * u, gnutls_datum_t * exp1,
gnutls_datum_t * exp2, int cprint)
{
print_head(outfile, "modulus", m->size, cprint);
print_hex_datum(outfile, m, cprint);
print_head(outfile, "public exponent", e->size, cprint);
print_hex_datum(outfile, e, cprint);
if (d) {
print_head(outfile, "private exponent", d->size, cprint);
print_hex_datum(outfile, d, cprint);
print_head(outfile, "prime1", p->size, cprint);
print_hex_datum(outfile, p, cprint);
print_head(outfile, "prime2", q->size, cprint);
print_hex_datum(outfile, q, cprint);
print_head(outfile, "coefficient", u->size, cprint);
print_hex_datum(outfile, u, cprint);
if (exp1 && exp2) {
print_head(outfile, "exp1", exp1->size, cprint);
print_hex_datum(outfile, exp1, cprint);
print_head(outfile, "exp2", exp2->size, cprint);
print_hex_datum(outfile, exp2, cprint);
}
}
}
void print_pubkey_info(gnutls_pubkey_t pubkey,
FILE *outfile,
gnutls_certificate_print_formats_t format,
gnutls_x509_crt_fmt_t outcert_format,
unsigned int outtext)
{
gnutls_datum_t data;
int ret;
size_t size;
if (outtext) {
ret = gnutls_pubkey_print(pubkey, format, &data);
if (ret < 0) {
fprintf(
stderr
, "pubkey_print error: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fprintf(outfile, "%s\n\n", data.data);
gnutls_free((void *) (data.data)), data.data=
((void *)0)
;
}
fix_lbuffer(0);
size = lbuffer_size;
ret =
gnutls_pubkey_export(pubkey, outcert_format, lbuffer,
&size);
if (ret < 0) {
fprintf(
stderr
, "export error: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fwrite(lbuffer, 1, size, outfile);
}
static void
print_dh_info(FILE * outfile, gnutls_datum_t * p, gnutls_datum_t * g,
unsigned int q_bits, int cprint)
{
if (q_bits > 0) {
if (cprint != 0)
fprintf(outfile,
"\n /* recommended key length: %d bytes */\n\n",
(7 + q_bits) / 8);
else
fprintf(outfile,
"\nRecommended key length: %d bits\n\n",
q_bits);
}
print_head(outfile, "generator", g->size, cprint);
print_hex_datum(outfile, g, cprint);
print_head(outfile, "prime", p->size, cprint);
print_hex_datum(outfile, p, cprint);
}
static
int import_dsa_dh(gnutls_dh_params_t dh_params, gnutls_datum_t *params, gnutls_x509_crt_fmt_t format)
{
gnutls_x509_privkey_t pkey;
int ret;
ret = gnutls_x509_privkey_init(&pkey);
if (ret < 0)
return ret;
ret = gnutls_x509_privkey_import(pkey, params, format);
if (ret < 0)
return ret;
ret = gnutls_dh_params_import_dsa(dh_params, pkey);
gnutls_x509_privkey_deinit(pkey);
return ret;
}
void dh_info(FILE * infile, FILE * outfile, common_info_st * ci)
{
gnutls_datum_t params;
size_t size;
int ret, ret2;
gnutls_dh_params_t dh_params;
gnutls_datum_t p, g;
unsigned int q_bits = 0;
fix_lbuffer(0);
if (gnutls_dh_params_init(&dh_params) < 0) {
fprintf(
stderr
, "Error in dh parameter initialization\n");
app_exit(1);
}
params.data = (void *) _gnutls_fread_file(infile, 0, &size);
params.size = size;
if (params.data ==
((void *)0)
) {
fprintf(
stderr
, "Could not read input\n");
app_exit(1);
}
ret =
gnutls_dh_params_import_pkcs3(dh_params, ¶ms,
ci->incert_format);
if (ret < 0) {
ret2 = import_dsa_dh(dh_params, ¶ms, ci->incert_format);
if (ret2 < 0) {
fprintf(
stderr
, "Error parsing dh params: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
ret = gnutls_dh_params_export_raw(dh_params, &p, &g, &q_bits);
if (ret < 0) {
fprintf(
stderr
, "Error exporting parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (ci->outtext)
print_dh_info(outfile, &p, &g, q_bits, ci->cprint);
if (!ci->cprint) {
size_t len = lbuffer_size;
ret =
gnutls_dh_params_export_pkcs3(dh_params,
ci->outcert_format,
lbuffer, &len);
if (ret == 0) {
if (ci->outcert_format == GNUTLS_X509_FMT_PEM) {
fprintf(outfile, "\n%s", lbuffer);
} else {
fwrite(lbuffer, 1, len, outfile);
}
} else {
fprintf(
stderr
, "Error: %s\n",
gnutls_strerror(ret));
}
}
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (g.data)), g.data=
((void *)0)
;
gnutls_dh_params_deinit(dh_params);
}
int cipher_to_flags(const char *cipher)
{
if (cipher ==
((void *)0)
) {
return GNUTLS_PKCS_PBES2_AES_128;
} else if (strcasecmp(cipher, "3des") == 0) {
return GNUTLS_PKCS_PBES2_3DES;
} else if (strcasecmp(cipher, "3des-pkcs12") == 0) {
return GNUTLS_PKCS_PKCS12_3DES;
} else if (strcasecmp(cipher, "arcfour") == 0) {
return GNUTLS_PKCS_PKCS12_ARCFOUR;
} else if (strcasecmp(cipher, "aes-128") == 0) {
return GNUTLS_PKCS_PBES2_AES_128;
} else if (strcasecmp(cipher, "aes-192") == 0) {
return GNUTLS_PKCS_PBES2_AES_192;
} else if (strcasecmp(cipher, "aes-256") == 0) {
return GNUTLS_PKCS_PBES2_AES_256;
} else if (strcasecmp(cipher, "rc2-40") == 0) {
return GNUTLS_PKCS_PKCS12_RC2_40;
} else if (strcasecmp(cipher, "gost28147-tc26z") == 0) {
return GNUTLS_PKCS_PBES2_GOST_TC26Z;
} else if (strcasecmp(cipher, "gost28147-cpa") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPA;
} else if (strcasecmp(cipher, "gost28147-cpb") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPB;
} else if (strcasecmp(cipher, "gost28147-cpc") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPC;
} else if (strcasecmp(cipher, "gost28147-cpd") == 0) {
return GNUTLS_PKCS_PBES2_GOST_CPD;
} else if (strcasecmp(cipher, "none") == 0) {
return GNUTLS_PKCS_PLAIN;
}
fprintf(
stderr
, "unknown cipher %s\n", cipher);
app_exit(1);
}
static void privkey_info_int(FILE *outfile, common_info_st * cinfo,
gnutls_x509_privkey_t key)
{
int ret, key_type;
unsigned int bits = 0;
size_t size;
const char *cprint;
gnutls_x509_spki_t spki;
gnutls_digest_algorithm_t dig;
fprintf(outfile, "Public Key Info:\n");
ret = gnutls_x509_spki_init(&spki);
if (ret < 0) {
fprintf(
stderr
, "spki_init: %s\n", gnutls_strerror(ret));
return;
}
fprintf(outfile, "\tPublic Key Algorithm: ");
key_type = gnutls_x509_privkey_get_pk_algorithm2(key, &bits);
cprint = gnutls_pk_algorithm_get_name(key_type);
fprintf(outfile, "%s\n", cprint ? cprint : "Unknown");
if (key_type == GNUTLS_PK_RSA_PSS) {
unsigned int salt_size;
ret = gnutls_x509_privkey_get_spki(key, spki, 0);
if (ret == -56)
goto spki_skip;
if (ret < 0) {
fprintf(
stderr
, "spki_get: %s\n", gnutls_strerror(ret));
goto spki_skip;
}
ret = gnutls_x509_spki_get_rsa_pss_params(spki, &dig, &salt_size);
if (ret < 0) {
fprintf(
stderr
, "spki_get_rsa_pss_params: %s\n",
gnutls_strerror(ret));
} else {
fprintf(outfile, "\t\tHash Algorithm: %s\n",
gnutls_digest_get_name(dig));
fprintf(outfile, "\t\tSalt Length: %d\n", salt_size);
}
}
spki_skip:
gnutls_x509_spki_deinit(spki);
fprintf(outfile, "\tKey Security Level: %s (%u bits)\n\n",
gnutls_sec_param_get_name(gnutls_x509_privkey_sec_param
(key)), bits);
if (((key_type) == GNUTLS_PK_RSA || (key_type) == GNUTLS_PK_RSA_PSS)) {
gnutls_datum_t m, e, d, p, q, u, exp1, exp2;
ret =
gnutls_x509_privkey_export_rsa_raw2(key, &m, &e, &d,
&p, &q, &u, &exp1,
&exp2);
if (ret < 0)
fprintf(
stderr
,
"Error in key RSA data export: %s\n",
gnutls_strerror(ret));
else {
print_rsa_pkey(outfile, &m, &e, &d, &p, &q, &u,
&exp1, &exp2, cinfo->cprint);
gnutls_free((void *) (m.data)), m.data=
((void *)0)
;
gnutls_free((void *) (e.data)), e.data=
((void *)0)
;
gnutls_free((void *) (d.data)), d.data=
((void *)0)
;
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (q.data)), q.data=
((void *)0)
;
gnutls_free((void *) (u.data)), u.data=
((void *)0)
;
gnutls_free((void *) (exp1.data)), exp1.data=
((void *)0)
;
gnutls_free((void *) (exp2.data)), exp2.data=
((void *)0)
;
}
} else if (key_type == GNUTLS_PK_DSA) {
gnutls_datum_t p, q, g, y, x;
ret =
gnutls_x509_privkey_export_dsa_raw(key, &p, &q, &g, &y,
&x);
if (ret < 0)
fprintf(
stderr
,
"Error in key DSA data export: %s\n",
gnutls_strerror(ret));
else {
print_dsa_pkey(outfile, &x, &y, &p, &q, &g,
cinfo->cprint);
gnutls_free((void *) (x.data)), x.data=
((void *)0)
;
gnutls_free((void *) (y.data)), y.data=
((void *)0)
;
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (q.data)), q.data=
((void *)0)
;
gnutls_free((void *) (g.data)), g.data=
((void *)0)
;
}
} else if (key_type == GNUTLS_PK_ECDSA ||
key_type == GNUTLS_PK_EDDSA_ED25519 ||
key_type == GNUTLS_PK_EDDSA_ED448 ||
key_type == GNUTLS_PK_ECDH_X25519 ||
key_type == GNUTLS_PK_ECDH_X448) {
gnutls_datum_t y, x, k;
gnutls_ecc_curve_t curve;
ret =
gnutls_x509_privkey_export_ecc_raw(key, &curve, &x, &y,
&k);
if (ret < 0)
fprintf(
stderr
,
"Error in key ECC data export: %s\n",
gnutls_strerror(ret));
else {
print_ecc_pkey(outfile, curve, &k, &x, &y,
cinfo->cprint);
gnutls_free((void *) (x.data)), x.data=
((void *)0)
;
gnutls_free((void *) (y.data)), y.data=
((void *)0)
;
gnutls_free((void *) (k.data)), k.data=
((void *)0)
;
}
} else if (key_type == GNUTLS_PK_GOST_01 ||
key_type == GNUTLS_PK_GOST_12_256 ||
key_type == GNUTLS_PK_GOST_12_512) {
gnutls_datum_t y, x, k;
gnutls_ecc_curve_t curve;
gnutls_digest_algorithm_t digest;
gnutls_gost_paramset_t paramset;
ret =
gnutls_x509_privkey_export_gost_raw(key, &curve,
&digest,
¶mset,
&x, &y, &k);
if (ret < 0)
fprintf(
stderr
,
"Error in key GOST data export: %s\n",
gnutls_strerror(ret));
else {
print_gost_pkey(outfile, curve, digest, paramset,
&k, &x, &y,
cinfo->cprint);
gnutls_free((void *) (x.data)), x.data=
((void *)0)
;
gnutls_free((void *) (y.data)), y.data=
((void *)0)
;
gnutls_free((void *) (k.data)), k.data=
((void *)0)
;
}
}
size = lbuffer_size;
ret = gnutls_x509_privkey_get_seed(key, &dig, lbuffer, &size);
if (ret >= 0) {
fprintf(outfile, "Validation parameters:\n");
fprintf(outfile, "\tHash: %s\n",
gnutls_digest_get_name(dig));
fprintf(outfile, "\tSeed: %s\n",
raw_to_hex(lbuffer, size));
}
fprintf(outfile, "\n");
size = lbuffer_size;
ret =
gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA256, lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "Error in key id calculation: %s\n",
gnutls_strerror(ret));
} else {
fprintf(outfile, "Public Key PIN:\n\tpin-sha256:%s\n",
raw_to_base64(lbuffer, size));
fprintf(outfile, "Public Key ID:\n\tsha256:%s\n",
raw_to_hex(lbuffer, size));
size = lbuffer_size;
ret =
gnutls_x509_privkey_get_key_id(key, GNUTLS_KEYID_USE_SHA1, lbuffer, &size);
if (ret >= 0) {
fprintf(outfile, "\tsha1:%s\n",
raw_to_hex(lbuffer, size));
}
}
fprintf(outfile, "\n");
}
void
print_private_key(FILE *outfile, common_info_st * cinfo, gnutls_x509_privkey_t key)
{
int ret;
size_t size;
if (!key)
return;
switch_to_pkcs8_when_needed(cinfo, key, gnutls_x509_privkey_get_pk_algorithm(key));
if (!cinfo->pkcs8) {
if (cinfo->outtext)
privkey_info_int(outfile, cinfo, key);
size = lbuffer_size;
ret = gnutls_x509_privkey_export(key, cinfo->outcert_format,
lbuffer, &size);
if (ret < 0) {
fprintf(
stderr
, "privkey_export: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
} else {
unsigned int flags = 0;
const char *pass;
pass = get_password(cinfo, &flags, 0);
flags |= cipher_to_flags(cinfo->pkcs_cipher);
if (cinfo->outtext && (flags & GNUTLS_PKCS_PLAIN))
privkey_info_int(outfile, cinfo, key);
size = lbuffer_size;
ret =
gnutls_x509_privkey_export_pkcs8(key, cinfo->outcert_format,
pass, flags, lbuffer,
&size);
if (ret < 0) {
fprintf(
stderr
, "privkey_export_pkcs8: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
fwrite(lbuffer, 1, size, outfile);
}
int generate_prime(FILE * outfile, int how, common_info_st * info)
{
int ret;
gnutls_dh_params_t dh_params;
gnutls_datum_t p, g;
int bits = get_bits(GNUTLS_PK_DH, info->bits, info->sec_param, 1);
unsigned int q_bits = 0, key_bits = 0;
fix_lbuffer(0);
gnutls_dh_params_init(&dh_params);
if (how != 0) {
fprintf(
stderr
, "Generating DH parameters (%d bits)...\n",
bits);
fprintf(
stderr
, "(might take long time)\n");
} else
fprintf(
stderr
, "Retrieving DH parameters...\n");
if (how != 0) {
if (info->provable != 0) {
gnutls_x509_privkey_t pkey;
ret = gnutls_x509_privkey_init(&pkey);
if (ret < 0) {
fprintf(
stderr
,
"Error initializing key: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (info->seed_size > 0) {
gnutls_keygen_data_st data;
if (info->seed_size < 32) {
fprintf(
stderr
, "For DH parameter generation a 32-byte seed value or larger is expected (have: %d); use -d 2 for more information.\n", (int)info->seed_size);
app_exit(1);
}
data.type = GNUTLS_KEYGEN_SEED;
data.data = (void*)info->seed;
data.size = info->seed_size;
ret = gnutls_x509_privkey_generate2(pkey, GNUTLS_PK_DSA, bits, GNUTLS_PRIVKEY_FLAG_PROVABLE, &data, 1);
} else {
ret = gnutls_x509_privkey_generate(pkey, GNUTLS_PK_DSA, bits, GNUTLS_PRIVKEY_FLAG_PROVABLE);
}
if (ret < 0) {
fprintf(
stderr
,
"Error generating DSA parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
if (info->outcert_format == GNUTLS_X509_FMT_PEM) {
print_private_key(outfile, info, pkey);
}
ret = gnutls_dh_params_import_dsa(dh_params, pkey);
if (ret < 0) {
fprintf(
stderr
,
"Error importing DSA parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
gnutls_x509_privkey_deinit(pkey);
} else {
ret = gnutls_dh_params_generate2(dh_params, bits);
if (ret < 0) {
fprintf(
stderr
,
"Error generating parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
ret =
gnutls_dh_params_export_raw(dh_params, &p, &g,
&q_bits);
if (ret < 0) {
fprintf(
stderr
, "Error exporting parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
} else {
if (info->provable != 0) {
fprintf(
stderr
, "The DH parameters obtained via this option are not provable\n");
app_exit(1);
}
if (bits <= 2048) {
p = gnutls_ffdhe_2048_group_prime;
g = gnutls_ffdhe_2048_group_generator;
key_bits = gnutls_ffdhe_2048_key_bits;
} else if (bits <= 3072) {
p = gnutls_ffdhe_3072_group_prime;
g = gnutls_ffdhe_3072_group_generator;
key_bits = gnutls_ffdhe_3072_key_bits;
} else if (bits <= 4096) {
p = gnutls_ffdhe_4096_group_prime;
g = gnutls_ffdhe_4096_group_generator;
key_bits = gnutls_ffdhe_4096_key_bits;
} else if (bits <= 6144) {
p = gnutls_ffdhe_6144_group_prime;
g = gnutls_ffdhe_6144_group_generator;
key_bits = gnutls_ffdhe_6144_key_bits;
} else {
p = gnutls_ffdhe_8192_group_prime;
g = gnutls_ffdhe_8192_group_generator;
key_bits = gnutls_ffdhe_8192_key_bits;
}
ret = gnutls_dh_params_import_raw2(dh_params, &p, &g, key_bits);
if (ret < 0) {
fprintf(
stderr
, "Error exporting parameters: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
}
if (info->outtext)
print_dh_info(outfile, &p, &g, q_bits, info->cprint);
if (!info->cprint) {
size_t len = lbuffer_size;
ret =
gnutls_dh_params_export_pkcs3(dh_params,
info->outcert_format,
lbuffer, &len);
if (ret == 0) {
if (info->outcert_format == GNUTLS_X509_FMT_PEM)
fprintf(outfile, "\n%s", lbuffer);
else
fwrite(lbuffer, 1, len, outfile);
} else {
fprintf(
stderr
, "Error: %s\n",
gnutls_strerror(ret));
}
}
if (how != 0) {
gnutls_free((void *) (p.data)), p.data=
((void *)0)
;
gnutls_free((void *) (g.data)), g.data=
((void *)0)
;
}
gnutls_dh_params_deinit(dh_params);
return 0;
}
void decode_seed(gnutls_datum_t *seed, const char *hex, unsigned hex_size)
{
int ret;
size_t seed_size;
seed->size = hex_size;
seed->data = malloc(hex_size);
if (seed->data ==
((void *)0)
) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
seed_size = hex_size;
ret = gnutls_hex2bin(hex, hex_size, seed->data, &seed_size);
if (ret < 0) {
fprintf(
stderr
, "Could not hex decode data: %s\n", gnutls_strerror(ret));
app_exit(1);
}
seed->size = seed_size;
return;
}
gnutls_pk_algorithm_t figure_key_type(const char *key_type)
{
if (strcasecmp(key_type, "rsa") == 0)
return GNUTLS_PK_RSA;
else if (strcasecmp(key_type, "rsa-pss") == 0)
return GNUTLS_PK_RSA_PSS;
else if (strcasecmp(key_type, "ed25519") == 0 || strcasecmp(key_type, "eddsa") == 0)
return GNUTLS_PK_EDDSA_ED25519;
else if (strcasecmp(key_type, "ed448") == 0)
return GNUTLS_PK_EDDSA_ED448;
else if (strcasecmp(key_type, "x25519") == 0)
return GNUTLS_PK_ECDH_X25519;
else if (strcasecmp(key_type, "x448") == 0)
return GNUTLS_PK_ECDH_X448;
else if (strcasecmp(key_type, "dsa") == 0)
return GNUTLS_PK_DSA;
else if (strcasecmp(key_type, "ecdsa") == 0 || strcasecmp(key_type, "ecc") == 0)
return GNUTLS_PK_ECDSA;
else if (strcasecmp(key_type, "gost01") == 0)
return GNUTLS_PK_GOST_01;
else if (strcasecmp(key_type, "gost12-256") == 0)
return GNUTLS_PK_GOST_12_256;
else if (strcasecmp(key_type, "gost12-512") == 0)
return GNUTLS_PK_GOST_12_512;
else {
fprintf(
stderr
, "unknown key type: %s\n", key_type);
return GNUTLS_PK_UNKNOWN;
}
}
gnutls_digest_algorithm_t hash_to_id(const char *hash)
{
if (strcasecmp(hash, "md5") == 0) {
fprintf(
stderr
,
"Warning: MD5 is broken, and should not be used any more for digital signatures.\n");
return GNUTLS_DIG_MD5;
} else if (strcasecmp(hash, "sha1") == 0)
return GNUTLS_DIG_SHA1;
else if (strcasecmp(hash, "sha256") == 0)
return GNUTLS_DIG_SHA256;
else if (strcasecmp(hash, "sha224") == 0)
return GNUTLS_DIG_SHA224;
else if (strcasecmp(hash, "sha384") == 0)
return GNUTLS_DIG_SHA384;
else if (strcasecmp(hash, "sha512") == 0)
return GNUTLS_DIG_SHA512;
else if (strcasecmp(hash, "sha3-256") == 0)
return GNUTLS_DIG_SHA3_256;
else if (strcasecmp(hash, "sha3-224") == 0)
return GNUTLS_DIG_SHA3_224;
else if (strcasecmp(hash, "sha3-384") == 0)
return GNUTLS_DIG_SHA3_384;
else if (strcasecmp(hash, "sha3-512") == 0)
return GNUTLS_DIG_SHA3_512;
else if (strcasecmp(hash, "rmd160") == 0)
return GNUTLS_DIG_RMD160;
else {
return gnutls_digest_get_id(hash);
}
}
void sign_params_to_flags(common_info_st *cinfo, const char *params)
{
char *p, *sp;
sp = strdup(params);
if (sp ==
((void *)0)
) {
fprintf(
stderr
, "memory error\n");
app_exit(1);
}
p = strtok(sp, ",");
while(p !=
((void *)0)
) {
if (strcasecmp(p, "rsa-pss")==0) {
cinfo->rsa_pss_sign = 1;
} else {
fprintf(
stderr
, "Unknown signature parameter: %s\n", p);
app_exit(1);
}
p=strtok(
((void *)0)
, ",");
}
free(sp);
}
|
long insert_type(long a1, int *a2, long a3, void *a4, double a5, double a6, double a7, double a8)
[1680] {
const char *v9; // r12
unsigned int v11; // r13d
long inserted; // rax
char v13; // dl
_BYTE *v14; // rsi
char v15; // cl
char v16; // dl
unsigned int v17; // r14d
long v18; // rdx
char v19; // dl
char *v21; // rax
char *v22; // rax
char *v23; // rax
char *v24; // rax
char *v25; // rax
char *v26; // rax
_BYTE *v27; // [rsp+0h] [rbp-38h]
[1696, 1697, 1698, 1701, 1680, 1682, 1685, 1687, 1689] v9 = "-xtype";
[1741] if ( a4 != &pred_xtype )
[1728, 1731, 1705, 1738, 1741, 1712, 1721, 1726] v9 = "-type";
[1745, 1750] v11 = collect_arg(a1, a2);
[1753, 1755] if ( (_BYTE)v11 )
{
[1768, 1761, 1765] if ( !*v27 )
{
LABEL_28:
[2241, 2253, 2246, 2255] v24 = dcgettext(0LL, "Arguments to %s should contain at least one letter", 5);
[2273, 2275, 2260, 2263, 2265, 2270] error(1, 0, v24, v9, a5, a6, a7, a8);
LABEL_29:
[2280, 2292, 2285, 2294] v25 = dcgettext(0LL, "Last file type in list argument to %s is missing, i.e., list is ending on: ','", 5);
[2304, 2309, 2312, 2314, 2299, 2302] error(1, 0, v25, v9, a5, a6, a7, a8);
LABEL_30:
[2331, 2324, 2333, 2319] v26 = dcgettext(0LL, "Must separate multiple arguments to %s using: ','", 5);
[2338, 2341, 2343, 2348, 2351, 2353, 2358] error(1, 0, v26, v9, a5, a6, a7, a8);
}
[1777, 1780, 1774] inserted = insert_primary_withpred(a3, a4);
[1785] v13 = 0;
[1787, 1790] v14 = v27;
[1794] v15 = 0;
[1796] if ( a4 == &pred_xtype )
[1796] v13 = v11;
[1800] *(_DWORD *)(inserted + 36) = 0;
[1815] if ( a4 != &pred_xtype )
[1815, 1807] v15 = v11;
[1827, 1819] *(_QWORD *)&a8 = (unsigned int)LC31;
[1835] *(_BYTE *)(inserted + 26) = v13;
[1838] *(_QWORD *)&a7 = (unsigned int)LC30;
[1846] *(_BYTE *)(inserted + 27) = v15;
[1849] v16 = *v27;
[1859, 1852] *(_QWORD *)&a6 = (unsigned int)LC29;
[1867, 1869] while ( v16 )
{
[1875, 1871] v17 = v16;
[1890, 1894, 1897, 1878, 1881, 1887] switch ( v16 )
{
case 'D':
goto LABEL_26;
case 'b':
[2010] *(_QWORD *)&a5 = (unsigned int)LC27;
[2013] v18 = 0LL;
[2015] goto LABEL_13;
case 'c':
[2087] *(_QWORD *)&a5 = (unsigned int)LC32;
[2095] v18 = 1LL;
[2100] goto LABEL_13;
case 'd':
[2069] *(_QWORD *)&a5 = (unsigned int)LC28;
[2077] v18 = 2LL;
[2082] goto LABEL_13;
case 'f':
[2017] *(_QWORD *)&a5 = (unsigned int)LC29;
[2020] v18 = 3LL;
[2025] goto LABEL_13;
case 'l':
[2000] *(_QWORD *)&a5 = (unsigned int)LC30;
[2003] v18 = 4LL;
[2008] goto LABEL_13;
case 'p':
[1990] *(_QWORD *)&a5 = (unsigned int)LC31;
[1993] v18 = 5LL;
[1998] goto LABEL_13;
case 's':
[1900] *(_QWORD *)&a5 = (unsigned int)LC26;
[1908, 1903] v18 = 6LL;
LABEL_13:
[1912, 1917] if ( *(_BYTE *)(inserted + v18 + 56) )
goto LABEL_27;
[1923] *(float *)&a5 = *(float *)&a5 + *(float *)(inserted + 36);
[1928] *(_DWORD *)(inserted + 36) = LODWORD(a5);
[1933] *(_BYTE *)(inserted + v18 + 56) = 1;
[1938, 1942, 1946] v19 = v14[1];
[1952, 1954, 1959, 1968, 1950] if ( !v19 )
[1952, 1978] return v11;
[2032, 2035] if ( v19 != 44 )
goto LABEL_30;
[2041, 2045, 2049] v16 = v14[2];
[2053, 2055] if ( !v16 )
goto LABEL_29;
[2061] v14 += 2;
[2064] break;
default:
[2112, 2124, 2117, 2126] v21 = dcgettext(0LL, "Unknown argument to %s: %c", 5);
[1859, 1827, 2147, 2149, 1838, 2131, 2134, 2137, 2139, 2142] error(
1,
0,
v21,
v9,
v17,
a5,
COERCE_DOUBLE((unsigned long)LC29),
COERCE_DOUBLE((unsigned long)LC30),
COERCE_DOUBLE((unsigned long)LC31));
LABEL_26:
[2168, 2154, 2166, 2159] v22 = dcgettext(
0LL,
"%s %c is not supported because Solaris doors are not supported on the platform find was compiled on.",
5);
[1859, 1827, 2179, 2182, 2184, 2187, 1838, 2192, 2194, 2173] error(
1,
0,
v22,
v9,
68LL,
a5,
COERCE_DOUBLE((unsigned long)LC29),
COERCE_DOUBLE((unsigned long)LC30),
COERCE_DOUBLE((unsigned long)LC31));
LABEL_27:
[2211, 2204, 2213, 2199] v23 = dcgettext(0LL, "Duplicate file type '%c' in the argument list to %s.", 5);
[1859, 1827, 2218, 2221, 1838, 2224, 2226, 2229, 2234, 2236] error(
1,
0,
v23,
v17,
v9,
a5,
COERCE_DOUBLE((unsigned long)LC29),
COERCE_DOUBLE((unsigned long)LC30),
COERCE_DOUBLE((unsigned long)LC31));
goto LABEL_28;
}
}
}
[1978, 1974] return v11;
[1985, 1987, 1989, 1981, 1982, 1983] }
// 6E5: variable 'v27' is possibly undefined
// 6220: using guessed type int LC26;
// 6224: using guessed type int LC27;
// 6228: using guessed type int LC28;
// 622C: using guessed type int LC29;
// 6230: using guessed type int LC30;
// 6234: using guessed type int LC31;
// 6238: using guessed type int LC32;
// 7428: using guessed type long insert_primary_withpred(_QWORD, _QWORD);
//----- (0000000000000940) ----------------------------------------------------
long parse_xtype(long a1, long a2, int *a3, double a4, double a5, double a6, double a7)
[2368] {
[2368, 2372, 2375, 2382, 2385, 2388, 2391] return insert_type(a2, a3, a1, &pred_xtype, a4, a5, a6, a7);
}
//----- (0000000000000960) ----------------------------------------------------
long parse_type(long a1, long a2, int *a3, double a4, double a5, double a6, double a7)
[2400] {
[2400, 2404, 2407, 2414, 2417, 2420, 2423] return insert_type(a2, a3, a1, &pred_type, a4, a5, a6, a7);
}
//----- (0000000000000980) ----------------------------------------------------
float fnmatch_sanitycheck()
[2432] {
char *v0; // rax
float result; // xmm0_4
[2432, 2439]
[2441] if ( !checked_11631 )
[2448, 2455, 2459, 2461, 2464, 2469, 2471, 2473, 2475, 2482, 2489, 2494, 2496, 2498, 2503, 2510, 2517, 2522, 2524] {
if ( fnmatch("foo", "foo", 0) || !fnmatch("Foo", "foo", 0) || fnmatch("Foo", "foo", 16) )
[2555, 2548, 2557, 2543] {
[2569, 2572, 2574, 2579, 2590] v0 = dcgettext(0LL, "sanity check of the fnmatch() library function failed.", 5);
[2562, 2564, 2591] error(1, 0, v0);
return estimate_pattern_match_rate((_BYTE *)get_noop + 1, 0);
}
else
[2526] {
[2538, 2533] checked_11631 = 1;
}
[2542, 2446] }
return result;
}
// 4430: using guessed type char checked_11631;
//----- (0000000000000A20) ----------------------------------------------------
float estimate_pattern_match_rate(char *s, int a2)
[2592] {
float result; // xmm0_4
[2592, 2593, 2626, 2596, 2606, 2615, 2623] result = *(float *)&LC43;
[2610, 2597, 2599] if ( !strpbrk(s, "*?[") )
{
[2640] result = *(float *)&LC3;
[2648, 2650] if ( a2 )
{
[2673, 2682, 2679] result = *(float *)&LC3;
[2668, 2659, 2652, 2662] if ( strpbrk(s, ".") )
[2684] return *(float *)&LC43;
}
}
[2628] return result;
[2692, 2632, 2633, 2634, 2696, 2697, 2698] }
// 620C: using guessed type int LC3;
// 623C: using guessed type int LC43;
//----- (0000000000000A90) ----------------------------------------------------
long is_feasible_path_argument(const char *a1, unsigned char a2)
[2704] {
char *v2; // rax
[2720, 2704, 2705, 2708, 2709, 2711, 2716] v2 = strrchr(a1, 47);
[2728, 2730, 2725, 2734] if ( v2 && !v2[1] )
[2764, 2756, 2759] return matches_start_point(a1, a2);
else
[2740] return 1LL;
[2752, 2762, 2763, 2736, 2745, 2746, 2747] }
// 7450: using guessed type long matches_start_point(_QWORD, _QWORD);
//----- (0000000000000AE0) ----------------------------------------------------
long insert_path_check(long a1, long a2, int *a3, long a4, void *a5)
[2784] {
unsigned int v8; // r12d
long inserted; // rbp
float matched; // xmm0_4
bool v12; // zf
char *v13; // rax
char *s; // [rsp+0h] [rbp-38h]
[2784, 2786, 2820, 2789, 2791, 2825, 2794, 2827, 2796, 2799, 2800, 2803, 2804, 2807, 2811] fnmatch_sanitycheck();
[2832, 2835, 2838, 2841, 2846] v8 = collect_arg(a2, a3);
[2849, 2851, 2853, 2858, 2867] if ( (_BYTE)v8 )
{
[2915, 2917, 2896, 2900, 2903, 2906, 2911] inserted = insert_primary_withpred(a1, a5);
[2920, 2922] *(_WORD *)(inserted + 26) = 0;
[2929] *(_QWORD *)(inserted + 56) = s;
[2933, 2926] matched = estimate_pattern_match_rate(s, 0);
[2938] v12 = BYTE1(options[2]) == 0;
[2945] *(float *)(inserted + 36) = matched;
[2950, 2952, 2954, 2961, 2964, 2968, 2973, 2975] if ( v12 && !(unsigned char)is_feasible_path_argument(s, a5 == &pred_ipath) )
{
[2977, 2981, 2986, 2993, 2995] v13 = dcgettext(0LL, "warning: -%s %s will not match anything because it ends with /.", 5);
[3010, 3013, 3015, 3000, 3003, 3005, 3007] error(0, 0, v13, a4);
[3027, 3020] *(_DWORD *)(inserted + 36) = 841731191;
}
}
[2873, 2877] return v8;
[2880, 2881, 2882, 2884, 2886, 2888] }
// B71: variable 's' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 7428: using guessed type long insert_primary_withpred(_QWORD, _QWORD);
//----- (0000000000000BE0) ----------------------------------------------------
long parse_wholename(long a1, long a2, int *a3)
[3040] {
[3040, 3058, 3051, 3044] return insert_path_check(a1, a2, a3, (long)"wholename", &pred_path);
}
//----- (0000000000000C00) ----------------------------------------------------
long parse_path(long a1, long a2, int *a3)
[3072] {
[3072, 3090, 3083, 3076] return insert_path_check(a1, a2, a3, (long)"path", &pred_path);
}
//----- (0000000000000C20) ----------------------------------------------------
long parse_iwholename(long a1, long a2, int *a3)
[3104] {
[3104, 3122, 3115, 3108] return insert_path_check(a1, a2, a3, (long)"iwholename", &pred_ipath);
}
//----- (0000000000000C40) ----------------------------------------------------
long parse_ipath(long a1, long a2, int *a3)
[3136] {
[3136, 3154, 3147, 3140] return insert_path_check(a1, a2, a3, (long)"ipath", &pred_ipath);
}
//----- (0000000000000C60) ----------------------------------------------------
long parse_user(long a1, long a2, int *a3)
[3168] {
long v3; // r12
struct passwd *v5; // rbx
unsigned int pw_uid; // ebx
long inserted; // rax
int v8; // xmm0_4
size_t v9; // rax
char *v10; // rax
char *v11; // rax
char *name; // [rsp+0h] [rbp-38h]
[3168, 3200, 3172, 3205, 3174, 3207, 3176, 3177, 3210, 3180, 3183, 3215, 3186, 3187, 3191] LODWORD(v3) = collect_arg(a2, a3);
[3236, 3218, 3220, 3222, 3227] if ( (_BYTE)v3 )
{
[3264, 3273, 3268] v5 = getpwnam(name);
[3276] endpwent();
[3281, 3284] if ( v5 )
{
[3286] pw_uid = v5->pw_uid;
}
else
{
[3336, 3347, 3340, 3350] v9 = strspn(name, "0123456789");
[3360, 3355, 3366, 3358] if ( !v9 || name[v9] )
{
[3368, 3373] if ( *name )
{
[3405, 3375, 3381, 3384, 3386] v3 = quotearg_n_style(0LL, HIDWORD(options[13]));
[3408, 3403, 3396, 3391] v10 = dcgettext(0LL, "%s is not the name of a known user", 5);
[3426, 3428, 3433, 3413, 3416, 3418, 3423] error(1, 0, v10, v3);
}
[3440, 3452, 3445, 3454] v11 = dcgettext(0LL, "The argument to -user should not be empty", 5);
[3459, 3461, 3466, 3469, 3471, 3476] error(1, 0, v11);
}
[3489, 3494, 3496, 3480, 3486] pw_uid = safe_atoi(name);
}
[3296, 3289, 3293] inserted = insert_primary(a1);
[3301] v8 = LC52;
[3309] *(_DWORD *)(inserted + 56) = pw_uid;
[3312, 3315] if ( pw_uid > 0x63 )
[3317] v8 = LC22;
[3330, 3325] *(_DWORD *)(inserted + 36) = v8;
}
[3242, 3246] return (unsigned int)v3;
[3249, 3250, 3251, 3253, 3255] }
// CC4: variable 'name' is possibly undefined
// 6218: using guessed type int LC22;
// 6240: using guessed type int LC52;
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000000DC0) ----------------------------------------------------
long parse_nogroup(long a1)
[3520] {
[3520, 3524, 3528, 3530, 3535] *(_DWORD *)(insert_primary(a1) + 36) = 953267991;
[3547, 3542] return 1LL;
[3551] }
//----- (0000000000000DE0) ----------------------------------------------------
long parse_lname(long a1, long a2, int *a3)
[3552] {
unsigned int v4; // r12d
long inserted; // rbp
char *s; // [rsp+0h] [rbp-28h]
[3552, 3556, 3588, 3558, 3590, 3561, 3563, 3566, 3567, 3570, 3574, 3583] fnmatch_sanitycheck();
[3595, 3598, 3601, 3604, 3609] v4 = collect_arg(a2, a3);
[3616, 3621, 3630, 3612, 3614] if ( (_BYTE)v4 )
{
[3648, 3666, 3652, 3655] inserted = insert_primary(a1);
[3669] *(_QWORD *)(inserted + 56) = s;
[3686, 3691, 3660, 3664, 3673, 3678] *(float *)(inserted + 36) = estimate_pattern_match_rate(s, 0) * 0.1;
}
[3632, 3636] return v4;
[3640, 3642, 3644, 3639] }
// E55: variable 's' is possibly undefined
// 620C: using guessed type int LC3;
//----- (0000000000000E80) ----------------------------------------------------
long parse_ilname(long a1, long a2, int *a3)
[3712] {
unsigned int v3; // r12d
long inserted; // rbp
char *s; // [rsp+0h] [rbp-28h]
[3712, 3746, 3716, 3748, 3718, 3719, 3751, 3722, 3756, 3725, 3728, 3732, 3741] v3 = collect_arg(a2, a3);
[3777, 3759, 3761, 3763, 3768] if ( (_BYTE)v3 )
{
[3792, 3810, 3796, 3799] inserted = insert_primary(a1);
[3813] *(_QWORD *)(inserted + 56) = s;
[3808, 3817, 3822, 3830, 3835, 3804] *(float *)(inserted + 36) = estimate_pattern_match_rate(s, 0) * 0.1;
}
[3779, 3783] return v3;
[3786, 3787, 3789] }
// EE5: variable 's' is possibly undefined
// 620C: using guessed type int LC3;
//----- (0000000000000F10) ----------------------------------------------------
long parse_context(long a1, long a2, int *a3, double a4)
[3856] {
long inserted; // rax
long v6; // rdx
long v7; // rdx
long result; // rax
char *v9; // rax
long v10; // rdx
[3856, 3860, 3863]
[3968] if ( !a2 )
[3872, 3875, 3878, 3883, 3865, 3867, 3868, 3871] return 0LL;
[3952, 3953, 3955, 3956] if ( !*(_QWORD *)(a2 + 8LL * *a3) )
[3888, 3893, 3885, 3895] return 0LL;
if ( (int)is_selinux_enabled() <= 0 )
[3976, 3985, 3971, 3983] {
[4000, 4002, 4007, 3990, 3992, 3997] v9 = dcgettext(0LL, "invalid predicate -context: SELinux is not enabled.", 5);
[4008] error(1, 0, v9);
return get_relative_timestamp((_BYTE *)get_noop + 1, 0LL, v10, a4);
}
else
[3897, 3900, 3902] {
[3907] inserted = insert_primary(a1);
[3910] v6 = *a3;
[3917] *(_DWORD *)(inserted + 36) = 1008981770;
[3922] v7 = *(_QWORD *)(a2 + 8 * v6);
[3926] *(_BYTE *)(inserted + 26) = 0;
[3930] *(_QWORD *)(inserted + 56) = v7;
[3935] result = 1LL;
++*a3;
[3938, 3939, 3940, 3942] }
[3970, 3958] return result;
}
// FA8: variable 'v10' is possibly undefined
// 73F0: using guessed type long is_selinux_enabled(void);
//----- (0000000000000FB0) ----------------------------------------------------
long get_relative_timestamp(char *a1, long a2, long a3, double a4)
[4016] {
int v5; // ecx
const char *v6; // r8
int v7; // eax
int v8; // ebp
const char *v9; // r14
unsigned int v10; // r12d
double v12; // xmm0_8
double v13; // xmm2_8
long v14; // rax
long v15; // rdx
int *v16; // rdx
char *v17; // [rsp+8h] [rbp-50h] BYREF
double v18; // [rsp+18h] [rbp-40h] BYREF
double iptr[7]; // [rsp+20h] [rbp-38h] BYREF
[4034, 4038, 4016, 4018, 4020, 4023, 4025, 4026]
[4048, 4053, 4062] v17 = a1;
[4069, 4074, 4043, 4076, 4027, 4030] *(_QWORD *)&iptr[1] = __readfsqword(0x28u);
[4067, 4069] if ( !(unsigned char)get_comp_type(&v17, (_DWORD *)(a2 + 4)) )
[4078] return 0;
[4081] v7 = *(_DWORD *)(a2 + 4);
[4084] v8 = v5;
[4089, 4087] v9 = v6;
if ( v7 )
[4098, 4095] {
[4176, 4183] if ( v7 == 1 )
*(_DWORD *)(a2 + 4) = 0;
}
else
[4336, 4343] {
*(_DWORD *)(a2 + 4) = 1;
[4100, 4107, 4112, 4117, 4119, 4124] }
[4129, 4131, 4134, 4139, 4148, 4127] v10 = xstrtod(v17, 0LL, &v18, &strtod);
[4169] if ( !(_BYTE)v10 )
[4192, 4197, 4203, 4208, 4213, 4221] return 0;
[4225, 4229] v12 = modf(a4 * v18, iptr) * 1000000000.0;
[4385, 4392, 4366, 4373, 4378] if ( v12 >= 1000000000.0 )
[4235, 4239] _assert_fail("nanosec < nanosec_per_sec", "parser.c", 0xC4Du, "get_relative_timestamp");
[4250, 4245, 4254] v13 = iptr[0];
[4266, 4259, 4263] v14 = (unsigned int)(int)((double)(int)a3 - iptr[0]);
[4270, 4273, 4277, 4280, 4282, 4284] *(_QWORD *)(a2 + 8) = v14;
if ( v14 > a3 == v13 < 0.0 )
[4288, 4293, 4297, 4301, 4305] {
[4288, 4310] v15 = (unsigned int)(int)((double)v8 - v12);
if ( v12 <= (double)v8 )
[4352, 4356] {
*(_QWORD *)(a2 + 16) = v15;
}
else
[4312, 4323] {
[4327, 4319] *(_QWORD *)(a2 + 16) = v15 + 1000000000;
*(_QWORD *)(a2 + 8) = v14 - 1;
[4331, 4158] }
return v10;
[4419, 4397, 4430, 4402, 4405, 4407, 4412, 4414] }
[4154, 4431] error(1, 0, v9, v17);
[4161, 4162, 4163, 4165, 4167] return parse_used(1LL, 0LL, v16);
}
// FF1: variable 'v5' is possibly undefined
// FF4: variable 'v6' is possibly undefined
// 114F: variable 'v16' is possibly undefined
// 74A0: using guessed type long xstrtod(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000001150) ----------------------------------------------------
long parse_used(long a1, long a2, int *a3)
[4432] {
unsigned int relative_timestamp; // r12d
long inserted; // rax
long v6; // rsi
float v7; // xmm0_4
long v8; // rcx
char *v9; // rax
int *v10; // rdx
int v11; // ecx
char *v12; // [rsp+8h] [rbp-40h]
__m128i v13; // [rsp+10h] [rbp-38h] BYREF
long v14; // [rsp+20h] [rbp-28h]
[4448, 4452, 4461, 4432, 4466, 4436, 4468, 4438] unsigned long v15; // [rsp+28h] [rbp-20h]
[4439, 4473, 4442, 4445, 4478]
[4481, 4483, 4485, 4490, 4499] v15 = __readfsqword(0x28u);
[4483, 4509] relative_timestamp = collect_arg(a2, a3);
[4549, 4520, 4554, 4525, 4530, 4532, 4534, 4542] if ( !(_BYTE)relative_timestamp )
[4557, 4559] return relative_timestamp;
relative_timestamp = get_relative_timestamp(v12, (long)&v13, 0LL, 86400.0);
[4561, 4569, 4566] if ( (_BYTE)relative_timestamp )
[4585, 4595, 4580, 4598] {
[4602, 4574] inserted = insert_primary(a1);
[4611, 4606] v6 = v13.m128i_i64[1];
[4615, 4618, 4622, 4625, 4629, 4632, 4637] *(__m128i *)(inserted + 56) = _mm_load_si128(&v13);
[4642, 4647] *(_QWORD *)(inserted + 72) = v14;
[4515, 4509] v7 = estimate_file_age_success_rate((float)(int)(v6 / 86400));
*(float *)(v8 + 36) = v7;
[4674, 4676, 4657, 4662, 4667] return relative_timestamp;
[4681, 4683, 4688, 4691, 4694, 4696, 4701] }
[4505, 4702] v9 = dcgettext(0LL, "Invalid argument %s to -used", 5);
[4512, 4513] error(1, 0, v9);
return do_parse_xmin(1LL, 0LL, v10, v11);
}
// 11C5: variable 'v12' is possibly undefined
// 1222: variable 'v8' is possibly undefined
// 125E: variable 'v10' is possibly undefined
// 125E: variable 'v11' is possibly undefined
//----- (0000000000001260) ----------------------------------------------------
long do_parse_xmin(long a1, long a2, int *a3, int a4)
[4704] {
int v6; // r13d
unsigned int relative_timestamp; // r12d
long inserted; // rax
long v10; // rdi
char *v11; // [rsp+8h] [rbp-50h]
__m128i v12; // [rsp+10h] [rbp-48h] BYREF
long v13; // [rsp+20h] [rbp-38h]
unsigned long v14; // [rsp+28h] [rbp-30h]
[4704, 4706, 4709, 4711, 4713, 4720, 4721, 4727, 4731] v6 = *a3;
[4750, 4748, 4734, 4743] v14 = __readfsqword(0x28u);
[4714, 4717, 4755, 4724, 4760] relative_timestamp = collect_arg(a2, a3);
[4772, 4781, 4763, 4765, 4767] if ( (_BYTE)relative_timestamp )
{
[4818, 4823] v12.m128i_i32[0] = a4;
[4864, 4837, 4808, 4845, 4813, 4852, 4859, 4830] relative_timestamp = get_relative_timestamp(v11, (long)&v12, (long)options[5] + 86400, 60.0);
[4867, 4869] if ( (_BYTE)relative_timestamp )
{
[4880, 4888, 4885] inserted = insert_primary(a1);
[4904, 4899] v10 = v12.m128i_i64[1];
[4907, 4893] *(__m128i *)(inserted + 56) = _mm_load_si128(&v12);
[4916, 4911] *(_QWORD *)(inserted + 72) = v13;
[4920, 4930, 4925] *(float *)(inserted + 36) = estimate_timestamp_success_rate(v10);
}
else
{
[4874, 4871] *a3 = v6;
}
}
[4787, 4791] return relative_timestamp;
[4800, 4802, 4794, 4795, 4796, 4798] }
// 12FB: variable 'v11' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000001350) ----------------------------------------------------
long parse_mmin(long a1, long a2, int *a3)
[4944] {
[4944, 4953, 4948] return do_parse_xmin(a1, a2, a3, 3);
}
//----- (0000000000001360) ----------------------------------------------------
long parse_cmin(long a1, long a2, int *a3)
[4960] {
[4960, 4969, 4964] return do_parse_xmin(a1, a2, a3, 2);
}
//----- (0000000000001370) ----------------------------------------------------
long parse_amin(long a1, long a2, int *a3)
[4976] {
[4976, 4980, 4982] return do_parse_xmin(a1, a2, a3, 0);
}
//----- (0000000000001380) ----------------------------------------------------
bool get_num(char *a1, long a2, _DWORD *a3)
[4992] {
long v3; // rcx
char *v5; // [rsp+8h] [rbp-20h] BYREF
char v6[8]; // [rsp+10h] [rbp-18h] BYREF
unsigned long v7; // [rsp+18h] [rbp-10h]
[4992, 5002] v5 = a1;
[5016, 5023, 5021, 5007] v7 = __readfsqword(0x28u);
[5088, 5057, 5026, 5090, 4996, 5028, 4999, 5064, 5033, 5069, 5038, 5071, 5040, 5042, 5074, 5079, 5047, 5052] return a1 && (unsigned char)get_comp_type(&v5, a3) && (unsigned int)xstrtoumax(v5, v6, 10LL, v3, &LC67) == 0;
[5094] }
// 13C8: variable 'v3' is possibly undefined
// 74B8: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 1380: using guessed type char var_18[8];
//----- (0000000000001400) ----------------------------------------------------
long insert_num(long a1, int *a2, long a3)
[5120] {
long inserted; // r12
const char *v6; // r8
const char *v7; // rcx
int v8; // [rsp+4h] [rbp-34h] BYREF
char *v9; // [rsp+8h] [rbp-30h]
long v10[5]; // [rsp+10h] [rbp-28h] BYREF
[5120, 5122, 5125, 5126, 5129] inserted = 0LL;
[5133, 5142] v10[1] = __readfsqword(0x28u);
[5154, 5159, 5161, 5147, 5149] if ( (unsigned char)collect_arg(a1, a2) )
{
[5185, 5187, 5192, 5163, 5168, 5201, 5173, 5178, 5183] if ( get_num(v9, (long)v10, &v8) )
{
[5224, 5232, 5229, 5237] inserted = insert_primary(a3);
[5240, 5244] *(_DWORD *)(inserted + 56) = v8;
[5249, 5254] *(_QWORD *)(inserted + 64) = v10[0];
[5266, 5259] if ( ((long)options[8] & 1) != 0 )
{
[5280, 5287, 5289, 5294, 5268, 5273] _fprintf_chk(stderr, 1LL, "inserting %s\n", *(const char **)(inserted + 8));
[5299, 5303] v6 = " >";
[5310] v7 = "gt";
[5317, 5319] if ( v8 )
{
[5321] v6 = " <";
[5328] v7 = "lt";
[5338, 5335] if ( v8 != 1 )
{
[5340, 5343] v6 = " ?";
[5357, 5350] v7 = "?";
[5371] if ( v8 == 2 )
{
[5371, 5364] v6 = " =";
[5375] v7 = "eq";
}
}
}
[5379, 5386, 5393, 5398, 5400] _fprintf_chk(stderr, 1LL, " type: %s %s ", v7, v6);
[5410, 5415, 5417, 5424, 5431, 5436, 5405] _fprintf_chk(stderr, 1LL, "%lu\n", *(_QWORD *)(inserted + 64));
}
}
}
[5211, 5207] return inserted;
[5217, 5214, 5215] }
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 73C8: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
//----- (0000000000001550) ----------------------------------------------------
long parse_links(long a1, long a2, int *a3)
[5456] {
long inserted; // rax
long v5; // rdx
[5473, 5476, 5456, 5460, 5461, 5464, 5467, 5470] inserted = insert_num(a2, a3, a1);
[5481, 5484] if ( inserted )
{
[5486] v5 = *(_QWORD *)(inserted + 64);
[5490, 5494] if ( v5 == 1 )
{
[5520] *(_DWORD *)(inserted + 36) = 1065185444;
[5527] return 1LL;
}
else
{
[5496, 5500] if ( v5 == 2 )
[5552, 5559] *(_DWORD *)(inserted + 36) = 1008981770;
else
[5502] *(_DWORD *)(inserted + 36) = 981668463;
[5509] return 1LL;
}
}
else
{
[5536] --*a3;
[5539] return 0LL;
}
[5541, 5542, 5514, 5515, 5564, 5532, 5533, 5565] }
//----- (00000000000015C0) ----------------------------------------------------
long parse_inum(long a1, long a2, int *a3)
[5568] {
long inserted; // rax
[5568, 5572, 5573, 5576, 5579, 5582, 5585, 5588] inserted = insert_num(a2, a3, a1);
[5593, 5596] if ( inserted )
{
[5600, 5598] *(_DWORD *)(inserted + 36) = 897988541;
[5607] *(_WORD *)(inserted + 26) = 0;
[5611] *(_BYTE *)(inserted + 28) = 1;
[5615] return 1LL;
}
else
{
[5632] --*a3;
[5635] return 0LL;
}
[5637, 5620, 5621, 5638] }
//----- (0000000000001610) ----------------------------------------------------
long parse_gid(long a1, long a2, int *a3)
[5648] {
long inserted; // rax
[5665, 5668, 5648, 5652, 5653, 5656, 5659, 5662] inserted = insert_num(a2, a3, a1);
[5673, 5676] if ( inserted )
{
[5691, 5683, 5678] if ( *(_QWORD *)(inserted + 64) > 0x63uLL )
[5712, 5730, 5720, 5725] *(_DWORD *)(inserted + 36) = LC22;
else
[5693] *(_DWORD *)(inserted + 36) = LC52;
[5698] return 1LL;
}
else
{
[5736] --*a3;
[5739] return 0LL;
}
[5704, 5741, 5742, 5703] }
// 6218: using guessed type int LC22;
// 6240: using guessed type int LC52;
//----- (0000000000001670) ----------------------------------------------------
long parse_uid(long a1, long a2, int *a3)
[5744] {
[5744, 5748] return parse_gid(a1, a2, a3);
}
//----- (0000000000001680) ----------------------------------------------------
long parse_size(long a1, long a2, int *a3)
[5760] {
long v3; // rax
char *v5; // r15
int v6; // eax
char *v7; // rax
char v8; // bl
long v9; // r13
int v10; // r12d
bool num; // al
long inserted; // rax
int v13; // ecx
long v14; // rdx
_BOOL4 v15; // r8d
int v17; // xmm0_4
char *v18; // rax
char *v19; // rax
char *v20; // rax
long v21; // rdx
long *v22; // rcx
bool v23; // [rsp+Fh] [rbp-59h]
int v24; // [rsp+14h] [rbp-54h] BYREF
long v25; // [rsp+18h] [rbp-50h] BYREF
char v26[2]; // [rsp+26h] [rbp-42h] BYREF
[5760, 5764, 5766, 5768, 5770, 5772, 5773, 5774, 5778, 5787] unsigned long v27; // [rsp+28h] [rbp-40h]
[5792, 5794, 5797]
[5797] v27 = __readfsqword(0x28u);
[5803, 5806] if ( !a2 )
[5816, 5809, 5813] return 0;
[6192, 6195] v3 = *a3;
[5809, 5828, 5825, 5822] if ( (v5 = *(char **)(a2 + 8 * v3)) == 0LL )
[5833, 5835] return 0;
v6 = strlen(*(const char **)(a2 + 8 * v3));
[5841, 5843] if ( v6 )
[5848] {
[5848, 5851, 5854] v7 = &v5[v6 - 1];
v8 = *v7;
[6320] if ( *v7 == 98 )
[6323] {
[6329] *v7 = 0;
[6335] v9 = 512LL;
v10 = 512;
[5860] goto LABEL_10;
}
[6064, 6067] if ( v8 > 98 )
{
switch ( v8 )
[6232] {
[6235] case 'k':
[6241] *v7 = 0;
[6247] v9 = 1024LL;
v10 = 1024;
[6073, 6076, 6078] goto LABEL_10;
[6081] case 'w':
[6087] *v7 = 0;
[6093] v9 = 2LL;
v10 = 2;
[6098, 6107, 6101] goto LABEL_10;
[6110] case 'c':
[6116] *v7 = 0;
[6122] v9 = 1LL;
v10 = 1;
goto LABEL_10;
}
}
[5866, 5869] else
{
[6208] if ( v8 == 71 )
[6211] {
[6217] *v7 = 0;
[6223] v9 = 0x40000000LL;
v10 = 0x40000000;
[5875] goto LABEL_10;
}
[6130, 6132, 6127] if ( v8 <= 71 )
{
[6138] if ( (unsigned char)(v8 - 48) <= 9u )
[6144] {
[6150] v9 = 512LL;
[6152] v10 = 512;
v8 = 0;
goto LABEL_10;
[5881, 5884] }
}
[5890] else if ( v8 == 77 )
[5893] {
[5905, 5899] *v7 = 0;
v9 = 0x100000LL;
[5912, 5922, 5925, 5917] v10 = 0x100000;
[5930, 5932] LABEL_10:
num = get_num(v5, (long)&v25, &v24);
[5944] if ( num )
[5938, 5948, 5941] {
[5953] v23 = num;
[5957] inserted = insert_primary(a1);
[5962, 5967] v13 = v24;
[5971] v14 = v25;
[5977, 5979] *(_DWORD *)(inserted + 60) = v10;
[5982] v15 = v23;
[5986] *(_DWORD *)(inserted + 56) = v13;
[5990] *(_QWORD *)(inserted + 64) = v14;
*(_WORD *)(inserted + 26) = 1;
[5996, 5999] if ( v13 )
{
[6005] if ( v13 != 1 )
{
[6016, 6012, 6021, 6030] *(_DWORD *)(inserted + 36) = 1008981770;
[6040, 6053] LABEL_14:
++*a3;
[6284] return v15;
[6280, 6299, 6292] }
[6301, 6309] v17 = LC23;
if ( (unsigned long)(v14 * v9) <= 0x5000 )
v17 = LC3;
}
[6164] else
[6160, 6179, 6172] {
v17 = LC3;
[6256, 6264] if ( (unsigned long)(v14 * v9) <= 0x5000 )
[6269] {
*(_DWORD *)(inserted + 36) = LC23;
goto LABEL_14;
[6181] }
[6186] }
*(_DWORD *)(inserted + 36) = v17;
[6357, 6359] goto LABEL_14;
[6363] }
[6368, 6345, 6350] v26[0] = v8;
[6373, 6378, 6381, 6383, 6386, 6391, 6393] v26[1] = 0;
v18 = dcgettext(0LL, "Invalid argument `%s%s' to -size", 5);
error(1, 0, v18, v5, v26);
[6410, 6403, 6412, 6398] }
[6432, 6417, 6420, 6422, 6427, 6430] }
v19 = dcgettext(0LL, "invalid -size type `%c'", 5);
[6449, 6442, 6451, 6437] error(1, 0, v19, (unsigned int)v8);
[6466, 6468, 6473, 6456, 6458, 6463] }
[6474, 6036] v20 = dcgettext(0LL, "invalid null argument to -size", 5);
[6049, 6051, 6043, 6044, 6045, 6047] error(1, 0, v20);
return collect_arg_stat_info(1LL, 0LL, v21, v22);
}
// 194A: variable 'v21' is possibly undefined
// 194A: variable 'v22' is possibly undefined
// 620C: using guessed type int LC3;
// 621C: using guessed type int LC23;
// 1680: using guessed type long var_50;
//----- (0000000000001950) ----------------------------------------------------
long collect_arg_stat_info(long a1, int *a2, long a3, long *a4)
[6480] {
unsigned int v6; // r12d
long v8; // rdi
int *v9; // rdx
long v10; // [rsp+0h] [rbp-28h]
[6503, 6508, 6510, 6480, 6513, 6482, 6483, 6486, 6487, 6518, 6490, 6494]
[6521, 6523] v6 = collect_arg(a1, a2);
if ( !(_BYTE)v6 )
[6576] {
[6565, 6583] *a4 = 0LL;
return v6;
[6532] }
[6529, 6535, 6541, 6543, 6545, 6550, 6525, 6559] *a4 = v10;
[6572, 6565] if ( !options[10](v10, a3) )
[6590] return v6;
[6601, 6595, 6606, 6599] v8 = (unsigned int)*_errno_location();
[6561, 6607] fatal_target_file_error(v8);
[6568, 6569, 6570] return parse_samefile(v8, v10, v9);
}
// 1984: variable 'v10' is possibly undefined
// 19CF: variable 'v9' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (00000000000019D0) ----------------------------------------------------
long parse_samefile(long a1, long a2, int *a3)
[6608] {
unsigned int v5; // r12d
int v7; // ebp
long v8; // rsi
int v9; // eax
long inserted; // rax
__m128d v11; // xmm0
int v12; // edi
__m128i si128; // xmm2
__m128i v14; // xmm3
__m128i v15; // xmm4
__m128i v16; // xmm5
__m128i v17; // xmm6
__m128i v18; // xmm7
__m128i v19; // xmm1
__m128i v20; // xmm2
int *v21; // rax
int *v22; // rsi
long v23; // rdi
long v24; // rdx
int v25; // ecx
int *v26; // [rsp+8h] [rbp-160h] BYREF
__m128i v27; // [rsp+10h] [rbp-158h] BYREF
__m128i v28; // [rsp+20h] [rbp-148h]
__m128i v29; // [rsp+30h] [rbp-138h]
__m128i v30; // [rsp+40h] [rbp-128h]
__m128i v31; // [rsp+50h] [rbp-118h]
__m128i v32; // [rsp+60h] [rbp-108h]
__m128i v33; // [rsp+70h] [rbp-F8h]
__m128i v34; // [rsp+80h] [rbp-E8h]
[6626, 6627, 6630, 6637, 6608, 6612, 6614, 6646, 6616, 6618, 6621, 6623] __m128i v35; // [rsp+90h] [rbp-D8h]
[6656, 6664, 6661, 6654] struct stat v36; // [rsp+A0h] [rbp-C8h] BYREF
[6688, 6669, 6672, 6677, 6680, 6683] unsigned long v37; // [rsp+138h] [rbp-30h]
[6691, 6693, 6695, 6703, 6712]
[6725, 6693] v37 = __readfsqword(0x28u);
[6744, 6755, 6752] set_stat_placeholders(&v27);
[6760, 6768, 6766] v5 = collect_arg_stat_info(a2, a3, (long)&v27, (long *)&v26);
if ( !(_BYTE)v5 )
return v5;
[6808] set_stat_placeholders(&v36);
if ( LODWORD(options[9]) )
{
[6777, 6770] LABEL_7:
v8 = 0LL;
[6793, 6779, 6788, 6783] goto LABEL_8;
}
[6800, 6795] if ( !LOBYTE(options[11]) )
{
[6833, 6836, 6828] if ( (v28.m128i_i16[4] & 0xF000) == 40960 )
[6841] {
[6852, 6847] v7 = -2;
[6860] LABEL_9:
[6864] inserted = insert_primary(a1);
[6871, 6875, 6855] v11 = (__m128d)_mm_load_si128(&v27);
[6737, 6725] *(_DWORD *)(inserted + 72) = v7;
*(_WORD *)(inserted + 26) = 1;
*(_DWORD *)(inserted + 36) = 1008981770;
*(__m128d *)(inserted + 56) = _mm_shuffle_pd(v11, v11, 1);
[6880, 6885] return v5;
}
[6817, 6810, 6815] goto LABEL_7;
[6822] }
[6824, 6826] v8 = 0x20000LL;
LABEL_8:
[6914, 6919, 6922, 6896, 6928, 6930, 6899, 6901, 6906, 6908] v9 = open_cloexec(v26, v8);
v7 = v9;
[6944, 6946, 6953, 6936, 6942] if ( v9 < 0 )
goto LABEL_9;
[7033] if ( !fstat(v9, &v36) && !options[10]((long)v26, (long)&v27) )
[7042] {
[7051] if ( LODWORD(options[9]) || LOBYTE(options[11]) )
[7060] {
[7024, 7069] si128 = _mm_load_si128((const __m128i *)&v36.st_nlink);
[7074] v14 = _mm_load_si128((const __m128i *)&v36.st_gid);
[7083] v15 = _mm_load_si128((const __m128i *)&v36.st_size);
[7092] v16 = _mm_load_si128((const __m128i *)&v36.st_blocks);
[7097] v27 = _mm_load_si128((const __m128i *)&v36);
[7106] v17 = _mm_load_si128((const __m128i *)&v36.st_atim.tv_nsec);
[7115] v18 = _mm_load_si128((const __m128i *)&v36.st_mtim.tv_nsec);
[7120] v28 = si128;
[7125] v19 = _mm_load_si128((const __m128i *)&v36.st_ctim.tv_nsec);
[7130] v20 = _mm_load_si128((const __m128i *)&v36.__unused[1]);
[7135] v29 = v14;
[7140] v30 = v15;
[7156, 7148] v31 = v16;
v32 = v17;
[6979, 6984, 6986, 6955, 6959, 6964, 6969, 6971] v33 = v18;
v34 = v19;
[6994, 7005, 6999] v35 = v20;
[7007] }
[7012] else if ( (v28.m128i_i16[4] & 0xF000) == 40960 || *(_OWORD *)&v27 != *(_OWORD *)&v36.st_dev )
{
[7017] v12 = v7;
v7 = -1;
[7166] close(v12);
[7176, 7178, 7171] }
[6718, 7183] goto LABEL_9;
[6728, 6729, 6731, 6733, 6735] }
v21 = _errno_location();
v22 = v26;
v23 = (unsigned int)*v21;
fatal_target_file_error(v23);
return insert_regex(v23, v22, v24, v25);
}
// 1C0F: variable 'v24' is possibly undefined
// 1C0F: variable 'v25' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 74D0: using guessed type long set_stat_placeholders(_QWORD);
// 74D8: using guessed type long open_cloexec(_QWORD, _QWORD);
//----- (0000000000001C10) ----------------------------------------------------
long insert_regex(long a1, int *a2, long a3, int a4)
[7184] {
const char *v4; // r14
reg_syntax_t v6; // rbx
unsigned int v7; // r12d
long inserted; // rbp
long v10; // rax
struct re_pattern_buffer *v11; // r13
long v12; // rax
size_t v13; // rax
const char *v14; // rbx
char *v15; // rax
int *v16; // rdx
char *s; // [rsp+0h] [rbp-38h]
[7184, 7186, 7188, 7191, 7193, 7194, 7195, 7198]
[7202, 7211, 7216, 7218, 7221, 7226] v6 = a4;
[7233, 7238, 7247, 7229, 7231] v7 = collect_arg(a1, a2);
[7257, 7231] if ( !(_BYTE)v7 )
[7296, 7272, 7276, 7283, 7286, 7291] return v7;
[7299, 7301] inserted = insert_primary_withpred(a3, &pred_regex);
[7305] *(_WORD *)(inserted + 26) = 0;
[7315, 7310] v10 = xmalloc(64LL);
[7319] *(_QWORD *)(inserted + 56) = v10;
[7322] v11 = (struct re_pattern_buffer *)v10;
[7330] *(_QWORD *)(v10 + 8) = 100LL;
[7335] v12 = xmalloc(100LL);
[7346] v11->fastmap = 0LL;
[7350, 7343] v11->buffer = (unsigned char *)v12;
[7359] re_set_syntax(v6);
[7363] v11->syntax = v6;
[7371, 7374] v11->translate = 0LL;
[7393, 7379, 7382, 7385, 7388] v13 = strlen(v4);
[7396, 7399] v14 = re_compile_pattern(v4, v13, v11);
if ( !v14 )
[7401, 7405, 7410, 7415, 7420] {
[7257, 7268] *(float *)(inserted + 36) = estimate_pattern_match_rate(s, 1);
return v7;
[7430, 7434, 7439, 7446, 7448] }
[7456, 7458, 7463, 7466, 7469, 7471, 7476, 7453] v15 = dcgettext(0LL, "failed to compile regular expression '%s': %s", 5);
[7253, 7487] error(1, 0, v15, s, v14);
[7264, 7266, 7355, 7260, 7261, 7262] return parse_regex(1LL, 0LL, v16);
}
// 1CCE: variable 'v4' is possibly undefined
// 1CF2: variable 's' is possibly undefined
// 1D3F: variable 'v16' is possibly undefined
// 7428: using guessed type long insert_primary_withpred(_QWORD, _QWORD);
// 74F8: using guessed type long xmalloc(_QWORD);
//----- (0000000000001D40) ----------------------------------------------------
long parse_regex(long a1, long a2, int *a3)
[7488] {
[7488, 7492, 7495, 7501, 7504, 7507, 7510] return insert_regex(a2, a3, a1, HIDWORD(options[11]));
}
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000001D60) ----------------------------------------------------
long parse_iregex(long a1, long a2, int *a3)
[7520] {
[7520, 7524, 7530, 7533, 7536, 7539, 7542, 7548] return insert_regex(a2, a3, a1, HIDWORD(options[11]) | 0x400000u);
}
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000001D90) ----------------------------------------------------
bool stream_is_tty(FILE *a1)
[7568] {
int v1; // edi
bool result; // al
[7568, 7577, 7572] v1 = fileno(a1);
[7579] result = 0;
[7584, 7581] if ( v1 != -1 )
[7593, 7586, 7591] return isatty(v1) != 0;
[7596] return result;
[7600] }
//----- (0000000000001DC0) ----------------------------------------------------
char open_output_file(char *s1, long a2)
[7616] {
FILE *v3; // rdi
char result; // al
char *v5; // rax
FILE *v6; // rdi
char *v7; // rax
FILE *v8; // rdi
long v9; // rdi
[7616, 7617, 7620, 7622, 7623, 7626, 7630] *(_QWORD *)a2 = 0LL;
[7652, 7637] *(_QWORD *)(a2 + 32) = clone_quoting_options(0LL);
[7649, 7656, 7661, 7663, 7642] if ( !strcmp(s1, "/dev/stderr") )
{
[7819, 7821] *(_QWORD *)(a2 + 8) = stderr;
[7800, 7825, 7812, 7807] v7 = dcgettext(0LL, "standard error", 5);
[7830] v8 = *(FILE **)(a2 + 8);
[7834] *(_QWORD *)(a2 + 16) = v7;
[7838] result = stream_is_tty(v8);
[7843] *(_BYTE *)(a2 + 24) = result;
}
[7684, 7686, 7669, 7676, 7679] else if ( !strcmp(s1, "/dev/stdout") )
{
[7763, 7765] *(_QWORD *)(a2 + 8) = stdout;
[7744, 7769, 7756, 7751] v5 = dcgettext(0LL, "standard output", 5);
[7774] v6 = *(FILE **)(a2 + 8);
[7778] *(_QWORD *)(a2 + 16) = v5;
[7782] result = stream_is_tty(v6);
[7787] *(_BYTE *)(a2 + 24) = result;
}
else
{
[7688, 7713, 7698, 7695] v3 = (FILE *)sharefile_fopen(state[6], s1);
[7720, 7708, 7716, 7703] *(__m128i *)(a2 + 8) = _mm_unpacklo_epi64((__m128i)(unsigned long)v3, (__m128i)(unsigned long)s1);
[7724, 7727] if ( v3 )
{
[7729] result = stream_is_tty(v3);
[7734] *(_BYTE *)(a2 + 24) = result;
}
else
{
[7853] v9 = (unsigned int)*_errno_location();
[7858, 7868, 7861, 7863] fatal_nontarget_file_error(v9, s1);
[7869] return open_stdout(v9);
}
}
[7737] return result;
[7846, 7850, 7851, 7852, 7790, 7794, 7795, 7796, 7741, 7742, 7743] }
// 73D0: using guessed type _QWORD state[7];
// 7520: using guessed type long clone_quoting_options(_QWORD);
// 7530: using guessed type long sharefile_fopen(_QWORD, _QWORD);
// 7540: using guessed type long fatal_nontarget_file_error(_QWORD, _QWORD);
//----- (0000000000001EC0) ----------------------------------------------------
char open_stdout(long a1)
[7872] {
[7872, 7882, 7875] return open_output_file("/dev/stdout", a1);
}
//----- (0000000000001ED0) ----------------------------------------------------
long parse_printf(long a1, long a2, int *a3)
[7888] {
int v4; // r12d
long result; // rax
long v6; // [rsp+8h] [rbp-60h] BYREF
char v7[40]; // [rsp+10h] [rbp-58h] BYREF
unsigned long v8; // [rsp+38h] [rbp-30h]
[7904, 7910, 7914, 7888, 7892, 7894, 7896, 7903] v4 = *a3;
[7931, 7917, 7926] v8 = __readfsqword(0x28u);
[7938, 7907, 7897, 7900, 7933] result = collect_arg_nonconst(a2, a3, &v6);
[7943, 7945, 7947, 7952, 7961] if ( (_BYTE)result )
{
[7984, 7992, 7989] open_stdout((long)v7);
[8008, 8002, 8005, 7997] result = insert_fprintf(v7, a1, v6);
[8013, 8015] if ( !(_BYTE)result )
[8017, 8020] *a3 = v4;
}
[7963] return result;
[7968, 7969, 7971, 7973, 7967] }
// 7548: using guessed type long insert_fprintf(_QWORD, _QWORD, _QWORD);
//----- (0000000000001F60) ----------------------------------------------------
long parse_print(long a1)
[8032] {
long inserted; // rax
[8032, 8036, 8040] inserted = insert_primary_noarg(a1);
[8045] *(_DWORD *)(inserted + 24) = 257;
[8056, 8052] open_stdout(inserted + 56);
[8066, 8061] return 1LL;
[8070] }
// 7410: using guessed type long insert_primary_noarg(_QWORD);
//----- (0000000000001F90) ----------------------------------------------------
long insert_fprint(long a1, char *a2)
[8080] {
long inserted; // rax
long v3; // rbx
long result; // rax
[8080, 8081, 8084, 8085, 8089] inserted = insert_primary(a1);
[8094] v3 = inserted;
[8097, 8100] if ( a2 )
[8106, 8109, 8102] open_output_file(a2, inserted + 56);
else
[8144, 8153, 8148] open_stdout(inserted + 56);
[8114] *(_DWORD *)(v3 + 24) = 257;
[8121] result = 1LL;
[8126] *(_DWORD *)(v3 + 36) = 1065353216;
[8133] return result;
[8137, 8138, 8139] }
//----- (0000000000001FE0) ----------------------------------------------------
long parse_print0(long a1)
[8160] {
[8160, 8164, 8166] return insert_fprint(a1, 0LL);
}
//----- (0000000000001FF0) ----------------------------------------------------
long parse_fprint0(long a1, long a2, int *a3)
[8176] {
long result; // rax
char *v5; // [rsp+0h] [rbp-28h]
[8194, 8198, 8207, 8176, 8180, 8181, 8212, 8214, 8184, 8217, 8187, 8188, 8191] result = collect_arg(a2, a3);
[8224, 8226, 8231, 8240, 8222] if ( (_BYTE)result )
{
[8256, 8260, 8263] result = insert_fprint(a1, v5);
[8268, 8270] if ( !(_BYTE)result )
[8272, 8275] --*a3;
}
[8242] return result;
[8248, 8246, 8247] }
// 2047: variable 'v5' is possibly undefined
//----- (0000000000002060) ----------------------------------------------------
long insert_fls(long a1, char *a2)
[8288] {
long inserted; // rax
long v3; // rbx
[8288, 8289, 8292, 8293, 8297] inserted = insert_primary_noarg(a1);
[8302] v3 = inserted;
[8305, 8308] if ( a2 )
[8314, 8317, 8310] open_output_file(a2, inserted + 56);
else
[8352, 8361, 8356] open_stdout(inserted + 56);
[8322, 8327] *(_DWORD *)(v3 + 36) = 1065353216;
[8334] *(_WORD *)(v3 + 24) = 257;
[8338, 8342] return 1LL;
[8347, 8348, 8349] }
// 7410: using guessed type long insert_primary_noarg(_QWORD);
//----- (00000000000020B0) ----------------------------------------------------
long parse_ls(long a1)
[8368] {
[8368, 8372, 8374] return insert_fls(a1, 0LL);
}
//----- (00000000000020C0) ----------------------------------------------------
long parse_fls(long a1, long a2, int *a3)
[8384] {
long result; // rax
char *v5; // [rsp+0h] [rbp-28h]
[8384, 8388, 8389, 8420, 8422, 8392, 8425, 8395, 8396, 8399, 8402, 8406, 8415] result = collect_arg(a2, a3);
[8448, 8430, 8432, 8434, 8439] if ( (_BYTE)result )
{
[8464, 8468, 8471] result = insert_fls(a1, v5);
[8476, 8478] if ( !(_BYTE)result )
[8480, 8483] --*a3;
}
[8450] return result;
[8456, 8454, 8455] }
// 2117: variable 'v5' is possibly undefined
//----- (0000000000002130) ----------------------------------------------------
long parse_fprintf(long a1, long a2, int *a3)
[8496] {
int v4; // r13d
long result; // rax
char *s1; // [rsp+0h] [rbp-68h]
long v7; // [rsp+8h] [rbp-60h] BYREF
char v8[40]; // [rsp+10h] [rbp-58h] BYREF
unsigned long v9; // [rsp+38h] [rbp-30h]
[8521, 8525, 8496, 8500, 8502, 8504, 8507, 8508, 8511] v4 = *a3;
[8528, 8537, 8544, 8542] v9 = __readfsqword(0x28u);
[8592, 8597, 8600, 8603, 8608, 8610, 8612, 8616, 8621, 8624, 8629, 8634, 8637, 8512, 8640, 8515, 8643, 8518, 8648, 8650, 8652, 8547, 8552, 8554] if ( !(unsigned char)collect_arg(a2, a3)
|| !(unsigned char)collect_arg_nonconst(a2, a3, &v7)
|| (open_output_file(s1, (long)v8), v4 = *a3, result = insert_fprintf(v8, a1, v7), !(_BYTE)result) )
{
[8556] *a3 = v4;
[8561, 8575, 8566, 8559] return 0LL;
}
[8577] return result;
[8581, 8582, 8583, 8585, 8587] }
// 21B0: variable 's1' is possibly undefined
// 7548: using guessed type long insert_fprintf(_QWORD, _QWORD, _QWORD);
//----- (00000000000021E0) ----------------------------------------------------
long parse_fprint(long a1, long a2, int *a3)
[8672] {
unsigned int v3; // r12d
long inserted; // rbp
char *s1; // [rsp+0h] [rbp-28h]
[8672, 8706, 8676, 8708, 8678, 8679, 8711, 8682, 8716, 8685, 8688, 8692, 8701] v3 = collect_arg(a2, a3);
[8737, 8719, 8721, 8723, 8728] if ( (_BYTE)v3 )
{
[8752, 8768, 8756, 8759] inserted = insert_primary(a1);
[8771, 8764, 8775] open_output_file(s1, inserted + 56);
[8780] *(_DWORD *)(inserted + 24) = 257;
[8794, 8787] *(_DWORD *)(inserted + 36) = 1065353216;
}
[8739, 8743] return v3;
[8746, 8747, 8749] }
// 2247: variable 's1' is possibly undefined
//----- (0000000000002270) ----------------------------------------------------
unsigned long parse_perm(long a1, long a2, int *a3)
[8816] {
unsigned int v3; // r12d
int v4; // r14d
void *v5; // rbp
unsigned int v6; // eax
long v7; // rbx
long v8; // r15
long v9; // rbx
long inserted; // rax
char *v12; // rax
long v13; // r12
char *v14; // rax
int v15; // [rsp+8h] [rbp-50h]
unsigned int v16; // [rsp+Ch] [rbp-4Ch]
_BYTE *v17; // [rsp+10h] [rbp-48h]
[8832, 8864, 8835, 8837, 8838, 8839, 8869, 8843, 8816, 8820, 8852, 8822, 8824, 8857, 8826, 8859, 8829] v3 = collect_arg(a2, a3);
[8872, 8874, 8880] if ( !(_BYTE)v3 )
[9122, 9109] return v3;
[8888, 8890, 8885] if ( *v17 == 45 )
{
[9160, 9172, 9168] v4 = 0;
[9181, 9175] v15 = LC22;
}
[8896, 8898, 8885] else if ( *v17 == 47 )
{
[9128, 9140, 9136] v4 = 1;
[9152, 9146] v15 = LC0;
}
else
{
[8904, 8912] v4 = 2;
[8918] v15 = LC1;
}
[8929, 8924, 8934] v5 = (void *)mode_compile();
[8960, 8937, 8940, 8946, 8949, 8951, 8955, 8958] if ( v5 && (*v17 != 43 || (unsigned char)(v17[1] - 48) > 7u) )
{
[8966, 8969, 8972, 8974, 8976, 8978] v6 = mode_adjust(0LL, 0LL, 0LL, v5, 0LL);
[8989, 8991] v7 = v6;
[9000, 8993, 8995] v16 = v6;
[8986, 9004, 9012, 8983] v8 = (unsigned int)mode_adjust(0LL, 1LL, 0LL, v5, 0LL);
[9018, 9022, 9015] v9 = (v8 << 32) | v7;
[9025, 9009] free(v5);
[9030, 9035, 9039, 9041, 9046, 9049] if ( *v17 == 47 && !((unsigned int)v8 | v16) )
{
[9204, 9206] v4 = 0;
[9192, 9209, 9197] v12 = dcgettext(
0LL,
"warning: you have specified a mode pattern %s (which is equivalent to /000). The meaning of -perm /000 has"
" now been changed to be consistent with -perm -000; that is, while it used to match no files, it now matches all files.",
5);
[9217, 9219, 9221, 9224, 9226, 9214] error(0, 0, v12);
[9250, 9239, 9244, 9231] v15 = LC88;
}
[9058, 9061, 9055] inserted = insert_primary(a1);
[9072, 9066] *(_DWORD *)(inserted + 56) = v4;
[9076] *(_QWORD *)(inserted + 60) = v9;
[9080, 9090, 9099, 9085] *(_DWORD *)(inserted + 36) = v15;
[9080, 9109] return v3;
}
[9266, 9260, 9268, 9287] v13 = quotearg_n_style(0LL, HIDWORD(options[13]));
[9273, 9290, 9285, 9278] v14 = dcgettext(0LL, "invalid mode %s", 5);
[9315, 9326, 9295, 9298, 9300, 9305, 9308, 9310] error(1, 0, v14, v13);
[9105, 9327] return check_path_safety(1LL);
[9120, 9112, 9113, 9114, 9116, 9118] }
// 22B5: variable 'v17' is possibly undefined
// 6200: using guessed type int LC0;
// 6204: using guessed type int LC1;
// 6218: using guessed type int LC22;
// 6244: using guessed type int LC88;
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 7550: using guessed type long mode_compile(void);
// 7558: using guessed type long mode_adjust(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002470) ----------------------------------------------------
unsigned long check_path_safety(long a1)
[9328] {
char *v1; // rax
char *v2; // rbx
char v3; // al
char *v4; // rax
char *v6; // rsi
long v7; // r12
char *v8; // rax
long v9; // [rsp+8h] [rbp-40h] BYREF
size_t n; // [rsp+10h] [rbp-38h] BYREF
unsigned long v11; // [rsp+18h] [rbp-30h]
[9344, 9345, 9346, 9350, 9359, 9328, 9330, 9364, 9342] v11 = __readfsqword(0x28u);
[9332, 9366, 9335] v1 = getenv("PATH");
[9371, 9374] if ( v1 )
{
[9393] v2 = v1;
[9380, 9414, 9385, 9421, 9390, 9426, 9396, 9399, 9402, 9407] splitstring(v1, ":", 1LL, &v9, &n);
[9473, 9468, 9471] while ( n )
{
[9481, 9478] v3 = v2[v9];
[9488, 9490, 9484, 9492] if ( n == 1 && v3 == 46 )
break;
[9432, 9434] if ( v3 != 47 )
{
[9570, 9565, 9478, 9463] v6 = strndup(&v2[v9], n);
[9576, 9573] if ( !v6 )
[9640, 9635, 9643] v6 = &v2[v9];
[9578, 9580, 9599] v7 = safely_quote_err_filename(0LL, v6);
[9585, 9602, 9597, 9590] v8 = dcgettext(
0LL,
"The relative path %s is included in the PATH environment variable, which is insecure in combination with "
"the %s action of find. Please remove that entry from $PATH",
5);
[9607, 9610, 9613, 9615, 9618, 9623, 9625, 9630] error(1, 0, v8, v7, a1);
}
[9440, 9442, 9445, 9448, 9451, 9454, 9461] if ( !(unsigned char)splitstring(v2, ":", 0LL, &v9, &n) )
[9459, 9541, 9461, 9550] return __readfsqword(0x28u) ^ v11;
}
[9506, 9499, 9508, 9494] v4 = dcgettext(
0LL,
"The current directory is included in the PATH environment variable, which is insecure in combination with the"
" %s action of find. Please remove the current directory from your $PATH (that is, remove \".\", doubled colo"
"ns, or leading or trailing colons)",
5);
[9536, 9513, 9516, 9518, 9523, 9526, 9528, 9533] error(1, 0, v4, a1);
}
[9552, 9541] return __readfsqword(0x28u) ^ v11;
[9556, 9557, 9558, 9560, 9562, 9564] }
// 7570: using guessed type long splitstring(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 7580: using guessed type long safely_quote_err_filename(_QWORD, _QWORD);
//----- (00000000000025B0) ----------------------------------------------------
long insert_exec_ok(long a1, long a2, long a3, int *a4)
[9648] {
long inserted; // rax
char *v5; // r13
long v6; // rbp
int v7; // esi
long v8; // rbx
const char *v9; // r12
char *v10; // r15
char *v11; // r14
char *v12; // r10
char i; // al
const char *v14; // r12
size_t v15; // rax
char *v16; // rax
char *v18; // rbp
char *v19; // r13
char *v20; // rcx
int v21; // r14d
bool v22; // zf
char *v23; // r12
char *v24; // r10
const char **v25; // r14
const char *v26; // r15
size_t v27; // rax
int v28; // esi
long v29; // rdx
unsigned long v30; // rcx
long v31; // rax
long v32; // rax
long v33; // rsi
char *v34; // r12
char **v35; // r15
int v36; // eax
char *v37; // rax
char *v38; // rax
char *v39; // rax
int *v40; // rdx
char *s; // [rsp+8h] [rbp-B0h]
char *sa; // [rsp+8h] [rbp-B0h]
char *v43; // [rsp+10h] [rbp-A8h]
char *ptr; // [rsp+20h] [rbp-98h]
int v46; // [rsp+2Ch] [rbp-8Ch]
void *v48; // [rsp+38h] [rbp-80h]
unsigned long v49; // [rsp+48h] [rbp-70h]
long v50; // [rsp+50h] [rbp-68h]
long v51; // [rsp+58h] [rbp-60h]
char v52[24]; // [rsp+60h] [rbp-58h] BYREF
unsigned long v53; // [rsp+78h] [rbp-40h]
[9665, 9670, 9675, 9648, 9650, 9652, 9684, 9654, 9656, 9657, 9658]
[9700, 9703, 9708, 9689, 9691, 9694] v53 = __readfsqword(0x28u);
[10503] if ( !a3 || !*(_QWORD *)(a3 + 8LL * *a4) )
[9714, 9734] return 0LL;
[9728, 9731, 9739, 9718, 9725] v48 = *(void **)(a2 + 24);
[9765] inserted = insert_primary_withpred(a2, v48);
[9776, 9770, 9773] ptr = (char *)inserted;
[9783] *(_DWORD *)(inserted + 24) = 257;
[9761, 9794, 9797, 9800, 9744, 9751, 9754] *(_QWORD *)(inserted + 248) = 0LL;
[9805] LOBYTE(v43) = v48 != &pred_okdir && v48 != &pred_ok;
if ( !(_BYTE)v43 )
[9819, 9814, 9807] {
[9826] LOBYTE(options[15]) = 1;
[9833, 9838, 9841, 9843, 9846] *(_BYTE *)(inserted + 244) = 1;
if ( v48 == &pred_execdir || v48 == &pred_okdir )
goto LABEL_6;
[9896, 9906, 9903] LABEL_8:
[11136, 11141, 11148, 11155, 11129] if ( !initial_wd )
[9912, 9917] _assert_fail("NULL != initial_wd", "parser.c", 0xB79u, "insert_exec_ok");
*(_QWORD *)(inserted + 248) = initial_wd;
goto LABEL_10;
[9872, 9879] }
[9891, 9894, 9886] *(_BYTE *)(inserted + 244) = 0;
if ( v48 != &pred_execdir )
goto LABEL_8;
[9848, 9851] LABEL_6:
[9848, 9858, 9863] BYTE6(options[1]) = 0;
check_path_safety(a1);
[9929, 9924] LABEL_10:
[9941, 9938, 9933] ptr[56] = 0;
[9945, 9941] v46 = *a4;
[9954, 9957, 9950] v51 = *a4;
[9962, 9970, 9957, 9967] v50 = 8 * v51;
[9973, 9957] v5 = *(char **)(8 * v51 + a3);
[9978, 9981] v49 = 8 * v51 + a3;
if ( !v5 )
[10826, 10830] {
LODWORD(v8) = *a4;
goto LABEL_44;
[9987, 9992, 9997, 10000, 10006, 10009] }
if ( v48 != &pred_execdir && v48 != &pred_okdir )
[10025, 10020, 10015] {
[10027] LODWORD(v6) = 0;
[10034, 10029] v7 = 0;
[10038] LODWORD(v8) = *a4;
[10047] s = 0LL;
[10059, 10062] v9 = "{}";
[10065, 10054] v10 = (char *)(v50 + a3);
[10068] v11 = (char *)(a3 + v50 + 8);
goto LABEL_19;
[11170, 11165, 11175] }
[11177] LODWORD(v6) = 0;
[11186] s = 0LL;
[11198, 11191] v34 = (char *)(v50 + a3);
[11203] v35 = (char **)(a3 + v50 + 8);
[11207] LODWORD(v8) = *a4;
v36 = 0;
[11209, 11214] LABEL_57:
[11209, 11220, 11217] v12 = v34;
if ( *v5 != 59 )
[11232, 11364, 11209, 11369, 11375, 11377, 11222, 11383, 11225, 11227] {
if ( *v5 == 43 && (_BYTE)v43 && !v5[1] && v36 )
goto LABEL_32;
goto LABEL_60;
[11304, 11297, 11302] }
while ( v5[1] )
{
[11238, 11241, 11244, 11249, 11252] LABEL_60:
if ( !mbsstr(v5, "{}") )
[11360, 11362] {
v36 = 0;
[11322] LABEL_66:
[11325] v5 = *v35;
[11328] LODWORD(v8) = v8 + 1;
[11332] ++v35;
[11336, 11345, 11339] v34 += 8;
if ( !v5 )
goto LABEL_44;
goto LABEL_57;
[11254] }
[11257, 11259] LODWORD(v6) = v6 + 1;
if ( (_DWORD)v8 )
[11312] {
[11317] s = v5;
v36 = 1;
goto LABEL_66;
[11273, 11266, 11275, 11261] }
v37 = dcgettext(
0LL,
"You may not use {} within the utility name for -execdir and -okdir, because this is a potential security problem.",
[11280, 11282, 11287, 11290, 11292] 5);
error(1, 0, v37);
}
[10168, 10457, 10452] LABEL_21:
for ( i = 0; ; i = 1 )
[10184, 10170, 10180, 10174] {
if ( v46 == (_DWORD)v8 || !*(_QWORD *)v12 )
[10192, 10190] goto LABEL_44;
if ( !i )
[10203, 10198] goto LABEL_34;
[10222] v14 = "dir";
[10210, 10222, 10215] if ( v48 != &pred_execdir )
[10226, 10229] v14 = (const char *)&LC67;
if ( (int)v6 > 1 )
[11400, 11393, 11402, 11388] {
[11407, 11410, 11412, 11417, 11420, 11422] v38 = dcgettext(0LL, "Only one instance of {} is supported with -exec%s ... +", 5);
error(1, 0, v38, v14);
goto LABEL_73;
[10235] }
[10240] v10 = s;
[10248, 10245] v43 = v12;
[10253] v15 = strlen(s);
[10258, 10262] v12 = v43;
if ( v15 == 2 )
{
[10512, 10522, 10517] LABEL_34:
[10527] sa = v12;
[10531] v18 = ptr + 64;
[10535, 10538, 10543, 10548, 10551, 10554] v19 = ptr + 56;
if ( (unsigned int)bc_init_controlinfo(ptr + 64, 2048LL) - 1 > 1 )
[10560, 10568, 10563, 10571] {
[10576] bc_use_sensible_arg_max(v18);
[10593, 10586, 10581, 10598] v20 = ptr;
[10601] v21 = v8 - v46;
[10605] v22 = ptr[56] == 0;
[10612] v23 = ptr + 152;
[10619] *((_QWORD *)ptr + 16) = &launch;
if ( v22 )
[10863] {
[10873, 10877, 10870] *((_DWORD *)ptr + 60) = v21;
[10856, 10882, 10894] *((_QWORD *)ptr + 14) = "{}";
[10902] *((_QWORD *)v20 + 13) = strlen("{}");
[10887, 10891, 10924, 10898, 10910] *(_OWORD *)(ptr + 136) = 0LL;
[10921, 10915, 10931, 10918] *((_QWORD *)ptr + 29) = xmalloc(8LL * v21);
[10936] bc_init_state(v18, v23, v19);
[10943] v28 = *((_DWORD *)ptr + 60);
[10948, 10950] v24 = sa;
if ( v28 > 0 )
[10961, 10956, 10966] {
[10969] v29 = (unsigned int)(v28 - 1);
[10976, 11008, 11011, 10981, 10986, 10989, 10993, 10997, 11000, 11003, 11006] v30 = *((_QWORD *)ptr + 29);
if ( (v49 >= v30 + 16 || v30 >= a3 + v50 + 16) && (unsigned int)v29 > 3 )
[11013, 11015] {
v31 = 0LL;
do
[11032, 11037] {
[11041] *(__m128i *)(v30 + v31) = _mm_loadu_si128((const __m128i *)(v49 + v31));
v31 += 16LL;
[11045, 11048, 11017, 11020, 11022, 11026] }
[11064, 11058, 11068, 11055] while ( v31 != 16LL * ((unsigned int)v28 >> 1) );
[11073, 11075, 11077, 11081, 11050, 11052, 11085] if ( (v28 & 1) != 0 )
*(_QWORD *)(v30 + 8LL * (v28 & 0xFFFFFFFE)) = *(_QWORD *)(a3 + 8LL * (int)((v28 & 0xFFFFFFFE) + v46));
}
else
[11097, 11090, 11095] {
v32 = 0LL;
do
[11104, 11108] {
[11112] *(_QWORD *)(v30 + 8 * v32) = *(_QWORD *)(v49 + 8 * v32);
v33 = v32++;
[11122, 11115, 11124, 11119] }
while ( v33 != v29 );
}
}
}
else
[10641, 10639] {
[10625, 10652] *((_QWORD *)ptr + 14) = 0LL;
[10656] *((_QWORD *)ptr + 15) = v21 - 1;
[10667] *((_QWORD *)ptr + 29) = 0LL;
[10675] *((_QWORD *)ptr + 13) = 0LL;
[10629, 10633, 10636, 10649, 10682] *(_OWORD *)(ptr + 136) = 0LL;
[10690] bc_init_state(v18, v23, v19);
[10698, 10695, 10687] v24 = sa;
if ( v46 < (int)v8 - 1 )
[10716] {
v25 = (const char **)(v50 + a3);
do
[10736] {
[10746, 10739, 10743] v26 = *v25++;
[10755, 10758, 10761, 10763, 10767, 10770, 10773, 10776, 10781, 10782, 10751] v27 = strlen(v26);
bc_push_arg(v18, v23, v26, v27 + 1, 0LL, 0LL, 1LL);
[10721, 10786, 10724, 10729, 10700, 10734, 10705, 10707, 10712, 10783] }
[10793, 10788] while ( v25 != (const char **)(a3 + 8 * (v51 + (unsigned int)(v8 - v46 - 2)) + 8) );
v24 = sa;
}
[10800, 10804] }
[10806] if ( *(_QWORD *)v24 )
[10809, 10814] LODWORD(v8) = v8 + 1;
[10816, 10821] *a4 = v8;
return 1LL;
}
[11432, 11441, 11427, 11439] LABEL_73:
[11456, 11458, 11463, 11446, 11448, 11453] v39 = dcgettext(0LL, "The environment is too large for exec().", 5);
[11464] error(1, 0, v39);
return parse_okdir(1LL, 0LL, v40);
[10268] }
[10273, 10276, 10281, 10283, 10290, 10295, 10300, 10303] v11 = v52;
[10308, 10345, 10314, 10317, 10322] _snprintf_chk(v52, 19LL, 1LL, 19LL, "-exec%s ... {} +", v14);
[10338, 10348, 10327, 10364, 10333] v6 = quotearg_n_style(2LL, HIDWORD(options[13]));
[10353, 10386, 10359, 10362, 10367] v8 = quotearg_n_style(1LL, HIDWORD(options[13]));
[10384, 10377, 10372, 10389] v9 = (const char *)quotearg_n_style(0LL, HIDWORD(options[13]));
[10408, 10413, 10406] v16 = dcgettext(0LL, "In %s the %s must appear by itself, but you specified %s", 5);
[10400, 10403, 10415, 10420, 10394, 10397] v7 = 0;
error(1, 0, v16, v9, v8, v6);
[10424, 10437, 10435, 10429] LABEL_30:
if ( v5[1] || !v7 )
break;
[10448, 10443] LABEL_32:
ptr[56] = 1;
[10106, 10108, 10111] }
while ( 1 )
[10106] {
[10098, 10101, 10095] v7 = 0;
if ( mbsstr(v5, v9) )
[10113] {
[10118] s = v5;
[10121] LODWORD(v6) = v6 + 1;
v7 = 1;
[10126] }
[10129] v5 = *(char **)v11;
[10132] LODWORD(v8) = v8 + 1;
[10136] v10 += 8;
[10140, 10143] v11 += 8;
if ( !v5 )
break;
[10154, 10149] LABEL_19:
[10159, 10149, 10157] v12 = v10;
if ( *v5 == 59 )
[10161, 10166] {
if ( !v5[1] )
goto LABEL_21;
[10080, 10082, 10084, 10149, 10089] }
else if ( *v5 == 43 && (_BYTE)v43 )
{
goto LABEL_30;
}
}
[10832, 10842] LABEL_44:
[10849, 10851, 10844, 10837] *a4 = v8;
[10486] free(ptr);
[10497, 10499, 10501, 10493, 10494, 10495] return 0LL;
}
// 27C4: variable 'v12' is possibly undefined
// 2CC8: variable 'v40' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 7428: using guessed type long insert_primary_withpred(_QWORD, _QWORD);
// 74F8: using guessed type long xmalloc(_QWORD);
// 75A8: using guessed type long mbsstr(_QWORD, _QWORD);
// 75B0: using guessed type long _snprintf_chk(_QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 75B8: using guessed type long bc_init_controlinfo(_QWORD, _QWORD);
// 75C0: using guessed type long bc_use_sensible_arg_max(_QWORD);
// 75D0: using guessed type long bc_init_state(_QWORD, _QWORD, _QWORD);
// 75D8: using guessed type long bc_push_arg(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002CD0) ----------------------------------------------------
long parse_okdir(long a1, long a2, int *a3)
[11472] {
[11492, 11472, 11476, 11479, 11482, 11485] return insert_exec_ok((long)"-okdir", a1, a2, a3);
}
//----- (0000000000002CF0) ----------------------------------------------------
long parse_ok(long a1, long a2, int *a3)
[11504] {
[11524, 11504, 11508, 11511, 11514, 11517] return insert_exec_ok((long)"-ok", a1, a2, a3);
}
//----- (0000000000002D10) ----------------------------------------------------
long parse_execdir(long a1, long a2, int *a3)
[11536] {
[11556, 11536, 11540, 11543, 11546, 11549] return insert_exec_ok((long)"-execdir", a1, a2, a3);
}
//----- (0000000000002D30) ----------------------------------------------------
long parse_exec(long a1, long a2, int *a3)
[11568] {
[11588, 11568, 11572, 11575, 11578, 11581] return insert_exec_ok((long)"-exec", a1, a2, a3);
}
//----- (0000000000002D50) ----------------------------------------------------
long parse_or()
[11600] {
long new_pred_noarg; // rax
[11600, 11608, 11604] new_pred_noarg = get_new_pred_noarg();
[11620, 11613, 11630] *(_QWORD *)(new_pred_noarg + 16) = 0x200000003LL;
[11634] *(_QWORD *)new_pred_noarg = &pred_or;
[11637, 11639] *(_WORD *)(new_pred_noarg + 26) = 0;
[11648, 11643] return 1LL;
[11652] }
// 2D50: using guessed type long parse_or();
// 75E0: using guessed type long get_new_pred_noarg(void);
//----- (0000000000002D90) ----------------------------------------------------
long parse_and()
[11664] {
long new_pred_noarg; // rax
[11664, 11668, 11672] new_pred_noarg = get_new_pred_noarg();
[11684, 11677, 11694] *(_QWORD *)(new_pred_noarg + 16) = 0x300000003LL;
[11698] *(_QWORD *)new_pred_noarg = &pred_and;
[11701, 11703] *(_WORD *)(new_pred_noarg + 26) = 0;
[11712, 11707] return 1LL;
[11716] }
// 2D90: using guessed type long parse_and();
// 75E0: using guessed type long get_new_pred_noarg(void);
//----- (0000000000002DD0) ----------------------------------------------------
long parse_comma()
[11728] {
long new_pred_noarg; // rax
[11728, 11732, 11736] new_pred_noarg = get_new_pred_noarg();
[11748, 11741, 11758] *(_QWORD *)(new_pred_noarg + 16) = 0x100000003LL;
[11762] *(_QWORD *)new_pred_noarg = &pred_comma;
[11765, 11767] *(_WORD *)(new_pred_noarg + 26) = 0;
[11771] *(_DWORD *)(new_pred_noarg + 36) = 1065353216;
[11778, 11783] return 1LL;
[11787] }
// 2DD0: using guessed type long parse_comma();
// 75E0: using guessed type long get_new_pred_noarg(void);
//----- (0000000000002E10) ----------------------------------------------------
long parse_closeparen()
[11792] {
long new_pred_noarg; // rax
[11792, 11800, 11796] new_pred_noarg = get_new_pred_noarg();
[11812, 11805] *(_QWORD *)(new_pred_noarg + 16) = 5LL;
[11820] *(_QWORD *)new_pred_noarg = &pred_closeparen;
[11825, 11823] *(_WORD *)(new_pred_noarg + 26) = 0;
[11834, 11829] return 1LL;
[11838] }
// 2E10: using guessed type long parse_closeparen();
// 75E0: using guessed type long get_new_pred_noarg(void);
//----- (0000000000002E40) ----------------------------------------------------
long check_name_arg(long a1, long a2)
[11840] {
const char *v2; // rdx
long v3; // rbx
long v4; // rbp
long v5; // r12
char *v6; // rax
[11840, 11872, 11842, 11843, 11844, 11875, 11849, 11851, 11853, 11856, 11859, 11862, 11867] if ( (unsigned char)should_issue_warnings() && strchr(v2, 47) )
{
[11880, 11885, 11877, 11902] v3 = safely_quote_err_filename(2LL, a2);
[11897, 11890, 11915, 11905] v4 = safely_quote_err_filename(1LL, "/");
[11937, 11913, 11918, 11910] v5 = safely_quote_err_filename(0LL, a1);
[11928, 11923, 11940, 11935] v6 = dcgettext(
0LL,
"warning: %s matches against basenames only, but the given pattern contains a directory separator (%s), thus t"
"he expression will evaluate to false all the time. Did you mean %s?",
5);
[11945, 11948, 11951, 11954, 11957, 11959, 11961, 11963] error(0, 0, v6, v5, v4, v3);
}
[11968, 11969] return 1LL;
[11977, 11974, 11975] }
// 2E5B: variable 'v2' is possibly undefined
// 7580: using guessed type long safely_quote_err_filename(_QWORD, _QWORD);
//----- (0000000000002ED0) ----------------------------------------------------
long parse_name(long a1, long a2, int *a3)
[11984] {
int v4; // r13d
unsigned int v5; // r12d
long inserted; // rbx
char *s; // [rsp+0h] [rbp-38h]
[12000, 12006, 12010, 12013, 11984, 11988, 11990, 12022, 11992, 12027, 12029, 11999] v4 = *a3;
[12032, 12003, 12037, 11993, 11996] v5 = collect_arg(a2, a3);
[12040, 12042, 12044, 12049, 12058] if ( (_BYTE)v5 )
{
[12080] fnmatch_sanitycheck();
[12096, 12103, 12108, 12085, 12089] v5 = check_name_arg((long)"-name", (long)"-wholename");
[12113, 12111] if ( (_BYTE)v5 )
{
[12128, 12146, 12132, 12135] inserted = insert_primary(a1);
[12149, 12151] *(_WORD *)(inserted + 26) = 0;
[12155] *(_QWORD *)(inserted + 56) = s;
[12164, 12169, 12140, 12144, 12159] *(float *)(inserted + 36) = estimate_pattern_match_rate(s, 0);
}
else
{
[12115, 12118] *a3 = v4;
}
}
[12064, 12060] return v5;
[12067, 12068, 12069, 12071, 12073] }
// 2F7B: variable 's' is possibly undefined
//----- (0000000000002F90) ----------------------------------------------------
long parse_iname(long a1, long a2, int *a3)
[12176] {
unsigned int v4; // r12d
long inserted; // rbp
char *s; // [rsp+0h] [rbp-28h]
[12194, 12198, 12207, 12176, 12180, 12212, 12182, 12214, 12185, 12187, 12190, 12191] fnmatch_sanitycheck();
[12225, 12290, 12228, 12283, 12295, 12233, 12298, 12235, 12300, 12276, 12219, 12222] if ( (unsigned char)collect_arg(a2, a3)
&& (v4 = check_name_arg((long)"-iname", (long)"-iwholename"), (_BYTE)v4) )
{
[12320, 12306, 12309, 12302] inserted = insert_primary(a1);
[12323, 12325] *(_WORD *)(inserted + 26) = 0;
[12329] *(_QWORD *)(inserted + 56) = s;
[12333, 12338, 12343, 12314, 12318] *(float *)(inserted + 36) = estimate_pattern_match_rate(s, 0);
}
else
{
[12240, 12245, 12237, 12254] return 0;
}
[12256, 12260] return v4;
[12264, 12266, 12268, 12263] }
// 3029: variable 's' is possibly undefined
//----- (0000000000003040) ----------------------------------------------------
unsigned long parse_group(long a1, long a2, int *a3)
[12352] {
unsigned int v3; // r12d
struct group *v5; // rbx
int gr_gid; // ebx
long inserted; // rax
int v8; // xmm0_4
bool v9; // cc
int v10; // eax
long v11; // r12
char *v12; // rax
char *v13; // rax
long v14; // rbx
long v15; // r12
char *v16; // rax
char *name; // [rsp+0h] [rbp-38h]
[12352, 12384, 12356, 12389, 12358, 12391, 12360, 12361, 12394, 12364, 12367, 12399, 12370, 12371, 12375] v3 = collect_arg(a2, a3);
[12420, 12402, 12404, 12406, 12411] if ( !(_BYTE)v3 )
[12430, 12439] return v3;
[12448, 12457, 12452] v5 = getgrnam(name);
[12460] endgrent();
[12465, 12468] if ( v5 )
{
[12470] gr_gid = v5->gr_gid;
LABEL_5:
[12480, 12473, 12477] inserted = insert_primary(a1);
[12485] v8 = LC52;
[12493] v9 = *(_QWORD *)(inserted + 64) <= 0x63uLL;
[12498] *(_DWORD *)(inserted + 56) = gr_gid;
[12501] if ( !v9 )
[12503] v8 = LC22;
[12511] *(_DWORD *)(inserted + 36) = v8;
[12516, 12430] return v3;
}
[12528, 12539, 12532, 12542] v10 = strspn(name, "0123456789");
[12547, 12549] if ( !v10 )
{
[12592, 12597] if ( *name )
{
[12608, 12610, 12629, 12599, 12605] v11 = quotearg_n_style(0LL, HIDWORD(options[13]));
[12632, 12627, 12620, 12615] v12 = dcgettext(0LL, "%s is not the name of an existing group", 5);
[12640, 12642, 12647, 12650, 12652, 12657, 12637] error(1, 0, v12, v11);
}
[12664, 12676, 12669, 12678] v13 = dcgettext(0LL, "argument to -group is empty, but should be a group name", 5);
[12683, 12685, 12690, 12693, 12695, 12700] error(1, 0, v13);
}
[12562, 12559, 12565, 12551] if ( !name[v10] )
{
[12579, 12571, 12574] gr_gid = safe_atoi(name);
[12581] goto LABEL_5;
}
[12553, 12730, 12713] v14 = quotearg_n_style(1LL, HIDWORD(options[13]));
[12718, 12752, 12722, 12728, 12733] v15 = quotearg_n_style(0LL, HIDWORD(options[13]));
[12738, 12755, 12750, 12743] v16 = dcgettext(
0LL,
"%s is not the name of an existing group and it does not look like a numeric group ID because it has the unexpected suffix %s",
5);
[12768, 12778, 12760, 12763, 12766] error(1, 0, v16, v15, v14);
[12776, 12426, 12771, 12783] return estimate_fstype_success_rate((_BYTE *)get_noop + 1);
[12433, 12434, 12435, 12437] }
// 30A4: variable 'name' is possibly undefined
// 6218: using guessed type int LC22;
// 6240: using guessed type int LC52;
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (00000000000031F0) ----------------------------------------------------
unsigned long estimate_fstype_success_rate(char *s1)
[12784] {
const char *v2; // rax
struct stat v3; // [rsp+0h] [rbp-B8h] BYREF
unsigned long v4; // [rsp+98h] [rbp-20h]
[12804, 12813, 12784, 12786, 12821, 12823, 12797] v4 = __readfsqword(0x28u);
[12826, 12787, 12829, 12790] if ( !stat("/", &v3) )
{
[12834, 12842, 12844, 12880, 12887, 12890] v2 = (const char *)filesystem_type(&v3, "/", 1.0);
[12898, 12901, 12906, 12914, 12916, 12918, 12926, 12895] strcmp(s1, v2);
}
[12854, 12865, 12846, 12863] return __readfsqword(0x28u) ^ v4;
[12872, 12873, 12875] }
// 6200: using guessed type int LC0;
// 7628: using guessed type long filesystem_type(_QWORD, _QWORD, float);
//----- (0000000000003290) ----------------------------------------------------
long parse_daystart()
[12944] {
long result; // rax
struct tm *v1; // rax
long v2; // rcx
long v3; // rdx
[12944, 12955, 12948] if ( LOBYTE(options[7]) )
[12957] return 1LL;
[12979] options[5] = (unsigned int ( *)(long, long))((char *)options[5] + 86400);
[12990] options[6] = 0LL;
[12968, 13001, 12972] v1 = localtime((const time_t *)&options[5]);
[13006] v2 = (long)options[5];
[13016, 13013] if ( v1 )
[13024, 13031, 13033, 13018, 13022] v3 = 3600 * v1->tm_hour + v1->tm_sec + 60 * v1->tm_min;
else
[13088, 13091, 13095, 13099, 13102, 13072, 13105, 13112, 13082, 13115, 13085, 13118] v3 = v2 % 86400;
[13039] LOBYTE(options[7]) = 1;
[13046] result = 1LL;
[13058, 13051, 13036] options[5] = (unsigned int ( *)(long, long))(v2 - v3);
[12962] return result;
[13062] }
// 3290: using guessed type long parse_daystart();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003340) ----------------------------------------------------
long parse_time(long a1, long a2, int *a3)
[13120] {
unsigned int relative_timestamp; // r12d
char *v6; // r14
long v7; // r9
long inserted; // rax
long v9; // rdi
long v10; // rbx
const char *v11; // r8
const char *v12; // rcx
char *v13; // rax
char *v14; // rax
int v15; // [rsp+Ch] [rbp-7Ch]
int v16; // [rsp+1Ch] [rbp-6Ch] BYREF
char *v17; // [rsp+20h] [rbp-68h] BYREF
time_t timer; // [rsp+28h] [rbp-60h] BYREF
__m128i v19; // [rsp+30h] [rbp-58h] BYREF
long v20; // [rsp+40h] [rbp-48h]
unsigned long v21; // [rsp+48h] [rbp-40h]
[13120, 13152, 13124, 13157, 13126, 13128, 13161, 13130, 13133, 13135, 13170, 13175, 13177, 13147, 13148, 13149] v21 = __readfsqword(0x28u);
[13137, 13140, 13182] dcgettext(0LL, "arithmetic overflow while converting %s days to a number of seconds", 5);
[13201, 13196, 13199] v15 = *a3;
[13187, 13190, 13193, 13205, 13210] relative_timestamp = collect_arg(a2, a3);
[13217, 13222, 13231, 13213, 13215] if ( (_BYTE)relative_timestamp )
{
[13272, 13284, 13277] v6 = v17;
[13291, 13264, 13296, 13298, 13300, 13269, 13305] if ( (unsigned char)get_comp_type(&v17, &v16) && v16 == 1 )
[13696, 13703] v7 += 86399LL;
[13333] v17 = v6;
[13316, 13319, 13322, 13325, 13338, 13343, 13311] relative_timestamp = get_relative_timestamp(v6, (long)&v19, v7, 86400.0);
[13346, 13348] if ( (_BYTE)relative_timestamp )
{
[13368, 13371, 13374] inserted = insert_primary(a1);
[13385] v9 = v19.m128i_i64[1];
[13390] v10 = inserted;
[13393, 13379] *(__m128i *)(inserted + 56) = _mm_load_si128(&v19);
[13402, 13397] *(_QWORD *)(inserted + 72) = v20;
[13411, 13406] *(float *)(inserted + 36) = estimate_timestamp_success_rate(v9);
[13416, 13423] if ( ((long)options[8] & 1) != 0 )
{
[13440, 13447, 13449, 13454, 13429, 13433] _fprintf_chk(stderr, 1LL, "inserting %s\n", *(const char **)(v10 + 8));
[13459, 13463] v11 = " >";
[13470] v12 = "gt";
[13477, 13479] if ( v19.m128i_i32[1] )
{
[13481] v11 = " <";
[13488] v12 = "lt";
[13498, 13495] if ( v19.m128i_i32[1] != 1 )
{
[13500, 13503] v11 = " ?";
[13517, 13510] v12 = "?";
[13531] if ( v19.m128i_i32[1] == 2 )
{
[13531, 13524] v11 = ">=";
[13535] v12 = "eq";
}
}
}
[13539, 13546, 13553, 13558, 13560, 13565] _fprintf_chk(stderr, 1LL, " type: %s %s ", v12, v11);
[13577, 13570] timer = *(_QWORD *)(v10 + 64);
[13574, 13582] v13 = ctime(&timer);
[13603, 13606, 13613, 13615, 13587, 13591, 13596] _fprintf_chk(stderr, 1LL, "%lu %s", *(_QWORD *)(v10 + 64), v13);
[13625, 13620] if ( v19.m128i_i32[1] == 2 )
{
[13644, 13631] timer = *(_QWORD *)(v10 + 64) + 86400LL;
[13649, 13635, 13638] v14 = ctime(&timer);
[13664, 13671, 13674, 13681, 13683, 13654, 13688, 13659] _fprintf_chk(stderr, 1LL, " < %lu %s", timer, v14);
}
}
}
else
{
[13354, 13356, 13350] *a3 = v15;
}
}
[13241, 13237] return relative_timestamp;
[13248, 13250, 13252, 13254, 13244, 13245, 13246] }
// 3580: variable 'v7' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 73C8: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
//----- (00000000000035A0) ----------------------------------------------------
long parse_negate(long a1)
[13728] {
long new_pred_chk_op; // rax
[13728, 13738, 13732, 13736] new_pred_chk_op = get_new_pred_chk_op(a1, 0LL);
[13760, 13750, 13743] *(_QWORD *)(new_pred_chk_op + 16) = 0x400000002LL;
[13764] *(_QWORD *)new_pred_chk_op = &pred_negate;
[13769, 13767] *(_WORD *)(new_pred_chk_op + 26) = 0;
[13778, 13773] return 1LL;
[13782] }
// 7640: using guessed type long get_new_pred_chk_op(_QWORD, _QWORD);
//----- (00000000000035E0) ----------------------------------------------------
long parse_openparen(long a1)
[13792] {
long new_pred_chk_op; // rax
[13792, 13802, 13796, 13800] new_pred_chk_op = get_new_pred_chk_op(a1, 0LL);
[13814, 13807] *(_QWORD *)(new_pred_chk_op + 16) = 4LL;
[13822] *(_QWORD *)new_pred_chk_op = &pred_openparen;
[13825, 13827] *(_WORD *)(new_pred_chk_op + 26) = 0;
[13836, 13831] return 1LL;
[13840] }
// 7640: using guessed type long get_new_pred_chk_op(_QWORD, _QWORD);
//----- (0000000000003620) ----------------------------------------------------
long get_stat_mtime_isra_0(long a1)
{
return a1;
}
//----- (0000000000003630) ----------------------------------------------------
long parse_newer(long a1, long a2, int *a3)
[13872] {
unsigned int v4; // r12d
long stat_mtime_isra_0; // rax
long v7; // rdi
_QWORD *v8; // r8
long v9; // rdx
float v10; // xmm0_4
long v11; // r8
long v12; // [rsp+8h] [rbp-D0h] BYREF
char v13[88]; // [rsp+10h] [rbp-C8h] BYREF
long v14; // [rsp+68h] [rbp-70h]
unsigned long v15; // [rsp+A8h] [rbp-30h]
[13888, 13889, 13892, 13899, 13872, 13876, 13908, 13878, 13880, 13883, 13885] v15 = __readfsqword(0x28u);
[13926, 13923, 13916, 13918] set_stat_placeholders(v13);
[13931, 13934, 13939, 13942, 13945, 13950] v4 = collect_arg_stat_info(a2, a3, (long)v13, &v12);
[13953, 13955, 13957, 13965, 13974] if ( (_BYTE)v4 )
{
[14000, 14005, 14008] insert_primary(a1);
[14026, 14018, 14013, 14023] stat_mtime_isra_0 = get_stat_mtime_isra_0(v14);
[14031] v7 = v14;
[14036] v8[8] = stat_mtime_isra_0;
[14040] v8[9] = v9;
[14044] v8[7] = 3LL;
[14052] v10 = estimate_timestamp_success_rate(v7);
[14057, 14063] *(float *)(v11 + 36) = v10;
}
[13976, 13983] return v4;
[13986, 13987, 13989, 13991, 13993] }
// 36D4: variable 'v8' is possibly undefined
// 36D8: variable 'v9' is possibly undefined
// 36E9: variable 'v11' is possibly undefined
// 74D0: using guessed type long set_stat_placeholders(_QWORD);
//----- (0000000000003700) ----------------------------------------------------
long parse_cnewer(long a1, long a2, int *a3)
[14080] {
unsigned int v4; // r12d
long stat_mtime_isra_0; // rax
long v7; // rdi
_QWORD *v8; // r8
long v9; // rdx
float v10; // xmm0_4
long v11; // r8
long v12; // [rsp+8h] [rbp-D0h] BYREF
char v13[88]; // [rsp+10h] [rbp-C8h] BYREF
long v14; // [rsp+68h] [rbp-70h]
unsigned long v15; // [rsp+A8h] [rbp-30h]
[14080, 14084, 14116, 14086, 14088, 14091, 14093, 14096, 14097, 14100, 14107] v15 = __readfsqword(0x28u);
[14134, 14131, 14124, 14126] set_stat_placeholders(v13);
[14147, 14150, 14153, 14158, 14139, 14142] v4 = collect_arg_stat_info(a2, a3, (long)v13, &v12);
[14182, 14161, 14163, 14165, 14173] if ( (_BYTE)v4 )
{
[14208, 14213, 14216] insert_primary(a1);
[14234, 14226, 14221, 14231] stat_mtime_isra_0 = get_stat_mtime_isra_0(v14);
[14239] v7 = v14;
[14244] v8[8] = stat_mtime_isra_0;
[14248] v8[9] = v9;
[14252] v8[7] = 2LL;
[14260] v10 = estimate_timestamp_success_rate(v7);
[14265, 14271] *(float *)(v11 + 36) = v10;
}
[14184, 14191] return v4;
[14194, 14195, 14197, 14199, 14201] }
// 37A4: variable 'v8' is possibly undefined
// 37A8: variable 'v9' is possibly undefined
// 37B9: variable 'v11' is possibly undefined
// 74D0: using guessed type long set_stat_placeholders(_QWORD);
//----- (00000000000037D0) ----------------------------------------------------
long parse_anewer(long a1, long a2, int *a3)
[14288] {
unsigned int v4; // r12d
long stat_mtime_isra_0; // rax
long v7; // rdi
_QWORD *v8; // r8
long v9; // rdx
float v10; // xmm0_4
long v11; // r8
long v12; // [rsp+8h] [rbp-D0h] BYREF
char v13[88]; // [rsp+10h] [rbp-C8h] BYREF
long v14; // [rsp+68h] [rbp-70h]
unsigned long v15; // [rsp+A8h] [rbp-30h]
[14304, 14305, 14308, 14315, 14288, 14292, 14324, 14294, 14296, 14299, 14301] v15 = __readfsqword(0x28u);
[14339, 14332, 14334, 14342] set_stat_placeholders(v13);
[14347, 14350, 14355, 14358, 14361, 14366] v4 = collect_arg_stat_info(a2, a3, (long)v13, &v12);
[14369, 14371, 14373, 14381, 14390] if ( (_BYTE)v4 )
{
[14416, 14424, 14421] insert_primary(a1);
[14434, 14429, 14442, 14439] stat_mtime_isra_0 = get_stat_mtime_isra_0(v14);
[14447] v7 = v14;
[14452] v8[8] = stat_mtime_isra_0;
[14456] v8[9] = v9;
[14460] v8[7] = 0LL;
[14468] v10 = estimate_timestamp_success_rate(v7);
[14473, 14479] *(float *)(v11 + 36) = v10;
}
[14392, 14399] return v4;
[14402, 14403, 14405, 14407, 14409] }
// 3874: variable 'v8' is possibly undefined
// 3878: variable 'v9' is possibly undefined
// 3889: variable 'v11' is possibly undefined
// 74D0: using guessed type long set_stat_placeholders(_QWORD);
//----- (00000000000038A0) ----------------------------------------------------
long get_stat_birthtime_isra_0()
{
return -1LL;
}
//----- (00000000000038B0) ----------------------------------------------------
_BOOL8 get_stat_Ytime(long *a1, long a2, long a3)
[14512] {
long v3; // rax
long *v4; // rcx
_BOOL8 result; // rax
long v6; // rdx
long v7; // rax
long *v8; // rcx
long v9; // rdx
long stat_mtime_isra_0; // rax
long *v11; // rcx
long v12; // rdx
long stat_birthtime_isra_0; // rax
long *v14; // rcx
long v15; // rdx
[14512, 14523, 14519] if ( (_BYTE)a2 == 99 )
{
[14624, 14632, 14635, 14628] stat_mtime_isra_0 = get_stat_mtime_isra_0(a1[13]);
[14640] *v11 = stat_mtime_isra_0;
[14643] result = 1LL;
[14648] v11[1] = v12;
}
[14525] else if ( (char)a2 > 99 )
{
[14584, 14588] if ( (_BYTE)a2 != 109 )
goto LABEL_10;
[14601, 14594, 14590, 14598] v7 = get_stat_mtime_isra_0(a1[11]);
[14606] *v8 = v7;
[14609] result = 1LL;
[14614] v8[1] = v9;
}
else
{
[14531, 14527] if ( (_BYTE)a2 != 66 )
{
[14537, 14541] if ( (_BYTE)a2 == 97 )
{
[14547, 14558, 14555, 14551] v3 = get_stat_mtime_isra_0(a1[9]);
[14563] *v4 = v3;
[14566] result = 1LL;
[14571] v4[1] = v6;
[14579] return result;
}
LABEL_10:
[14692, 14699, 14704, 14711, 14718] _assert_fail("0", "parser.c", 0x1F2u, "get_stat_Ytime");
}
[14664, 14516] stat_birthtime_isra_0 = get_stat_birthtime_isra_0();
[14669] *v14 = stat_birthtime_isra_0;
[14672] v14[1] = v15;
[14676, 14687, 14684] return v14[1] >= 0;
}
[14575] return result;
[14656, 14691, 14680, 14618, 14652, 14622] }
// 38E3: variable 'v4' is possibly undefined
// 38EB: variable 'v6' is possibly undefined
// 390E: variable 'v8' is possibly undefined
// 3916: variable 'v9' is possibly undefined
// 3930: variable 'v11' is possibly undefined
// 3938: variable 'v12' is possibly undefined
// 394D: variable 'v14' is possibly undefined
// 3950: variable 'v15' is possibly undefined
//----- (0000000000003990) ----------------------------------------------------
long parse_newerXY(long a1, long a2, int *a3)
[14736] {
long v3; // rax
long v5; // r14
int v6; // r13d
unsigned int v7; // r9d
char v8; // r15
char *v9; // rax
char *v10; // rax
int v11; // r13d
long inserted; // rax
long v13; // r12
char *v15; // rax
float v16; // xmm0_4
void *v17; // rax
char *v18; // rax
long v19; // r12
char *v20; // rax
long v21; // r12
char *v22; // rax
int *v23; // rax
long v24; // [rsp+0h] [rbp-F8h]
char v25; // [rsp+Eh] [rbp-EAh]
long v26[18]; // [rsp+20h] [rbp-D8h] BYREF
char s[6]; // [rsp+B2h] [rbp-46h] BYREF
unsigned long v28; // [rsp+B8h] [rbp-40h]
[14757, 14766, 14736, 14740, 14742, 14744, 14746, 14748, 14749, 14750] v28 = __readfsqword(0x28u);
[14816, 14785, 14788, 14822, 14791, 14825, 14794, 14828, 14798, 14833, 14837, 14774, 14806, 14776, 14809, 14779, 14813] if ( a2 && (v3 = *a3, v5 = *(_QWORD *)(a2 + 8 * v3), v6 = *a3, v24 = 8 * v3, v5) && strlen((const char *)v5) == 8 )
{
[14856] strcpy(s, "aBcmt");
[14848, 14882, 14853, 14887, 14889, 14867, 14874, 14843] if ( strncmp("-newer", (const char *)v5, 6uLL) )
goto LABEL_32;
[14895] v8 = *(_BYTE *)(v5 + 6);
[14905, 14900, 14909] v25 = *(_BYTE *)(v5 + 7);
[14913, 14922, 14917, 14919] LOBYTE(v7) = v25 == 66 || v8 == 66;
[14925] if ( (_BYTE)v7 )
{
[15200, 15212, 15205, 15214] v15 = dcgettext(0LL, "This system does not provide a way to find the birth time of a file.", 5);
[15219, 15221, 15223, 15226, 15228] error(0, 0, v15);
[15233, 15236] return 0;
}
[14931, 14935] else if ( v8 != 116 )
{
[14949, 14953, 14958, 14970, 14941] v9 = strchr(s, v8);
[14975] v7 = 0;
[14984, 14981] if ( v9 )
{
[14995, 14990, 15006] v10 = strchr(s, v25);
[15011] v7 = 0;
[15017, 15020] if ( v10 )
{
[15026, 15030] v11 = v6 + 1;
[15042, 15034, 15039] if ( *(_QWORD *)(a2 + v24 + 8) )
{
[15048] *a3 = v11;
[15052, 15055] inserted = insert_primary(a1);
[15060] v13 = inserted;
[15067, 15063] switch ( v8 )
{
case 'c':
goto LABEL_29;
case 'm':
[15280] *(_DWORD *)(inserted + 56) = 3;
break;
case 'a':
[15584, 15591] *(_DWORD *)(inserted + 56) = 0;
break;
default:
[15073, 15077, 15083, 15087, 14961, 14965, 15093, 15097, 15102] if ( strchr(s, v8) )
[15107, 15142, 15114, 15117, 15123, 15128, 15135] _assert_fail("0", "parser.c", 0x64Cu, "parse_newerXY");
[15267, 15107, 15248, 15253, 15260] _assert_fail("strchr (validchars, x)", "parser.c", 0x64Bu, "parse_newerXY");
}
[15292, 15287] while ( v25 == 116 )
{
[15488, 15492, 15497, 15499, 15472, 15476, 15481] if ( (unsigned char)parse_datetime(v13 + 64, *(_QWORD *)(a2 + 8LL * *a3), &options[3]) )
goto LABEL_23;
[15521, 15505, 15540, 15509, 15515, 15517] v13 = quotearg_n_style(0LL, HIDWORD(options[13]));
[15538, 15531, 15526, 15543] v18 = dcgettext(0LL, "I cannot figure out how to interpret %s as a date or time", 5);
[15553, 15558, 15561, 15563, 15548, 15551] error(1, 0, v18, v13);
LABEL_29:
[15568, 15575] *(_DWORD *)(inserted + 56) = 2;
}
[15306, 15298, 15303] set_stat_placeholders(v26);
[15328, 15330, 15336, 15311, 15315, 15318, 15322] if ( !options[10](*(_QWORD *)(a2 + 8LL * *a3), (long)v26) )
{
[15340, 15345, 15348, 15000, 15353, 15002, 15355] if ( get_stat_Ytime(v26, (unsigned int)v25, v13 + 64) )
{
LABEL_23:
[15361] *(_DWORD *)(v13 + 60) = 0;
[15370, 15375] v16 = estimate_timestamp_success_rate(*(_QWORD *)(v13 + 64));
[15380] v17 = *(void **)v13;
[15384] *(float *)(v13 + 36) = v16;
[15391] ++*a3;
[15395, 15398] if ( !v17 )
[15747, 15721, 15728, 15733, 15740] _assert_fail("our_pred->pred_func != NULL", "parser.c", 0x66Fu, "parse_newerXY");
[15411, 15404] if ( v17 != &pred_newerXY )
[15716, 15690, 15697, 15702, 15709] _assert_fail("our_pred->pred_func == pred_newerXY", "parser.c", 0x670u, "parse_newerXY");
[15417] v7 = *(unsigned char *)(v13 + 26);
[15426, 15423] if ( !(_BYTE)v7 )
[15458, 15432, 15439, 15444, 15451] _assert_fail("our_pred->need_stat", "parser.c", 0x671u, "parse_newerXY");
[15185, 15426] return v7;
}
[15781, 15752, 15756, 15758, 15762] v21 = safely_quote_err_filename(0LL, *(_QWORD *)(a2 + 8LL * *a3));
[15784, 15779, 15772, 15767] v22 = dcgettext(0LL, "Cannot obtain birth time of file %s", 5);
[15789, 15792, 15794, 15799, 15802, 15804] error(1, 0, v22, v21);
}
[15809] v23 = _errno_location();
[15814, 15818, 15820, 15824, 15829] fatal_target_file_error((unsigned int)*v23);
[15830] return parse_noop_isra_0();
}
[15631, 15601, 15607, 15610, 15612] v19 = quotearg_n_style(0LL, HIDWORD(options[13]));
[15617, 15634, 15629, 15622] v20 = dcgettext(0LL, "The %s test needs an argument", 5);
[15649, 15652, 15654, 15639, 15642, 15644] error(1, 0, v20, v19);
LABEL_32:
[15685, 15659, 15666, 15671, 15678] _assert_fail("0 == strncmp (\"-newer\", argv[*arg_ptr], 6)", "parser.c", 0x613u, "parse_newerXY");
}
}
}
}
else
{
[15152, 15163, 15155, 15172] return 0;
}
[15185, 15178] return v7;
[15188, 15189, 15190, 15192, 15194, 15196, 15198] }
// 3B51: variable 'v7' is possibly undefined
// 3CD0: variable 'inserted' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 74D0: using guessed type long set_stat_placeholders(_QWORD);
// 7580: using guessed type long safely_quote_err_filename(_QWORD, _QWORD);
// 7668: using guessed type long parse_datetime(_QWORD, _QWORD, _QWORD);
// 3990: using guessed type long var_D8[18];
//----- (0000000000003DE0) ----------------------------------------------------
long parse_noop_isra_0()
{
char *noop; // rax
noop = get_noop();
return parse_true((long)noop);
}
//----- (0000000000003E00) ----------------------------------------------------
long parse_warn()
[15872] {
[15872, 15882, 15876, 15879] LOBYTE(options[2]) = 1;
[15889] return parse_noop_isra_0();
}
// 3E00: using guessed type long parse_warn();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003E20) ----------------------------------------------------
long parse_nowarn()
[15904] {
[15904, 15914, 15908, 15911] LOBYTE(options[2]) = 0;
[15921] return parse_noop_isra_0();
}
// 3E20: using guessed type long parse_nowarn();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003E40) ----------------------------------------------------
long parse_noignore_race()
[15936] {
[15936, 15946, 15940, 15943] BYTE6(options[1]) = 0;
[15953] return parse_noop_isra_0();
}
// 3E40: using guessed type long parse_noignore_race();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003E60) ----------------------------------------------------
long parse_noleaf()
[15968] {
[15968, 15978, 15972, 15975] BYTE4(options[1]) = 1;
[15985] return parse_noop_isra_0();
}
// 3E60: using guessed type long parse_noleaf();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003E80) ----------------------------------------------------
long parse_xdev()
[16000] {
[16000, 16010, 16004, 16007] BYTE5(options[1]) = 1;
[16017] return parse_noop_isra_0();
}
// 3E80: using guessed type long parse_xdev();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003EA0) ----------------------------------------------------
long parse_ignore_race()
[16032] {
[16032, 16042, 16036, 16039] BYTE6(options[1]) = 1;
[16049] return parse_noop_isra_0();
}
// 3EA0: using guessed type long parse_ignore_race();
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003EC0) ----------------------------------------------------
long parse_depth()
[16064] {
[16064, 16068, 16071, 16076, 16079] LOWORD(options[0]) = 256;
[16086] return parse_noop_isra_0();
}
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003EE0) ----------------------------------------------------
long parse_d(long a1, long a2, long a3)
[16096] {
char *v4; // rax
[16096, 16100, 16102, 16105, 16107, 16110, 16111, 16114, 16119, 16121] if ( (unsigned char)should_issue_warnings() )
{
[16144, 16146, 16158, 16151] v4 = dcgettext(
0LL,
"warning: the -d option is deprecated; please use -depth instead, because the latter is a POSIX-compliant feature.",
5);
[16163, 16165, 16167, 16170, 16172, 16177] error(0, 0, v4);
}
[16129, 16132, 16137, 16123, 16126] return parse_depth();
[16133, 16135] }
//----- (0000000000003F40) ----------------------------------------------------
long parse_regextype(long a1, long a2, int *a3)
[16192] {
long result; // rax
[16192, 16224, 16196, 16229, 16198, 16231, 16201, 16202, 16234, 16205, 16208, 16211, 16215] result = collect_arg(a2, a3);
[16257, 16239, 16241, 16243, 16248] if ( (_BYTE)result )
{
[16272, 16276, 16281, 16284, 16287] HIDWORD(options[11]) = get_regex_type();
[16298, 16293] return parse_noop_isra_0();
}
[16259] return result;
[16264, 16266, 16263] }
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000003FC0) ----------------------------------------------------
long insert_depthspec_isra_0(long a1, int *a2, int *a3)
{
long v4; // r13
long result; // rax
int v6; // eax
long v7; // rsi
int v8; // eax
long v9; // rbx
char *v10; // rax
char *s; // [rsp+0h] [rbp-38h]
v4 = *(_QWORD *)(a1 + 8LL * *a2 - 8);
result = collect_arg(a1, a2);
if ( (_BYTE)result )
{
v6 = strspn(s, "0123456789");
v7 = HIDWORD(options[13]);
if ( v6 > 0 && !s[v6] )
{
v8 = safe_atoi(s);
*a3 = v8;
if ( v8 >= 0 )
return parse_noop_isra_0();
v7 = HIDWORD(options[13]);
}
v9 = quotearg_n_style(0LL, v7);
v10 = dcgettext(0LL, "Expected a positive decimal integer argument to %s, but got %s", 5);
error(1, 0, v10, v4, v9);
}
return result;
}
// 4007: variable 's' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (00000000000040A0) ----------------------------------------------------
long parse_mindepth(long a1, long a2, int *a3)
[16544] {
[16544, 16548, 16551, 16554, 16561] return insert_depthspec_isra_0(a2, a3, (int *)&options[1]);
}
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (00000000000040C0) ----------------------------------------------------
long parse_maxdepth(long a1, long a2, int *a3)
[16576] {
[16576, 16580, 16583, 16586, 16593] return insert_depthspec_isra_0(a2, a3, (int *)options + 1);
}
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (00000000000040E0) ----------------------------------------------------
void check_option_combinations(long a1)
[16608] {
int v1; // eax
void *v2; // rdx
char *v3; // rax
[16608, 16612, 16615] if ( a1 )
{
[16624, 16617, 16626] v1 = 0;
do
{
[16659] while ( 1 )
{
[16659] v2 = *(void **)a1;
[16665, 16659, 16662] if ( *(_UNKNOWN **)a1 != &pred_delete )
break;
[16667] a1 = *(_QWORD *)(a1 + 264);
[16674] v1 |= 1u;
[16680, 16677] if ( !a1 )
goto LABEL_8;
}
[16632, 16634] a1 = *(_QWORD *)(a1 + 264);
[16651] if ( v2 == &pred_prune )
[16641, 16651, 16644] v1 |= 2u;
}
[16657, 16654] while ( a1 );
LABEL_8:
[16688, 16682, 16685, 16695] if ( v1 == 3 && !BYTE1(options[0]) )
{
[16697, 16698, 16710, 16703] v3 = dcgettext(
(const char *)a1,
"The -delete action automatically turns on -depth, but -prune does nothing when -depth is in effect. If you"
" want to carry on anyway, just explicitly use the -depth option.",
5);
[16715, 16717, 16722, 16725, 16727, 16732] error(1, 0, v3);
[16733] set_follow_state(1);
}
}
[16687] }
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000004160) ----------------------------------------------------
long ( * set_follow_state(int a1))()
{
long ( *result)(); // rax
switch ( a1 )
{
case 1:
BYTE4(options[1]) = 1;
options[10] = (unsigned int ( *)(long, long))&optionl_stat;
result = (long ( *)())optionl_getfilecon;
options[12] = (unsigned int ( *)(long, long))optionl_getfilecon;
break;
case 2:
BYTE4(options[1]) = 1;
options[10] = (unsigned int ( *)(long, long))&optionh_stat;
result = (long ( *)())optionh_getfilecon;
options[12] = (unsigned int ( *)(long, long))optionh_getfilecon;
break;
case 0:
options[10] = (unsigned int ( *)(long, long))&optionp_stat;
result = (long ( *)())optionp_getfilecon;
options[12] = (unsigned int ( *)(long, long))optionp_getfilecon;
break;
}
LODWORD(options[9]) = a1;
if ( ((long)options[8] & 2) != 0 )
{
result = (long ( *)())&debug_stat;
options[10] = (unsigned int ( *)(long, long))&debug_stat;
}
return result;
}
// 7390: using guessed type unsigned int ( *options[15])(long, long);
//----- (0000000000004210) ----------------------------------------------------
long parse_follow()
[16912] {
[16928, 16931, 16912, 16916, 16920, 16925] set_follow_state(1);
[16936, 16940, 16943] return parse_noop_isra_0();
}
// 4210: using guessed type long parse_follow();
//----- (0000000000004240) ----------------------------------------------------
void parse_begin_user_args()
[16960] {
[16960, 16964] first_nonoption_arg = 0LL;
[16975] }
// 4440: using guessed type long first_nonoption_arg;
//----- (0000000000004250) ----------------------------------------------------
void parse_end_user_args()
[16976] {
[16976] ;
[16980] }
//----- (0000000000004260) ----------------------------------------------------
_DWORD * find_parser(char *s2)
[16992] {
_DWORD *v2; // rsi
const char **v3; // rbx
const char *v4; // rdi
int v5; // ebp
const char *v6; // r13
[16992, 17024, 16996, 17029, 16998, 17031, 17001, 17006, 17008, 17011, 17018, 17019, 17020] if ( !strncmp("-newer", s2, 6uLL) )
{
[17041] v2 = &parse_entry_newerXY;
[17048, 17033, 17036, 17052] if ( strlen(s2) == 8 )
[17139, 17148, 17135] return found_parser((long)s2, v2);
}
[17062] v3 = (const char **)&off_5728;
[17073, 17069] v4 = "!";
[17080] v5 = 0;
[17057, 17082, 17085, 17054] v6 = &s2[*s2 == 45];
do
{
[17113, 17106, 17111, 17103] if ( !strcmp(v4, v6) )
{
[17122, 17115, 17132, 17118] v2 = (_DWORD *)((char *)&parse_table + 32 * v5);
[17148, 17139, 17132, 17125] return found_parser((long)s2, v2);
}
[17088] v4 = *v3;
[17091] v3 += 4;
[17095] ++v5;
}
[17098, 17101] while ( v4 );
[17135] return 0LL;
[17160, 17164, 17166, 17167, 17168, 17170, 17172, 17142, 17143, 17144, 17146] }
// 5728: using guessed type char *off_5728;
//----- (0000000000004320) ----------------------------------------------------
long insert_false()
[17184] {
_DWORD *parser; // rax
long inserted; // rax
[17184, 17195, 17188] parser = find_parser("false");
[17200, 17203] inserted = insert_primary_noarg(parser);
[17208] *(_DWORD *)(inserted + 24) = 0;
[17215] *(_DWORD *)(inserted + 36) = 0;
[17227, 17222] return 1LL;
[17231] }
// 7410: using guessed type long insert_primary_noarg(_QWORD);
//----- (0000000000004350) ----------------------------------------------------
long parse_false()
[17232] {
[17232, 17236] return insert_false();
}
// 4350: using guessed type long parse_false();
//----- (0000000000004360) ----------------------------------------------------
long parse_fstype(long a1, long a2, int *a3, float a4)
[17248] {
unsigned int v4; // r12d
long inserted; // rbp
char *s1; // [rsp+0h] [rbp-28h]
[17248, 17282, 17252, 17284, 17254, 17255, 17287, 17258, 17292, 17261, 17264, 17268, 17277] v4 = collect_arg(a2, a3);
[17297, 17295] if ( (_BYTE)v4 )
{
[17313, 17318, 17320, 17322, 17299, 17307, 17311] if ( LOWORD(options[13]) <= 1u || (unsigned char)is_used_fs_type() )
{
[17329, 17332, 17341, 17326] inserted = insert_primary(a1);
[17344] *(_QWORD *)(inserted + 56) = s1;
[17337, 17348] estimate_fstype_success_rate(s1);
[17353, 17363, 17372, 17358] *(float *)(inserted + 36) = a4;
}
else
{
[17392, 17399] if ( ((long)options[8] & 8) != 0 )
[17441, 17446, 17416, 17420, 17427, 17434, 17436] _fprintf_chk(stderr, 1LL, "-fstype %s can never succeed, substituting -false\n", s1);
[17409, 17401, 17406] return (unsigned int)insert_false();
}
}
[17378, 17374] return v4;
[17384, 17381, 17382] }
// 43C0: variable 's1' is possibly undefined
// 7390: using guessed type unsigned int ( *options[15])(long, long);
// 73C8: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// nfuncs=189 queued=118 decompiled=118 lumina nreq=0 worse=0 better=0
// ALL OK, 118 function(s) have been successfully decompiled
|
long insert_type(long a1, int *a2, long a3, void *a4)
[17553] {
const char *v4; // rax
char *v6; // rax
unsigned int v7; // ebx
char *v8; // rax
unsigned int v9; // ebx
char *v10; // rax
unsigned int v11; // ebx
char *v12; // rax
char *v13; // rax
char *v14; // rax
unsigned int v17; // [rsp+28h] [rbp-38h]
float v18; // [rsp+2Ch] [rbp-34h]
_BYTE *v19; // [rsp+30h] [rbp-30h] BYREF
const char *v20; // [rsp+38h] [rbp-28h]
long inserted; // [rsp+40h] [rbp-20h]
unsigned long v22; // [rsp+48h] [rbp-18h]
[17570, 17574, 17578, 17582, 17553, 17557, 17558, 17591, 17561, 17562, 17566] v22 = __readfsqword(0x28u);
[17608, 17595, 17604, 17597] if ( a4 == &pred_xtype )
[17617, 17610] v4 = "-xtype";
else
[17619] v4 = "-type";
[17626] v20 = v4;
[17634, 17638, 17642, 17645, 17648, 17653, 17656, 17658, 17630] if ( (unsigned char)collect_arg(a1, a2, &v19) != 1 )
[17665, 17660] return 0LL;
[17674, 17677, 17670, 17679] if ( !*v19 )
{
[17688, 17681] v6 = gettext("Arguments to %s should contain at least one letter");
[17696, 17700, 17703, 17708, 17713, 17718, 17693] error(1, 0, v6, v20);
}
[17731, 17735, 17738, 17741, 17746, 17723, 17727] inserted = insert_primary_withpred(a3, a4, v19);
[17758, 17754, 17750] *(_DWORD *)(inserted + 36) = 0;
[17770, 17763, 17774] if ( a4 == &pred_xtype )
{
[17776, 17780] *(_BYTE *)(inserted + 26) = 1;
[17784, 17788, 17792] *(_BYTE *)(inserted + 27) = 0;
}
else
{
[17801, 17797] *(_BYTE *)(inserted + 26) = 0;
[17809, 17805, 17813] *(_BYTE *)(inserted + 27) = 1;
}
[18465, 18434, 18437, 18439, 18445, 18450, 18454, 18430, 18463] while ( *v19 )
{
[17826, 17831, 17835, 17838, 17841, 17818] v18 = 0.0099999998;
[17885, 17863, 17870, 17873, 17875, 17844, 17847, 17882, 17853, 17855] switch ( *v19 )
{
case 'D':
[18074, 18067, 18060, 18071] v7 = (char)*v19;
[18084, 18077] v8 = gettext("%s %c is not supported because Solaris doors are not supported on the platform find was compiled on.");
[18112, 18117, 18089, 18092, 18096, 18099, 18102, 18107] error(1, 0, v8, v20, v7);
goto LABEL_20;
case 'b':
[17888] v17 = 0;
[17903, 17895] v18 = 0.00088800001;
[17908] break;
case 'c':
[17913] v17 = 1;
[17920, 17928] v18 = 0.000443;
[17933] break;
case 'd':
[17938] v17 = 2;
[17945, 17953] v18 = 0.092200004;
[17958] break;
case 'f':
[17963] v17 = 3;
[17970, 17978] v18 = 0.875;
[17983] break;
case 'l':
[17988] v17 = 4;
[18003, 17995] v18 = 0.031099999;
[18008] break;
case 'p':
[18013] v17 = 5;
[18028, 18020] v18 = 0.0000075540001;
[18033] break;
case 's':
[18038] v17 = 6;
[18045, 18053] v18 = 0.000015899999;
[18058] break;
default:
LABEL_20:
[18122] v17 = 0;
[18136, 18129, 18133] v9 = (char)*v19;
[18146, 18139] v10 = gettext("Unknown argument to %s: %c");
[18179, 18151, 18154, 18158, 18161, 18164, 18169, 18174] error(1, 0, v10, v20, v9);
break;
}
[18184, 18188, 18191, 18196, 18198] if ( *(_BYTE *)(inserted + v17 + 56) )
{
[18200, 18204, 18207] v11 = (char)*v19;
[18217, 18210] v12 = gettext("Duplicate file type '%c' in the argument list to %s.");
[18244, 18249, 18222, 18226, 18229, 18231, 18234, 18239] error(1, 0, v12, v11, v20);
}
[18272, 18254, 18258, 18263, 18268] *(float *)(inserted + 36) = *(float *)(inserted + 36) + v18;
[18281, 18284, 18277] *(_BYTE *)(inserted + v17 + 56) = 1;
[18305, 18308, 18310, 18289, 18293, 18297, 18301] if ( *++v19 )
{
[18312, 18321, 18316, 18319] if ( *v19 != 44 )
{
[18330, 18323] v13 = gettext("Must separate multiple arguments to %s using: ','");
[18338, 18342, 18345, 18350, 18355, 18360, 18335] error(1, 0, v13, v20);
}
[18369, 18373, 18377, 18381, 18384, 18386, 18365] if ( !*++v19 )
{
[18395, 18388] v14 = gettext("Last file type in list argument to %s is missing, i.e., list is ending on: ','");
[18400, 18403, 18407, 18410, 18415, 18420, 18425] error(1, 0, v14, v20);
}
}
}
[18470] return 1LL;
[18474, 18475, 18476] }
// 8BE8: using guessed type long insert_primary_withpred(_QWORD, _QWORD, _QWORD);
//----- (000000000000482D) ----------------------------------------------------
bool stream_is_tty(FILE *a1)
[18477] {
int fd; // [rsp+1Ch] [rbp-4h]
[18497, 18500, 18505, 18477, 18481, 18482, 18485, 18489, 18493] fd = fileno(a1);
[18531, 18533, 18536, 18508, 18512, 18514, 18519, 18524, 18526] return fd != -1 && isatty(fd) != 0;
[18537] }
//----- (000000000000486A) ----------------------------------------------------
unsigned long check_path_safety(long a1)
[18538] {
char *v1; // rax
char *v2; // rax
long v3; // rbx
char *v4; // rax
long v6; // [rsp+10h] [rbp-40h] BYREF
size_t n; // [rsp+18h] [rbp-38h] BYREF
char *v8; // [rsp+20h] [rbp-30h]
const char *v9; // [rsp+28h] [rbp-28h]
char *v10; // [rsp+30h] [rbp-20h]
unsigned long v11; // [rsp+38h] [rbp-18h]
[18564, 18538, 18542, 18543, 18546, 18547, 18551, 18555] v11 = __readfsqword(0x28u);
[18568, 18577, 18570, 18582] v8 = getenv("PATH");
[18593, 18586] v9 = ":";
[18602, 18597] if ( v8 )
{
[18624, 18627, 18630, 18635, 18638, 18608, 18612, 18616, 18620] splitstring(v8, v9, 1LL, &v6, &n);
do
{
[18656, 18660, 18662, 18666, 18670, 18673, 18643, 18676, 18678, 18647, 18650, 18652] if ( !n || n == 1 && v8[v6] == 46 )
{
[18680, 18687] v1 = gettext(
"The current directory is included in the PATH environment variable, which is insecure in combination with"
" the %s action of find. Please remove the current directory from your $PATH (that is, remove \".\", doub"
"led colons, or leading or trailing colons)");
[18692, 18695, 18699, 18702, 18707, 18712, 18717] error(1, 0, v1, a1);
}
[18722, 18726, 18730, 18733, 18736, 18738] if ( v8[v6] != 47 )
{
[18752, 18755, 18758, 18761, 18766, 18740, 18744, 18748] v10 = strndup(&v8[v6], n);
[18770, 18775] if ( v10 )
[18790] v2 = v10;
else
[18785, 18777, 18788, 18781] v2 = &v8[v6];
[18794, 18797, 18802, 18807] v3 = safely_quote_err_filename(0LL, v2);
[18817, 18810] v4 = gettext(
"The relative path %s is included in the PATH environment variable, which is insecure in combination with "
"the %s action of find. Please remove that entry from $PATH");
[18850, 18822, 18826, 18829, 18832, 18835, 18840, 18845] error(1, 0, v4, v3, a1);
}
}
[18882, 18885, 18855, 18890, 18859, 18892, 18863, 18898, 18867, 18871, 18874, 18877] while ( (unsigned char)splitstring(v8, v9, 0LL, &v6, &n) );
}
[18914, 18916, 18921, 18901, 18905] return __readfsqword(0x28u) ^ v11;
[18925, 18926, 18927] }
// 8BC0: using guessed type long safely_quote_err_filename(_QWORD, _QWORD);
// 8CA0: using guessed type long splitstring(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000049F0) ----------------------------------------------------
long insert_exec_ok(long a1, long a2, long a3, int *a4)
[18928] {
char *v5; // rax
char *v6; // rax
long v7; // r13
long v8; // r12
long v9; // rbx
char *v10; // rax
char *v11; // rax
size_t v12; // rax
char v15; // [rsp+27h] [rbp-89h]
int v16; // [rsp+28h] [rbp-88h]
int i; // [rsp+2Ch] [rbp-84h]
int j; // [rsp+2Ch] [rbp-84h]
int v19; // [rsp+30h] [rbp-80h]
int v20; // [rsp+34h] [rbp-7Ch]
int v21; // [rsp+38h] [rbp-78h]
int inited; // [rsp+3Ch] [rbp-74h]
char *s; // [rsp+40h] [rbp-70h]
const char *v24; // [rsp+48h] [rbp-68h]
void *v25; // [rsp+50h] [rbp-60h]
char *ptr; // [rsp+58h] [rbp-58h]
char v27[24]; // [rsp+70h] [rbp-40h] BYREF
unsigned long v28; // [rsp+88h] [rbp-28h]
[18976, 18948, 18985, 18955, 18928, 18962, 18932, 18933, 18936, 18969, 18938, 18940, 18941] v28 = __readfsqword(0x28u);
[19002, 18989, 18998, 18991] v25 = *(void **)(a2 + 24);
[19042, 19045, 19014, 19016, 19048, 19051, 19023, 19025, 19027, 19035, 19006] if ( !a3 || !*(_QWORD *)(8LL * *a4 + a3) )
[19058, 19053] return 0LL;
[19074, 19081, 19084, 19087, 19092, 19063, 19067] ptr = (char *)insert_primary_withpred(a2, v25, "(some -exec* arguments)");
[19096, 19100] ptr[25] = 1;
[19104, 19116, 19108, 19112] ptr[24] = ptr[25];
[19123, 19119] ptr[26] = 0;
[19139, 19142, 19146, 19127, 19131, 19135] ptr[27] = ptr[26];
[19154, 19158] *((_QWORD *)ptr + 31) = 0LL;
[19169, 19176, 19180, 19182, 19189, 19193] if ( v25 == &pred_okdir || v25 == &pred_ok )
{
[19215] v15 = 0;
[19222] LOBYTE(options[15]) = 1;
[19233, 19229] ptr[244] = 1;
}
else
{
[19195] v15 = 1;
[19202, 19213, 19206] ptr[244] = 0;
}
[19264, 19240, 19247, 19251, 19253, 19260] if ( v25 == &pred_execdir || v25 == &pred_okdir )
{
[19266, 19270] *((_QWORD *)ptr + 31) = 0LL;
[19281] BYTE6(options[1]) = 0;
[19288, 19298, 19303, 19295] check_path_safety(a1);
}
else
{
[19312, 19305, 19315] if ( !initial_wd )
[19329, 19336, 19343, 19317, 19324] _assert_fail("NULL != initial_wd", "parser.c", 0xB79u, "insert_exec_ok");
[19355, 19348, 19359] *((_QWORD *)ptr + 31) = initial_wd;
}
[19370, 19366] ptr[56] = 0;
[19381, 19374, 19383] v21 = *a4;
[19386, 19389] v16 = *a4;
[19395] v19 = 0;
[19402] v20 = 0;
[19409, 19417] s = 0LL;
[19719, 19726, 19729, 19732, 19735, 19737, 19743, 19745, 19753, 19760, 19763, 19766, 19769, 19771, 19777, 19783, 19785, 19793, 19800, 19803, 19806, 19810, 19813, 19815, 19703, 19709, 19711] while ( *(_QWORD *)(8LL * v16 + a3)
&& (**(_BYTE **)(8LL * v16 + a3) != 59 || *(_BYTE *)(*(_QWORD *)(8LL * v16 + a3) + 1LL)) )
{
[19457, 19460, 19463, 19465, 19467, 19473, 19475, 19483, 19490, 19493, 19496, 19500, 19503, 19505, 19507, 19511, 19422, 19429, 19431, 19437, 19439, 19447, 19454] if ( v15 && **(_BYTE **)(8LL * v16 + a3) == 43 && !*(_BYTE *)(*(_QWORD *)(8LL * v16 + a3) + 1LL) && v19 )
{
[19513, 19517] ptr[56] = 1;
[19521] break;
}
[19526] v19 = 0;
[19556, 19559, 19562, 19533, 19569, 19539, 19572, 19541, 19577, 19580, 19549] if ( mbsstr(*(_QWORD *)(8LL * v16 + a3), &off_6B88) )
{
[19582] v19 = 1;
[19618, 19589, 19595, 19597, 19605, 19612, 19615] s = *(char **)(8LL * v16 + a3);
[19622] ++v20;
[19648, 19655, 19626, 19659, 19633, 19635, 19642, 19646] if ( !v16 && (v25 == &pred_execdir || v25 == &pred_okdir) )
{
[19668, 19661] v5 = gettext(
"You may not use {} within the utility name for -execdir and -okdir, because this is a potential security problem.");
[19681, 19686, 19691, 19673, 19676] error(1, 0, v5);
}
}
[19696] ++v16;
}
[19840, 19864, 19848, 19821, 19855, 19858, 19827, 19861, 19830, 19832, 19838] if ( v16 != v21 && *(_QWORD *)(8LL * v16 + a3) )
{
[19913, 19911, 19907, 19903] if ( ptr[56] )
{
[19930, 19926, 19919] if ( v25 == &pred_execdir )
[19939, 19932, 19943] v24 = "dir";
else
[19952, 19945] v24 = (const char *)&unk_6C06;
[19960, 19956] if ( v20 > 1 )
{
[19969, 19962] v6 = gettext("Only one instance of {} is supported with -exec%s ... +");
[19974, 19977, 19981, 19984, 19989, 19994, 19999] error(1, 0, v6, v24);
}
[20004, 20008, 20011, 20016, 20020] if ( strlen(s) != 2 )
{
[20064, 20034, 20068, 20037, 20062, 20073, 20044, 20049, 20052, 20057, 20026, 20030] if ( (unsigned long)snprintf(v27, 0x13uLL, "-exec%s ... {} +", v24) > 0x13 )
[20101, 20075, 20082, 20087, 20094] _assert_fail("needed <= MsgBufSize", "parser.c", 0xBC6u, "insert_exec_ok");
[20128, 20106, 20112, 20116, 20118, 20123] v7 = quotearg_n_style(2LL, HIDWORD(options[13]), s);
[20131, 20137, 20144, 20146, 20151, 20156] v8 = quotearg_n_style(1LL, HIDWORD(options[13]), &off_6B88);
[20165, 20169, 20171, 20176, 20181, 20159] v9 = quotearg_n_style(0LL, HIDWORD(options[13]), v27);
[20184, 20191] v10 = gettext("In %s the %s must appear by itself, but you specified %s");
[20196, 20199, 20202, 20205, 20208, 20213, 20218, 20223] error(1, 0, v10, v9, v8, v7);
}
}
[20228, 20232, 20236, 20241, 20244, 20249] inited = bc_init_controlinfo(ptr + 64, 2048LL);
[20256, 20258, 20261, 20264, 20267, 20252] if ( inited && (unsigned int)(inited - 1) <= 1 )
{
[20276, 20269] v11 = gettext("The environment is too large for exec().");
[20289, 20294, 20299, 20304, 20281, 20284] error(1, 0, v11);
}
[20313, 20305, 20316, 20309] bc_use_sensible_arg_max(ptr + 64);
[20321, 20332, 20325] *((_QWORD *)ptr + 16) = &launch;
[20336, 20344, 20346, 20340] if ( ptr[56] )
{
[20352, 20356] *((_QWORD *)ptr + 29) = 0LL;
[20371, 20367] *((_QWORD *)ptr + 14) = 0LL;
[20379, 20383] *((_QWORD *)ptr + 13) = 0LL;
[20395, 20391] *((_QWORD *)ptr + 17) = 0LL;
[20403, 20407] *((_QWORD *)ptr + 18) = 0LL;
[20421, 20424, 20427, 20430, 20434, 20415] *((_QWORD *)ptr + 15) = v16 - v21 - 1;
[20450, 20454, 20458, 20461, 19150, 20464, 20438, 20442, 20446] bc_init_state(ptr + 64, ptr + 152, ptr + 56);
[20612, 20615, 20621, 20627, 20469, 20478, 20599, 20472, 20606] for ( i = v21; i < v16 - 1; ++i )
{
[20480, 20512, 20486, 20488, 20496, 20503, 20506, 20509] v12 = strlen(*(const char **)(8LL * i + a3));
[20517, 20521, 20527, 20529, 20537, 20544, 20547, 20550, 20554, 20558, 20562, 20566, 20570, 20572, 20578, 20584, 20587, 20590, 20595] bc_push_arg(ptr + 64, ptr + 152, *(_QWORD *)(8LL * i + a3), v12 + 1, 0LL, 0LL, 1LL);
}
}
else
{
[20641, 20643, 20647, 20632, 20638] *((_DWORD *)ptr + 60) = v16 - v21;
[20664, 20657, 20653] *((_QWORD *)ptr + 14) = &off_6B88;
[20672, 20676, 20679, 20684, 20688, 20668] *((_QWORD *)ptr + 13) = strlen(*((const char **)ptr + 14));
[20696, 20692] *((_QWORD *)ptr + 17) = 0LL;
[20704, 20708] *((_QWORD *)ptr + 18) = 0LL;
[20740, 20743, 20747, 20716, 20720, 20726, 20728, 20732, 20735] *((_QWORD *)ptr + 29) = xmalloc(8LL * *((int *)ptr + 60));
[20770, 20774, 20777, 20780, 19150, 20754, 20758, 20762, 20766] bc_init_state(ptr + 64, ptr + 152, ptr + 56);
[20869, 20873, 20879, 20785, 20885, 20795, 20862] for ( j = 0; j < *((_DWORD *)ptr + 60); ++j )
[20833, 20803, 20806, 20808, 20840, 20810, 20846, 20849, 20818, 20853, 20856, 20825, 20859, 20829, 20797] *(_QWORD *)(*((_QWORD *)ptr + 29) + 8LL * j) = *(_QWORD *)(8LL * (j + v21) + a3);
}
[20919, 20903, 20910, 20913, 20916, 20887, 20893, 20895] if ( *(_QWORD *)(8LL * v16 + a3) )
[20944, 20954, 20938, 20947] *a4 = v16 + 1;
else
[20928, 20921, 20934, 20936] *a4 = v16;
[20961, 20965, 20974, 20976, 20956] return 1LL;
}
else
{
[19873, 19866, 19879] *a4 = v16;
[19888, 19881, 19885] free(ptr);
[19898, 19893] return 0LL;
}
[20981, 20985, 20986, 20988, 20990, 20991] }
// 6B88: using guessed type void *off_6B88;
// 8A88: using guessed type unsigned int ( *options[15])(long);
// 8B98: using guessed type long quotearg_n_style(_QWORD, _QWORD, _QWORD);
// 8BE8: using guessed type long insert_primary_withpred(_QWORD, _QWORD, _QWORD);
// 8C20: using guessed type long xmalloc(_QWORD);
// 8CB8: using guessed type long mbsstr(_QWORD, _QWORD);
// 8CC8: using guessed type long bc_init_controlinfo(_QWORD, _QWORD);
// 8CD0: using guessed type long bc_use_sensible_arg_max(_QWORD);
// 8CE0: using guessed type long bc_init_state(_QWORD, _QWORD, _QWORD);
// 8CE8: using guessed type long bc_push_arg(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000005200) ----------------------------------------------------
long get_relative_timestamp(long a1, long a2, long a3, int a4, const char *a5, double a6)
[20992] {
unsigned int v6; // eax
long v11; // [rsp+28h] [rbp-28h] BYREF
double v12; // [rsp+30h] [rbp-20h] BYREF
double iptr; // [rsp+38h] [rbp-18h] BYREF
double v14; // [rsp+40h] [rbp-10h]
unsigned long v15; // [rsp+48h] [rbp-8h]
[20992, 20996, 20997, 21000, 21004] v11 = a1;
[21025, 21029, 21038, 21008, 21012, 21016, 21020] v15 = __readfsqword(0x28u);
[21056, 21059, 21062, 21067, 21069, 21042, 21044, 21048, 21052] if ( !(unsigned char)get_comp_type(&v11, (_DWORD *)(a2 + 4)) )
[21479, 21484, 21488, 21497, 21499] return 0LL;
[21075, 21079] v6 = *(_DWORD *)(a2 + 4);
[21082, 21085] if ( v6 <= 1 )
{
[21090, 21092, 21094, 21087] if ( v6 )
[21096, 21099, 21101, 21105, 21112] *(_DWORD *)(a2 + 4) = 0;
else
[21114, 21125, 21118] *(_DWORD *)(a2 + 4) = 1;
}
[21156, 21158, 21128, 21132, 21136, 21143, 21148, 21151] if ( !(unsigned char)xstrtod(v11, 0LL, &v12, &strtod) )
[21472, 21477] return 0LL;
[21186, 21191, 21195, 21164, 21200, 21169, 21174, 21208, 21178, 21212, 21181] v14 = 1000000000.0 * modf(v12 * a6, &iptr);
[21224, 21217, 21234, 21229] if ( (double)(int)nanosec_per_sec_11514 <= v14 )
[21248, 21255, 21262, 21236, 21243] _assert_fail("nanosec < nanosec_per_sec", "parser.c", 0xC4Du, "get_relative_timestamp");
[21281, 21285, 21290, 21294, 21267, 21271, 21276] *(_QWORD *)(a2 + 8) = (unsigned int)(int)((double)(int)a3 - iptr);
[21313, 21316, 21321, 21325, 21329, 21298, 21332, 21302, 21334, 21336, 21306, 21310] if ( a3 < *(_QWORD *)(a2 + 8) != iptr < 0.0 )
[21346, 21349, 21352, 21357, 21362, 21367, 21338, 21342] error(1, 0, a5, v11);
[21376, 21381, 21386, 21391, 21395, 21372] *(_QWORD *)(a2 + 16) = (unsigned int)(int)((double)a4 - v14);
[21408, 21413, 21417, 21399, 21403] if ( v14 > (double)a4 )
{
[21441, 21419, 21423, 21427, 21434, 21437] *(_QWORD *)(a2 + 16) += nanosec_per_sec_11514;
[21445, 21449, 21453, 21457, 21461, 21465, 21470] --*(_QWORD *)(a2 + 8);
}
[21504] return 1LL;
[21505] }
// 526B: conditional instruction was optimized away because eax.4==1
// 6E10: using guessed type long nanosec_per_sec_11514;
// 8CF8: using guessed type long xstrtod(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000005402) ----------------------------------------------------
long parse_time(long a1, long a2, int *a3)
[21506] {
unsigned int ( *v4)(long); // rdx
__m128i v5; // xmm0
_QWORD *inserted; // rax
long v7; // rdx
const char *v8; // rdx
const char *v9; // rax
char *v10; // rax
char *v11; // rax
int v13; // [rsp+28h] [rbp-68h] BYREF
int v14; // [rsp+2Ch] [rbp-64h]
long v15; // [rsp+30h] [rbp-60h] BYREF
time_t timer; // [rsp+38h] [rbp-58h] BYREF
char *v17; // [rsp+40h] [rbp-50h]
long v18; // [rsp+48h] [rbp-48h]
unsigned int ( *v19)(long); // [rsp+50h] [rbp-40h]
_QWORD *v20; // [rsp+58h] [rbp-38h]
unsigned int ( *v21)(long); // [rsp+60h] [rbp-30h]
unsigned int ( *v22)(long); // [rsp+68h] [rbp-28h]
long v23; // [rsp+70h] [rbp-20h] BYREF
long v24; // [rsp+78h] [rbp-18h]
long v25; // [rsp+80h] [rbp-10h]
unsigned long v26; // [rsp+88h] [rbp-8h]
[21536, 21506, 21510, 21511, 21545, 21514, 21521, 21525, 21529] v26 = __readfsqword(0x28u);
[21563, 21549, 21558, 21551] v17 = gettext("arithmetic overflow while converting %s days to a number of seconds");
[21576, 21574, 21567] v14 = *a3;
[21600, 21605, 21608, 21610, 21579, 21583, 21590, 21594, 21597] if ( (unsigned char)collect_arg(a2, a3, &v15) != 1 )
[21617, 21612] return 0LL;
[21626, 21622] v18 = v15;
[21637] v4 = options[6];
[21644, 21630] v21 = options[5];
[21648] v22 = v4;
[21666, 21671, 21673, 21675, 21678, 21681, 21652, 21656, 21660, 21663] if ( (unsigned char)get_comp_type(&v15, &v13) && v13 == 1 )
{
[21697, 21701, 21707, 21711, 21715] v21 = (unsigned int ( *)(long))((char *)v21 + 86399);
[21683, 21693, 21687] v19 = v21;
}
[21731, 21763, 21736, 21754, 21739, 21744, 21749, 21719, 21722, 21724, 21759] v15 = v18;
[21786, 21794, 21782, 21775] v5 = (__m128i)0x40F5180000000000uLL;
[21794, 21799, 21767, 21802, 21771, 21805, 21810, 21813, 21815, 21790] if ( (unsigned char)get_relative_timestamp(v18, (long)&v23, (long)v21, (int)v22, v17, 86400.0) != 1 )
{
[21824, 21817, 21827] *a3 = v14;
[21834, 21829] return 0LL;
}
else
{
[21839, 21843, 21847, 21850, 21853] inserted = (_QWORD *)insert_primary(a1, v18);
[21858] v20 = inserted;
[21870, 21866, 21862] v7 = v24;
[21874] inserted[7] = v23;
[21878] inserted[8] = v7;
[21882, 21886] inserted[9] = v25;
[21897, 21890, 21894] *(float *)v5.m128i_i32 = estimate_timestamp_success_rate(v24);
[21906, 21910, 21902] *((_DWORD *)v20 + 9) = _mm_cvtsi128_si32(v5);
[21920, 21913, 21923, 21926] if ( ((unsigned long)options[8] & 1) != 0 )
{
[21954, 21957, 21962, 21932, 21936, 21940, 21947] fprintf(stderr, "inserting %s\n", (const char *)v20[1]);
[21970, 21972, 21967] if ( HIDWORD(v23) )
{
[21977, 21980, 21974] if ( HIDWORD(v23) == 1 )
{
[22008, 22015] v8 = " <";
}
[21985, 21988, 21982] else if ( HIDWORD(v23) == 2 )
{
[21997, 21990] v8 = ">=";
}
else
{
[22006, 21999] v8 = " ?";
}
}
else
{
[22017] v8 = " >";
}
[22024, 22027, 22029] if ( HIDWORD(v23) )
{
[22034, 22037, 22031] if ( HIDWORD(v23) == 1 )
{
[22072, 22065] v9 = "lt";
}
[22042, 22045, 22039] else if ( HIDWORD(v23) == 2 )
{
[22054, 22047] v9 = "eq";
}
else
{
[22056, 22063] v9 = "?";
}
}
else
{
[22074] v9 = "gt";
}
[22081, 22088, 22091, 22094, 22101, 22106] fprintf(stderr, " type: %s %s ", v9, v8);
[22119, 22115, 22111] timer = v20[8];
[22130, 22123, 22127] v10 = ctime(&timer);
[22177, 22146, 22149, 22156, 22159, 22162, 22135, 22169, 22138, 22172, 22142] fprintf(stderr, "%lu %s", v20[8], v10);
[22185, 22188, 22182] if ( HIDWORD(v23) == 2 )
{
[22204, 22194, 22198, 22190] timer = v20[8] + 86400LL;
[22208, 22212, 22215] v11 = ctime(&timer);
[22240, 22243, 22250, 22220, 22253, 22223, 22258, 22227, 22230, 22237] fprintf(stderr, " < %lu %s", timer, v11);
}
}
[22272, 22281, 22283, 22263, 22268] return 1LL;
}
[22288, 22289] }
// 8A88: using guessed type unsigned int ( *options[15])(long);
// 8B48: using guessed type long insert_primary(_QWORD, _QWORD);
//----- (0000000000005712) ----------------------------------------------------
long get_comp_type(_QWORD *a1, _DWORD *a2)
[22290] {
int v2; // eax
[22306, 22310, 22313, 22316, 22290, 22294, 22295, 22298, 22302] v2 = *(char *)*a1;
[22322, 22319] if ( v2 == 43 )
{
[22331, 22335] *a2 = 0;
[22341, 22345, 22348, 22352, 22356, 22359] ++*a1;
}
[22329, 22324, 22327] else if ( v2 == 45 )
{
[22361, 22365] *a2 = 1;
[22371, 22375, 22378, 22382, 22386, 22389] ++*a1;
}
else
{
[22401, 22395, 22391] *a2 = 2;
}
[22402, 22407] return 1LL;
[22408] }
//----- (0000000000005789) ----------------------------------------------------
bool get_num(long a1, long a2, _DWORD *a3)
[22409] {
long v4; // [rsp+18h] [rbp-18h] BYREF
char v5[8]; // [rsp+20h] [rbp-10h] BYREF
unsigned long v6; // [rsp+28h] [rbp-8h]
[22409, 22413, 22414, 22417, 22421] v4 = a1;
[22425, 22442, 22433, 22429] v6 = __readfsqword(0x28u);
[22448, 22452, 22446, 22455] if ( !a1 )
[22457, 22462] return 0;
[22464, 22469, 22471, 22475, 22479, 22482, 22485, 22490, 22493, 22495] if ( a3 && (unsigned char)get_comp_type(&v4, a3) != 1 )
[22497, 22502] return 0;
[22531, 22564, 22534, 22504, 22539, 22508, 22541, 22512, 22544, 22516, 22548, 22523, 22557, 22526, 22559] return (unsigned int)xstrtoumax(v4, v5, 10LL, a2, &unk_6C06) == 0;
[22565] }
// 8D10: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5789: using guessed type char var_10[8];
//----- (0000000000005826) ----------------------------------------------------
long insert_num(long a1, int *a2, long a3)
[22566] {
const char *v3; // rdx
const char *v4; // rax
int v7; // [rsp+2Ch] [rbp-24h] BYREF
long v8; // [rsp+30h] [rbp-20h] BYREF
long v9; // [rsp+38h] [rbp-18h] BYREF
long inserted; // [rsp+40h] [rbp-10h]
unsigned long v11; // [rsp+48h] [rbp-8h]
[22566, 22599, 22570, 22571, 22574, 22578, 22582, 22586, 22590] v11 = __readfsqword(0x28u);
[22659, 22628, 22661, 22630, 22603, 22636, 22605, 22640, 22609, 22644, 22613, 22648, 22617, 22651, 22620, 22654, 22623] if ( !(unsigned char)collect_arg(a1, a2, &v8) || !get_num(v8, (long)&v9, &v7) )
[22951, 22956, 22960, 22969, 22971] return 0LL;
[22667, 22671, 22675, 22678, 22681, 22686] inserted = insert_primary(a3, v8);
[22697, 22690, 22693] *(_DWORD *)(inserted + 56) = v7;
[22704, 22708, 22700] *(_QWORD *)(inserted + 64) = v9;
[22712, 22722, 22725, 22719] if ( ((unsigned long)options[8] & 1) != 0 )
{
[22753, 22756, 22761, 22731, 22735, 22739, 22746] fprintf(stderr, "inserting %s\n", *(const char **)(inserted + 8));
[22769, 22771, 22766] if ( v7 )
{
[22776, 22779, 22773] if ( v7 == 1 )
{
[22814, 22807] v3 = " <";
}
[22784, 22787, 22781] else if ( v7 == 2 )
{
[22796, 22789] v3 = " =";
}
else
{
[22805, 22798] v3 = " ?";
}
}
else
{
[22816] v3 = " >";
}
[22826, 22828, 22823] if ( v7 )
{
[22833, 22836, 22830] if ( v7 == 1 )
{
[22864, 22871] v4 = "lt";
}
[22841, 22844, 22838] else if ( v7 == 2 )
{
[22853, 22846] v4 = "eq";
}
else
{
[22862, 22855] v4 = "?";
}
}
else
{
[22873] v4 = "gt";
}
[22880, 22887, 22890, 22893, 22900, 22905] fprintf(stderr, " type: %s %s ", v4, v3);
[22914, 22918, 22925, 22932, 22935, 22940, 22910] fprintf(stderr, "%lu\n", *(_QWORD *)(inserted + 64));
}
[22976, 22945, 22949] return inserted;
[22977] }
// 8A88: using guessed type unsigned int ( *options[15])(long);
// 8B48: using guessed type long insert_primary(_QWORD, _QWORD);
//----- (00000000000059C2) ----------------------------------------------------
bool open_output_file(const char *a1, long a2)
[22978] {
int *v2; // rax
bool result; // al
[22978, 22982, 22983, 22986, 22990, 22994, 22998, 23002] *(_QWORD *)a2 = 0LL;
[23009, 23014, 23019, 23022, 23026] *(_QWORD *)(a2 + 32) = clone_quoting_options(0LL);
[23041, 23044, 23049, 23051, 23030, 23034] if ( !strcmp(a1, "/dev/stderr") )
{
[23064, 23060, 23053] *(_QWORD *)(a2 + 8) = stderr;
[23075, 23080, 23084, 23088, 23068] *(_QWORD *)(a2 + 16) = gettext("standard error");
}
[23104, 23107, 23112, 23114, 23093, 23097] else if ( !strcmp(a1, "/dev/stdout") )
{
[23123, 23116, 23127] *(_QWORD *)(a2 + 8) = stdout;
[23138, 23143, 23147, 23151, 23131] *(_QWORD *)(a2 + 16) = gettext("standard output");
}
else
{
[23170, 23175, 23179, 23153, 23160, 23164, 23167] *(_QWORD *)(a2 + 8) = sharefile_fopen(state[6], a1);
[23191, 23187, 23183] *(_QWORD *)(a2 + 16) = a1;
[23195, 23203, 23206, 23199] if ( !*(_QWORD *)(a2 + 8) )
{
[23208] v2 = _errno_location();
[23213, 23215, 23219, 23222, 23224] fatal_nontarget_file_error((unsigned int)*v2, a1);
}
}
[23237, 23233, 23229, 23240] result = stream_is_tty(*(FILE **)(a2 + 8));
[23249, 23245] *(_BYTE *)(a2 + 24) = result;
[23252, 23253] return result;
[23254] }
// 8AA8: using guessed type _QWORD state[7];
// 8D18: using guessed type long clone_quoting_options(_QWORD);
// 8D28: using guessed type long sharefile_fopen(_QWORD, _QWORD);
// 8D30: using guessed type long fatal_nontarget_file_error(_QWORD, _QWORD);
//----- (0000000000005AD7) ----------------------------------------------------
bool open_stdout(long a1)
[23255] {
[23267, 23271, 23275, 23278, 23291, 23285, 23255, 23290, 23259, 23260, 23263] return open_output_file("/dev/stdout", a1);
[23292] }
// nfuncs=192 queued=116 decompiled=116 lumina nreq=0 worse=0 better=0
// ALL OK, 116 function(s) have been successfully decompiled
|
void free_orphan(struct_0 *a0) {
[1088] unsigned long long v2[3]; // rdi
[1088] unsigned long long v3; // rax
[1088]
[1088] v2 = a0->field_18;
[1092] free(v2);
[1096] free(v2[2]);
[1105, 1101] free(v2[1]);
[1114, 1110] v3 = free(a0);
[3167, 1119, 3169, 1122, 1123, 3178, 3182, 3184, 3186, 3188, 3195] return;
[3169, 1122, 1123, 3178, 3182, 3184, 3186, 3188, 3195, 3167, 1119] }
|
void free_orphan(unsigned long long a0[4]) {
[719] unsigned long long v1; // rax
[719]
[719] free(a0[3]);
[739, 743, 746, 719, 723, 724, 727, 731, 735] free(a0[2]);
[751, 755, 759, 762] free(a0[1]);
[771, 775, 778, 767] v1 = free(a0);
[787, 790, 783] return;
[795, 796, 797] }
|
long terminal_get_size(long a1, _DWORD *a2, _DWORD *a3)
[4048] {
long v4; // rax
long v5; // rax
unsigned int v6; // r8d
unsigned short v8; // [rsp+0h] [rbp-28h] BYREF
unsigned short v9; // [rsp+2h] [rbp-26h]
unsigned long v10; // [rsp+8h] [rbp-20h]
[4065, 4069, 4078, 4048, 4052, 4054, 4057, 4058, 4061, 4062] v10 = __readfsqword(0x28u);
[4083, 4085] v4 = *(_QWORD *)(a1 + 184);
[4092, 4095] *a3 = *(_DWORD *)(v4 + 12);
[4104, 4098] *a2 = *(_DWORD *)(v4 + 8);
[4101, 4106, 4109, 4111, 4116, 4121, 4124] if ( ioctl(*(_DWORD *)(a1 + 32), 0x5413uLL, &v8) != -1 )
{
[4131, 4134] if ( v9 )
[4136, 4126] *a3 = v9;
[4146, 4143] if ( v8 )
[4216, 4139, 4220] *a2 = v8;
}
[4148] v5 = *(_QWORD *)(a1 + 184);
[4158] v6 = 1;
[4155, 4164, 4167] if ( *(_DWORD *)(v5 + 12) == *a3 )
[4197, 4169, 4172, 4176, 4179, 4183, 4188] return *(_DWORD *)(v5 + 8) != *a2;
[4203, 4199] return v6;
[4208, 4210, 4206, 4207] }
//----- (0000000000001090) ----------------------------------------------------
long terminal_change_size(long a1, int a2, int a3)
[4240] {
long v3; // rbp
long v4; // rax
long result; // rax
[4258, 4261, 4240, 4244, 4245, 4250, 4251, 4254] v3 = *(_QWORD *)(a1 + 48);
[4265] if ( a3 <= 1 )
[4265] a3 = 80;
[4268] v4 = *(_QWORD *)(a1 + 184);
[4275, 4277] *(_DWORD *)(v4 + 12) = a3;
[4285] if ( a2 <= 0 )
[4280, 4285] a2 = 24;
[4288] *(_DWORD *)(v4 + 8) = a2;
[4291] result = terminal_rebuffer_display(a1);
[4296, 4299] if ( (_DWORD)result != -1 )
{
[4304, 4301] re_clear_display(a1);
[4309] *(_QWORD *)(a1 + 48) = v3;
[4313] return 0LL;
}
[4315] return result;
[4320, 4321, 4319] }
// 47A0: using guessed type long re_clear_display(_QWORD);
//----- (00000000000010F0) ----------------------------------------------------
long terminal_set_arrow(long a1, const wchar_t *a2, long *a3, int a4)
[4336] {
long v6; // rbx
long v7; // r14
int v8; // r8d
long result; // rax
long v10; // rax
[4352, 4353, 4356, 4357, 4336, 4340, 4342, 4344, 4347, 4349] v6 = *(_QWORD *)(a1 + 200);
[4364, 4367, 4370, 4375, 4377] if ( !wcscmp(a2, *(const wchar_t **)v6) )
goto LABEL_9;
[4390] v7 = v6 + 32;
[4480, 4483, 4490, 4495, 4497, 4499, 4506, 4509, 4383, 4387, 4516, 4521, 4394, 4524, 4399, 4401, 4529, 4532, 4407, 4411, 4414, 4418, 4423, 4425, 4427, 4431, 4434, 4438, 4443, 4445, 4447, 4454, 4457, 4464, 4469, 4471, 4473] if ( !wcscmp(a2, *(const wchar_t **)(v6 + 32))
|| (v7 = v6 + 64, !wcscmp(a2, *(const wchar_t **)(v6 + 64)))
|| (v7 = v6 + 96, !wcscmp(a2, *(const wchar_t **)(v6 + 96)))
|| (v7 = v6 + 128, !wcscmp(a2, *(const wchar_t **)(v6 + 128)))
|| (v7 = v6 + 160, !wcscmp(a2, *(const wchar_t **)(v6 + 160)))
|| (v7 = v6 + 192, v8 = wcscmp(a2, *(const wchar_t **)(v6 + 192)), result = 0xFFFFFFFFLL, !v8) )
{
[4544] v6 = v7;
LABEL_9:
[4547] v10 = *a3;
[4551] *(_DWORD *)(v6 + 24) = a4;
[4555] *(_QWORD *)(v6 + 16) = v10;
[4559] return 0LL;
}
[4534] return result;
[4567, 4561, 4562, 4563, 4565, 4535, 4536, 4569, 4538, 4540, 4542] }
//----- (00000000000011E0) ----------------------------------------------------
long terminal_clear_arrow(long a1, const wchar_t *a2)
[4576] {
long v2; // rbx
long v3; // r12
int v4; // r8d
long result; // rax
[4576, 4580, 4582, 4583, 4586, 4587] v2 = *(_QWORD *)(a1 + 200);
[4594, 4597, 4600, 4605, 4607] if ( !wcscmp(a2, *(const wchar_t **)v2) )
goto LABEL_9;
[4620] v3 = v2 + 32;
[4736, 4739, 4613, 4617, 4746, 4751, 4624, 4754, 4629, 4631, 4759, 4762, 4637, 4641, 4644, 4648, 4653, 4655, 4657, 4661, 4664, 4668, 4673, 4675, 4677, 4684, 4687, 4694, 4699, 4701, 4703, 4710, 4713, 4720, 4725, 4727, 4729] if ( !wcscmp(a2, *(const wchar_t **)(v2 + 32))
|| (v3 = v2 + 64, !wcscmp(a2, *(const wchar_t **)(v2 + 64)))
|| (v3 = v2 + 96, !wcscmp(a2, *(const wchar_t **)(v2 + 96)))
|| (v3 = v2 + 128, !wcscmp(a2, *(const wchar_t **)(v2 + 128)))
|| (v3 = v2 + 160, !wcscmp(a2, *(const wchar_t **)(v2 + 160)))
|| (v3 = v2 + 192, v4 = wcscmp(a2, *(const wchar_t **)(v2 + 192)), result = 0xFFFFFFFFLL, !v4) )
{
[4776] v2 = v3;
LABEL_9:
[4779] *(_DWORD *)(v2 + 24) = 2;
[4786] return 0LL;
}
[4764] return result;
[4768, 4788, 4789, 4790, 4792, 4765, 4766] }
//----- (00000000000012C0) ----------------------------------------------------
void terminal_print_arrow(long a1, const wchar_t *a2)
[4800] {
_QWORD *v3; // rbx
_QWORD *v4; // rbp
_QWORD *v5; // rbp
_QWORD *v6; // rbp
_QWORD *v7; // rbp
_QWORD *v8; // rbp
_QWORD *v9; // rbx
const wchar_t *v10; // rsi
_QWORD *v11; // rdx
[4800, 4833, 4804, 4806, 4809, 4811, 4814, 4815, 4816, 4823, 4830] v3 = *(_QWORD **)(a1 + 200);
[4820] if ( *a2 )
{
[5059, 5061, 5063, 5066, 5069, 5048, 5051, 5054] if ( wcscmp(a2, (const wchar_t *)*v3) || *((_DWORD *)v3 + 6) == 2 )
{
[5075] v4 = v3 + 4;
goto LABEL_20;
}
}
[4842, 4845, 4839] else if ( *((_DWORD *)v3 + 6) == 2 )
{
goto LABEL_3;
}
[5376, 5379, 5383, 5386, 5391] keymacro_kprint(a1, *v3, v3 + 2);
LABEL_3:
[4859, 4851, 4862, 4855] v4 = v3 + 4;
[4851] if ( !*a2 )
{
[4874, 4868, 4871] if ( *((_DWORD *)v3 + 14) == 2 )
goto LABEL_5;
goto LABEL_40;
}
LABEL_20:
[5091, 5093, 5095, 5098, 5101, 5079, 5083, 5086] if ( wcscmp(a2, (const wchar_t *)*v4) || *((_DWORD *)v4 + 6) == 2 )
{
[5107] v5 = v3 + 8;
goto LABEL_23;
}
LABEL_40:
[5352, 5356, 5360, 5363, 5368] keymacro_kprint(a1, *v4, v4 + 2);
LABEL_5:
[4880, 4888, 4890, 4884] v5 = v3 + 8;
[4880] if ( !*a2 )
{
[4896, 4899, 4902] if ( *((_DWORD *)v3 + 22) == 2 )
goto LABEL_7;
goto LABEL_39;
}
LABEL_23:
[5123, 5125, 5127, 5130, 5133, 5111, 5115, 5118] if ( wcscmp(a2, (const wchar_t *)*v5) || *((_DWORD *)v5 + 6) == 2 )
{
[5139] v6 = v3 + 12;
goto LABEL_26;
}
LABEL_39:
[5344, 5328, 5332, 5336, 5339] keymacro_kprint(a1, *v5, v5 + 2);
LABEL_7:
[4912, 4908, 4918, 4916] v6 = v3 + 12;
[4908] if ( !*a2 )
{
[4930, 4924, 4927] if ( *((_DWORD *)v3 + 30) == 2 )
{
[4936] v7 = v3 + 16;
goto LABEL_10;
}
goto LABEL_37;
}
LABEL_26:
[5155, 5157, 5275, 5278, 5143, 5272, 5147, 5150] if ( wcscmp(a2, (const wchar_t *)*v6) || *((_DWORD *)v6 + 6) == 2 )
{
[5159] v7 = v3 + 16;
goto LABEL_28;
}
LABEL_37:
[5280] v10 = (const wchar_t *)*v6;
[5284] v11 = v6 + 2;
[5291] v7 = v3 + 16;
[5288, 5298] keymacro_kprint(a1, v10, v11);
[5307, 5309, 5315, 5303] if ( !*a2 )
{
LABEL_10:
[4946, 4949, 4943] if ( *((_DWORD *)v7 + 6) == 2 )
goto LABEL_12;
goto LABEL_11;
}
LABEL_28:
[5185, 5188, 5166, 5170, 5173, 5178, 5180, 5182] if ( wcscmp(a2, (const wchar_t *)*v7) || *((_DWORD *)v7 + 6) == 2 )
{
[5194] v8 = v3 + 20;
goto LABEL_31;
}
LABEL_11:
[4962, 4955, 4959, 4951] keymacro_kprint(a1, *v7, v7 + 2);
LABEL_12:
[4978, 4971, 4980, 4967] v8 = v3 + 20;
[4967] if ( !*a2 )
{
[4992, 4986, 4995] if ( *((_DWORD *)v3 + 46) == 2 )
{
[5001] v9 = v3 + 24;
goto LABEL_15;
}
goto LABEL_42;
}
LABEL_31:
[5217, 5220, 5223, 5201, 5205, 5208, 5213, 5215] if ( wcscmp(a2, (const wchar_t *)*v8) || *((_DWORD *)v8 + 6) == 2 )
{
[5229] v9 = v3 + 24;
goto LABEL_34;
}
LABEL_42:
[5400, 5411] v9 = v3 + 24;
[5400, 5408, 5418, 5404] keymacro_kprint(a1, *v8, v8 + 2);
[5435, 5427, 5429, 5423] if ( *a2 )
{
LABEL_34:
[5242, 5236, 5239] if ( wcscmp(a2, (const wchar_t *)*v9) )
[5249, 5247] return;
}
LABEL_15:
[5008, 5011, 5014] if ( *((_DWORD *)v9 + 6) != 2 )
[5040, 5027, 5020, 5031] keymacro_kprint(a1, *v9, v9 + 2);
[5255, 5034, 5035, 5036, 5259, 5038, 5260, 5261, 5263, 5265, 5023] }
// 47B0: using guessed type long keymacro_kprint(_QWORD, _QWORD, _QWORD);
//----- (0000000000001540) ----------------------------------------------------
unsigned long terminal_bind_arrow(long a1)
[5440] {
long v1; // r14
long v2; // r12
long v3; // r13
int *v4; // rbx
int *v5; // r13
unsigned char *v6; // rax
int v7; // edx
long v8; // rcx
long v9; // rdx
_BYTE *v10; // r15
char v11; // si
long v12; // rcx
char v13; // al
long v15; // rdx
int v16; // [rsp+10h] [rbp-68h] BYREF
int v17; // [rsp+14h] [rbp-64h]
int v18[4]; // [rsp+18h] [rbp-60h]
int v19; // [rsp+28h] [rbp-50h]
int v20; // [rsp+2Ch] [rbp-4Ch]
unsigned long v21; // [rsp+38h] [rbp-40h]
[5440, 5444, 5446, 5448, 5450, 5452, 5453, 5454, 5458, 5467] v21 = __readfsqword(0x28u);
[5472, 5474, 5482] if ( *(_QWORD *)(a1 + 160) )
{
[5488] v1 = *(_QWORD *)(a1 + 1016);
[5498, 5501, 5495] if ( v1 )
{
[5514] v2 = *(_QWORD *)(a1 + 1032);
[5521, 5507] if ( *(_DWORD *)(a1 + 1056) == 1 )
{
[5880] v2 = *(_QWORD *)(a1 + 1040);
[5894, 5887] v1 = *(_QWORD *)(a1 + 1008);
}
[5527] v3 = *(_QWORD *)(a1 + 200);
[5537, 5534] terminal_reset_arrow(a1);
[5542] v4 = (int *)(v3 + 8);
[5553, 5546] v5 = (int *)(v3 + 232);
[5583] while ( 1 )
{
[5576, 5573, 5583] v6 = *(unsigned char **)(*(_QWORD *)(a1 + 176) + 8LL * *v4);
[5587, 5590, 5592, 5595, 5597] if ( !v6 || !*v6 )
goto LABEL_6;
[5592, 5599] v16 = (char)*v6;
[5609, 5603, 5607] if ( v6[1] )
{
[5603, 5615] v17 = (char)v6[1];
[5625, 5619, 5623] if ( v6[2] )
{
[5619, 5631] v18[0] = (char)v6[2];
[5641, 5635, 5639] if ( v6[3] )
{
[5635, 5647] v18[1] = (char)v6[3];
[5657, 5651, 5655] if ( v6[4] )
{
[5651, 5663] v18[2] = (char)v6[4];
[5673, 5667, 5671] if ( v6[5] )
{
[5667, 5679] v18[3] = (char)v6[5];
[5689, 5683, 5687] if ( v6[6] )
{
[5683, 5695] v19 = (char)v6[6];
[5703] v7 = 0;
[5699] if ( v6[7] )
[5699, 5708, 5711] v7 = (char)v6[7];
[5714] v20 = v7;
}
else
{
[6129] v19 = 0;
[6137, 6145] v20 = 0;
}
goto LABEL_18;
}
[6124, 6119] v15 = 5LL;
}
else
{
[6114, 6109] v15 = 4LL;
}
}
else
{
[6107, 6102] v15 = 3LL;
}
}
else
{
[6100, 6095] v15 = 2LL;
}
}
else
{
[5977] v15 = 1LL;
}
[5982] *(&v16 + v15) = 0;
[5994] v18[v15 - 1] = 0;
[6002] v18[v15] = 0;
[6010, 6014] if ( v15 != 5 )
{
[6020, 5990] *(&v16 + v15 + 3) = 0;
[6032, 6036] if ( v15 != 4 )
{
[6042, 6028] *(&v16 + v15 + 4) = 0;
[6058, 6054] if ( v15 != 3 )
{
[6064, 6050] *(&v16 + v15 + 5) = 0;
[6072, 6076] if ( v15 == 1 )
[6090, 6082] v20 = 0;
}
}
}
LABEL_18:
[5718] v8 = (unsigned int)v4[4];
[5721] v9 = *v6;
[5724, 5727] if ( (_DWORD)v8 == 2 )
{
[5936, 5944, 5947, 5941] keymacro_clear(a1, v1, &v16);
[5952] goto LABEL_6;
}
[5733] v10 = (_BYTE *)(v1 + v9);
[5733, 5741] v11 = *(_BYTE *)(v1 + v9);
[5761, 5737, 5745, 5747, 5751, 5757] if ( v6[1] && (*(_BYTE *)(v2 + v9) == v11 || v11 == 25) )
{
[5904, 5913, 5908, 5916] keymacro_add(a1, &v16, v4 + 2, v8);
[5921] *v10 = 25;
[5925] goto LABEL_6;
}
[5771, 5767] if ( v11 == 28 )
{
[5796, 5777, 5782, 5785, 5788, 5791] keymacro_clear(a1, v1, &v16);
[5801] v12 = (unsigned int)v4[4];
[5809, 5811, 5804] if ( (_DWORD)v12 )
{
[5961, 5964, 5957, 5967] keymacro_add(a1, &v16, v4 + 2, v12);
[5972] goto LABEL_6;
}
[5817] v13 = *((_BYTE *)v4 + 8);
[5821] v4 += 8;
[5825] *v10 = v13;
[5840, 5828, 5837, 5831] if ( v5 == v4 )
[5845, 5854, 5831] return __readfsqword(0x28u) ^ v21;
}
else
{
LABEL_6:
[5560] v4 += 8;
[5564, 5567] if ( v5 == v4 )
[5845, 5567] return __readfsqword(0x28u) ^ v21;
}
}
}
}
[5860, 5845] return __readfsqword(0x28u) ^ v21;
[5864, 5865, 5866, 5868, 5870, 5872, 5874] }
// 4750: using guessed type long keymacro_add(_QWORD, _QWORD, _QWORD, _QWORD);
// 47B8: using guessed type long keymacro_clear(_QWORD, _QWORD, _QWORD);
//----- (0000000000001810) ----------------------------------------------------
long terminal_set(long a1, char *a2)
[6160] {
char *v2; // rbp
_QWORD *v4; // rax
int v5; // eax
int v6; // r14d
long v7; // rdi
long v8; // rax
int v9; // edx
char **v10; // rdx
long v11; // rdx
long v12; // rax
int v13; // edx
long result; // rax
int *v15; // r13
long v16; // r13
long v17; // r13
long v18; // r13
long v19; // r13
long v20; // r13
long v21; // r13
long v22; // r13
int v23; // esi
const char *v24; // rdi
const char **v25; // r13
char *v26; // rax
char *v27; // rax
long v28; // rsi
int v29; // [rsp+0h] [rbp-958h] BYREF
int v30; // [rsp+4h] [rbp-954h] BYREF
char *v31; // [rsp+8h] [rbp-950h] BYREF
sigset_t oset; // [rsp+10h] [rbp-948h] BYREF
sigset_t set; // [rsp+90h] [rbp-8C8h] BYREF
char v34; // [rsp+110h] [rbp-848h] BYREF
unsigned long v35; // [rsp+918h] [rbp-40h]
[6176, 6177, 6180, 6160, 6164, 6166, 6168, 6170, 6172, 6173] v2 = a2;
[6187, 6196] v35 = __readfsqword(0x28u);
[6214, 6219, 6222, 6204, 6206] sigemptyset(&set);
[6232, 6235, 6227] sigaddset(&set, 28);
[6240, 6243, 6248, 6246] sigprocmask(0, &set, &oset);
[6261, 6253] v31 = &v34;
[6690, 6275, 6279, 6672, 6679, 6266, 6684, 6269, 6687] if ( !a2 && (v2 = getenv("TERM")) == 0LL || !*v2 )
[6696, 6703] v2 = "dumb";
[6285, 6292, 6295, 6300, 6302] if ( !strcmp(v2, "emacs") )
[6304] *(_DWORD *)(a1 + 44) |= 4u;
[6308] v4 = *(_QWORD **)(a1 + 192);
[6322] *v4 = 0LL;
[6329] v4[255] = 0LL;
[6340, 6344, 6347, 6318, 6353, 6355, 6358] memset(
(void *)((unsigned long)(v4 + 1) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL * (((unsigned int)v4 - (((_DWORD)v4 + 8) & 0xFFFFFFF8) + 2048) >> 3));
[6368, 6361, 6315] v5 = tgetent(*(char **)(a1 + 192), v2);
[6373] v6 = v5;
[6376, 6378] if ( v5 > 0 )
{
[6712] v15 = *(int **)(a1 + 184);
[6731, 6743, 6726, 6719] *v15 = tgetflag("am");
[6747] v16 = *(_QWORD *)(a1 + 184);
[6736, 6754, 6766] *(_DWORD *)(v16 + 24) = tgetflag("xn");
[6770] v17 = *(_QWORD *)(a1 + 184);
[6777, 6789, 6759] *(_DWORD *)(v17 + 4) = tgetflag("pt");
[6793] v18 = *(_QWORD *)(a1 + 184);
[6800, 6812, 6782] *(_DWORD *)(v18 + 20) = tgetflag("xt");
[6816] v19 = *(_QWORD *)(a1 + 184);
[6835, 6805, 6823] *(_DWORD *)(v19 + 16) = tgetflag("km");
[6839] v20 = *(_QWORD *)(a1 + 184);
[6858, 6828, 6846] *(_DWORD *)(v20 + 28) = tgetflag("MT");
[6862] v21 = *(_QWORD *)(a1 + 184);
[6881, 6851, 6869] *(_DWORD *)(v21 + 12) = tgetnum("co");
[6885] v22 = *(_QWORD *)(a1 + 184);
[6897] v23 = 97;
[6902] v24 = "al";
[6874, 6892, 6909] *(_DWORD *)(v22 + 8) = tgetnum("li");
[6920, 6913] v25 = (const char **)tstr;
[6931] while ( 1 )
{
[6931] v26 = strchr(v24, v23);
[6936, 6939, 6942] v27 = tgetstr(v26, &v31);
[6947] v28 = (long)v25;
[6953] v25 += 2;
[6960, 6957, 6950] terminal_alloc((_QWORD *)a1, v28, v27);
[6969, 6972, 6965, 6974] v24 = *v25;
[6965] if ( !*v25 )
break;
[6928] v23 = *v24;
}
}
else
{
[6384] v7 = *(_QWORD *)(a1 + 24);
[6388, 6391] if ( v5 == -1 )
{
[6984, 6996, 6998, 6991] _fprintf_chk(v7, 1LL, "Cannot read termcap database;\n");
[7003, 7007] v7 = *(_QWORD *)(a1 + 24);
}
[6397, 6399] else if ( !v5 )
{
[7016, 7019, 7026, 7031, 7033] _fprintf_chk(v7, 1LL, "No entry for terminal type \"%s\";\n", v2);
[7042, 7038] v7 = *(_QWORD *)(a1 + 24);
}
[6417, 6419, 6412, 6405] _fprintf_chk(v7, 1LL, "using dumb terminal settings.\n");
[6424] v8 = *(_QWORD *)(a1 + 184);
[6439] v9 = *(_DWORD *)(v8 + 28);
[6442, 6431] *(__m128i *)(v8 + 4) = _mm_load_si128((const __m128i *)&LC15);
[6446] *(_DWORD *)(v8 + 20) = v9;
[6456, 6449] v10 = tstr;
do
{
[6464, 6467, 6470] terminal_alloc_constprop_0(a1, (long)v10);
[6475] v10 = (char **)(v11 + 16);
}
[6483, 6479] while ( *v10 );
}
[6485] v12 = *(_QWORD *)(a1 + 184);
[6492] v13 = *(_DWORD *)(v12 + 12);
[6498, 6495] if ( v13 <= 1 )
{
[6500] *(_DWORD *)(v12 + 12) = 80;
[6507] v13 = 80;
}
[6512, 6515, 6517] if ( *(int *)(v12 + 8) <= 0 )
[6519] *(_DWORD *)(v12 + 8) = 24;
[6526] *(_DWORD *)(a1 + 148) = v13;
[6538, 6532] *(_DWORD *)(a1 + 144) = *(_DWORD *)(v12 + 8);
[6544, 6535] terminal_setflags(a1);
[6560, 6554, 6549, 6557] terminal_get_size(a1, &v29, &v30);
[6569, 6572, 6565, 6575] result = terminal_change_size(a1, v29, v30);
[6580, 6583] if ( (_DWORD)result != -1 )
{
[6585, 6587, 6595, 6590] sigprocmask(2, &oset, 0LL);
[6600, 6603] terminal_bind_arrow(a1);
[6608, 6610] *(_QWORD *)(a1 + 136) = v2;
[6625, 6633, 6642, 6617, 6620, 6623] return (unsigned int)-(v6 <= 0);
}
[6648] return result;
[6656, 6657, 6659, 6661, 6663, 6665, 6655] }
// 194B: variable 'v11' is possibly undefined
// 3BC0: using guessed type char *tstr[78];
// 3E40: using guessed type __int128 LC15;
// 4770: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
//----- (0000000000001B90) ----------------------------------------------------
long terminal_init(long a1)
[7056] {
void *v1; // rax
void *v2; // rax
void *v3; // rax
void *v4; // rax
void *v5; // rax
long result; // rax
[7074, 7056, 7060, 7061, 7066, 7069] v1 = calloc(0x800uLL, 1uLL);
[7079] *(_QWORD *)(a1 + 160) = v1;
[7089, 7086] if ( !v1 )
[7347] return 0xFFFFFFFFLL;
[7105, 7100, 7095] v2 = calloc(0x800uLL, 1uLL);
[7110] *(_QWORD *)(a1 + 192) = v2;
[7120, 7117] if ( v2 )
{
[7136, 7131, 7126] v3 = calloc(7uLL, 0x20uLL);
[7141] *(_QWORD *)(a1 + 200) = v3;
[7148, 7151] if ( v3 )
{
[7157] *(_QWORD *)(a1 + 168) = 0LL;
[7168, 7178, 7173] v4 = calloc(0x27uLL, 8uLL);
[7183] *(_QWORD *)(a1 + 176) = v4;
[7193, 7190] if ( v4 )
{
[7200, 7195, 7205] v5 = calloc(8uLL, 4uLL);
[7210] *(_QWORD *)(a1 + 184) = v5;
[7217, 7220] if ( v5 )
{
[7225, 7227, 7222] terminal_set(a1, 0LL);
[7232, 7239] terminal_init_arrow_isra_0(*(_QWORD *)(a1 + 200));
[7247] return 0LL;
}
[7248, 7255] free(*(void **)(a1 + 176));
[7260] *(_QWORD *)(a1 + 176) = 0LL;
}
[7278, 7271] free(*(void **)(a1 + 200));
[7283] *(_QWORD *)(a1 + 200) = 0LL;
}
[7301, 7294] free(*(void **)(a1 + 192));
[7306] *(_QWORD *)(a1 + 192) = 0LL;
}
[7324, 7317] free(*(void **)(a1 + 160));
[7329] result = 0xFFFFFFFFLL;
[7334] *(_QWORD *)(a1 + 160) = 0LL;
[7244, 7246] return result;
[7345, 7346, 7350, 7351] }
//----- (0000000000001CC0) ----------------------------------------------------
int terminal__putc(long a1, long a2)
[7360] {
long v2; // rax
FILE *v3; // rsi
FILE *v4; // r12
const char *v5; // rax
char v7[24]; // [rsp+0h] [rbp-38h] BYREF
unsigned long v8; // [rsp+18h] [rbp-20h]
[7360, 7364, 7366, 7367, 7371, 7380] v8 = __readfsqword(0x28u);
[7385] LODWORD(v2) = 0;
[7392, 7387, 7390] if ( (_DWORD)a2 != -1 )
{
[7397, 7399] if ( (int)a2 < 0 )
{
[7472] v4 = *(FILE **)(a1 + 16);
[7395, 7476] v5 = (const char *)literal_get(a1, a2, (unsigned int)a2);
[7481, 7492, 7484, 7487] LODWORD(v2) = fputs(v5, v4);
}
else
{
[7395, 7401, 7404, 7409, 7412] v2 = ct_encode_char(v7, 16LL, (unsigned int)a2);
[7417, 7420] if ( v2 > 0 )
{
[7422] v3 = *(FILE **)(a1 + 16);
[7429] v7[v2] = 0;
[7426, 7433, 7438, 7443, 7452] LODWORD(v2) = fputs(v7, v3);
}
}
}
[7454] return v2;
[7458, 7459, 7461] }
// 4780: using guessed type long ct_encode_char(_QWORD, _QWORD, _QWORD);
// 4808: using guessed type long literal_get(_QWORD, _QWORD, _QWORD);
// 1CC0: using guessed type char var_38[24];
//----- (0000000000001D50) ----------------------------------------------------
unsigned long terminal_overwrite(long a1, unsigned int *a2, unsigned long a3)
[7504] {
unsigned long v4; // rbp
long v5; // rsi
int v6; // eax
int v7; // edx
int v8; // eax
long v9; // rdx
int v10; // ecx
long v11; // rdx
long v12; // rax
unsigned int v14; // [rsp+4h] [rbp-24h] BYREF
unsigned long v15; // [rsp+8h] [rbp-20h]
[7525, 7504, 7508, 7510, 7511, 7512, 7516] v15 = __readfsqword(0x28u);
[7530, 7532, 7535] if ( a3 )
{
[7554, 7548, 7551] v4 = a3;
[7560, 7566, 7541, 7557] if ( *(int *)(a1 + 144) >= a3 )
{
do
{
[7568] v5 = *a2++;
[7579, 7572, 7575] terminal__putc(a1, v5);
[7584, 7587] v6 = *(_DWORD *)(a1 + 48) + 1;
[7590] *(_DWORD *)(a1 + 48) = v6;
[7593] --v4;
}
[7597] while ( v4 );
[7599] v7 = *(_DWORD *)(a1 + 144);
[7605, 7607] if ( v6 >= v7 )
{
[7613] v8 = *(_DWORD *)(a1 + 152);
[7619, 7621] if ( (v8 & 0x80u) == 0 )
{
[7776, 7779, 7782] *(_DWORD *)(a1 + 48) = v7 - 1;
}
else
{
[7627] v9 = *(int *)(a1 + 52);
[7631] *(_DWORD *)(a1 + 48) = 0;
[7638] v10 = v9 + 1;
[7641, 7638, 7647] if ( (int)v9 + 1 < *(_DWORD *)(a1 + 148) )
{
[7649] *(_DWORD *)(a1 + 52) = v10;
[7652] v9 = v10;
}
[7658, 7655] if ( (v8 & 0x100) != 0 )
{
[7664, 7660, 7668, 7670] v14 = **(_DWORD **)(*(_QWORD *)(a1 + 56) + 8 * v9);
[7674, 7676] if ( v14 )
{
[7688, 7691, 7683, 7678] terminal_overwrite(a1, &v14, 1uLL);
[7696, 7700, 7708] v11 = *(_QWORD *)(*(_QWORD *)(a1 + 56) + 8LL * *(int *)(a1 + 52));
[7704, 7712, 7715, 7722] v12 = *(_DWORD *)(a1 + 48) + 1;
[7704, 7726, 7724, 7718] if ( *(_DWORD *)(v11 + 4LL * *(int *)(a1 + 48)) == -1 )
{
do
[7728] *(_DWORD *)(a1 + 48) = v12++;
[7731, 7740, 7742, 7735] while ( *(_DWORD *)(v11 + 4 * v12 - 4) == -1 );
}
}
else
{
[7784, 7787] terminal__putc_constprop_0(a1);
[7792, 7799] *(_DWORD *)(a1 + 48) = 1;
}
}
}
}
}
}
[7744, 7760, 7749, 7758] return __readfsqword(0x28u) ^ v15;
[7768, 7764, 7765, 7766] }
//----- (0000000000001E80) ----------------------------------------------------
void terminal_move_to_char(long a1, int a2)
[7808] {
int v2; // edx
int v4; // r12d
const char *v5; // rdi
const char *v6; // rdi
signed int v7; // edx
int v8; // r12d
long v9; // rax
signed int v10; // r12d
int v11; // r13d
char *v12; // rax
int v13; // edx
char *v14; // rax
signed int v15; // [rsp+0h] [rbp-2Ch]
[7808, 7812] v2 = *(_DWORD *)(a1 + 48);
[7817, 7815] if ( a2 == v2 )
[7817] return;
[7843, 7845, 7846, 7849, 7853, 7855, 7857] if ( !a2 )
{
[8084, 8082, 8076] if ( *(int *)(a1 + 144) >= 0 )
{
[8086] terminal__putc_constprop_1(a1);
[8091] *(_DWORD *)(a1 + 48) = 0;
}
[8098, 8102, 8103, 8104, 8106, 8108] return;
}
[7897] while ( 1 )
{
[7897, 7903] if ( a2 > *(_DWORD *)(a1 + 144) )
[7903] return;
[7912, 7909] v4 = a2 - v2;
[7912, 7920, 7915, 7923] if ( (unsigned int)(a2 - v2 + 4) > 8 )
{
[7932, 7925] v5 = *(const char **)(*(_QWORD *)(a1 + 176) + 32LL);
[7936, 7939] if ( v5 )
{
[7944, 7941] if ( *v5 )
{
[8291, 8293, 8295] v12 = tgoto(v5, a2, a2);
[8304, 8306, 8300, 8309] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v12, a2);
[8314] goto LABEL_18;
}
}
}
[7953, 7950] if ( v4 > 0 )
break;
[7963, 7959] if ( v4 < -4 )
{
[7972, 7965] v6 = *(const char **)(*(_QWORD *)(a1 + 176) + 264LL);
[7979, 7982] if ( v6 )
{
[7984, 7987] if ( *v6 )
{
[8319] v13 = v2 - a2;
[8321] v4 = v13;
goto LABEL_36;
}
}
}
[7993] v7 = v2 - a2;
[8002, 7995] if ( (*(_BYTE *)(a1 + 152) & 8) != 0 )
{
[7840, 8008, 8011, 7823, 7825, 7827, 7830, 7832, 7836, 7839] if ( (a2 & 7) + ((unsigned int)a2 >> 3) >= v7 )
{
LABEL_16:
[8017] v8 = 0;
[8024, 8020, 8022] if ( v7 > 0 )
{
do
{
[8040] v15 = v7;
[8044] ++v8;
[8032, 8048, 8037] terminal__putc(a1, 8LL);
[8053] v7 = v15;
}
[8057, 8060] while ( v15 != v8 );
}
goto LABEL_18;
}
}
[7872, 7874] else if ( v7 <= a2 )
{
goto LABEL_16;
}
[7880, 7883] terminal__putc_constprop_1(a1);
[7888] *(_DWORD *)(a1 + 48) = 0;
[7895] v2 = 0;
}
[8112, 8116] if ( v4 > 4 )
{
[8125, 8118] v6 = *(const char **)(*(_QWORD *)(a1 + 176) + 272LL);
[8132, 8135] if ( v6 )
{
[8137, 8140] if ( *v6 )
{
[8352, 8355] v13 = a2 - v2;
LABEL_36:
[8324, 8327] v14 = tgoto(v6, v4, v13);
[8332, 8336, 8339, 8342, 8347] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v14, v4);
LABEL_18:
[8065, 8069, 8070, 8071, 8073, 8062] *(_DWORD *)(a1 + 48) = a2;
[8062] return;
}
}
}
[8154, 8146, 8150] v9 = *(_QWORD *)(*(_QWORD *)(a1 + 56) + 8LL * *(int *)(a1 + 52));
[8196, 8165, 8167, 8200, 8170, 8176, 8180, 8190, 8183, 8186, 8188, 8158] if ( (*(_BYTE *)(a1 + 152) & 8) == 0
|| (v10 = a2 & 0xFFFFFFF8, v11 = v2 & 0xF8, v11 == (a2 & 0xFFFFFFF8))
|| *(_DWORD *)(v9 + 4LL * ((unsigned char)a2 & 0xF8)) == -1 )
{
[8256] v10 = *(_DWORD *)(a1 + 48);
}
else
{
[8202, 8205, 8207] if ( v11 < v10 )
{
do
{
[8216] v11 += 8;
[8208, 8220, 8213] terminal__putc(a1, 9LL);
}
[8225, 8228] while ( v10 > v11 );
[8238, 8234, 8230] v9 = *(_QWORD *)(*(_QWORD *)(a1 + 56) + 8LL * *(int *)(a1 + 52));
}
[8242, 8246] *(_DWORD *)(a1 + 48) = v10;
}
[8260, 8262, 8265, 8268, 8271, 8274, 8278] terminal_overwrite(a1, (unsigned int *)(v9 + 4LL * v10), a2 - v10);
[8283, 8286] *(_DWORD *)(a1 + 48) = a2;
[8075, 8357] }
//----- (00000000000020B0) ----------------------------------------------------
void terminal_insertwrite(long a1, unsigned int *a2, int a3)
[8368] {
_QWORD *v5; // rax
unsigned int *v6; // r12
const char *v7; // rdi
_BYTE *v8; // rdx
const char *v9; // rsi
_BYTE *v10; // rdx
long v11; // rbx
long v12; // rsi
long v13; // rax
const char *v14; // rsi
const char *v15; // rsi
char *v16; // rax
long v17; // rbx
long v18; // rsi
long v19; // rax
FILE *v20; // rdi
const char *v21; // rsi
[8386, 8387, 8394, 8368, 8400, 8402, 8372, 8374, 8408, 8380, 8382, 8383] if ( a3 > 0 && (*(_BYTE *)(a1 + 152) & 1) != 0 && *(_DWORD *)(a1 + 144) >= a3 )
{
[8414] v5 = *(_QWORD **)(a1 + 176);
[8421] v6 = a2;
[8424] v7 = (const char *)v5[32];
[8450, 8454, 8457, 8431, 8463, 8434, 8466, 8436, 8439, 8472, 8441, 8444] if ( !v7 || !*v7 || a3 == 1 && (v8 = (_BYTE *)v5[13]) != 0LL && *v8 )
{
[8480] v9 = (const char *)v5[14];
[8484, 8487, 8489, 8492, 8494, 8498, 8501, 8503, 8506] if ( v9 && *v9 && (v10 = (_BYTE *)v5[10]) != 0LL && *v10 )
{
[8689, 8698, 8693] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v9, 1);
[8706] *(_DWORD *)(a1 + 48) += a3;
[8714, 8709, 8703] v17 = (long)&v6[a3 - 1 + 1];
do
{
[8720] v18 = *v6++;
[8728, 8731, 8724] terminal__putc(a1, v18);
}
[8736, 8739] while ( v6 != (unsigned int *)v17 );
[8741] v19 = *(_QWORD *)(a1 + 176);
[8748] v20 = *(FILE **)(a1 + 16);
[8752] v21 = *(const char **)(v19 + 120);
[8761, 8756, 8764, 8759] if ( v21 && *v21 )
{
[8784, 8789] terminal_tputs_isra_0(v20, v21, 1);
[8794] v19 = *(_QWORD *)(a1 + 176);
[8801, 8805] v20 = *(FILE **)(a1 + 16);
}
[8770, 8771, 8776, 8777, 8779, 8766] terminal_tputs_isra_0(v20, *(const char **)(v19 + 80), 1);
}
else
{
[8512, 8520, 8515] v11 = (long)&v6[a3 - 1 + 1];
[8581] while ( 1 )
{
[8581] v15 = (const char *)v5[13];
[8585, 8593, 8588, 8590] if ( v15 && *v15 )
[8609, 8595, 8604, 8599] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v15, 1);
[8528] v12 = *v6++;
[8539, 8532, 8535] terminal__putc(a1, v12);
[8544] v13 = *(_QWORD *)(a1 + 176);
[8551] ++*(_DWORD *)(a1 + 48);
[8555] v14 = *(const char **)(v13 + 120);
[8562, 8559] if ( v14 )
{
[8564, 8567] if ( *v14 )
[8624, 8633, 8628, 8638] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v14, 1);
}
[8569, 8572] if ( v6 == (unsigned int *)v11 )
break;
[8574] v5 = *(_QWORD **)(a1 + 176);
}
}
}
else
{
[8648, 8650, 8652] v16 = tgoto(v7, a3, a3);
[8657, 8666, 8661, 8663] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v16, a3);
[8674, 8677, 8678, 8681, 8682, 8684, 8671] terminal_overwrite(a1, a2, a3);
}
}
[8640, 8620] }
//----- (0000000000002270) ----------------------------------------------------
int terminal_beep(long a1)
[8816] {
const char *v1; // rsi
[8816, 8827, 8820] v1 = *(const char **)(*(_QWORD *)(a1 + 176) + 8LL);
[8839, 8834, 8836, 8831] if ( v1 && *v1 )
[8856, 8865, 8860] return terminal_tputs_isra_0(*(FILE **)(a1 + 16), v1, 1);
else
[8841, 8846] return terminal__putc(a1, 7LL);
}
//----- (00000000000022B0) ----------------------------------------------------
int terminal__flush(long a1)
[8880] {
[8880, 8884, 8888] return fflush(*(FILE **)(a1 + 16));
}
//----- (00000000000022C0) ----------------------------------------------------
unsigned long terminal_writec(long a1, unsigned int a2)
[8896] {
long v2; // rax
unsigned long v3; // rdx
int v5[10]; // [rsp+0h] [rbp-48h] BYREF
unsigned long v6; // [rsp+28h] [rbp-20h]
[8896, 8931, 8900, 8933, 8909, 8910, 8913, 8917, 8926] v6 = __readfsqword(0x28u);
[8904, 8936, 8939, 8902] v2 = ct_visual_char(v5, 8LL, a2);
[8944] v3 = 0LL;
[8958] if ( v2 >= 0 )
[8952, 8955, 8958] v3 = v2;
[8962] v5[v3] = 0;
[8969, 8949] terminal_overwrite(a1, (unsigned int *)v5, v3);
[8977, 8974] terminal__flush(a1);
[8998, 8987, 8996, 8982] return __readfsqword(0x28u) ^ v6;
[9002, 9003, 9005] }
// 4818: using guessed type long ct_visual_char(_QWORD, _QWORD, _QWORD);
// 22C0: using guessed type unsigned int var_48[10];
//----- (0000000000002340) ----------------------------------------------------
long terminal_telltc(long a1)
[9024] {
const char *v2; // rcx
const char *v3; // rcx
const char *v4; // rcx
long v5; // rdx
long v6; // rcx
int v7; // eax
const char *v8; // rcx
_BYTE **v9; // r13
const char *v10; // r8
char **v11; // rbx
const char *v12; // rcx
_BYTE *v13; // rdi
const char *v14; // r9
long v15; // rax
long v16; // rax
long v17; // rax
[9024, 9056, 9059, 9028, 9060, 9030, 9064, 9037, 9071, 9042, 9044, 9046, 9048, 9055] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\n\tYour terminal has the\n");
[9094, 9076, 9080, 9085, 9087] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\tfollowing characteristics:\n\n");
[9122, 9126, 9129, 9099, 9131, 9106, 9110, 9117] _fprintf_chk(
*(_QWORD *)(a1 + 16),
1LL,
"\tIt has %d columns and %d lines\n",
*(unsigned int *)(*(_QWORD *)(a1 + 184) + 12LL),
*(unsigned int *)(*(_QWORD *)(a1 + 184) + 8LL));
[9150, 9143] v2 = "a";
[9136, 9157] if ( (*(_BYTE *)(a1 + 152) & 0x40) == 0 )
[9157] v2 = "no";
[9161, 9165, 9170, 9172, 9179] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\tIt has %s meta key\n", v2);
[9198, 9191] v3 = " ";
[9184, 9205] if ( (*(_BYTE *)(a1 + 152) & 8) == 0 )
[9205] v3 = "not ";
[9218, 9220, 9227, 9209, 9213] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\tIt can%suse tabs\n", v3);
[9239] v4 = "does not have";
[9232, 9246] if ( *(char *)(a1 + 152) < 0 )
[9246] v4 = "has";
[9250, 9257, 9262, 9264, 9242] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\tIt %s automatic margins\n", v4);
[9269] v7 = *(_DWORD *)(a1 + 152);
[9275, 9277] if ( (v7 & 0x80u) != 0 )
{
[9282] v8 = "does not have";
[9296, 9305, 9300, 9279] if ( (v7 & 0x100) != 0 )
[9296] v8 = "has";
[9289, 9307, 9285] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\tIt %s magic margins\n", v8);
}
[9312] v9 = *(_BYTE ***)(a1 + 176);
[9319] v10 = "al";
[9340, 9333, 9326] v11 = tstr;
do
{
[9387] v13 = *v9;
[9391] v14 = "(empty)";
[9387, 9394, 9397, 9399, 9402] if ( *v9 && *v13 )
{
[9411, 9404, 9414, 9391] v15 = ct_decode_string(v13, a1 + 1256, v5, v6, v10, "(empty)");
[9426, 9419, 9429] v16 = ct_visual_string(v15, a1 + 1224);
[9440, 9434, 9437] v17 = ct_encode_string(v16, a1 + 1256);
[9445] v10 = *v11;
[9448, 9451] v14 = (const char *)v17;
}
[9344] v12 = v11[1];
[9366] v11 += 2;
[9370] ++v9;
[9348, 9352, 9357, 9359, 9374] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "\t%25s (%s) == %s\n", v12, v10, v14);
[9379] v10 = *v11;
}
[9385, 9379, 9382] while ( *v11 );
[9456, 9465, 9460] fputc(10, *(FILE **)(a1 + 16));
[9470, 9471] return 0LL;
[9473, 9474, 9476, 9478, 9480] }
// 24C6: variable 'v5' is possibly undefined
// 24C6: variable 'v6' is possibly undefined
// 3BC0: using guessed type char *tstr[78];
// 4770: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 4820: using guessed type long ct_decode_string(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4828: using guessed type long ct_visual_string(_QWORD, _QWORD);
// 4830: using guessed type long ct_encode_string(_QWORD, _QWORD);
//----- (0000000000002510) ----------------------------------------------------
long terminal_settc(long a1, long a2, const wchar_t **a3)
[9488] {
const wchar_t *v4; // rdi
long v6; // rax
char **v7; // rbp
long v8; // rax
const char *v9; // rdi
unsigned int v10; // r12d
char **v12; // rbp
const char *v13; // rdi
int v14; // eax
long v15; // rcx
char *v16; // [rsp+0h] [rbp-58h] BYREF
char s2[8]; // [rsp+8h] [rbp-50h] BYREF
char s1[8]; // [rsp+10h] [rbp-48h] BYREF
unsigned long v19; // [rsp+18h] [rbp-40h]
[9506, 9515, 9488, 9492, 9494, 9496, 9498, 9500, 9501, 9502] v19 = __readfsqword(0x28u);
[9538, 9541, 9544, 9550, 9520, 9522, 9555, 9525, 9531, 9534] if ( a3 && (v4 = a3[1]) != 0LL && a3[2] )
{
[9568, 9573, 9576, 9581, 9561] v6 = ct_encode_string(v4, a1 + 1256);
[9586, 9597, 9594, 9591] strlcpy(s2, v6, 8LL);
[9609] v7 = tstr;
[9616, 9602, 9606] v8 = ct_encode_string(a3[2], a1 + 1256);
[9624, 9632, 9621, 9629] strlcpy(s1, v8, 8LL);
[9644, 9637] v9 = "al";
do
{
[9664, 9669, 9661] v10 = strcmp(v9, s2);
[9672, 9674] if ( !v10 )
{
[9682, 9676, 9685, 9679] terminal_alloc((_QWORD *)a1, (long)v7, s1);
LABEL_8:
[9698, 9703, 9712, 9690, 9693] terminal_setflags(a1);
[9722, 9693] return v10;
}
[9648] v9 = v7[2];
[9652] v7 += 2;
}
[9656, 9659] while ( v9 );
[9744] v12 = tval;
[9758, 9751] v13 = "am";
[9785] while ( 1 )
{
[9777, 9780, 9785] v10 = strcmp(v13, s2);
[9788, 9790] if ( !v10 )
break;
[9760] v13 = v12[2];
[9764] v12 += 2;
[9768, 9771] if ( !v13 )
{
[10112, 10116, 10119, 10122, 10127, 10136] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "%ls: Bad capability `%s'.\n", *a3, s2);
[10136, 10147, 10141, 10134] return (unsigned int)-1;
}
}
[9792, 9825, 9827, 9830, 9799, 9833, 9835, 9837, 9806, 9809, 9841, 9844, 9816, 9819, 9822] if ( v12 == tval || v12 == off_3B30 || v12 == off_3B60 || v12 == &tval[12] )
{
[9856, 9861, 9863, 9846, 9853] if ( !strcmp(s1, "yes") )
{
[9928, 9935, 9938, 9945, 9949] *(_DWORD *)(*(_QWORD *)(a1 + 184) + 4 * (((char *)v12 - (char *)tval) >> 4)) = 1;
[9956] goto LABEL_8;
}
[9865, 9872, 9875, 9880, 9882] if ( !strcmp(s1, "no") )
{
[9888, 9895, 9898, 9905, 9909] *(_DWORD *)(*(_QWORD *)(a1 + 184) + 4 * (((char *)v12 - (char *)tval) >> 4)) = 0;
[9916] goto LABEL_8;
}
goto LABEL_27;
}
[9968, 9976, 9979, 9973] v14 = strtol(s1, &v16, 10);
[9984, 9988, 9991] if ( *v16 )
{
LABEL_27:
[10152, 10174, 10176] v10 = -1;
[10182, 10152, 10156, 10159, 10162, 10167] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "%ls: Bad value `%s'.\n", *a3, s1);
[9722, 10187] return v10;
}
[10004, 9997, 10007] v15 = *(_QWORD *)(a1 + 184);
[10017, 10021, 10014] *(_DWORD *)(v15 + 4 * (((char *)v12 - (char *)tval) >> 4)) = v14;
[10024, 10028, 10031] if ( v12 == &tval[6] )
{
[10091, 10101, 10094] *(_DWORD *)(a1 + 148) = *(_DWORD *)(v15 + 12);
}
else
{
[10040, 10033, 10043] if ( v12 != off_3B40 )
[9722, 10043] return v10;
[10049, 10052] *(_DWORD *)(a1 + 144) = *(_DWORD *)(v15 + 8);
}
[10083, 10086, 10059, 10062, 10065, 10068, 10071, 10076, 10079] return (unsigned int)-((unsigned int)terminal_change_size(a1, *(_DWORD *)(v15 + 8), *(_DWORD *)(v15 + 12)) == -1);
}
else
{
[10141] return (unsigned int)-1;
}
[9729, 9731, 9733, 9735, 9718, 9725, 9726, 9727] }
// 3B20: using guessed type char *tval[16];
// 3B30: using guessed type char *off_3B30[14];
// 3B40: using guessed type char *off_3B40[12];
// 3B60: using guessed type char *off_3B60[8];
// 3BC0: using guessed type char *tstr[78];
// 4770: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 4830: using guessed type long ct_encode_string(_QWORD, _QWORD);
// 4838: using guessed type long strlcpy(_QWORD, _QWORD, _QWORD);
// 2510: using guessed type char s2[8];
// 2510: using guessed type char s1[8];
//----- (00000000000027E0) ----------------------------------------------------
int terminal_gettc(long a1, long a2, long a3)
[10208] {
const char *v3; // r13
_QWORD *v4; // r12
const char *v6; // rdi
char **v7; // rbx
int result; // eax
const char *v9; // rdi
char **i; // rbx
int v11; // esi
[10208, 10212, 10215] if ( !a3 )
[10534] return -1;
[10221, 10223, 10225, 10227, 10228, 10229] v3 = *(const char **)(a3 + 8);
[10233, 10236] if ( !v3 )
[10236] return -1;
[10242] v4 = *(_QWORD **)(a3 + 16);
[10249, 10246] if ( !v4 )
[10496, 10497, 10502, 10503, 10505, 10507] return -1;
[10265, 10262, 10255] v6 = "al";
[10272, 10275] v7 = tstr;
do
{
[10296, 10293] result = strcmp(v6, v3);
[10301, 10303] if ( !result )
{
[10305, 10312, 10315, 10319, 10323] *v4 = *(_QWORD *)(*(_QWORD *)(a1 + 176) + 8 * (((char *)v7 - (char *)tstr) >> 4));
[10327, 10328, 10329, 10331, 10333, 10335] return result;
}
[10280] v6 = v7[2];
[10284] v7 += 2;
}
[10288, 10291] while ( v6 );
[10336, 10343] v9 = "am";
[10353, 10364, 10350] for ( i = tval; ; i += 2 )
{
[10376, 10373] result = strcmp(v9, v3);
[10381, 10383] if ( !result )
break;
[10360] v9 = i[2];
[10368, 10371] if ( !v9 )
[10371] return -1;
}
[10402, 10385, 10388, 10395, 10398] v11 = *(_DWORD *)(*(_QWORD *)(a1 + 184) + 4 * (((char *)i - (char *)tval) >> 4));
[10433, 10436, 10405, 10439, 10441, 10443, 10412, 10450, 10419, 10453, 10422, 10425, 10428, 10431] if ( i == tval || i == off_3B30 || i == off_3B60 || i == off_3B80 )
{
[10472, 10474] if ( v11 )
{
[10476, 10483, 10487, 10488, 10489, 10491, 10493] *v4 = &yes_8492;
}
else
{
[10512, 10519] *v4 = &no_8493;
[10529, 10531, 10523, 10525, 10526, 10527] return 0;
}
}
else
{
[10465, 10455, 10459, 10460, 10461, 10463] *(_DWORD *)v4 = v11;
}
[10335] return result;
[10467, 10533, 10539, 10509, 10495] }
// 3B20: using guessed type char *tval[16];
// 3B30: using guessed type char *off_3B30[14];
// 3B60: using guessed type char *off_3B60[8];
// 3B80: using guessed type char *off_3B80[4];
// 3BC0: using guessed type char *tstr[78];
//----- (0000000000002930) ----------------------------------------------------
long terminal_echotc(long a1, long a2, long a3)
[10544] {
unsigned int *v3; // r14
const wchar_t **v5; // rbp
_BOOL4 v6; // r13d
unsigned int v7; // r15d
const char **v8; // r12
int v9; // eax
char *v10; // r9
const char *v11; // rax
int v12; // eax
char *v13; // r8
char *v14; // r12
char v15; // al
char *v16; // rdx
char v17; // cl
const wchar_t *v18; // rdi
long v19; // r15
const wchar_t *v20; // rdi
long v21; // r13
const wchar_t *v22; // rcx
int v23; // esi
char *v24; // rax
unsigned int v26; // eax
bool v27; // zf
long v28; // rdi
const char *v29; // rcx
char *v30; // rax
char v31; // dl
long v32; // rcx
const wchar_t *v33; // rdi
long v34; // rdx
char *v35; // rax
const wchar_t *v36; // rcx
int v37; // [rsp+Ch] [rbp-86Ch]
char *v38; // [rsp+10h] [rbp-868h]
char *v39; // [rsp+10h] [rbp-868h]
char *v40; // [rsp+18h] [rbp-860h]
wchar_t *endptr; // [rsp+20h] [rbp-858h] BYREF
char *v42; // [rsp+28h] [rbp-850h] BYREF
char v43; // [rsp+30h] [rbp-848h] BYREF
unsigned long v44; // [rsp+838h] [rbp-40h]
[10565, 10574, 10544, 10548, 10550, 10552, 10554, 10556, 10557, 10558] v44 = __readfsqword(0x28u);
[10584, 10589, 10582] v42 = &v43;
[10594, 10597] if ( !a3 )
[11840, 10597] return (unsigned int)-1;
[10603] v3 = *(unsigned int **)(a3 + 8);
[10610, 10607] if ( !v3 )
[11840, 10610] return (unsigned int)-1;
[10616, 10620, 10623] if ( *v3 == 45 )
{
[11336] v26 = v3[1];
[11340, 11343] if ( v26 == 115 )
{
[11488] v37 = 1;
[11496, 11499] v6 = 0;
}
else
{
[11349] v37 = 0;
[11360, 11363, 11357] v6 = v26 == 118;
}
[11367] v3 = *(unsigned int **)(a3 + 16);
[11371] v5 = (const wchar_t **)(a3 + 16);
[11375] v7 = 0;
[11378, 11381, 11383] if ( !v3 )
[11381, 11318] return v7;
}
else
{
[10629] v37 = 0;
[10637] v5 = (const wchar_t **)(a3 + 8);
[10641] v6 = 0;
}
[10650, 10644, 10647] v7 = *v3;
[10644] if ( *v3 )
{
[10656, 10671, 10666, 10663] v7 = wcscmp((const wchar_t *)v3, &LC42);
[10674, 10676] if ( v7 )
{
[10689, 10682, 10692, 10697] v7 = wcscmp((const wchar_t *)v3, &LC43);
[10700, 10702] if ( v7 )
{
[10715, 10708, 10718, 10723] v7 = wcscmp((const wchar_t *)v3, &LC44);
[10728, 10726] if ( v7 )
{
[10744, 10749, 10741, 10734] v7 = wcscmp((const wchar_t *)v3, &LC45);
[10752, 10754] if ( v7 )
{
[10760, 10770, 10775, 10767] v7 = wcscmp((const wchar_t *)v3, &LC46);
[10778, 10780] if ( !v7 )
{
[11584] v32 = *(unsigned int *)(a1 + 772);
goto LABEL_59;
}
[10816, 10786, 10819, 10824, 10793, 10826, 10796, 10801, 10803, 10809] if ( !wcscmp((const wchar_t *)v3, &LC47) || !wcscmp((const wchar_t *)v3, &LC48) )
{
[11536, 11531] v7 = 0;
[11520, 11527, 11539, 11546, 11549, 11551] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "%d\n", *(unsigned int *)(*(_QWORD *)(a1 + 184) + 8LL));
[11556, 11318] return v7;
}
[10842] v8 = (const char **)tstr;
[10832, 10849, 10839] v9 = wcscmp((const wchar_t *)v3, &LC49);
[10854] v10 = (char *)(a1 + 1256);
[10861] v7 = v9;
[10864, 10866, 10868] if ( !v9 )
{
[11858, 11851, 11861] v32 = *(unsigned int *)(*(_QWORD *)(a1 + 184) + 12LL);
LABEL_59:
[11590, 11594, 11601, 11606, 11608] _fprintf_chk(*(_QWORD *)(a1 + 16), 1LL, "%d\n", v32);
[11613, 11318] return v7;
}
do
{
[10905] v38 = v10;
[10910, 10899, 10902] v11 = (const char *)ct_encode_string(v3, v10);
[10922, 10915, 10919] v12 = strcmp(*v8, v11);
[10927] v10 = v38;
[10932, 10934] if ( !v12 )
{
[10946, 10953, 10957, 10936, 10943] v14 = *(char **)(*(_QWORD *)(a1 + 176) + 8 * (((char *)v8 - (char *)tstr) >> 4));
goto LABEL_18;
}
[10880] v8 += 2;
[10884] v3 = (unsigned int *)*v5;
}
[10888, 10893] while ( *v8 );
[11624, 11627, 11630] v30 = (char *)ct_encode_string(*v5, v38);
[11648, 11651, 11635, 11640, 11643] v14 = tgetstr(v30, &v42);
LABEL_18:
[10977, 10961, 10964, 10970, 10975] if ( !v14 || (v15 = *v14) == 0 )
{
[12112, 12107] if ( !v37 )
{
[12140] v7 = -1;
[12131, 12133, 12144, 12118, 12122, 12126] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "echotc: Termcap parameter `%ls' not found.\n", *v5);
[12149, 11318] return v7;
}
[11840, 12112] return (unsigned int)-1;
}
[10986, 10983] if ( v6 )
{
[11664] v13 = v14;
[11667, 11677, 11670] v7 = 0;
do
{
[11693] v31 = v13[1];
[11704, 11698, 11702] if ( v15 == 37 )
{
[11706, 11709] v10 = v13 + 2;
[11713, 11715, 11717, 11720, 11724, 11727] switch ( v31 )
{
case '%':
case '>':
case 'B':
case 'D':
case 'i':
case 'n':
case 'r':
goto LABEL_68;
case '+':
case '.':
case '2':
case '3':
case 'd':
[11792] ++v7;
LABEL_68:
[11796] v15 = v13[2];
[11801] v13 += 2;
[11804] break;
default:
[11757] v40 = v13 + 2;
[11762] v39 = v13;
[11748, 11750, 11767, 11736, 11740, 11743] _fprintf_chk(
*(_QWORD *)(a1 + 24),
1LL,
"echotc: Warning: unknown termcap %% `%c'.\n",
(unsigned int)v31);
[11777, 11772] v10 = v40;
[11782] v15 = v39[2];
[11787] v13 = v40;
[11790] break;
}
}
else
{
[11680] ++v13;
[11683] v15 = v31;
}
}
[11685, 11687] while ( v15 );
}
else
{
[10992] v7 = 0;
[10995, 11005, 10998] v16 = v14;
do
{
[11017] v17 = v16[1];
[11021, 11025, 11027, 11029, 11032] if ( v15 == 37 )
{
[11045, 11048, 11052, 11055, 11036, 11039] switch ( v17 )
{
case '+':
case '.':
case '2':
case '3':
case 'd':
[11561] ++v7;
break;
default:
break;
}
[11565] v15 = v16[2];
[11569, 11572] v16 += 2;
}
else
{
[11008] ++v16;
[11011] v15 = v17;
}
}
[11013, 11015] while ( v15 );
}
[11064, 11068] if ( v7 == 1 )
{
[11866] v33 = v5[1];
[11873, 11879, 11882, 11885, 11870] if ( !v33 || !*v33 )
goto LABEL_82;
[11896, 11906, 11891, 11901] v34 = wcstol(v33, &endptr, 10);
[11909, 11914, 11917, 11920, 11926, 11929] if ( *endptr || v34 < 0 )
{
[12258, 12253] if ( !v37 )
{
[12264] v36 = v5[1];
[12268] goto LABEL_88;
}
[11840, 11846] return (unsigned int)-1;
}
[11935] v22 = v5[2];
[11939, 11942, 11944, 11947, 11950] if ( !v22 || !*v22 )
{
[11961] v7 = 0;
[11964, 11956, 11958] v35 = tgoto(v14, 0, v34);
[11981, 11969, 11978, 11973] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v35, 1);
[11986, 11318] return v7;
}
}
else
{
[11074, 11078] if ( v7 == 2 )
{
LABEL_31:
[11098] v18 = v5[1];
[11105, 11102] if ( v18 )
{
[11111] v13 = (char *)*(unsigned int *)v18;
[11114, 11117] if ( (_DWORD)v13 )
{
[11136, 11141, 11123, 11128, 11133] v19 = wcstol(v18, &endptr, 10);
[11144, 11149, 11151, 11153, 11159, 11162] if ( *endptr || v19 < 0 )
{
[12211, 12206] if ( !v37 )
{
[12239] v7 = -1;
[12225, 12230, 12232, 12243, 12217, 12221] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "echotc: Bad value `%ls' for cols.\n", v5[1]);
[12248, 11318] return v7;
}
[11840, 12211] return (unsigned int)-1;
}
[11168] v20 = v5[2];
[11172, 11175] if ( v20 )
{
[11185, 11181, 11183] if ( *v20 )
{
[11199, 11204, 11196, 11191] v21 = wcstol(v20, &endptr, 10);
[11207, 11212, 11214, 11216, 11222, 11225] if ( !*endptr && v21 >= 0 )
{
[11231] v22 = v5[3];
[11235, 11238, 11240, 11242, 11244] if ( !v22 || !*v22 )
{
[11250] v23 = v19;
[11259] v7 = 0;
[11256, 11253, 11262] v24 = tgoto(v14, v23, v21);
[11296, 11267, 11271, 11305, 11274, 11277, 11282, 11288] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v24, v21);
[11277, 11318] return v7;
}
goto LABEL_69;
}
[12164, 12159] if ( !v37 )
{
[12170] v36 = v5[2];
LABEL_88:
[12185, 12178, 12174, 12183] v7 = -1;
[12196, 12189, 12174] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "echotc: Bad value `%ls' for rows.\n", v36);
[12201, 11318] return v7;
}
[11840, 12164] return (unsigned int)-1;
}
}
}
}
LABEL_82:
[12067, 12069, 12063] if ( !v37 )
{
[12084, 12086, 12079] v7 = -1;
[12097, 12090, 12075] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "echotc: Warning: Missing argument.\n", 0LL, v13, v10);
[12102, 11318] return v7;
}
[11840, 12069] return (unsigned int)-1;
}
[11080, 11083] if ( v7 )
{
[11089, 11092] if ( v6 )
[12032, 12036, 12039, 12046, 12048, 12053, 12058] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "echotc: Warning: Too many required arguments (%d).\n", v7);
goto LABEL_31;
}
[11991] v22 = v5[1];
[12000, 12002, 12004, 11995, 11998] if ( !v22 || !*v22 )
{
[12022, 12010, 12019, 12014] terminal_tputs_isra_0(*(FILE **)(a1 + 16), v14, 1);
[12027, 11318] return v7;
}
}
LABEL_69:
[11811, 11806] if ( !v37 )
[11817, 11836, 11813, 11831] _fprintf_chk(*(_QWORD *)(a1 + 24), 1LL, "echotc: Warning: Extra argument `%ls'.\n", v22);
[11824, 11840, 11829, 11831] return (unsigned int)-1;
}
[11504, 11511] v27 = *(_BYTE *)(a1 + 152) >= 0;
}
else
{
[11448, 11455] v27 = (*(_BYTE *)(a1 + 153) & 1) == 0;
}
}
else
{
[11464, 11475, 11478, 11471] v27 = *(_DWORD *)(*(_QWORD *)(a1 + 184) + 16LL) == 0;
}
}
else
{
[11392] v27 = (*(_BYTE *)(a1 + 152) & 8) == 0;
}
[11406, 11399] v28 = *(_QWORD *)(a1 + 16);
[11410] v29 = "yes";
[11422] if ( v27 )
[11417, 11422] v29 = "no";
[11440, 11433, 11426, 11435] _fprintf_chk(v28, 1LL, "%s\n", v29);
}
[11318, 11311] return v7;
[11329, 11331, 11321, 11322, 11323, 11325, 11327] }
// 2F41: variable 'v13' is possibly undefined
// 2F41: variable 'v10' is possibly undefined
// 3BC0: using guessed type char *tstr[78];
// 4770: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 4830: using guessed type long ct_encode_string(_QWORD, _QWORD);
// nfuncs=76 queued=40 decompiled=40 lumina nreq=0 worse=0 better=0
// ALL OK, 40 function(s) have been successfully decompiled
|
_BOOL8 terminal_get_size(long a1, _DWORD *a2, _DWORD *a3)
[8882] {
unsigned short v5; // [rsp+20h] [rbp-10h] BYREF
unsigned short v6; // [rsp+22h] [rbp-Eh]
unsigned long v7; // [rsp+28h] [rbp-8h]
[8898, 8902, 8906, 8882, 8915, 8886, 8887, 8890, 8894] v7 = __readfsqword(0x28u);
[8932, 8935, 8939, 8919, 8921, 8925] *a3 = *(_DWORD *)(*(_QWORD *)(a1 + 184) + 12LL);
[8941, 8945, 8952, 8955, 8959] *a2 = *(_DWORD *)(*(_QWORD *)(a1 + 184) + 8LL);
[8992, 8961, 8965, 8968, 8972, 8977, 8979, 8984, 8989] if ( ioctl(*(_DWORD *)(a1 + 32), 0x5413uLL, &v5) != -1 )
{
[9001, 8994, 8998] if ( v6 )
[9010, 9003, 9014, 9007] *a3 = v6;
[9016, 9020, 9023] if ( v5 )
[9032, 9025, 9036, 9029] *a2 = v5;
}
[9088, 9090, 9092, 9097, 9124, 9038, 9042, 9049, 9053, 9055, 9059, 9061, 9063, 9065, 9069, 9076, 9080, 9082, 9086] return *(_DWORD *)(*(_QWORD *)(a1 + 184) + 12LL) != *a3 || *(_DWORD *)(*(_QWORD *)(a1 + 184) + 8LL) != *a2;
[9125] }
//----- (00000000000023A6) ----------------------------------------------------
long terminal_change_size(long a1, int a2, int a3)
[9126] {
int v3; // eax
int v4; // eax
long v6; // [rsp+18h] [rbp-8h]
[9152, 9156, 9126, 9130, 9131, 9134, 9138, 9142, 9145, 9148] v6 = *(_QWORD *)(a1 + 48);
[9160, 9164] if ( a3 <= 1 )
[9171] v3 = 80;
else
[9169, 9166] v3 = a3;
[9176, 9187, 9180, 9191] *(_DWORD *)(*(_QWORD *)(a1 + 184) + 12LL) = v3;
[9193, 9197] if ( a2 <= 0 )
[9204] v4 = 24;
else
[9202, 9199] v4 = a2;
[9224, 9209, 9220, 9213] *(_DWORD *)(*(_QWORD *)(a1 + 184) + 8LL) = v4;
[9226, 9230, 9233, 9238, 9241] if ( (unsigned int)terminal_rebuffer_display(a1) == -1 )
[9248, 9243] return 0xFFFFFFFFLL;
[9257, 9250, 9254] re_clear_display(a1);
[9270, 9266, 9274, 9262] *(_QWORD *)(a1 + 48) = v6;
[9279] return 0LL;
[9280] }
// 5808: using guessed type long re_clear_display(_QWORD);
//----- (0000000000002441) ----------------------------------------------------
long terminal_init_arrow(long a1)
[9281] {
long result; // rax
long v2; // [rsp+10h] [rbp-8h]
[9281, 9285, 9286, 9289, 9293, 9297, 9304] v2 = *(_QWORD *)(a1 + 200);
[9312, 9308, 9319] *(_QWORD *)v2 = "d";
[9322, 9326] *(_DWORD *)(v2 + 8) = 16;
[9337, 9333] *(_BYTE *)(v2 + 16) = 15;
[9345, 9341] *(_DWORD *)(v2 + 24) = 0;
[9352, 9356, 9360, 9367] *(_QWORD *)(v2 + 32) = "u";
[9378, 9370, 9374] *(_DWORD *)(v2 + 40) = 19;
[9385, 9393, 9389] *(_BYTE *)(v2 + 48) = 18;
[9401, 9397, 9405] *(_DWORD *)(v2 + 56) = 0;
[9416, 9420, 9412, 9427] *(_QWORD *)(v2 + 64) = "l";
[9434, 9438, 9430] *(_DWORD *)(v2 + 72) = 17;
[9449, 9445, 9453] *(_BYTE *)(v2 + 80) = 17;
[9457, 9465, 9461] *(_DWORD *)(v2 + 88) = 0;
[9472, 9480, 9476, 9487] *(_QWORD *)(v2 + 96) = "r";
[9490, 9498, 9494] *(_DWORD *)(v2 + 104) = 18;
[9505, 9509, 9513] *(_BYTE *)(v2 + 112) = 14;
[9521, 9525, 9517] *(_DWORD *)(v2 + 120) = 0;
[9536, 9547, 9532, 9540] *(_QWORD *)(v2 + 128) = "h";
[9558, 9554, 9550] *(_DWORD *)(v2 + 136) = 36;
[9569, 9573, 9565] *(_BYTE *)(v2 + 144) = 11;
[9577, 9581, 9585] *(_DWORD *)(v2 + 152) = 0;
[9592, 9609, 9602, 9596] *(_QWORD *)(v2 + 160) = "e";
[9616, 9612, 9622] *(_DWORD *)(v2 + 168) = 37;
[9633, 9629, 9639] *(_BYTE *)(v2 + 176) = 12;
[9643, 9653, 9647] *(_DWORD *)(v2 + 184) = 0;
[9664, 9660, 9677, 9670] *(_QWORD *)(v2 + 192) = "d";
[9680, 9690, 9684] *(_DWORD *)(v2 + 200) = 38;
[9697, 9707, 9701] *(_BYTE *)(v2 + 208) = 3;
[9715, 9711] result = v2 + 192;
[9721] *(_DWORD *)(v2 + 216) = 0;
[9728, 9729] return result;
[9730] }
//----- (0000000000002603) ----------------------------------------------------
long terminal_reset_arrow(long a1)
[9731] {
long result; // rax
unsigned int *v2; // [rsp+18h] [rbp-8h]
[9731, 9735, 9736, 9739, 9743, 9747, 9751, 9758] v2 = *(unsigned int **)(a1 + 200);
[9762, 9794, 9766, 9801, 9770, 9804, 9773, 9777, 9781, 9785, 9789, 9791] keymacro_add(a1, &strA_7375, v2 + 12, v2[14]);
[9824, 9828, 9830, 9833, 9840, 9809, 9843, 9813, 9816, 9820] keymacro_add(a1, &strB_7376, v2 + 4, v2[6]);
[9856, 9890, 9859, 9863, 9867, 9880, 9871, 9875, 9877, 9848, 9852, 9887] keymacro_add(a1, &strC_7377, v2 + 28, v2[30]);
[9922, 9924, 9895, 9927, 9899, 9934, 9903, 9937, 9906, 9910, 9914, 9918] keymacro_add(a1, &strD_7378, v2 + 20, v2[22]);
[9984, 9953, 9957, 9961, 9965, 9969, 9971, 9942, 9974, 9946, 9981, 9950] keymacro_add(a1, &strH_7379, v2 + 36, v2[38]);
[10016, 10020, 9989, 10022, 9993, 10025, 9999, 10032, 10002, 10035, 10006, 10012] keymacro_add(a1, &strF_7380, v2 + 44, v2[46]);
[10048, 10082, 10051, 10055, 10059, 10063, 10067, 10072, 10069, 10040, 10044, 10079] keymacro_add(a1, &stOA_7381, v2 + 12, v2[14]);
[10118, 10087, 10121, 10091, 10094, 10098, 10102, 10106, 10108, 10111] keymacro_add(a1, &stOB_7382, v2 + 4, v2[6]);
[10145, 10149, 10153, 10155, 10126, 10158, 10130, 10165, 10134, 10168, 10137, 10141] keymacro_add(a1, &stOC_7383, v2 + 28, v2[30]);
[10177, 10212, 10181, 10215, 10184, 10188, 10192, 10205, 10196, 10200, 10202, 10173] keymacro_add(a1, &stOD_7384, v2 + 20, v2[22]);
[10243, 10247, 10249, 10220, 10252, 10224, 10259, 10228, 10262, 10231, 10235, 10239] keymacro_add(a1, &stOH_7385, v2 + 36, v2[38]);
[10277, 10310, 10280, 10313, 10284, 10290, 10294, 10298, 10267, 10300, 10303, 10271] keymacro_add(a1, &stOF_7386, v2 + 44, v2[46]);
[10322, 10318] result = *(unsigned int *)(a1 + 1056);
[10328, 10331] if ( (_DWORD)result == 1 )
{
[10337, 10369, 10341, 10376, 10345, 10379, 10348, 10352, 10356, 10360, 10364, 10366] keymacro_add(a1, &unk_4EC4, v2 + 12, v2[14]);
[10403, 10405, 10408, 10415, 10384, 10418, 10388, 10391, 10395, 10399] keymacro_add(a1, &unk_4ED4, v2 + 4, v2[6]);
[10465, 10434, 10438, 10442, 10446, 10450, 10452, 10423, 10455, 10427, 10462, 10431] keymacro_add(a1, &unk_4EE4, v2 + 28, v2[30]);
[10497, 10499, 10470, 10502, 10474, 10509, 10478, 10512, 10481, 10485, 10489, 10493] keymacro_add(a1, &unk_4EF4, v2 + 20, v2[22]);
[10528, 10532, 10536, 10540, 10544, 10546, 10517, 10549, 10521, 10556, 10525, 10559] keymacro_add(a1, &unk_4F04, v2 + 36, v2[38]);
[10595, 10564, 10597, 10568, 10600, 10574, 10607, 10577, 10610, 10581, 10587, 10591] keymacro_add(a1, &unk_4F14, v2 + 44, v2[46]);
[10647, 10657, 10626, 10630, 10634, 10638, 10642, 10644, 10615, 10619, 10654, 10623] keymacro_add(a1, &unk_4F24, v2 + 12, v2[14]);
[10693, 10662, 10696, 10666, 10669, 10673, 10677, 10681, 10683, 10686] keymacro_add(a1, &unk_4F34, v2 + 4, v2[6]);
[10720, 10724, 10728, 10730, 10701, 10733, 10705, 10740, 10709, 10743, 10712, 10716] keymacro_add(a1, &unk_4F44, v2 + 28, v2[30]);
[10752, 10787, 10756, 10790, 10759, 10763, 10767, 10771, 10775, 10777, 10748, 10780] keymacro_add(a1, &unk_4F54, v2 + 20, v2[22]);
[10818, 10822, 10824, 10795, 10827, 10799, 10834, 10803, 10837, 10806, 10810, 10814] keymacro_add(a1, &unk_4F64, v2 + 36, v2[38]);
[10852, 10885, 10855, 10888, 10878, 10859, 10893, 10865, 10869, 10873, 10842, 10875, 10846] return keymacro_add(a1, &unk_4F74, v2 + 44, v2[46]);
}
[10896] return result;
[10897] }
// 5810: using guessed type long keymacro_add(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002A92) ----------------------------------------------------
long terminal_set_arrow(long a1, const wchar_t *a2, _QWORD *a3, int a4)
[10898] {
int i; // [rsp+24h] [rbp-Ch]
long v8; // [rsp+28h] [rbp-8h]
[10914, 10918, 10922, 10925, 10929, 10898, 10902, 10903, 10936, 10906, 10910] v8 = *(_QWORD *)(a1 + 200);
[10947, 11052, 11056, 11060, 11062, 10940] for ( i = 0; i <= 6; ++i )
{
[10978, 10949, 10981, 10952, 10954, 10986, 10988, 10958, 10961, 10965, 10968, 10971, 10975] if ( !wcscmp(a2, *(const wchar_t **)(32LL * i + v8)) )
{
[11009, 11013, 11016, 10990, 10993, 10995, 10999, 11002, 11006] *(_QWORD *)(v8 + 32LL * i + 16) = *a3;
[11042, 11020, 11023, 11025, 11029, 11032, 11036, 11039] *(_DWORD *)(v8 + 32LL * i + 24) = a4;
[11050, 11045] return 0LL;
}
}
[11067] return 0xFFFFFFFFLL;
[11068] }
//----- (0000000000002B3D) ----------------------------------------------------
long terminal_clear_arrow(long a1, const wchar_t *a2)
[11069] {
int i; // [rsp+14h] [rbp-Ch]
long v4; // [rsp+18h] [rbp-8h]
[11073, 11074, 11077, 11081, 11085, 11089, 11093, 11100, 11069] v4 = *(_QWORD *)(a1 + 200);
[11104, 11111, 11187, 11191, 11195, 11197] for ( i = 0; i <= 6; ++i )
{
[11139, 11142, 11113, 11145, 11116, 11118, 11150, 11152, 11122, 11125, 11129, 11132, 11135] if ( !wcscmp(a2, *(const wchar_t **)(32LL * i + v4)) )
{
[11170, 11173, 11154, 11157, 11159, 11163, 11166] *(_DWORD *)(32LL * i + v4 + 24) = 2;
[11185, 11180] return 0LL;
}
}
[11202] return 0xFFFFFFFFLL;
[11203] }
//----- (0000000000002BC4) ----------------------------------------------------
int terminal_print_arrow(long a1, const wchar_t *a2)
[11204] {
long v2; // rax
int i; // [rsp+14h] [rbp-Ch]
long v5; // [rsp+18h] [rbp-8h]
[11204, 11208, 11209, 11212, 11216, 11220, 11224, 11228] v2 = *(_QWORD *)(a1 + 200);
[11235] v5 = v2;
[11239, 11246, 11413, 11417, 11421] for ( i = 0; i <= 6; ++i )
{
[11257, 11251, 11259, 11255] if ( *a2 )
{
[11264, 11266, 11270, 11273, 11277, 11280, 11293, 11283, 11287, 11290, 11261] LODWORD(v2) = wcscmp(a2, *(const wchar_t **)(32LL * i + v5));
[11298, 11300] if ( (_DWORD)v2 )
continue;
}
[11302, 11305, 11307, 11311, 11314, 11318, 11321] LODWORD(v2) = *(_DWORD *)(32LL * i + v5 + 24);
[11324, 11327] if ( (_DWORD)v2 != 2 )
[11393, 11396, 11400, 11402, 11405, 11408, 11329, 11332, 11334, 11338, 11341, 11345, 11348, 11351, 11354, 11356, 11360, 11363, 11367, 11370, 11374, 11377, 11379, 11383, 11386, 11390] LODWORD(v2) = keymacro_kprint(
a1,
*(_QWORD *)(32LL * i + v5),
32LL * i + v5 + 16,
*(unsigned int *)(32LL * i + v5 + 24));
}
[11427, 11428, 11429] return v2;
[11430] }
// 5820: using guessed type long keymacro_kprint(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002CA7) ----------------------------------------------------
unsigned long terminal_bind_arrow(long a1)
[11431] {
long v1; // rax
long v2; // rax
unsigned long v3; // rax
int i; // [rsp+18h] [rbp-68h]
int v6; // [rsp+1Ch] [rbp-64h]
unsigned long j; // [rsp+20h] [rbp-60h]
long v8; // [rsp+28h] [rbp-58h]
long v9; // [rsp+30h] [rbp-50h]
long v10; // [rsp+38h] [rbp-48h]
unsigned char *v11; // [rsp+40h] [rbp-40h]
int v12[10]; // [rsp+50h] [rbp-30h] BYREF
unsigned long v13; // [rsp+78h] [rbp-8h]
[11456, 11431, 11435, 11436, 11439, 11443, 11447] v13 = __readfsqword(0x28u);
[11473, 11466, 11460, 11462] v8 = *(_QWORD *)(a1 + 200);
[11488, 11491, 11497, 11501, 11508, 11477, 11511, 11481] if ( *(_QWORD *)(a1 + 160) && *(_QWORD *)(a1 + 1016) )
{
[11521, 11530, 11517, 11527] if ( *(_DWORD *)(a1 + 1056) == 1 )
[11536, 11532, 11543] v1 = *(_QWORD *)(a1 + 1008);
else
[11545, 11549] v1 = *(_QWORD *)(a1 + 1016);
[11556] v9 = v1;
[11560, 11570, 11564, 11573] if ( *(_DWORD *)(a1 + 1056) == 1 )
[11586, 11579, 11575] v2 = *(_QWORD *)(a1 + 1040);
else
[11592, 11588] v2 = *(_QWORD *)(a1 + 1032);
[11599] v10 = v2;
[11610, 11603, 11607] terminal_reset_arrow(a1);
[12226, 11622, 12232, 12218, 12222, 11615] for ( i = 0; i <= 6; ++i )
{
[11651, 11655, 11658, 11627, 11661, 11631, 11664, 11668, 11638, 11671, 11641, 11674, 11644, 11647] v11 = *(unsigned char **)(8LL * *(int *)(32LL * i + v8 + 8) + *(_QWORD *)(a1 + 176));
[11683, 11689, 11693, 11696, 11698, 11678] if ( v11 && *v11 )
{
[11744, 11712, 11749, 11751, 11755, 11759, 11762, 11765, 11767, 11704, 11769, 11739] for ( j = 0LL; j <= 7 && v11[j]; ++j )
[11714, 11718, 11722, 11725, 11728, 11731, 11735] v12[j] = (char)v11[j];
[11791, 11796, 11798, 11802, 11806] while ( j <= 7 )
{
[11771] v3 = j++;
[11779, 11783, 11775] v12[v3] = 0;
}
[11816, 11810, 11813] v6 = *v11;
[11841, 11844, 11819, 11822, 11824, 11828, 11831, 11835, 11838] if ( *(_DWORD *)(32LL * i + v8 + 24) == 2 )
{
[11846, 11850, 11854, 11858, 11861, 11864, 11869] keymacro_clear(a1, v9, v12);
}
[11906, 11909, 11912, 11915, 11919, 11922, 11925, 11927, 11929, 11932, 11935, 11810, 11939, 11942, 11945, 11947, 11874, 11878, 11882, 11885, 11887, 11893, 11896, 11899, 11903] else if ( v11[1] && (*(_BYTE *)(*v11 + v10) == *(_BYTE *)(*v11 + v9) || *(_BYTE *)(*v11 + v9) == 25) )
{
[11949, 11952, 11954, 11958, 11961, 11965, 11968, 11971, 11974, 11976, 11980, 11983, 11987, 11990, 11994, 11998, 12002, 12004, 12007, 12010] keymacro_add(a1, v12, 32LL * i + v8 + 16, *(unsigned int *)(32LL * i + v8 + 24));
[12015, 12018, 12021, 12025, 12028, 12031] *(_BYTE *)(v6 + v9) = 25;
}
[11810, 12036, 12039, 12042, 12046, 12049, 12052, 12054] else if ( *(_BYTE *)(*v11 + v9) == 28 )
{
[12064, 12068, 12072, 12075, 12078, 12060] keymacro_clear(a1, v9, v12);
[12099, 12102, 12105, 12107, 12083, 12086, 12088, 12092, 12095] if ( *(_DWORD *)(32LL * i + v8 + 24) )
[12161, 12165, 12168, 12171, 12174, 12176, 12180, 12183, 12187, 12190, 12194, 12198, 12202, 12204, 12207, 12210, 12215, 12149, 12152, 12154, 12158] keymacro_add(a1, v12, 32LL * i + v8 + 16, *(unsigned int *)(32LL * i + v8 + 24));
else
[12128, 12131, 12134, 12138, 12109, 12141, 12112, 12145, 12114, 12147, 12118, 12121, 12125] *(_BYTE *)(v6 + v9) = *(_BYTE *)(32LL * i + v8 + 16);
}
}
}
}
[12235, 12239, 12248, 12250, 12255] return __readfsqword(0x28u) ^ v13;
[12256] }
// 5810: using guessed type long keymacro_add(_QWORD, _QWORD, _QWORD, _QWORD);
// 5828: using guessed type long keymacro_clear(_QWORD, _QWORD, _QWORD);
// 2CA7: using guessed type int var_30[10];
//----- (0000000000002FE1) ----------------------------------------------------
int terminal_putc(int a1)
[12257] {
[12257, 12261, 12262, 12265, 12269, 12272, 12279, 12282] if ( terminal_outfile )
[12291, 12298, 12301, 12304, 12306] return fputc(a1, terminal_outfile);
else
[12289, 12284] return -1;
[12312, 12311] }
//----- (0000000000003019) ----------------------------------------------------
int terminal_tputs(long a1, const char *a2, int a3)
[12313] {
[12321, 12325, 12329, 12333, 12336, 12340, 12344, 12313, 12317, 12318] terminal_outfile = *(FILE **)(a1 + 16);
[12354, 12358, 12365, 12367, 12370, 12375, 12376, 12351] return tputs(a2, a3, terminal_putc);
[12377] }
//----- (000000000000305A) ----------------------------------------------------
int terminal__putc(long a1, unsigned int a2)
[12378] {
FILE *v3; // rbx
const char *v4; // rax
long v5; // [rsp+18h] [rbp-38h]
char s[24]; // [rsp+20h] [rbp-30h] BYREF
unsigned long v7; // [rsp+38h] [rbp-18h]
[12386, 12387, 12391, 12395, 12398, 12407, 12378, 12382, 12383] v7 = __readfsqword(0x28u);
[12417, 12411, 12413] if ( a2 == -1 )
[12424, 12419] return 0;
[12426, 12429, 12431] if ( (a2 & 0x80000000) == 0 )
{
[12483, 12486, 12491, 12471, 12474, 12478] v5 = ct_encode_char(s, 16LL, a2);
[12500, 12495] if ( v5 > 0 )
{
[12512, 12516, 12508, 12519] s[v5] = 0;
[12545, 12549, 12522, 12526, 12558, 12560, 12530, 12534, 12537, 12540] return fputs(s, *(FILE **)(a1 + 16));
}
else
{
[12506, 12502] return v5;
}
}
else
{
[12433, 12437] v3 = *(FILE **)(a1 + 16);
[12448, 12450, 12453, 12441, 12444] v4 = (const char *)literal_get(a1, a2);
[12464, 12458, 12461, 12469] return fputs(v4, v3);
}
[12569, 12570, 12571, 12565] }
// 5840: using guessed type long literal_get(_QWORD, _QWORD);
// 5850: using guessed type long ct_encode_char(_QWORD, _QWORD, _QWORD);
// 305A: using guessed type char s[24];
//----- (000000000000311C) ----------------------------------------------------
int terminal__flush(long a1)
[12572] {
[12576, 12577, 12580, 12584, 12588, 12592, 12596, 12604, 12599, 12572, 12605] return fflush(*(FILE **)(a1 + 16));
[12606] }
//----- (000000000000313F) ----------------------------------------------------
unsigned long terminal_writec(long a1, unsigned int a2)
[12607] {
signed long v3; // [rsp+18h] [rbp-38h]
int v4[10]; // [rsp+20h] [rbp-30h] BYREF
unsigned long v5; // [rsp+48h] [rbp-8h]
[12611, 12612, 12615, 12619, 12623, 12626, 12635, 12607] v5 = __readfsqword(0x28u);
[12641, 12644, 12648, 12653, 12656, 12661, 12639] v3 = ct_visual_char(v4, 8LL, a2);
[12665, 12670] if ( v3 < 0 )
[12672] v3 = 0LL;
[12680, 12684] v4[v3] = 0;
[12704, 12707, 12710, 12692, 12696, 12700] terminal_overwrite(a1, (unsigned int *)v4, v3);
[12722, 12715, 12719] terminal__flush(a1);
[12741, 12743, 12748, 12727, 12728, 12732] return __readfsqword(0x28u) ^ v5;
[12749] }
// 5860: using guessed type long ct_visual_char(_QWORD, _QWORD, _QWORD);
// 313F: using guessed type unsigned int var_30[10];
//----- (00000000000031CE) ----------------------------------------------------
long terminal_telltc(long a1)
[12750] {
const char *v1; // rax
const char *v2; // rax
const char *v3; // rax
const char *v4; // rax
long v5; // rax
long v6; // rax
const char **v8; // [rsp+28h] [rbp-28h]
_QWORD *v9; // [rsp+30h] [rbp-20h]
const char *v10; // [rsp+38h] [rbp-18h]
[12769, 12772, 12776, 12780, 12750, 12784, 12754, 12755, 12758, 12791, 12760, 12761, 12794, 12765, 12799] fprintf(*(FILE **)(a1 + 16), "\n\tYour terminal has the\n");
[12804, 12808, 12812, 12819, 12822, 12827] fprintf(*(FILE **)(a1 + 16), "\tfollowing characteristics:\n\n");
[12832, 12864, 12866, 12836, 12870, 12874, 12843, 12847, 12849, 12881, 12884, 12853, 12889, 12860] fprintf(
*(FILE **)(a1 + 16),
"\tIt has %d columns and %d lines\n",
*(unsigned int *)(*(_QWORD *)(a1 + 184) + 12LL),
*(unsigned int *)(*(_QWORD *)(a1 + 184) + 8LL));
[12898, 12904, 12907, 12909, 12894] if ( (*(_DWORD *)(a1 + 152) & 0x40) != 0 )
[12918, 12911] v1 = "a";
else
[12920] v1 = "no";
[12931, 12935, 12938, 12945, 12948, 12953, 12927] fprintf(*(FILE **)(a1 + 16), "\tIt has %s meta key\n", v1);
[12962, 12968, 12971, 12973, 12958] if ( (*(_DWORD *)(a1 + 152) & 8) != 0 )
[12982, 12975] v2 = " ";
else
[12984] v2 = "not ";
[12995, 12999, 13002, 13009, 13012, 13017, 12991] fprintf(*(FILE **)(a1 + 16), "\tIt can%suse tabs\n", v2);
[13026, 13032, 13037, 13039, 13022] if ( (*(_DWORD *)(a1 + 152) & 0x80) != 0 )
[13048, 13041] v3 = "has";
else
[13050] v3 = "does not have";
[13057, 13061, 13065, 13068, 13075, 13078, 13083] fprintf(*(FILE **)(a1 + 16), "\tIt %s automatic margins\n", v3);
[13088, 13092, 13098, 13103, 13105] if ( (*(_DWORD *)(a1 + 152) & 0x80) != 0 )
{
[13122, 13124, 13107, 13111, 13117] if ( (*(_DWORD *)(a1 + 152) & 0x100) != 0 )
[13133, 13126] v4 = "has";
else
[13135] v4 = "does not have";
[13153, 13160, 13163, 13168, 13142, 13146, 13150] fprintf(*(FILE **)(a1 + 16), "\tIt %s magic margins\n", v4);
}
[13180, 13173] v8 = (const char **)&tstr;
[13184, 13195, 13188, 13199] v9 = *(_QWORD **)(a1 + 176);
[13384, 13387, 13380, 13390] while ( *v8 )
{
[13216, 13220, 13223, 13226, 13228, 13204, 13208, 13211, 13214] if ( *v9 && *(_BYTE *)*v9 )
{
[13281, 13252, 13256, 13263, 13267, 13270, 13273, 13276] v5 = ct_decode_string(*v9, a1 + 1256);
[13284, 13287, 13292, 13241, 13245] v6 = ct_visual_string(v5, a1 + 1224);
[13230, 13295, 13234, 13298, 13303] v10 = (const char *)ct_encode_string(v6, a1 + 1256);
[13347, 13350, 13339, 13324, 13357, 13327, 13331, 13335, 13307, 13343] fprintf(*(FILE **)(a1 + 16), "\t%25s (%s) == %s\n", v8[1], *v8, v10);
}
else
{
[13347, 13350, 13324, 13357, 13360, 13331, 13365, 13339] fprintf(*(FILE **)(a1 + 16), "\t%25s (%s) == %s\n", v8[1], *v8, "(empty)");
}
[13370] v8 += 2;
[13375] ++v9;
}
[13412, 13396, 13400, 13404, 13407] fputc(10, *(FILE **)(a1 + 16));
[13417, 13422] return 0LL;
[13426, 13427, 13429, 13430] }
// 4FA0: using guessed type void *tstr;
// 5868: using guessed type long ct_decode_string(_QWORD, _QWORD);
// 5870: using guessed type long ct_visual_string(_QWORD, _QWORD);
// 5878: using guessed type long ct_encode_string(_QWORD, _QWORD);
//----- (0000000000003477) ----------------------------------------------------
long terminal_settc(long a1, long a2, const wchar_t **a3)
[13431] {
long v4; // rax
long v5; // rax
char *endptr; // [rsp+28h] [rbp-38h] BYREF
const char **i; // [rsp+30h] [rbp-30h]
const char **j; // [rsp+38h] [rbp-28h]
long v10; // [rsp+40h] [rbp-20h]
char s2[8]; // [rsp+48h] [rbp-18h] BYREF
char s1[8]; // [rsp+50h] [rbp-10h] BYREF
unsigned long v13; // [rsp+58h] [rbp-8h]
[13443, 13447, 13450, 13454, 13431, 13463, 13435, 13436, 13439] v13 = __readfsqword(0x28u);
[13474, 13506, 13476, 13480, 13484, 13487, 13490, 13492, 13496, 13467, 13500, 13469, 13503] if ( !a3 || !a3[1] || !a3[2] )
[13513, 13508] return 0xFFFFFFFFLL;
[13537, 13540, 13543, 13546, 13518, 13522, 13529, 13533] v4 = ct_encode_string(a3[1], a1 + 1256);
[13569, 13551, 13554, 13558, 13563, 13566] strlcpy(s2, v4, 8LL);
[13602, 13574, 13578, 13585, 13589, 13593, 13596, 13599] v5 = ct_encode_string(a3[2], a1 + 1256);
[13607, 13610, 13614, 13619, 13622, 13625] strlcpy(s1, v5, 8LL);
[13665, 13667, 13637, 13669, 13641, 13674, 13678, 13681, 13684, 13654, 13686, 13657, 13660, 13630] for ( i = (const char **)&tstr; *i && strcmp(*i, s2); i += 2 )
;
[13696, 13689, 13699, 13693] if ( *i )
{
[13701, 13705, 13709, 13713, 13716, 13719] terminal_alloc(a1, (long)i, s1);
[13728, 13731, 13724] terminal_setflags(a1);
[13736, 13741] return 0LL;
}
[13794, 13797, 13800, 13770, 13802, 13785, 13773, 13776, 13746, 13781, 13783, 13753, 13757, 13790] for ( j = (const char **)tval; *j && strcmp(*j, s2); j += 2 )
;
[13809, 13812, 13805, 13815] if ( !*j )
{
[13824, 13828, 13832, 13836, 13843, 13846, 13817, 13851, 13821] fprintf(*(FILE **)(a1 + 24), "%ls: Bad capability `%s'.\n", *a3, s2);
[13856, 13861] return 0xFFFFFFFFLL;
}
[13890, 13892, 13866, 13899, 13903, 13873, 13905, 13877, 13879, 13912, 13916, 13886] if ( j == (const char **)off_5230
|| j == (const char **)off_5260
|| j == (const char **)tval
|| j == (const char **)off_5280 )
{
[13922, 13926, 13933, 13936, 13941, 13943] if ( !strcmp(s1, "yes") )
{
[13987, 13956, 13981, 13963, 13967, 13970, 13974, 13945, 13978, 13949] *(_DWORD *)(4 * (((char *)j - (char *)tval) >> 4) + *(_QWORD *)(a1 + 184)) = 1;
}
else
{
[13989, 13993, 14000, 14003, 14008, 14010] if ( strcmp(s1, "no") )
{
[14082, 14085, 14056, 14090, 14060, 14063, 14067, 14071, 14075] fprintf(*(FILE **)(a1 + 24), "%ls: Bad value `%s'.\n", *a3, s1);
[14100, 14095] return 0xFFFFFFFFLL;
}
[14016, 14048, 14054, 14023, 14030, 14034, 14037, 14041, 14012, 14045] *(_DWORD *)(4 * (((char *)j - (char *)tval) >> 4) + *(_QWORD *)(a1 + 184)) = 0;
}
[14112, 14105, 14109] terminal_setflags(a1);
[14122, 14117] return 0LL;
}
else
{
[14146, 14151, 14127, 14131, 14135, 14140, 14143] v10 = strtol(s1, &endptr, 10);
[14162, 14155, 14164, 14159] if ( *endptr )
{
[14177, 14181, 14185, 14192, 14195, 14166, 14200, 14170, 14173] fprintf(*(FILE **)(a1 + 24), "%ls: Bad value `%s'.\n", *a3, s1);
[14210, 14205] return 0xFFFFFFFFLL;
}
else
{
[14240, 14244, 14215, 14248, 14219, 14251, 14255, 14226, 14233, 14237] *(_DWORD *)(4 * (((char *)j - (char *)tval) >> 4) + *(_QWORD *)(a1 + 184)) = v10;
[14257] v10 = 0LL;
[14272, 14265, 14276] if ( j == (const char **)off_5250 )
{
[14278, 14282, 14289, 14292, 14296] *(_DWORD *)(a1 + 148) = *(_DWORD *)(*(_QWORD *)(a1 + 184) + 12LL);
[14307, 14302] ++v10;
}
[14320, 14316, 14309] else if ( j == (const char **)off_5240 )
{
[14336, 14340, 14322, 14326, 14333] *(_DWORD *)(a1 + 144) = *(_DWORD *)(*(_QWORD *)(a1 + 184) + 8LL);
[14346] ++v10;
}
[14369, 14401, 14373, 14406, 14375, 14409, 14379, 14351, 14386, 14356, 14358, 14390, 14392, 14362, 14396, 14398] if ( v10
&& (unsigned int)terminal_change_size(
a1,
*(_DWORD *)(*(_QWORD *)(a1 + 184) + 8LL),
*(_DWORD *)(*(_QWORD *)(a1 + 184) + 12LL)) == -1 )
{
[14416, 14411] return 0xFFFFFFFFLL;
}
else
{
[14436, 14438, 14418, 14423, 14427] return 0LL;
}
}
}
[14443, 14444] }
// 4FA0: using guessed type void *tstr;
// 5220: using guessed type char *tval[16];
// 5230: using guessed type char *off_5230[14];
// 5240: using guessed type char *off_5240[12];
// 5250: using guessed type char *off_5250[10];
// 5260: using guessed type char *off_5260[8];
// 5280: using guessed type char *off_5280[4];
// 5878: using guessed type long ct_encode_string(_QWORD, _QWORD);
// 5880: using guessed type long strlcpy(_QWORD, _QWORD, _QWORD);
// 3477: using guessed type char s2[8];
// 3477: using guessed type char s1[8];
//----- (000000000000386D) ----------------------------------------------------
long terminal_gettc(long a1, long a2, long a3)
[14445] {
const char **i; // [rsp+20h] [rbp-20h]
const char **j; // [rsp+28h] [rbp-18h]
char *s2; // [rsp+30h] [rbp-10h]
_QWORD *v7; // [rsp+38h] [rbp-8h]
[14464, 14468, 14473, 14475, 14479, 14483, 14486, 14489, 14491, 14495, 14499, 14502, 14505, 14445, 14449, 14450, 14453, 14457, 14461] if ( !a3 || !*(_QWORD *)(a3 + 8) || !*(_QWORD *)(a3 + 16) )
[14512, 14507] return 0xFFFFFFFFLL;
[14521, 14517, 14525] s2 = *(char **)(a3 + 8);
[14529, 14537, 14533] v7 = *(_QWORD **)(a3 + 16);
[14592, 14595, 14565, 14597, 14568, 14571, 14541, 14576, 14578, 14548, 14580, 14552, 14585, 14589] for ( i = (const char **)&tstr; *i && strcmp(*i, s2); i += 2 )
;
[14600, 14610, 14604, 14607] if ( *i )
{
[14648, 14655, 14630, 14634, 14637, 14641, 14612, 14645, 14616, 14651, 14623] *v7 = *(_QWORD *)(8 * (((char *)i - (char *)&tstr) >> 4) + *(_QWORD *)(a1 + 176));
[14658, 14663] return 0LL;
}
else
{
[14722, 14692, 14724, 14695, 14698, 14668, 14703, 14705, 14675, 14707, 14679, 14712, 14716, 14719] for ( j = (const char **)tval; *j && strcmp(*j, s2); j += 2 )
;
[14737, 14731, 14734, 14727] if ( *j )
{
[14786, 14756, 14788, 14760, 14762, 14795, 14799, 14769, 14773, 14775, 14749, 14782] if ( j == (const char **)off_5230
|| j == (const char **)off_5260
|| j == (const char **)tval
|| j == (const char **)off_5280 )
{
[14819, 14823, 14826, 14830, 14801, 14834, 14805, 14837, 14839, 14841, 14812] if ( *(_DWORD *)(4 * (((char *)j - (char *)tval) >> 4) + *(_QWORD *)(a1 + 184)) )
[14857, 14843, 14854, 14847] *v7 = &yes_7504;
else
[14859, 14870, 14863] *v7 = &no_7505;
[14873, 14878] return 0LL;
}
else
{
[14880, 14913, 14884, 14916, 14918, 14922, 14891, 14898, 14902, 14905, 14909] *(_DWORD *)v7 = *(_DWORD *)(4 * (((char *)j - (char *)tval) >> 4) + *(_QWORD *)(a1 + 184));
[14924] return 0LL;
}
}
else
{
[14744, 14739] return 0xFFFFFFFFLL;
}
}
[14929, 14930] }
// 4FA0: using guessed type void *tstr;
// 5220: using guessed type char *tval[16];
// 5230: using guessed type char *off_5230[14];
// 5260: using guessed type char *off_5260[8];
// 5280: using guessed type char *off_5280[4];
//----- (0000000000003A53) ----------------------------------------------------
long terminal_echotc(long a1, long a2, long a3)
[14931] {
wchar_t v4; // eax
const char *v5; // rax
const char *v6; // rax
char *v7; // rax
char *v8; // rax
char *v9; // rax
const wchar_t **v10; // [rsp+8h] [rbp-878h]
const wchar_t **v11; // [rsp+8h] [rbp-878h]
const wchar_t **v12; // [rsp+8h] [rbp-878h]
const wchar_t **v13; // [rsp+8h] [rbp-878h]
const wchar_t **v14; // [rsp+8h] [rbp-878h]
const wchar_t **v15; // [rsp+8h] [rbp-878h]
const wchar_t **v16; // [rsp+8h] [rbp-878h]
int v17; // [rsp+2Ch] [rbp-854h]
_BOOL4 v18; // [rsp+30h] [rbp-850h]
int v19; // [rsp+34h] [rbp-84Ch]
int v20; // [rsp+38h] [rbp-848h]
int v21; // [rsp+3Ch] [rbp-844h]
wchar_t *endptr; // [rsp+40h] [rbp-840h] BYREF
char *v23; // [rsp+48h] [rbp-838h] BYREF
char *v24; // [rsp+50h] [rbp-830h]
char *v25; // [rsp+58h] [rbp-828h]
const char **i; // [rsp+60h] [rbp-820h]
long v27; // [rsp+68h] [rbp-818h]
char v28; // [rsp+70h] [rbp-810h] BYREF
unsigned long v29; // [rsp+878h] [rbp-8h]
[14946, 14953, 14959, 14931, 14966, 14935, 14936, 14939, 14975] v29 = __readfsqword(0x28u);
[14979, 14981] v18 = 0;
[14991] v19 = 0;
[15008, 15001] v23 = &v28;
[15042, 15015, 15023, 15025, 15032, 15036, 15039] if ( !a3 || !*(_QWORD *)(a3 + 8) )
[15049, 15044] return 0xFFFFFFFFLL;
[15054] v10 = (const wchar_t **)(a3 + 8);
[15072, 15074, 15077, 15054, 15062, 15069] if ( **(_DWORD **)(a3 + 8) == 45 )
{
[15089, 15093, 15086, 15079] v4 = (*v10)[1];
[15098, 15095] if ( v4 == 115 )
[15117, 15127] v19 = 1;
else
[15105, 15115, 15100, 15103] v18 = v4 == 118;
[15130] v10 = (const wchar_t **)(a3 + 16);
}
[15138, 15145, 15148, 15151, 15153, 15160, 15163, 15165, 15167] if ( !*v10 || !**v10 )
[15169, 15174] return 0LL;
[15204, 15206, 15179, 15186, 15189, 15196, 15199] if ( !wcscmp(*v10, "t") )
{
[15208, 15215, 15221, 15224, 15226] if ( (*(_DWORD *)(a1 + 152) & 8) != 0 )
[15235, 15228] v5 = "yes";
else
[15265, 15268, 15237, 15273, 15244, 15278, 15251, 15283, 15255, 15258] v5 = "no";
LABEL_28:
[15586, 15590, 15593, 15600, 15603, 15608, 15579] fprintf(*(FILE **)(a1 + 16), "%s\n", v5);
[15618, 15613] return 0LL;
}
[15298, 15305, 15308, 15313, 15315, 15288, 15295] if ( !wcscmp(*v10, U"meta") )
{
[15331, 15335, 15337, 15339, 15317, 15324] if ( *(_DWORD *)(*(_QWORD *)(a1 + 184) + 16LL) )
[15341] v5 = "yes";
else
[15364, 15396, 15368, 15371, 15378, 15381, 15350, 15386, 15357, 15391] v5 = "no";
[15348] goto LABEL_28;
}
[15426, 15428, 15401, 15408, 15411, 15418, 15421] if ( !wcscmp(*v10, U"xn") )
{
[15430, 15437, 15443, 15448, 15450] if ( (*(_DWORD *)(a1 + 152) & 0x100) != 0 )
[15452] v5 = "yes";
else
[15489, 15492, 15461, 15497, 15468, 15502, 15475, 15507, 15479, 15482] v5 = "no";
[15459] goto LABEL_28;
}
[15522, 15529, 15532, 15537, 15539, 15512, 15519] if ( !wcscmp(*v10, U"am") )
{
[15554, 15559, 15561, 15541, 15548] if ( (*(_DWORD *)(a1 + 152) & 0x80) != 0 )
[15563] v5 = "yes";
else
[15572] v5 = "no";
[15570] goto LABEL_28;
}
[15648, 15650, 15623, 15630, 15633, 15640, 15643] if ( !wcscmp(*v10, U"baud") )
{
[15652, 15685, 15688, 15659, 15693, 15665, 15667, 15674, 15678] fprintf(*(FILE **)(a1 + 16), "%d\n", *(unsigned int *)(a1 + 772));
[15698, 15703] return 0LL;
}
[15744, 15715, 15747, 15718, 15754, 15725, 15757, 15728, 15762, 15764, 15733, 15735, 15737, 15708] if ( !wcscmp(*v10, U"rows") || !wcscmp(*v10, U"lines") )
{
[15780, 15812, 15784, 15786, 15793, 15797, 15766, 15804, 15773, 15807] fprintf(*(FILE **)(a1 + 16), "%d\n", *(unsigned int *)(*(_QWORD *)(a1 + 184) + 8LL));
[15817, 15822] return 0LL;
}
[15844, 15847, 15852, 15854, 15827, 15834, 15837] if ( !wcscmp(*v10, U"cols") )
{
[15874, 15876, 15902, 15883, 15887, 15856, 15894, 15863, 15897, 15870] fprintf(*(FILE **)(a1 + 16), "%d\n", *(unsigned int *)(*(_QWORD *)(a1 + 184) + 12LL));
[15912, 15907] return 0LL;
}
[15917] v25 = 0LL;
[16069, 15942, 16076, 16079, 16082, 15928, 16061, 15935] for ( i = (const char **)&tstr; *i; i += 2 )
{
[15968, 15971, 15974, 15944, 15951, 15958, 15965] v6 = (const char *)ct_encode_string(*v10, a1 + 1256);
[16003, 16005, 15979, 15982, 15989, 15992, 15995, 15998] if ( !strcmp(*i, v6) )
{
[16035, 16038, 16007, 16042, 16014, 16046, 16049, 16052, 16021, 16028] v25 = *(char **)(8 * (((char *)i - (char *)&tstr) >> 4) + *(_QWORD *)(a1 + 176));
[16059] break;
}
}
[16088, 16098, 16101, 16095] if ( !*i )
{
[16130, 16133, 16103, 16110, 16117, 16124, 16127] v7 = (char *)ct_encode_string(*v10, a1 + 1256);
[16138, 16141, 16148, 16151, 16154, 16159] v25 = tgetstr(v7, &v23);
}
[16166, 16174, 16176, 16183, 16186, 16188] if ( !v25 || !*v25 )
{
[16197, 16190] if ( !v19 )
[16227, 16230, 16199, 16235, 16206, 16209, 16216, 16220] fprintf(*(FILE **)(a1 + 24), "echotc: Termcap parameter `%ls' not found.\n", *v10);
[16240, 16245] return 0xFFFFFFFFLL;
}
[16257, 16250] v24 = v25;
[16264, 16274] v17 = 0;
[16440, 16450, 16452, 16447] while ( *v24 )
{
[16289, 16291, 16297, 16305, 16318, 16279, 16312, 16315, 16286] if ( *v24 == 37 )
{
[16321, 16355, 16324, 16326, 16358, 16328, 16336, 16343, 16346, 16348] switch ( *++v24 )
{
case '%':
case '>':
case 'B':
case 'D':
case 'i':
case 'n':
case 'r':
break;
case '+':
case '.':
case '2':
case '3':
case 'd':
[16361] ++v17;
[16368] break;
default:
[16377, 16370] if ( v18 )
[16386, 16418, 16389, 16423, 16392, 16399, 16403, 16410, 16379, 16413] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: unknown termcap %% `%c'.\n", (unsigned int)*v24);
break;
}
}
[16432] ++v24;
}
[16465, 16458] if ( v17 == 2 )
goto LABEL_85;
[16478, 16471] if ( v17 > 2 )
{
LABEL_83:
[17046, 17039] if ( v18 )
[17059, 17065, 17080, 17072, 17075, 17048, 17055] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Too many required arguments (%d).\n", (unsigned int)v17);
LABEL_85:
[17085] v14 = v10 + 1;
[17120, 17122, 17093, 17100, 17103, 17106, 17108, 17115, 17118] if ( !*v14 || !**v14 )
{
[17131, 17124] if ( !v19 )
[17154, 17159, 17133, 17140, 17144, 17151] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Missing argument.\n");
[17169, 17164] return 0xFFFFFFFFLL;
}
[17184, 17191, 17196, 17199, 17202, 17174, 17207, 17181] v27 = wcstol(*v14, &endptr, 10);
[17221, 17223, 17225, 17227, 17235, 17214] if ( *endptr || v27 < 0 )
{
[17244, 17237] if ( !v19 )
[17282, 17253, 17256, 17263, 17267, 17274, 17277, 17246] fprintf(*(FILE **)(a1 + 24), "echotc: Bad value `%ls' for cols.\n", *v14);
[17292, 17287] return 0xFFFFFFFFLL;
}
[17304, 17297] v20 = v27;
[17310] v15 = v14 + 1;
[17345, 17347, 17318, 17325, 17328, 17331, 17333, 17340, 17343] if ( !*v15 || !**v15 )
{
[17356, 17349] if ( !v19 )
[17376, 17379, 17384, 17358, 17365, 17369] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Missing argument.\n");
[17394, 17389] return 0xFFFFFFFFLL;
}
[17409, 17416, 17421, 17424, 17427, 17399, 17432, 17406] v27 = wcstol(*v15, &endptr, 10);
[17446, 17448, 17450, 17452, 17460, 17439] if ( *endptr || v27 < 0 )
{
[17469, 17462] if ( !v19 )
[17507, 17478, 17481, 17488, 17492, 17499, 17502, 17471] fprintf(*(FILE **)(a1 + 24), "echotc: Bad value `%ls' for rows.\n", *v15);
[17512, 17517] return 0xFFFFFFFFLL;
}
[17529, 17522] v21 = v27;
[17544, 17546, 17542, 17535] if ( *endptr )
{
[17555, 17548] if ( !v19 )
[17574, 17578, 17585, 17588, 17557, 17593, 17564, 17567] fprintf(*(FILE **)(a1 + 24), "echotc: Bad value `%ls'.\n", *v15);
[17603, 17598] return 0xFFFFFFFFLL;
}
[17608] v16 = v15 + 1;
[17638, 17641, 17643, 17645, 17616, 17623, 17626, 17629, 17631] if ( *v16 && **v16 )
{
[17654, 17647] if ( !v19 )
[17666, 17673, 17677, 17684, 17687, 17656, 17692, 17663] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Extra argument `%ls'.\n", *v16);
[17697, 17702] return 0xFFFFFFFFLL;
}
[17728, 17704, 17710, 17716, 17723, 17725] v9 = tgoto(v25, v20, v27);
[17760, 17733, 17736, 17742, 17749, 17752, 17755] terminal_tputs(a1, v9, v21);
[17761, 17766, 17770, 17779, 17781] return 0LL;
}
[16491, 16484] if ( v17 )
{
[16506, 16500, 16493] if ( v17 != 1 )
goto LABEL_83;
[16645] v12 = v10 + 1;
[16675, 16678, 16680, 16682, 16653, 16660, 16663, 16666, 16668] if ( *v12 && **v12 )
{
[16769, 16766, 16772, 16744, 16777, 16751, 16754, 16761, 16734] v27 = wcstol(*v12, &endptr, 10);
[16805, 16784, 16791, 16793, 16795, 16797] if ( *endptr || v27 < 0 )
{
[16814, 16807] if ( !v19 )
[16833, 16837, 16844, 16847, 16816, 16852, 16823, 16826] fprintf(*(FILE **)(a1 + 24), "echotc: Bad value `%ls' for rows.\n", *v12);
[16857, 16862] return 0xFFFFFFFFLL;
}
else
{
[16880, 16874, 16867] v13 = v12 + 1;
[16898, 16901, 16903, 16910, 16913, 16915, 16917, 16888, 16895] if ( !*v13 || !**v13 )
{
[16998, 17000, 17003, 16979, 16985, 16991] v8 = tgoto(v25, 0, v27);
[17026, 17029, 17008, 17011, 17018, 17023] terminal_tputs(a1, v8, 1);
[17034] return 0LL;
}
[16926, 16919] if ( !v19 )
[16928, 16964, 16935, 16938, 16945, 16949, 16956, 16959] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Extra argument `%ls'.\n", *v13);
[16969, 16974] return 0xFFFFFFFFLL;
}
}
else
{
[16691, 16684] if ( !v19 )
[16704, 16711, 16714, 16719, 16693, 16700] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Missing argument.\n");
[16729, 16724] return 0xFFFFFFFFLL;
}
}
else
{
[16511] v11 = v10 + 1;
[16544, 16546, 16548, 16519, 16526, 16529, 16532, 16534, 16541] if ( !*v11 || !**v11 )
{
[16610, 16617, 16624, 16629, 16632, 16635] terminal_tputs(a1, v25, 1);
[16640] return 0LL;
}
[16557, 16550] if ( !v19 )
[16576, 16580, 16587, 16590, 16559, 16595, 16566, 16569] fprintf(*(FILE **)(a1 + 24), "echotc: Warning: Extra argument `%ls'.\n", *v11);
[16600, 16605] return 0xFFFFFFFFLL;
}
[17786, 17787] }
// 4FA0: using guessed type void *tstr;
// 5878: using guessed type long ct_encode_string(_QWORD, _QWORD);
// nfuncs=74 queued=36 decompiled=36 lumina nreq=0 worse=0 better=0
// ALL OK, 36 function(s) have been successfully decompiled
|
void el_init_fd(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned int a3, unsigned int a4, unsigned int a5, unsigned int v0) {
[592] unsigned long long v1; // rax
[592]
[592] v1 = el_init_internal(a0, a1, a2, a3, a4, a5, v0, 0x0);
[592, 596, 600, 602, 606, 607] return;
[616, 612] }
|
void el_init_fd(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long a4, unsigned long a5, unsigned int v0) {
[576] unsigned long long v1; // rax
[576]
[576] v1 = el_init_internal(a0, a1, a2, a3, a4, a5, v0, 0x0);
[641, 642, 645, 576, 580, 581, 584, 588, 592, 596, 600, 604, 608, 612, 616, 620, 624, 628, 632, 636, 638] return;
[650, 654, 655] }
|
void usage(unsigned long a0) {
[176] unsigned long v0; // [bp-0x10]
[176] unsigned long v1; // [bp-0x8]
[176] unsigned long v3; // r13
[176] unsigned long v4; // r12
[176] void* v5; // rbp
[176]
[176] v1 = v3;
[176] v0 = v4;
[192, 178, 180, 187] v5 = stderr;
[194, 201, 204, 205] if (!a0)
v5 = stdout;
[212, 213, 214, 220, 222] __fprintf_chk(v5, 0x1, dcgettext(NULL, "Usage: %s [options]\n\nOptions:\n", 0x5));
[194, 227, 230, 235, 238, 241, 243, 220, 222] __fprintf_chk(v5, 0x1, dcgettext(NULL, " -c, --crypt-method METHOD the crypt method (one of %s)\n", 0x5));
[260, 262, 267, 274, 279, 253, 282, 285, 287] fputs(dcgettext(NULL, " -e, --encrypted supplied passwords are encrypted\n", 0x5), v5);
[297, 304, 306, 311, 314, 317] fputs(dcgettext(NULL, " -h, --help display this help message and exit\n", 0x5), v5);
[327, 334, 336, 341, 344, 347] fputs(dcgettext(NULL, " -m, --md5 encrypt the clear text password using\n the MD5 algorithm\n", 0x5), v5);
[357, 364, 366, 371, 374, 377] fputs(dcgettext(NULL, " -R, --root CHROOT_DIR directory to chroot into\n", 0x5), v5);
[387, 394, 396, 401, 404, 407] fputs(dcgettext(NULL, " -s, --sha-rounds number of rounds for the SHA, BCRYPT\n or YESCRYPT crypt algorithms\n", 0x5), v5);
[417, 424, 426, 431, 434, 437] fputs("\n", v5);
[449, 452, 442] exit(a0); /* do not return */
[457, 460] }
|
void usage(unsigned long a0) {
[476] void* v0; // [bp-0x20]
[476] unsigned long v1; // [bp-0x10]
[476] unsigned long v3; // rbx
[476] void* v4; // rax
[476]
[476] v1 = v3;
[480, 481, 484, 476] if (a0)
v4 = stderr;
[498] else
v4 = stdout;
[514, 518, 525, 532, 507] v0 = v4;
[514] fprintf(v0, gettext("Usage: %s [options]\n\nOptions:\n"));
[544, 547, 550, 553, 525, 558, 532, 537, 540] fprintf(v0, gettext(" -c, --crypt-method METHOD the crypt method (one of %s)\n"));
[578, 582, 589, 592, 595, 563, 600, 570, 575] fputs(gettext(" -e, --encrypted supplied passwords are encrypted\n"), v0);
[612, 617, 620, 624, 627, 630, 605] fputs(gettext(" -h, --help display this help message and exit\n"), v0);
[642, 647, 650, 654, 657, 660, 635] fputs(gettext(" -m, --md5 encrypt the clear text password using\n the MD5 algorithm\n"), v0);
[672, 677, 680, 684, 687, 690, 665] fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"), v0);
[707, 710, 714, 717, 720, 695, 702] fputs(gettext(" -s, --sha-rounds number of rounds for the SHA, BCRYPT\n or YESCRYPT crypt algorithms\n"), v0);
[737, 740, 744, 747, 750, 725, 732] fputs("\n", v0);
[769, 755, 759, 762] exit(a0); /* do not return */
[774, 777, 779] }
|
void setoption(unsigned int a1, int a2)
[0] {
long v2; // rax
[0, 3] switch ( a1 )
{
case 0x65u:
LABEL_18:
[159] v2 = 0LL;
LABEL_19:
[168, 161] optlist[v2] = a2;
[172] return;
case 0x66u:
[173] v2 = 1LL;
[178] goto LABEL_19;
case 0x49u:
[187] v2 = 2LL;
[192] goto LABEL_19;
case 0x69u:
[194] v2 = 3LL;
[199] goto LABEL_19;
case 0x6Du:
[201] v2 = 4LL;
[206] goto LABEL_19;
case 0x6Eu:
[208] v2 = 5LL;
[213] goto LABEL_19;
case 0x73u:
[215] v2 = 6LL;
[220] goto LABEL_19;
case 0x78u:
[222] v2 = 7LL;
[227] goto LABEL_19;
case 0x76u:
[229] v2 = 8LL;
[234] goto LABEL_19;
case 0x56u:
[283] optlist[9] = a2;
[290, 292] if ( a2 )
[304] optlist[10] = 0;
break;
case 0x45u:
[236] optlist[10] = a2;
[243, 245] if ( a2 )
[247] optlist[9] = 0;
break;
case 0x43u:
[255] v2 = 11LL;
[260] goto LABEL_19;
case 0x61u:
[180] v2 = 12LL;
[185] goto LABEL_19;
case 0x62u:
[262] v2 = 13LL;
[267] goto LABEL_19;
case 0x75u:
[269] v2 = 14LL;
[274] goto LABEL_19;
case 0u:
[276] v2 = 15LL;
[281] goto LABEL_19;
default:
[131, 133, 9, 139, 12, 18, 21, 27, 30, 36, 39, 45, 48, 54, 57, 63, 66, 72, 75, 81, 84, 90, 93, 99, 102, 108, 111, 113, 116, 122, 125] LOBYTE(a2) = a1;
[139, 141, 145, 152, 154] sh_error("Illegal option -%c", a1);
goto LABEL_18;
}
[294, 312, 254, 311] }
// 1668: using guessed type long sh_error(const char *, ...);
//----- (0000000000000140) ----------------------------------------------------
long minus_o(char *s1, int a2)
[320] {
long result; // rax
char **v3; // rbx
char *v4; // rbp
const char *v5; // rdx
const char *v6; // rsi
const char *v7; // rdx
const char *v8; // rsi
[320, 322, 324, 326, 329, 330, 331, 334] if ( s1 )
{
[347, 340, 350] LODWORD(result) = strcmp(s1, "errexit");
[355, 357] if ( (_DWORD)result )
{
[363, 370, 373, 378, 380] if ( !strcmp(s1, "noglob") )
{
[978, 973] LODWORD(result) = 1;
}
[386, 393, 396, 401, 403] else if ( !strcmp(s1, "ignoreeof") )
{
[988, 983] LODWORD(result) = 2;
}
[416, 419, 424, 426, 409] else if ( !strcmp(s1, "interactive") )
{
[993, 998] LODWORD(result) = 3;
}
[449, 432, 439, 442, 447] else if ( !strcmp(s1, "monitor") )
{
[1008, 1003] LODWORD(result) = 4;
}
[455, 462, 465, 470, 472] else if ( !strcmp(s1, "noexec") )
{
[968, 963] LODWORD(result) = 5;
}
[485, 488, 493, 495, 478] else if ( !strcmp(s1, "stdin") )
{
[1018, 1013] LODWORD(result) = 6;
}
[516, 518, 501, 508, 511] else if ( !strcmp(s1, "xtrace") )
{
[1028, 1023] LODWORD(result) = 7;
}
[524, 531, 534, 539, 541] else if ( !strcmp(s1, "verbose") )
{
[1033, 1038] LODWORD(result) = 8;
}
[547, 554, 557, 562, 564] else if ( !strcmp(s1, "vi") )
{
[1048, 1043] LODWORD(result) = 9;
}
[577, 580, 585, 587, 570] else if ( !strcmp(s1, "emacs") )
{
[1058, 1053] LODWORD(result) = 10;
}
[608, 610, 593, 600, 603] else if ( !strcmp(s1, "noclobber") )
{
[1068, 1063] LODWORD(result) = 11;
}
[616, 623, 626, 631, 633] else if ( !strcmp(s1, "allexport") )
{
[1073, 1078] LODWORD(result) = 12;
}
[646, 649, 654, 656, 639] else if ( !strcmp(s1, "notify") )
{
[1088, 1083] LODWORD(result) = 13;
}
[672, 677, 679, 662, 669] else if ( !strcmp(s1, "nounset") )
{
[1098, 1093] LODWORD(result) = 14;
}
else
{
[685, 692, 695, 700, 702] if ( strcmp(s1, "nolog") )
{
[704, 711, 714, 719, 721] if ( !strcmp(s1, "debug") )
{
[1103] LODWORD(result) = 16;
[1108] goto LABEL_21;
}
[737, 730, 739, 727] sh_error("Illegal option -o %s", s1);
}
[744, 749] LODWORD(result) = 15;
}
}
LABEL_21:
[752] result = (int)result;
[752, 761, 754] optlist[(int)result] = a2;
[773] return result;
}
[784] v3 = &optnames;
[791] v4 = optlist;
[812, 805, 814] if ( a2 )
{
[880, 905, 910, 887] outstr("Current option settings\n", out1);
do
{
[923, 916] v7 = "on";
[912] if ( !*v4 )
[925] v7 = "off";
[928] v8 = *v3;
[938, 940] ++v4;
[944] ++v3;
[931, 948] result = out1fmt("%-16s%s\n", v8, v7);
}
[898, 894, 953, 956, 958] while ( v4 != &optlist[17] );
}
else
{
do
{
[820] v5 = *v3;
[830, 823] v6 = "-o";
[816] if ( !*v4 )
[832] v6 = "+o";
[842, 844] ++v3;
[848] ++v4;
[835, 852] result = out1fmt("set %s %s\n", v6, v5);
}
[857, 860, 798] while ( &optnames + 17 != v3 );
}
[765] return result;
[864, 769, 866, 771, 868, 870, 766, 863, 862, 767] }
// 12E0: using guessed type char *optnames;
// 1668: using guessed type long sh_error(const char *, ...);
// 1678: using guessed type long out1fmt(const char *, ...);
// 1688: using guessed type long outstr(_QWORD, _QWORD);
//----- (0000000000000460) ----------------------------------------------------
long getopts(_BYTE *a1, long a2, long a3)
[1120] {
long v4; // r12
size_t v5; // rbx
int v6; // eax
long v7; // r12
const char **v8; // r14
const char *v9; // rax
int v10; // r8d
char v11; // bl
int v12; // r12d
int v13; // r13d
unsigned int v14; // r8d
const char *v16; // rcx
const char *v17; // r12
_BYTE *v18; // rax
const char *v19; // rax
long v20; // rdx
long v21; // rdx
const char *v22; // [rsp+8h] [rbp-50h]
int v23; // [rsp+8h] [rbp-50h]
char v24; // [rsp+16h] [rbp-42h] BYREF
char v25; // [rsp+17h] [rbp-41h]
unsigned long v26; // [rsp+18h] [rbp-40h]
[1120, 1122, 1125, 1127, 1129, 1132, 1134, 1135, 1138, 1139, 1143] v4 = shellparam[4];
[1150] v5 = shellparam[5];
[1157, 1166] v26 = __readfsqword(0x28u);
[1171, 1173] shellparam[4] = -1;
[1183] v6 = v4;
[1186] v7 = 8 * v4;
[1190] v8 = (const char **)(a3 + v7 - 8);
[1216, 1221, 1190, 1509, 1224, 1512, 1195, 1515, 1517, 1198, 1519, 1200, 1202, 1204, 1208, 1211] if ( v6 <= 1
|| (v5 & 0x80000000) != 0LL
|| (v22 = *(const char **)(a3 + v7 - 16), strlen(v22) < v5)
|| (v16 = &v22[v5], (v11 = v22[v5]) == 0) )
{
[1233, 1236, 1230] v9 = *v8;
[1408, 1413, 1416, 1528, 1230, 1392, 1396, 1238, 1400, 1241, 1402, 1532, 1534] if ( !*v8 || *v9 != 45 || (v11 = v9[1], v16 = v9 + 1, !v11) || (v8 = (const char **)(a3 + v7), v11 == 45) && !v9[2] )
{
[1247] v10 = 1;
[1258, 1253] v11 = 63;
LABEL_7:
[1266, 1271, 1263] v23 = v10;
[1287] v12 = -1;
[1283, 1293, 1263] v13 = (((long)v8 - a3) >> 3) + 1;
[1297, 1276, 1300] setvarint("OPTIND", v13, 64LL);
[1313] v24 = v11;
[1317] v25 = 0;
[1305, 1322, 1307, 1310] setvar(a2, &v24, 0LL);
[1327] v14 = v23;
goto LABEL_8;
}
}
[1418] v17 = v16 + 1;
[1425, 1422] v18 = a1;
[1457] while ( 1 )
{
[1457, 1460, 1462] if ( *v18 == v11 )
{
[1464, 1468] if ( v18[1] != 58 )
{
[1728, 1730, 1737, 1742, 1749] setvar("OPTARG", &nullstr, 0LL);
[1754] goto LABEL_28;
}
[1481, 1478] v19 = *v8;
[1474] if ( v16[1] )
{
[1539, 1542] if ( v17 != v19 )
goto LABEL_25;
}
[1483, 1486] else if ( !v19 )
{
[1801, 1805] if ( *a1 == 58 )
{
[1875] v24 = v11;
[1882] v25 = 0;
[1887] v11 = 58;
[1892, 1861, 1897, 1866, 1868, 1900, 1879] setvar("OPTARG", &v24, 0LL);
}
else
{
[1807] v21 = (unsigned int)v11;
[1817, 1819] v11 = 63;
[1824, 1810, 1836, 1831] outfmt(&errout, "No arg for -%c option\n", v21);
[1848, 1841] unsetvar("OPTARG");
}
[1853] v10 = 0;
[1856] goto LABEL_7;
}
[1492] ++v8;
[1496, 1499] v17 = v19;
LABEL_25:
[1544, 1546, 1549, 1554, 1561] setvar("OPTARG", v17, 0LL);
[1566] v10 = 0;
[1569] goto LABEL_7;
}
[1457] if ( !*v18 )
break;
[1440, 1444, 1448] if ( v18[1] == 58 )
[1712, 1716] v18 += 2;
else
[1454] ++v18;
}
[1584, 1588] if ( *a1 == 58 )
{
[1774] v24 = v11;
[1781] v25 = 0;
[1786] v11 = 63;
[1760, 1796, 1765, 1767, 1778, 1791] setvar("OPTARG", &v24, 0LL);
}
else
{
[1594] v20 = (unsigned int)v11;
[1604, 1606] v11 = 63;
[1618, 1611, 1597, 1623] outfmt(&errout, "Illegal option -%c\n", v20);
[1635, 1628] unsetvar("OPTARG");
}
LABEL_28:
[1640, 1665, 1658, 1661] v13 = (((long)v8 - a3) >> 3) + 1;
[1669, 1672, 1643, 1648, 1655] setvarint("OPTIND", v13, 64LL);
[1685] v24 = v11;
[1689] v25 = 0;
[1682, 1677, 1694, 1679] setvar(a2, &v24, 0LL);
[1699] v12 = (_DWORD)v17 - *((_DWORD *)v8 - 2);
[1706, 1703] v14 = 0;
LABEL_8:
[1332] shellparam[5] = v12;
[1360, 1346, 1339, 1351] shellparam[4] = v13;
[1370, 1366] return v14;
[1377, 1379, 1381, 1383, 1373, 1374, 1375] }
// 1638: using guessed type int shellparam[6];
// 1698: using guessed type long setvarint(_QWORD, _QWORD, _QWORD);
// 16A0: using guessed type long setvar(_QWORD, _QWORD, _QWORD);
// 16B0: using guessed type long outfmt(_QWORD, const char *, ...);
// 16B8: using guessed type long unsetvar(_QWORD);
//----- (0000000000000780) ----------------------------------------------------
long options_constprop_0()
{
char **v0; // rdx
unsigned int v1; // r12d
char *v2; // rax
char **v3; // rcx
unsigned int v4; // edi
char v5; // dl
int v6; // ebp
long v7; // rax
long v8; // rbx
long result; // rax
v0 = (char **)argptr;
v1 = 0;
minusc = 0LL;
v2 = *(char **)argptr;
if ( !*(_QWORD *)argptr )
return v1;
while ( 1 )
{
v3 = v0 + 1;
argptr = (long)(v0 + 1);
v4 = *v2;
if ( v4 != 45 )
break;
v5 = v2[1];
if ( !v5 )
return v1;
v6 = 1;
if ( v5 == 45 )
{
if ( v2[2] )
{
v7 = (long)(v2 + 2);
LABEL_10:
while ( 2 )
{
v8 = v7 + 1;
switch ( v4 )
{
case 'c':
minusc = v7;
break;
case 'l':
v1 = 1;
break;
case 'o':
minus_o(*(char **)argptr, v6);
if ( !*(_QWORD *)argptr )
{
v4 = *(char *)(v8 - 1);
if ( !*(_BYTE *)(v8 - 1) )
return v1;
goto LABEL_9;
}
argptr += 8LL;
break;
default:
setoption(v4, v6);
v4 = *(char *)(v8 - 1);
if ( !*(_BYTE *)(v8 - 1) )
{
LABEL_14:
v0 = (char **)argptr;
goto LABEL_15;
}
goto LABEL_9;
}
v4 = *(char *)(v8 - 1);
if ( !*(_BYTE *)(v8 - 1) )
goto LABEL_14;
LABEL_9:
v7 = v8;
continue;
}
}
return v1;
}
LABEL_5:
v4 = v5;
v7 = (long)(v2 + 2);
v0 = v3;
if ( v4 )
goto LABEL_10;
LABEL_15:
v2 = *v0;
if ( !*v0 )
return v1;
}
if ( v4 == 43 )
{
v5 = v2[1];
v6 = 0;
goto LABEL_5;
}
result = v1;
argptr = (long)v0;
return result;
}
// 1640: using guessed type long argptr;
// 1648: using guessed type long minusc;
//----- (00000000000008C0) ----------------------------------------------------
long optschanged()
[2240] {
[2240, 2255, 2244, 2248] setinteractive((unsigned int)optlist[3]);
[2267, 2260, 2271] return setjobctl((unsigned int)optlist[4]);
}
// 16D0: using guessed type long setinteractive(_QWORD);
// 16D8: using guessed type long setjobctl(_QWORD);
//----- (00000000000008F0) ----------------------------------------------------
void procargs(int a1, long *a2)
[2288] {
__m128i si128; // xmm0
long *v3; // rbx
long v4; // rbp
long v5; // rdi
long v6; // rax
long *v7; // rdx
int v8; // eax
int v9; // edx
bool v10; // zf
arg0 = *a2;
si128 = _mm_load_si128((const __m128i *)&LC30);
if ( a1 > 0 )
[2288, 2292, 2294, 2297, 2298] ++a2;
[2305, 2299, 2302] optlist[16] = 2;
[2307, 2313, 2299, 2310] *(__m128i *)optlist = si128;
[2317, 2319] argptr = (long)a2;
[2330, 2326] options_constprop_0();
[2338] v3 = (long *)argptr;
[2338] v4 = minusc;
[2342] if ( *(_QWORD *)argptr )
[2349] {
[2356] if ( optlist[3] != 2 || optlist[6] != 1 )
[2363] goto LABEL_5;
[2368] goto LABEL_50;
[2375] }
[2382] if ( minusc )
[2385, 2389] {
sh_error("-c requires an argument");
[2840, 2402, 2395, 2847] freeparam((long)"-c requires an argument");
return;
}
v10 = optlist[3] == 2;
[2944, 2947] optlist[6] = 1;
if ( v10 )
[3013, 3020, 3022, 3027, 3038] {
[3039] LABEL_50:
if ( isatty(0) && isatty(1) )
[2949] optlist[3] = 1;
[2956] }
[2969, 2963] LABEL_5:
if ( optlist[4] == 2 )
optlist[4] = optlist[3];
[2880, 2853, 2855, 2860, 2862, 2868, 2873, 2878] if ( optlist[0] == 2 )
[2893, 2886] optlist[0] = 0;
if ( optlist[1] == 2 )
optlist[1] = 0;
[2408, 2415] if ( optlist[2] == 2 )
[2424, 2417] optlist[2] = 0;
[2437, 2430] if ( optlist[3] == 2 )
[2439] optlist[3] = 0;
[2453, 2446] if ( optlist[4] == 2 )
[2455] optlist[4] = 0;
[2469, 2462] if ( optlist[5] == 2 )
[2471] optlist[5] = 0;
[2485, 2478] if ( optlist[6] == 2 )
[2487] optlist[6] = 0;
[2501, 2494] if ( optlist[7] == 2 )
[2503] optlist[7] = 0;
[2517, 2510] if ( optlist[8] == 2 )
[2519] optlist[8] = 0;
[2533, 2526] if ( optlist[9] == 2 )
[2535] optlist[9] = 0;
[2549, 2542] if ( optlist[10] == 2 )
[2551] optlist[10] = 0;
[2565, 2558] if ( optlist[11] == 2 )
[2567] optlist[11] = 0;
[2581, 2574] if ( optlist[12] == 2 )
[2583] optlist[12] = 0;
[2597, 2590] if ( optlist[13] == 2 )
[2599] optlist[13] = 0;
[2613, 2606] if ( optlist[14] == 2 )
[2615] optlist[14] = 0;
[2629, 2622] if ( optlist[15] == 2 )
[2631] optlist[15] = 0;
[2645, 2638] if ( optlist[16] == 2 )
[2647] optlist[16] = 0;
[2661, 2654] v5 = *v3;
[2663] if ( v4 )
[2677, 2670] {
[2679] v6 = v3[1];
[2693, 2686] minusc = *v3;
[2695] v7 = v3 + 1;
[2702] if ( !v6 )
[2705, 2708] {
*(_QWORD *)&shellparam[2] = v7;
[2714] *(_QWORD *)&shellparam[4] = 0xFFFFFFFF00000001LL;
[2718] optschanged();
[2725] return;
[2729, 2732] }
}
[2976, 2986] else
[2993] {
[3000] if ( optlist[6] )
[3012, 3005] goto LABEL_44;
setinputfile(v5, 0LL);
v6 = *v3;
v7 = v3;
}
[2904, 2911] arg0 = v6;
v5 = v7[1];
[2917, 2919] v3 = v7 + 1;
[2924] LABEL_44:
[2930, 2927] *(_QWORD *)&shellparam[2] = v3;
*(_QWORD *)&shellparam[4] = 0xFFFFFFFF00000001LL;
[2738] if ( v5 )
[2745] {
[2749] v8 = shellparam[0] + 1;
do
[2753, 2763] {
[2770] ++v3;
[2777, 2780] v9 = v8++;
}
[2788, 2782, 2791] while ( *v3 );
shellparam[0] = v9;
}
[2800] optschanged();
[2804] }
// 1370: using guessed type __int128 LC30;
// 1638: using guessed type int shellparam[6];
// 1640: using guessed type long argptr;
// 1648: using guessed type long minusc;
// 1650: using guessed type long arg0;
// 1668: using guessed type long sh_error(const char *, ...);
// 16E8: using guessed type long setinputfile(_QWORD, _QWORD);
//----- (0000000000000BE0) ----------------------------------------------------
void freeparam(long a1)
[3040] {
long v2; // rbx
void *v3; // rdi
[3040, 3050, 3048, 3044] if ( *(_BYTE *)(a1 + 4) )
{
[3052, 3053, 3056, 3057, 3061] v2 = *(_QWORD *)(a1 + 8);
[3065, 3068, 3073, 3071] v3 = *(void **)v2;
[3065] if ( *(_QWORD *)v2 )
{
do
{
[3080] free(v3);
[3085] v3 = *(void **)(v2 + 8);
[3089] v2 += 8LL;
}
[3096, 3093] while ( v3 );
}
[3106, 3107, 3108, 3098, 3102] free(*(void **)(a1 + 8));
}
[3120] }
//----- (0000000000000C40) ----------------------------------------------------
unsigned long setparam(_QWORD *a1)
[3136] {
_QWORD *v1; // rbx
long v2; // rax
int v3; // r12d
long v4; // rdi
long v5; // r13
_QWORD *i; // rbp
unsigned long result; // rax
[3136, 3140, 3142, 3144, 3145, 3146, 3149] v1 = a1;
[3153, 3157] if ( *a1 )
{
[3163] v2 = 1LL;
do
[3168] v3 = v2++;
[3171, 3181, 3175] while ( a1[v2 - 1] );
[3188, 3191, 3183] v4 = 8LL * (v3 + 1);
}
else
{
[3312] v4 = 8LL;
[3320, 3317] v3 = 0;
}
[3195, 3203] v5 = ckmalloc(v4);
[3200, 3233, 3236, 3206, 3239, 3209, 3212, 3214, 3216, 3229] for ( i = (_QWORD *)v5; *v1; *(i - 1) = savestr() )
{
[3221] ++v1;
[3225] ++i;
}
[3241] *i = 0LL;
[3256, 3249] freeparam((long)shellparam);
[3261] shellparam[0] = v3;
[3268] result = 0xFFFFFFFF00000001LL;
[3278] *(_QWORD *)&shellparam[2] = v5;
[3285] LOBYTE(shellparam[1]) = 1;
[3292] *(_QWORD *)&shellparam[4] = 0xFFFFFFFF00000001LL;
[3299] return result;
[3303, 3304, 3305, 3307, 3309] }
// 1638: using guessed type int shellparam[6];
// 16F8: using guessed type long ckmalloc(_QWORD);
// 1700: using guessed type long savestr(void);
//----- (0000000000000D00) ----------------------------------------------------
long options_constprop_1()
{
long i; // rax
char *v1; // rbx
unsigned int v2; // edi
char v3; // dl
int v4; // ebp
char *v5; // rbx
LABEL_1:
for ( i = argptr; ; i += 8LL )
{
v1 = *(char **)i;
if ( !*(_QWORD *)i )
return 0LL;
argptr = i + 8;
v2 = *v1;
if ( v2 != 45 )
break;
v3 = v1[1];
if ( !v3 )
{
*(_WORD *)&optlist[7] = 0;
return 0LL;
}
v4 = 1;
if ( v3 == 45 )
{
if ( !v1[2] )
{
if ( !*(_QWORD *)(i + 8) )
setparam((_QWORD *)(i + 8));
return 0LL;
}
v5 = v1 + 2;
LABEL_10:
while ( 1 )
{
++v5;
if ( v2 != 111 )
break;
minus_o(*(char **)argptr, v4);
if ( *(_QWORD *)argptr )
{
argptr += 8LL;
LABEL_9:
v2 = *(v5 - 1);
if ( !*(v5 - 1) )
goto LABEL_1;
continue;
}
v2 = *(v5 - 1);
if ( !*(v5 - 1) )
return 0LL;
}
setoption(v2, v4);
goto LABEL_9;
}
LABEL_6:
v2 = v3;
v5 = v1 + 2;
if ( v3 )
goto LABEL_10;
}
if ( v2 == 43 )
{
v3 = v1[1];
v4 = 0;
goto LABEL_6;
}
argptr = i;
return 0LL;
}
// 1640: using guessed type long argptr;
//----- (0000000000000E20) ----------------------------------------------------
long shiftcmd(void *a1, long a2)
[3616] {
int v2; // eax
void **v3; // rbx
long v4; // rbp
long v5; // rax
void *v6; // rdx
v2 = 1;
[3616, 3620, 3621, 3626, 3627] if ( (int)a1 > 1 )
[3634, 3631] {
[3640, 3636] a1 = *(void **)(a2 + 8);
[3651, 3645] v2 = number(a1);
}
[3657] if ( shellparam[0] >= v2 )
[3664] {
[3671] ++suppressint;
[3677, 3679] v3 = *(void ***)&shellparam[2];
shellparam[0] -= v2;
[3808, 3811] if ( v2 <= 0 )
{
v4 = (long)v3;
}
[3681, 3684, 3689] else
{
v4 = (long)&v3[(unsigned int)(v2 - 1) + 1];
[3712, 3705] do
{
[3696, 3700, 3703] while ( !LOBYTE(shellparam[1]) )
{
if ( ++v3 == (void **)v4 )
[3714] goto LABEL_9;
[3721, 3717] }
a1 = *v3++;
[3729, 3726] free(a1);
}
[3731] while ( v3 != (void **)v4 );
LABEL_9:
[3738, 3740] v3 = *(void ***)&shellparam[2];
}
v5 = 0LL;
[3744] do
[3749] {
v6 = *(void **)(v4 + v5 * 8);
[3760, 3753, 3757] v3[v5++] = v6;
[3762, 3772] }
[3779, 3786, 3788, 3794, 3796] while ( v6 );
[3806] *(_QWORD *)&shellparam[4] = 0xFFFFFFFF00000001LL;
[3813] if ( --suppressint || !intpending )
return 0LL;
[3832, 3825, 3818, 3827] onint(a1, a2);
[3833, 3802, 3798] }
[3804, 3805] sh_error("can't shift that many", a2);
return setcmd((long)"can't shift that many", a2);
}
// 1638: using guessed type int shellparam[6];
// 1668: using guessed type long sh_error(const char *, ...);
// 1708: using guessed type long number(_QWORD);
// 1720: using guessed type long onint(_QWORD, _QWORD);
//----- (0000000000000F00) ----------------------------------------------------
long setcmd(long a1, long a2)
[3840] {
[3840, 3844, 3847] long v2; // rdi
[3920, 3925, 3934, 3927]
[3849, 3853] if ( (_DWORD)a1 == 1 )
[3860] return showvars(&nullstr, 0LL, 32LL);
[3865] ++suppressint;
[3881, 3877] options_constprop_1();
[3883, 3870] optschanged();
[3905, 3888, 3895, 3897, 3903] v2 = argptr;
if ( *(_QWORD *)argptr )
[3944, 3939] setparam((_QWORD *)argptr);
[3945] if ( !--suppressint && intpending )
{
onint(v2, a2);
return getoptsreset(v2);
[3907, 3909] }
else
[3913] {
return 0LL;
}
}
// 1640: using guessed type long argptr;
// 1720: using guessed type long onint(_QWORD, _QWORD);
// 1728: using guessed type long showvars(_QWORD, _QWORD, _QWORD);
//----- (0000000000000F70) ----------------------------------------------------
long getoptsreset(long a1)
[3952] {
long result; // rax
[3952, 3960, 3956] result = number(a1);
[3970, 3965] shellparam[5] = -1;
[3982] if ( !(_DWORD)result )
[3980, 3982] result = 1LL;
[3985] shellparam[4] = result;
[3991] return result;
[3995] }
// 1638: using guessed type int shellparam[6];
// 1708: using guessed type long number(_QWORD);
//----- (0000000000000FA0) ----------------------------------------------------
long getoptscmd(int a1, long a2)
[4000] {
unsigned int v2; // eax
long v3; // rdx
[4000, 4004, 4007] if ( a1 > 2 )
{
[4009] v2 = shellparam[4];
[4018, 4015] if ( a1 == 3 )
{
[4064, 4070] v3 = *(_QWORD *)&shellparam[2];
[4080, 4082, 4084, 4077] if ( shellparam[0] + 1 >= v2 )
[4048, 4082, 4052, 4056, 4059] return getopts(*(_BYTE **)(a2 + 8), *(_QWORD *)(a2 + 16), v3);
}
else
{
[4023] v3 = a2 + 24;
[4027, 4020, 4029] if ( a1 - 2 >= v2 )
[4048, 4059, 4052, 4056] return getopts(*(_BYTE **)(a2 + 8), *(_QWORD *)(a2 + 16), v3);
}
[4041, 4031] *(_QWORD *)&shellparam[4] = 0xFFFFFFFF00000001LL;
[4041, 4048, 4052, 4056, 4059] return getopts(*(_BYTE **)(a2 + 8), *(_QWORD *)(a2 + 16), v3);
}
[4096, 4101, 4086, 4087, 4094] sh_error("Usage: getopts optstring var [arg]", a2);
[4102] return nextopt("Usage: getopts optstring var [arg]");
}
// 1638: using guessed type int shellparam[6];
// 1668: using guessed type long sh_error(const char *, ...);
//----- (0000000000001010) ----------------------------------------------------
long nextopt(_BYTE *a1)
[4112] {
long v1; // rcx
char v2; // dl
long v3; // rsi
long result; // rax
_BYTE *v5; // rax
[4112, 4116] v1 = optptr;
[4128, 4131, 4133, 4123, 4126] if ( !optptr || (v2 = *(_BYTE *)optptr) == 0 )
{
[4208, 4218, 4221, 4215] v5 = *(_BYTE **)argptr;
[4215] if ( !*(_QWORD *)argptr )
[4215] return 0LL;
[4226, 4223] if ( *v5 != 45 )
[4226] return 0LL;
[4248, 4244] v1 = (long)(v5 + 1);
[4240] if ( !v5[1] )
[4240] return 0LL;
[4250, 4254] argptr += 8LL;
[4261] v2 = v5[1];
[4265, 4268, 4261] if ( *(_WORD *)(v5 + 1) == 45 )
[4228] return 0LL;
}
[4139, 4143, 4135] v3 = v1 + 1;
[4176, 4178, 4173] while ( *a1 != v2 )
{
[4152, 4154, 4173] if ( !*a1 )
{
[4360, 4357, 4367] LODWORD(result) = sh_error("Illegal option -%c", (unsigned int)v2);
goto LABEL_21;
}
[4160, 4168, 4164] if ( a1[1] == 58 )
[4288, 4292, 4274, 4278, 4284] a1 += 2;
else
[4170] ++a1;
}
[4184] result = (unsigned int)v2;
[4187, 4180] if ( a1[1] == 58 )
{
[4304, 4308] if ( !*(_BYTE *)(v1 + 1) )
{
[4317, 4310] v3 = *(_QWORD *)argptr;
[4320, 4324] argptr += 8LL;
[4331, 4334] if ( !v3 )
{
LABEL_21:
[4372, 4381, 4374, 4383] sh_error("No arg for -%c option", (unsigned int)result);
[4388] JUMPOUT(0x1124LL);
}
}
[4336] optionarg = v3;
[4352, 4345, 4343] optptr = 0LL;
}
else
{
[4189] optptr = v1 + 1;
}
[4200, 4196] return result;
[4356, 4230] }
// 111F: control flows out of bounds to 1124
// 1640: using guessed type long argptr;
// 1658: using guessed type long optptr;
// 1660: using guessed type long optionarg;
// 1668: using guessed type long sh_error(const char *, ...);
// nfuncs=34 queued=14 decompiled=14 lumina nreq=0 worse=0 better=0
// ALL OK, 14 function(s) have been successfully decompiled
|
long setoption(unsigned int a1, int a2)
[1414] {
long result; // rax
int i; // [rsp+1Ch] [rbp-4h]
[1414, 1418, 1419, 1422, 1521, 1426, 1429, 1432, 1439] for ( i = 0; ; ++i )
{
[1529, 1525] if ( i > 16 )
[1536, 1543, 1548, 1531, 1534] return sh_error("Illegal option -%c", a1);
[1441, 1444, 1446, 1453, 1457, 1460, 1463] if ( a1 == optletters[i] )
break;
}
[1465, 1468, 1470, 1473] result = i;
[1473, 1482, 1475] optlist[i] = a2;
[1489, 1485] if ( a2 )
{
[1491, 1495] if ( a1 == 86 )
{
[1504, 1497] optlist[10] = 0;
}
[1506, 1510] else if ( a1 == 69 )
{
[1512, 1519] optlist[9] = 0;
}
}
[1553, 1554] return result;
[1555] }
// 1300: using guessed type long sh_error(const char *, ...);
//----- (0000000000000614) ----------------------------------------------------
long setparam(_QWORD *a1)
[1556] {
_QWORD *v1; // rax
_QWORD *v2; // rbx
long result; // rax
_QWORD *v4; // [rsp+8h] [rbp-38h]
int i; // [rsp+1Ch] [rbp-24h]
_QWORD *v6; // [rsp+20h] [rbp-20h]
long v7; // [rsp+28h] [rbp-18h]
[1569, 1556, 1560, 1561, 1564, 1565] v4 = a1;
[1603, 1573, 1606, 1609, 1580, 1612, 1582, 1586, 1589, 1591, 1599] for ( i = 0; a1[i]; ++i )
;
[1634, 1614, 1617, 1620, 1622, 1626, 1629] v7 = ckmalloc(8LL * (i + 1));
[1642, 1646, 1638] v6 = (_QWORD *)v7;
[1696, 1690, 1693, 1686] while ( *v4 )
{
[1648] v1 = v4++;
[1656, 1660, 1652, 1663] v2 = v6++;
[1667, 1671, 1675, 1678, 1683] *v2 = savestr(*v1);
}
[1698, 1702] *v6 = 0LL;
[1716, 1709] freeparam((long)shellparam);
[1721] LOBYTE(shellparam[1]) = 1;
[1728, 1731] shellparam[0] = i;
[1737] result = v7;
[1741] *(_QWORD *)&shellparam[2] = v7;
[1748] shellparam[4] = 1;
[1758] shellparam[5] = -1;
[1768, 1769] return result;
[1773, 1774, 1775] }
// 12D0: using guessed type int shellparam[6];
// 1348: using guessed type long ckmalloc(_QWORD);
// 1350: using guessed type long savestr(_QWORD);
//----- (00000000000006F0) ----------------------------------------------------
void freeparam(long a1)
[1776] {
void **i; // [rsp+18h] [rbp-8h]
[1792, 1796, 1800, 1802, 1776, 1780, 1781, 1784, 1788] if ( *(_BYTE *)(a1 + 4) )
{
[1833, 1804, 1838, 1808, 1842, 1848, 1812, 1845, 1816] for ( i = *(void ***)(a1 + 8); *i; ++i )
[1825, 1818, 1828, 1822] free(*i);
[1858, 1861, 1866, 1850, 1854] free(*(void **)(a1 + 8));
}
[1867, 1868] }
//----- (000000000000074D) ----------------------------------------------------
long shiftcmd(const char *a1, long a2)
[1869] {
void **v2; // rdx
void **v3; // rax
int v5; // [rsp+1Ch] [rbp-14h]
void **i; // [rsp+20h] [rbp-10h]
void **v7; // [rsp+28h] [rbp-8h]
[1888, 1869, 1873, 1874, 1877, 1881, 1884] v5 = 1;
[1899, 1895] if ( (int)a1 > 1 )
[1920, 1901, 1905, 1909, 1912, 1915] {
[1929, 1923, 1932] a1 = *(const char **)(a2 + 8);
[1946, 1941, 1934] v5 = number(a1);
[1960, 1957, 1951] }
[1972, 1966, 1975] if ( v5 > shellparam[0] )
[1988, 2020, 1992, 2025, 2029, 2033, 1981] {
a1 = "can't shift that many";
[2001, 1994, 2003] sh_error("can't shift that many");
[2009, 2012, 2005, 2015] }
++suppressint;
[2042, 2035, 2046] shellparam[0] -= v5;
for ( i = *(void ***)&shellparam[2]; --v5 >= 0; ++i )
{
[2047] if ( LOBYTE(shellparam[1]) )
[2059, 2051, 2055] {
[2074, 2067, 2071, 2063] a1 = (const char *)*i;
free(*i);
[2080, 2083, 2077] }
[2085] }
[2095] v7 = *(void ***)&shellparam[2];
[2114, 2120, 2126, 2128, 2130, 2136, 2105, 2138, 2111] do
[2140] {
[2145, 2150] v2 = i++;
[2151] v3 = v7++;
*v3 = *v2;
}
while ( *v3 );
shellparam[4] = 1;
shellparam[5] = -1;
if ( !--suppressint && intpending )
onint(a1);
return 0LL;
}
// 12D0: using guessed type int shellparam[6];
// 1300: using guessed type long sh_error(const char *, ...);
// 1360: using guessed type long number(_QWORD);
// 1378: using guessed type long onint(_QWORD);
//----- (0000000000000868) ----------------------------------------------------
long setcmd(int a1)
[2152] {
long v2; // rdi
[2152, 2156, 2157, 2160, 2164, 2167, 2171, 2175] if ( a1 == 1 )
[2177, 2182, 2187, 2194, 2199] return showvars(&nullstr, 0LL, 32LL);
[2201, 2210, 2207] ++suppressint;
[2216] v2 = 0LL;
[2221] options(0);
[2226] optschanged();
[2241, 2244, 2238, 2231] if ( *(_QWORD *)argptr )
{
[2253, 2246] v2 = argptr;
[2256, 2253] setparam((_QWORD *)argptr);
}
[2276, 2282, 2284, 2261, 2267, 2270] if ( !--suppressint )
{
[2294, 2292, 2286] if ( intpending )
[2296, 2301] onint(v2);
}
[2306] return 0LL;
[2307] }
// 12D8: using guessed type long argptr;
// 1378: using guessed type long onint(_QWORD);
// 1388: using guessed type long showvars(_QWORD, _QWORD, _QWORD);
//----- (0000000000000904) ----------------------------------------------------
long getoptsreset(long a1)
[2308] {
long result; // rax
[2308, 2312, 2313, 2316, 2320, 2324, 2328, 2331] result = number(a1);
[2336, 2338] if ( !(_DWORD)result )
[2340] result = 1LL;
[2345] shellparam[4] = result;
[2351] shellparam[5] = -1;
[2361, 2362] return result;
[2363] }
// 12D0: using guessed type int shellparam[6];
// 1360: using guessed type long number(_QWORD);
//----- (000000000000093C) ----------------------------------------------------
long getoptscmd(int a1, long a2)
[2364] {
long v3; // [rsp+18h] [rbp-8h]
[2368, 2369, 2372, 2376, 2379, 2383, 2387, 2364] if ( a1 <= 2 )
[2401, 2396, 2389] sh_error("Usage: getopts optstring var [arg]");
[2410, 2406] if ( a1 == 3 )
{
[2419, 2412] v3 = *(_QWORD *)&shellparam[2];
[2437, 2440, 2442, 2423, 2429, 2431] if ( shellparam[4] > (unsigned int)(shellparam[0] + 1) )
{
[2444] shellparam[4] = 1;
[2464, 2454] shellparam[5] = -1;
}
}
else
{
[2474, 2466, 2470] v3 = a2 + 24;
[2478, 2484, 2486, 2489, 2492, 2494] if ( shellparam[4] > (unsigned int)(a1 - 2) )
{
[2496] shellparam[4] = 1;
[2506] shellparam[5] = -1;
}
}
[2531, 2535, 2538, 2542, 2545, 2516, 2548, 2520, 2553, 2524, 2527] return getopts(*(_BYTE **)(a2 + 8), *(_QWORD *)(a2 + 16), v3);
[2554] }
// 12D0: using guessed type int shellparam[6];
// 1300: using guessed type long sh_error(const char *, ...);
//----- (00000000000009FB) ----------------------------------------------------
long getopts(_BYTE *a1, long a2, long a3)
[2555] {
char *v3; // rax
int v4; // eax
char v7; // [rsp+2Bh] [rbp-35h]
unsigned int v8; // [rsp+2Ch] [rbp-34h]
int v9; // [rsp+30h] [rbp-30h]
int v10; // [rsp+30h] [rbp-30h]
int v11; // [rsp+34h] [rbp-2Ch]
char *v12; // [rsp+38h] [rbp-28h]
_BYTE *v13; // [rsp+38h] [rbp-28h]
_BYTE *v14; // [rsp+38h] [rbp-28h]
_BYTE *v15; // [rsp+40h] [rbp-20h]
_QWORD *v16; // [rsp+48h] [rbp-18h]
char v17; // [rsp+56h] [rbp-Ah] BYREF
char v18; // [rsp+57h] [rbp-9h]
unsigned long v19; // [rsp+58h] [rbp-8h]
[2560, 2563, 2567, 2571, 2575, 2579, 2555, 2588, 2559] v19 = __readfsqword(0x28u);
[2592, 2594] v7 = 63;
[2598] v8 = 0;
[2611, 2605] v9 = shellparam[4];
[2620, 2614] v11 = shellparam[5];
[2623] shellparam[4] = -1;
[2633, 2636, 2638, 2642, 2646, 2650, 2653] v16 = (_QWORD *)(8LL * v9 - 8 + a3);
[2688, 2657, 2691, 2661, 2694, 2663, 2697, 2667, 2669, 2673, 2677, 2680, 2683] if ( v9 > 1 && v11 >= 0 && strlen((const char *)*(v16 - 1)) >= v11 )
[2720, 2723, 2725, 2728, 2709, 2713, 2717] v12 = (char *)(*(v16 - 1) + v11);
else
[2699, 2707] v12 = 0LL;
[2819, 2824, 2828, 2831, 2833, 2835, 2839, 2843, 2846, 2848, 2732, 2737, 2739, 2743, 2746, 2748, 2750, 2754, 2757, 2761, 2766, 2768, 2772, 2775, 2777, 2779, 2784, 2788, 2791, 2793, 2795, 2796] if ( v12 && *v12
|| (v13 = (_BYTE *)*v16) != 0LL && *v13 == 45 && (v12 = v13 + 1, *v12) && ((++v16, *v12 != 45) || v12[1]) )
{
[2850] v3 = v12;
[2858, 2854] v14 = v12 + 1;
[2865, 2862] v7 = *v3;
[2872, 2868, 2876] v15 = a1;
[3016, 3019, 3012, 3022] while ( v7 != *v15 )
{
[2888, 2881, 2890, 2885] if ( !*v15 )
{
[2896, 2899, 2892, 2901] if ( *a1 == 58 )
{
[2907, 2903] v17 = *v3;
[2910] v18 = 0;
[2914, 2918, 2923, 2926, 2933, 2938] setvar("OPTARG", &v17, 0LL);
}
else
{
[2944, 2946, 2953, 2960, 2965, 2940] outfmt(&errout, "Illegal option -%c\n", (unsigned int)v7);
[2977, 2970] unsetvar("OPTARG");
}
[2982] v7 = 63;
[2986] goto LABEL_33;
}
[2991, 2996, 3000, 3003, 3005] if ( *++v15 == 58 )
[3007] ++v15;
}
[3040, 3042, 3028, 3033, 3037] if ( v15[1] == 58 )
{
[3048, 3052, 3055, 3057, 3059, 3063, 3066] if ( *v14 || (v14 = (_BYTE *)*v16) != 0LL )
{
[3184, 3177, 3188, 3181] if ( v14 == (_BYTE *)*v16 )
[3190] ++v16;
[3204, 3207, 3214, 3195, 3199] setvar("OPTARG", v14, 0LL);
[3219, 3227] v14 = 0LL;
}
[3075, 3077, 3081, 3084, 3086, 3070] else if ( *a1 == 58 )
{
[3088, 3092] v17 = *v3;
[3095] v18 = 0;
[3108, 3111, 3118, 3099, 3103] setvar("OPTARG", &v17, 0LL);
[3123, 3127] v7 = 58;
}
else
{
[3142, 3149, 3154, 3129, 3133, 3135] outfmt(&errout, "No arg for -%c option\n", (unsigned int)v7);
[3166, 3159] unsetvar("OPTARG");
[3171, 3175] v7 = 63;
}
}
else
{
[3248, 3241, 3234, 3229] setvar("OPTARG", &nullstr, 0LL);
}
}
else
{
[2799] v14 = 0LL;
[2814, 2807] v8 = 1;
}
LABEL_33:
[3265, 3268, 3253, 3257, 3261] v10 = (((long)v16 - a3) >> 3) + 1;
[3271, 3274, 3276, 3281, 3284, 3291] setvarint("OPTIND", v10, 64LL);
[3296, 3300] v17 = v7;
[3303] v18 = 0;
[3307, 3311, 3315, 3320, 3323, 3326] setvar(a2, &v17, 0LL);
[3336, 3331] if ( v14 )
[3338, 3342, 3346, 3349, 3353, 3356, 3359] v4 = (_DWORD)v14 - *(v16 - 1);
else
[3361] v4 = -1;
[3366] shellparam[5] = v4;
[3372, 3375] shellparam[4] = v10;
[3397, 3399, 3404, 3381, 3384, 3388] return v8;
[3405] }
// 12D0: using guessed type int shellparam[6];
// 1398: using guessed type long setvar(_QWORD, _QWORD, _QWORD);
// 13A8: using guessed type long outfmt(_QWORD, const char *, ...);
// 13B0: using guessed type long unsetvar(_QWORD);
// 13B8: using guessed type long setvarint(_QWORD, _QWORD, _QWORD);
//----- (0000000000000D4E) ----------------------------------------------------
long nextopt(_BYTE *a1)
[3406] {
char *v2; // rax
_BYTE **v3; // rax
char v4; // [rsp+1Fh] [rbp-11h]
char *v5; // [rsp+20h] [rbp-10h]
_BYTE *v6; // [rsp+20h] [rbp-10h]
_BYTE *v7; // [rsp+20h] [rbp-10h]
[3429, 3406, 3410, 3411, 3414, 3418, 3422] v5 = (char *)optptr;
[3433, 3438, 3440, 3444, 3447, 3449] if ( optptr && *(_BYTE *)optptr )
goto LABEL_10;
[3458, 3451, 3461] v6 = *(_BYTE **)argptr;
[3461] if ( !*(_QWORD *)argptr )
[3461] return 0LL;
[3465, 3470, 3472, 3476, 3481] if ( *v6 != 45 )
[3481, 3479] return 0LL;
[3483] v5 = v6 + 1;
[3488, 3497, 3492, 3495] if ( !*v5 )
[3504, 3499] return 0LL;
[3520, 3516, 3509] argptr += 8LL;
[3527, 3531, 3534, 3536, 3538, 3542, 3546, 3549, 3551] if ( *v5 == 45 && !v5[1] )
[3553, 3558] return 0LL;
LABEL_10:
[3563] v2 = v5;
[3571, 3567] v7 = v5 + 1;
[3585, 3589, 3575, 3578, 3581] v4 = *v2;
[3656, 3650, 3653, 3646] while ( v4 != *a1 )
{
[3600, 3595, 3598, 3591] if ( !*a1 )
[3620, 3602, 3606, 3608, 3615] sh_error("Illegal option -%c", (unsigned int)v4);
[3625, 3630, 3634, 3637, 3639] if ( *++a1 == 58 )
[3641] ++a1;
}
[3658, 3663, 3667, 3670, 3672] if ( a1[1] == 58 )
{
[3681, 3674, 3683, 3678] if ( !*v7 )
{
[3685] v3 = (_BYTE **)argptr;
[3696, 3692] argptr += 8LL;
[3706, 3703] v7 = *v3;
[3706] if ( !*v3 )
[3715, 3717, 3721, 3723, 3730, 3735, 3710] sh_error("No arg for -%c option", (unsigned int)v4);
}
[3744, 3740] optionarg = (long)v7;
[3751] v7 = 0LL;
}
[3763, 3759] optptr = (long)v7;
[3770, 3774] return (unsigned int)v4;
[3775] }
// 12D8: using guessed type long argptr;
// 12E0: using guessed type long optionarg;
// 12E8: using guessed type long optptr;
// 1300: using guessed type long sh_error(const char *, ...);
// nfuncs=33 queued=13 decompiled=13 lumina nreq=0 worse=0 better=0
// ALL OK, 13 function(s) have been successfully decompiled
|
void __ipstats_show_hw_s_info_one(unsigned int a0[2]) {
[6480] unsigned long long v0; // [bp-0x8]
[6480] unsigned long long v2; // rbx
[6480] unsigned long long v3; // rbx
[6480] unsigned long long v4; // rax
[6480]
[6480] if (!a0)
return;
[6536] v0 = v2;
[6485] ipstats_print_moo("request", " %s", a0[0]);
[6498, 6505, 6486, 6488, 6491] v3 = v0;
[6513, 6510] v4 = ipstats_print_moo("used", " used %s", a0[1]);
[6528, 8584, 8590, 6514, 6521] return;
[6528, 6514, 8584, 6521, 8590] }
|
void __ipstats_show_hw_s_info_one(unsigned int a0[2]) {
[3582] unsigned long long v1; // rax
[3582]
[3582] if (a0) {
ipstats_print_moo(0x4, "request", " %s", a0[0]);
[3620, 3627, 3632, 3605, 3609, 3611, 3613] v1 = ipstats_print_moo(0x4, "used", " used %s", a0[1]);
[3653, 3660, 3665, 3637, 3641, 3644, 3646] }
return;
}
|
long long string_copy(unsigned long a0, char *a1, unsigned long a2) {
[1360] unsigned long long v0; // [bp-0x10]
[1360] unsigned long v1; // [bp-0x8]
[1360] char v2; // [bp+0x0]
[1360] unsigned long long v4; // rbx
[1360] char *v5; // rbx
[1360] char *v6; // r8
[1360] char *v7; // rax
[1360] unsigned long long v8; // rbx
[1360]
[1360] if (!a1)
return 0;
[1456, 1459, 1462] v1 = &v2;
[1369] v0 = v4;
[1370, 1373] v5 = a2;
[1374] if (!a2)
v5 = strlen(a1);
[1448, 1443] v6 = malloc(v5 + 1);
[1395, 1390] if (v6) {
v7 = strncpy(v6, a1, v5);
[1409, 1412, 1403, 1406] *((v7 + v5)) = 0;
[1417] v6 = v7;
[1421, 1424, 1428, 1431, 1432, 1433] }
v8 = v0;
return v6;
}
|
long long string_copy(unsigned long a0, char *a1, unsigned long a2) {
[1273] char *v0; // [bp-0x30]
[1273] unsigned long v1; // [bp-0x20]
[1273] char *v2; // [bp-0x10]
[1273] void* v4; // rax
[1273]
[1273] v1 = a0;
[1281, 1285, 1273, 1277, 1278] v0 = a2;
[1289, 1293] if (!a1) {
v4 = 0;
[1304] return v4;
[1402, 1403] }
if (!v0)
v0 = strlen(a1);
v2 = malloc(v0 + 1);
if (v2) {
strncpy(v2, a1, v0);
*((v0 + v2)) = 0;
}
v4 = v2;
return v4;
}
|
int main(int argc, const char **argv, const char **envp)
[1600] {
int v3; // eax
int v4; // ebx
size_t v5; // r13
void *v6; // r14
_DWORD *v7; // r12
long v8; // rax
long v9; // rbx
unsigned int v10; // r15d
unsigned int v11; // ebp
unsigned int v12; // eax
long v13; // rdx
int v14; // ebx
const char *v16; // rdx
int *v17; // rax
[1600, 1604, 1606, 1608, 1610, 1612, 1613, 1614, 1618, 1621] if ( argc != 2 )
{
[1898, 1895] v16 = "Usage: %s LIMIT\nProduces a list of odd primes <= LIMIT\n";
goto LABEL_15;
}
[1627, 1631] v3 = atoi(argv[1]);
[1636, 1639] if ( v3 <= 2 )
[1880] return 0;
[1645, 1647] if ( (v3 & 1) != 0 )
{
[1936, 1931, 1934] v5 = (v3 - 1) >> 1;
[1939, 1958, 1942] v6 = xalloc(v5);
[1961, 1947, 1955, 1950] memset(v6, 1, v5);
[1978, 1970, 1966, 1975] v7 = xalloc(48 * v5);
LABEL_5:
[1708] v8 = 0LL;
[1710] v9 = 0LL;
LABEL_6:
[1712, 1716] v10 = 2 * v9 + 3;
[1728] v11 = v8 + 1;
[1721, 1731, 1725, 1734] process_prime((long)&v7[12 * v8], v10);
[1746, 1739, 1749, 1742] v12 = (v10 * v10 - 3) >> 1;
[1751] v13 = v12;
[1753, 1756, 1758, 1751] if ( v12 >= v5 )
{
[1803, 1806, 1799] while ( ++v9 < v5 )
{
LABEL_9:
[1792, 1797] if ( *((_BYTE *)v6 + v9) )
{
[1888] v8 = v11;
[1890] goto LABEL_6;
}
}
}
else
{
do
{
[1760] *((_BYTE *)v6 + v13) = 0;
[1769] v12 += v10;
[1765] v13 = v12;
}
[1772, 1765, 1775] while ( v12 < v5 );
[1784, 1777, 1786, 1781] if ( ++v9 < v5 )
goto LABEL_9;
}
goto LABEL_11;
}
[1656, 1653] v4 = (v3 - 2) >> 1;
[1658] v5 = v4;
[1664, 1680, 1661] v6 = xalloc(v4);
[1672, 1683, 1669, 1677] memset(v6, 1, v4);
[1688, 1697, 1658, 1692] v7 = xalloc(48LL * v4);
[1700, 1702] if ( v4 )
goto LABEL_5;
[2009, 2007] v11 = 0;
LABEL_11:
[1808, 1810, 1813] output_primes(v7, v11);
[1818, 1821] free(v6);
[1826, 1829] free(v7);
[1841, 1834, 1853] v14 = ferror(stdout);
[1860, 1846, 1855] if ( !(fclose(stdout) + v14) )
[1864, 1862] return 0;
[1983] v17 = _errno_location();
[1988, 1990] strerror(*v17);
[2002, 1995, 2005] v16 = "write error: %s\n";
LABEL_15:
[1924, 1929, 1905, 1912, 1917, 1919] _fprintf_chk(stderr, 1LL, v16);
[1866] return 1;
[1870, 1871, 1872, 1874, 1876, 1878] }
// 9D0: using guessed type long _fprintf_chk(_QWORD, _QWORD, _QWORD);
// nfuncs=21 queued=7 decompiled=7 lumina nreq=0 worse=0 better=0
// ALL OK, 7 function(s) have been successfully decompiled
|
int main(int argc, const char **argv, const char **envp)
[1651] {
unsigned int v4; // eax
int v5; // ebx
int *v6; // rax
char *v7; // rax
int v8; // [rsp+10h] [rbp-40h]
unsigned int v9; // [rsp+14h] [rbp-3Ch]
unsigned int i; // [rsp+18h] [rbp-38h]
unsigned int v11; // [rsp+1Ch] [rbp-34h]
unsigned long v12; // [rsp+20h] [rbp-30h]
unsigned long n; // [rsp+28h] [rbp-28h]
void *s; // [rsp+30h] [rbp-20h]
void *ptr; // [rsp+38h] [rbp-18h]
[1664, 1667, 1671, 1675, 1651, 1655, 1656, 1659, 1660] if ( argc == 2 )
{
[1729, 1732, 1735, 1740, 1721, 1725] v8 = atoi(argv[1]);
[1747, 1743] if ( v8 > 2 )
{
[1762, 1767, 1765, 1759] if ( (v8 & 1) == 0 )
[1769] --v8;
[1773, 1776, 1779, 1781, 1784, 1786, 1788, 1790] n = (v8 - 1) / 2;
[1801, 1794, 1798, 1806] s = xalloc(n);
[1826, 1810, 1814, 1818, 1823] memset(s, 1, n);
[1856, 1831, 1835, 1838, 1841, 1844, 1848, 1851] ptr = xalloc(48 * n);
[1860] v9 = 0;
[1875, 1867] v12 = 0LL;
[2016, 2024, 2020] while ( v12 < n )
{
[1880, 1889, 1884, 1886] v11 = 2 * v12 + 3;
[1892] v4 = v9++;
[1923, 1926, 1895, 1929, 1898, 1931, 1901, 1934, 1903, 1906, 1909, 1912, 1916, 1919] process_prime((long)ptr + 48 * v4, v11);
[1953, 1939, 1971, 1942, 1974, 1945, 1977, 1948, 1981, 1950] for ( i = (v11 * v11 - 3) >> 1; n > i; i += v11 )
[1955, 1958, 1962, 1965, 1968] *((_BYTE *)s + i) = 0;
do
[1983] ++v12;
[1988, 1992, 1996, 1998, 2002, 2006, 2009, 2012, 2014] while ( v12 < n && !*((_BYTE *)s + v12) );
}
[2030, 2033, 2037, 2039, 2042] output_primes((long)ptr, v9);
[2051, 2054, 2047] free(s);
[2066, 2059, 2063] free(ptr);
[2086, 2081, 2078, 2071] v5 = ferror(stdout);
[2088, 2095, 2098, 2103, 2105, 2107] if ( v5 + fclose(stdout) )
{
[2109] v6 = _errno_location();
[2114, 2116, 2118] v7 = strerror(*v6);
[2148, 2123, 2126, 2133, 2140, 2143] fprintf(stderr, "write error: %s\n", v7);
[2153, 2158] return 1;
}
else
{
[2160] return 0;
}
}
else
{
[1754, 1749] return 0;
}
}
else
{
[1698, 1701, 1706, 1677, 1681, 1684, 1691] fprintf(stderr, "Usage: %s LIMIT\nProduces a list of odd primes <= LIMIT\n", *argv);
[1716, 1711] return 1;
}
[2169, 2170, 2171, 2165] }
// nfuncs=20 queued=6 decompiled=6 lumina nreq=0 worse=0 better=0
// ALL OK, 6 function(s) have been successfully decompiled
|
static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
char s2[64];
if (!tb)
return;
tnl_print_endpoint("remote", tb[IFLA_VTI_REMOTE],
10
);
tnl_print_endpoint("local", tb[IFLA_VTI_LOCAL],
10
);
if (tb[IFLA_VTI_LINK]) {
__u32 link = rta_getattr_u32(tb[IFLA_VTI_LINK]);
if (link) {
print_string(PRINT_ANY, "link", "dev %s ",
ll_index_to_name(link));
}
}
if (tb[IFLA_VTI_IKEY]) {
struct rtattr *rta = tb[IFLA_VTI_IKEY];
__u32 key = rta_getattr_u32(rta);
if (key && inet_ntop(
2
, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), s2, sizeof(s2)))
print_string(PRINT_ANY, "ikey", "ikey %s ", s2);
}
if (tb[IFLA_VTI_OKEY]) {
struct rtattr *rta = tb[IFLA_VTI_OKEY];
__u32 key = rta_getattr_u32(rta);
if (key && inet_ntop(
2
, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), s2, sizeof(s2)))
print_string(PRINT_ANY, "okey", "okey %s ", s2);
}
if (tb[IFLA_VTI_FWMARK]) {
__u32 fwmark = rta_getattr_u32(tb[IFLA_VTI_FWMARK]);
if (fwmark) {
print_0xhex(PRINT_ANY,
"fwmark", "fwmark %#llx ", fwmark);
}
}
}
struct link_util vti6_link_util = {
.id = "vti6",
.maxattr = (__IFLA_VTI_MAX - 1),
.parse_opt = vti6_parse_opt,
.print_opt = vti6_print_opt,
.print_help = vti6_print_help,
};
|
static void vti6_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
{
char s2[64];
if (!tb)
return;
tnl_print_endpoint("remote", tb[IFLA_VTI_REMOTE],
10
);
tnl_print_endpoint("local", tb[IFLA_VTI_LOCAL],
10
);
if (tb[IFLA_VTI_LINK]) {
__u32 link = rta_getattr_u32(tb[IFLA_VTI_LINK]);
if (link) {
print_string(PRINT_ANY, "link", "dev %s ",
ll_index_to_name(link));
}
}
if (tb[IFLA_VTI_IKEY]) {
struct rtattr *rta = tb[IFLA_VTI_IKEY];
__u32 key = rta_getattr_u32(rta);
if (key && inet_ntop(
2
, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), s2, sizeof(s2)))
print_string(PRINT_ANY, "ikey", "ikey %s ", s2);
}
if (tb[IFLA_VTI_OKEY]) {
struct rtattr *rta = tb[IFLA_VTI_OKEY];
__u32 key = rta_getattr_u32(rta);
if (key && inet_ntop(
2
, ((void*)(((char*)(rta)) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))), s2, sizeof(s2)))
print_string(PRINT_ANY, "okey", "okey %s ", s2);
}
if (tb[IFLA_VTI_FWMARK]) {
__u32 fwmark = rta_getattr_u32(tb[IFLA_VTI_FWMARK]);
if (fwmark) {
print_0xhex(PRINT_ANY,
"fwmark", "fwmark %#llx ", fwmark);
}
}
}
struct link_util vti6_link_util = {
.id = "vti6",
.maxattr = (__IFLA_VTI_MAX - 1),
.parse_opt = vti6_parse_opt,
.print_opt = vti6_print_opt,
.print_help = vti6_print_help,
};
|
void buffer_append(unsigned long long a0[3], unsigned long a1) {
[400] char *v1; // r12
[400] unsigned long long v2[3]; // rbx
[400] unsigned long long v4; // rax
[400] unsigned long v5; // rax
[400] unsigned long long v6; // rax
[400] char *v8; // rax
[400] void* v9; // rax
[400] unsigned long long v10; // rax
[400]
[400] v1 = a0[1];
[400, 402, 403, 405, 410, 411] v2 = a0;
[415] v4 = xsum(a0[1], 0x1);
[421, 405] if (v4 == -1) {
[426, 430] v6 = 4294967274;
[544] return;
[520, 521, 523, 519] } else if (v2[2] < v4) {
[432, 436, 439] v5 = xsum(v2[2], 0x1);
[441, 446] if (v5 >= 0) {
[451, 454] v8 = realloc(v2[0], v5 * 2);
[466, 456, 460, 463] if (!v8) {
v10 = -(*(__errno_location()));
[528, 533, 535] } else {
v2[2] = v5 * 2;
[456, 476] v1 = v2[1];
[480] v2[0] = v8;
[484] v2[1] = v1 + 1;
[504, 509] *((v8 + v1)) = a1;
[513] v9 = 0;
[517, 519, 520, 521, 523] }
return;
[520, 521, 523, 519] } else {
v6 = 4294967274;
[544] return;
[520, 521, 523, 519] }
} else {
v8 = v2[0];
[496] if (!v2[0])
__assert_fail(); /* do not return */
[577, 551, 558, 563, 570] v2[1] = v1 + 1;
[504, 509] *((v8 + v1)) = a1;
[513] v9 = 0;
[517, 519, 520, 521, 523] return;
[520, 521, 523, 519] }
}
|
void buffer_append(unsigned long long a0[3], unsigned long a1) {
[166] unsigned int v0; // [bp-0x34]
[166] int tmp_21; // tmp #21
[166] unsigned long long v1[3]; // [bp-0x30]
[166] unsigned long v2; // [bp-0x20]
[166] unsigned long long v3; // [bp-0x18]
[166] unsigned long v4; // [bp-0x10]
[166] unsigned long long v6; // rax
[166] unsigned long long v8; // rax
[166] unsigned long long v9; // rax
[166] unsigned long long v10; // rax
[166] char *v11; // rsi
[166] void* v12; // rax
[166]
[166] v1[0] = a0;
[166, 170, 171, 174, 178] v0 = a1;
[182] v2 = xsum(a0[1], 0x1);
[201, 193, 206] if (v2 == -1) {
[210, 215] v6 = 4294967274;
[217] return;
[475, 476] } else if (v2 > a0[2]) {
[231, 227, 235, 239] if (xsum(a0[2], 0x1) < 0)
[258, 261, 266, 269, 245, 249, 253] v8 = -1;
[297, 304, 308, 313] else
v8 = xsum(a0[2], 0x1) * 2;
[292, 279, 287] v3 = v8;
[304] if (v3 != -1) {
[313, 308] v4 = realloc(a0[0], v3);
[347, 342] if (!v4) {
v10 = -(*(__errno_location()));
[358, 363, 365] return;
[475, 476] } else {
a0[2] = v3;
[369, 373, 377] a0[0] = v4;
[385, 389, 392, 396, 399, 402, 381] if (!a0[0])
__assert_fail(); /* do not return */
[416, 423, 430, 404, 411] v11 = a0[0];
[435, 439] tmp_21 = a0[1];
[442, 446] a0[1] = a0[1] + 1;
[442, 450, 454, 458, 446] v11[tmp_21] = v0;
[465, 468, 462] v12 = 0;
[470, 475, 476] return;
[475, 476] }
} else {
v9 = 4294967274;
[315] return;
[475, 476] }
} else if (!a0[0]) {
__assert_fail(); /* do not return */
[416, 423, 430, 404, 411] } else {
v11 = a0[0];
[435, 439] tmp_21 = a0[1];
[442, 446] a0[1] = a0[1] + 1;
[442, 450, 454, 458, 446] v11[tmp_21] = v0;
[465, 468, 462] v12 = 0;
[470, 475, 476] return;
[475, 476] }
}
|
int copy_for_command(struct_0 *a0) {
[1552] struct_0 *v1; // rbx
[1552] void* v2; // rdi
[1552] struct_0 *v3; // r12
[1552]
[1552] v1 = a0;
[1552, 1554, 1559, 1566, 1567] v2 = a0->field_8;
[1584] v3 = sh_xmalloc(0x20, "copy_cmd.c", 0xb9);
[1570, 1579, 1554, 1588, 1559] v3->field_0 = v1->field_0;
[1593, 1591] v3->field_4 = v1->field_4;
[1600, 1597] v3->field_8 = copy_word(v2);
[1605, 1610, 1614] v3->field_10 = copy_word_list(v1->field_10);
[1619, 1624, 1628] v3->field_18 = copy_command(v1->field_18);
[1633, 1638] return v3;
[1643, 1647, 1650, 1651, 1653] }
|
int copy_for_command(struct_0 *a0) {
[882] struct_0 *v0; // [bp-0x10]
[882]
[882] v0 = sh_xmalloc(0x20, "copy_cmd.c", 0xb9);
[898, 903, 910, 915, 920] v0->field_0 = a0->field_0;
[928, 930, 934, 924] v0->field_4 = a0->field_4;
[936, 940, 943, 947] v0->field_8 = copy_word(a0->field_8);
[961, 966, 970] v0->field_10 = copy_word_list(a0->field_10, "copy_cmd.c", v0);
[994, 903, 985, 990] v0->field_18 = copy_command(a0->field_18);
[1009, 1014, 1018] return v0;
[1026, 1027, 1022] }
|
void is_ENOTSUP(unsigned long a0) {
[80] char v1; // al
[80]
[80] v1 = a0 == 95;
[80, 83] return;
[86] }
|
int is_ENOTSUP(unsigned long a0) {
[917] char v1; // al
[917] unsigned int v2; // eax
[917]
[917] v1 = a0 == 95;
[928, 917, 918, 921, 924] return v2;
[931, 932] }
|
void print_context_function(void* a0, void* a1) {
[336] void* v1; // r14
[336] void* v3; // rbx
[336] unsigned long long v4; // rdi
[336] void* v5; // r13
[336] void* v8; // rax
[336] void* v9; // rbp
[336] void* v10; // rbx
[336] unsigned long long v11; // rax
[336] unsigned long long v12; // rax
[336]
[336] v1 = 0;
[336, 338, 341, 344, 346] v3 = a1;
[356, 361, 362, 363] putc_unlocked(0x20, a0);
[370, 366] while (true) {
[375] v4 = *(v3);
[375] v5 = v3;
[378] v3 += 1;
[381] if (v4 == 10)
[392, 396] break;
[392, 396] if (!c_isspace(v4))
[400, 387, 398] break;
[400, 398] v1 = v1 + 1;
[402] }
v8 = v1;
while (true) {
v9 = v8;
if (*((v3 + v8)) == 10)
break;
v9 = v8 + 1;
v8 += 1;
if ((v1 + 39) < v9)
break;
}
if (v1 < v9) {
v10 = v9;
while (true) {
v9 = v10;
v11 = c_isspace(*((v3 + v10 - 1)));
if (!v11)
break;
v9 = v10 - 1;
v10 -= 1;
if (v1 >= v9)
break;
}
}
v12 = fwrite_unlocked(v5, 0x1, v9 - v1, a0);
return;
}
|
void print_context_function(void* a0, char *a1) {
[890] unsigned int v0; // [bp-0x10]
[890] unsigned int v1; // [bp-0xc]
[890] unsigned long long v5; // rax
[890]
[890] putc_unlocked(0x20, a0);
[898, 902, 906, 910, 914, 917, 922, 890, 894, 895] v0 = 0;
[927] while (true) {
[940] if (!c_isspace(a1[v0]))
[961, 966, 968, 940, 943, 946, 950, 953, 956, 959] break;
[968, 966] if (a1[v0] == 10)
[970, 973, 976, 980, 983, 986, 988] break;
[970, 973, 976, 980, 983, 986, 988] v0 += 1;
[961, 936, 940, 943, 946, 950, 953, 956, 959] }
v1 = v0;
while (true) {
if (v1 > v0 + 39)
break;
if (a1[v1] == 10)
break;
v1 += 1;
}
while (true) {
if (v0 >= v1)
break;
if (!c_isspace(a1[1 + v1]))
break;
v1 -= 1;
}
v5 = fwrite_unlocked(&a1[v0], 0x1, v1 - v0, a0);
return;
}
|
void ssh_init_stdio_forwarding(long a1)
[2112] {
const char *v1; // rax
long v2; // rdx
unsigned int v3; // r12d
unsigned int v4; // eax
long v5; // rax
long v6; // rbx
[2112] v1 = *(const char **)&options[1222];
[2122, 2119] if ( v1 )
{
[2144, 2145, 2179, 2180, 2151, 2187, 2188, 2158, 2190, 2128, 2161, 2130, 2162, 2136, 2169, 2139, 2173, 2174] sshlog("ssh.c", "ssh_init_stdio_forwarding", 1880LL, 1LL, 7LL, 0LL, "%s:%d", v1, (unsigned int)options[1224]);
[2201, 2195, 2206, 2199] v3 = dup(0);
[2209, 2212, 2214, 2219, 2227, 2230] if ( v3 == -1 || (v4 = dup(1), v4 == -1) )
{
[2339, 2341, 2346, 2316, 2353, 2323, 2324, 2327, 2360, 2333, 2334] v5 = sshfatal("ssh.c", "ssh_init_stdio_forwarding", 1885LL, 1LL, 1LL, 0LL, "dup() in/out failed", v2);
}
else
{
[2246, 2249, 2252, 2224, 2258, 2232, 2239] v5 = channel_connect_stdio_fwd(a1, *(_QWORD *)&options[1222], LOWORD(options[1224]), v3, v4, 2LL);
[2263] v6 = v5;
[2266, 2269] if ( v5 )
{
[2274, 2277, 2279, 2286, 2271] channel_register_cleanup(a1, *(unsigned int *)(v5 + 4), client_cleanup_stdio_fwd, 0LL);
[2308, 2310, 2291, 2294, 2297, 2298, 2300, 2301] channel_register_open_confirm(a1, *(unsigned int *)(v6 + 4), ssh_stdio_confirm, 0LL);
return;
}
[2402, 2373, 2376, 2409, 2381, 2382, 2414, 2388, 2390, 2395, 2365, 2366] }
[2415] sshfatal("ssh.c", "ssh_init_stdio_forwarding", 1889LL, 1LL, 1LL, 0LL, "channel_connect_stdio_fwd failed", v5);
check_agent_present();
[2315] }
}
// 938: variable 'v2' is possibly undefined
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95F8: using guessed type long channel_connect_stdio_fwd(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9600: using guessed type long channel_register_cleanup(_QWORD, _QWORD, _QWORD, _QWORD);
// 9608: using guessed type long channel_register_open_confirm(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000000970) ----------------------------------------------------
void check_agent_present()
[2416] {
unsigned int authentication_socket; // eax
long v1; // rax
[2424, 2422] if ( options[0] )
{
[2432, 2436, 2438] authentication_socket = ssh_get_authentication_socket(0LL);
[2443, 2445] if ( authentication_socket )
{
[2447] options[0] = 0;
[2457, 2460] if ( authentication_socket != -47 )
{
[2464, 2462] v1 = ssh_err(authentication_socket);
[2496, 2497, 2469, 2504, 2473, 2506, 2478, 2480, 2513, 2483, 2518, 2519, 2520, 2490] sshlog("ssh.c", "check_agent_present", 2017LL, 0LL, 5LL, v1, "ssh_get_authentication_socket");
}
}
}
[2426, 2524] }
// 94C8: using guessed type int options[1482];
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95E0: using guessed type long ssh_err(_QWORD);
// 9610: using guessed type long ssh_get_authentication_socket(_QWORD);
//----- (00000000000009E0) ----------------------------------------------------
void ssh_session2_setup(long a1, unsigned int a2, int a3)
[2528] {
unsigned int v3; // r14d
char *v4; // r13
unsigned int v5; // eax
char *v6; // rax
char *v7; // rbx
char **v8; // r14
long v9; // r13
long v10; // rax
long v11; // rax
long v12; // [rsp+8h] [rbp-40h] BYREF
long v13[7]; // [rsp+10h] [rbp-38h] BYREF
v3 = tty_flag;
[2528, 2532, 2534, 2536, 2538, 2539, 2540, 2544] v13[1] = __readfsqword(0x28u);
[2560, 2551] v12 = 0LL;
[2565, 2567] v13[0] = 0LL;
[2576] if ( !a3 )
[2585, 2587, 2589] return;
[2594, 2603, 2621] v4 = getenv("DISPLAY");
[2624, 2627, 2634, 2637, 2642] if ( v4 )
[2648, 2645] goto LABEL_3;
if ( options[4] )
[3104, 3112, 3110] {
sshlog("ssh.c", "ssh_session2_setup", 2035LL, 0LL, 5LL, 0LL, "X11 forwarding requested but DISPLAY not set");
[3168, 3169, 3167, 3141, 3143, 3148, 3118, 3122, 3155, 3129, 3162, 3132, 3134, 3135] LABEL_3:
if ( options[4]
[2944, 2976, 2978, 2980, 2661, 2949, 2664, 2956, 2963, 2932, 2964, 2974, 2969, 2938, 2941, 2654] && !(unsigned int)client_x11_get_proto(
a1,
v4,
*(_QWORD *)&options[8],
(unsigned int)options[6],
(unsigned int)options[5],
&v12,
v13) )
{
v3 = 1;
[3030] sshlog(
[3009, 3011, 3016, 2986, 2990, 3023, 2997, 3000, 3002, 3003, 3036] "ssh.c",
"ssh_session2_setup",
2040LL,
0LL,
5LL,
0LL,
"Requesting X11 forwarding with authentication spoofing.");
x11_request_forwarding_with_spoofing(a1, a2, v4, v12, v13[0], 1LL);
[3041, 3046, 3049, 3052, 3057, 3063, 3066] client_expect_confirm(a1, a2, "X11 forwarding", 0LL);
[3074, 3076, 3079, 3086, 3091, 3092, 3094, 3071] }
}
check_agent_present();
[2670] if ( options[0]
[2689, 2696, 2699, 2701, 2702, 2708, 2710, 2715, 2722, 2729, 2734, 2736, 2739, 2742, 2749, 2754, 2757, 2762, 2763, 2764, 2766, 2675, 2681, 2683, 2685] && (sshlog("ssh.c", "ssh_session2_setup", 2051LL, 0LL, 5LL, 0LL, "Requesting authentication agent forwarding."),
channel_request_start(a1, a2, "[email protected]", 0LL),
(v5 = sshpkt_send(a1)) != 0) )
{
v11 = ssh_err(v5);
[2784, 2787, 2790, 2772, 2778] sshfatal("ssh.c", "ssh_session2_setup", 2054LL, 1LL, 1LL, v11, "send packet", v11);
[2808, 2801, 2795, 2815] ssh_session2_open((long)"ssh.c", (long)"ssh_session2_setup");
[2820] }
[2826, 2828, 2831, 2823] else
[2840, 2833, 2845] {
[2855] ssh_packet_set_interactive(a1, v3, (unsigned int)options[27], (unsigned int)options[28]);
[2862] v6 = (char *)lookup_env_in_list("TERM", *(_QWORD *)&options[1238], (unsigned int)options[1236]);
[2848, 2869] v7 = v6;
[2912, 2913, 2882, 2885, 2908, 2892, 2895, 2898, 2901, 2905, 2874, 2876, 2910] if ( !v6 || !*v6 )
[2922, 2594, 2918] v7 = getenv("TERM");
v8 = environ;
[3179, 3181] v9 = command;
[3202, 3235, 3205, 3206, 3213, 3246, 3186, 3220, 3221, 3192, 3228, 3197, 3230] LODWORD(v10) = fileno(stdin);
[2609, 3247] client_session2_setup(a1, a2, (unsigned int)tty_flag, options[1258] == 1, v7, 0LL, v10, v9, v8);
[2613, 2614, 2615, 2617, 2619] }
}
// B61: variable 'v10' is possibly undefined
// 3234: using guessed type int tty_flag;
// 94C8: using guessed type int options[1482];
// 94D8: using guessed type long command;
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95E0: using guessed type long ssh_err(_QWORD);
// 9620: using guessed type long channel_request_start(_QWORD, _QWORD, _QWORD, _QWORD);
// 9628: using guessed type long sshpkt_send(_QWORD);
// 9630: using guessed type long ssh_packet_set_interactive(_QWORD, _QWORD, _QWORD, _QWORD);
// 9638: using guessed type long lookup_env_in_list(_QWORD, _QWORD, _QWORD);
// 9658: using guessed type long client_session2_setup(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9660: using guessed type long client_x11_get_proto(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9668: using guessed type long x11_request_forwarding_with_spoofing(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9670: using guessed type long client_expect_confirm(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000000CB0) ----------------------------------------------------
void ssh_session2_open(long a1, long a2)
[3248] {
unsigned int v2; // r12d
unsigned int v3; // ebx
int v4; // r9d
long v5; // rbx
[3248, 3250, 3251, 3254, 3260, 3261, 3263] if ( options[1259] )
{
[3269] a2 = 0LL;
[3280, 3285, 3278, 3271] v2 = open("/dev/null", 0);
}
else
{
[3520, 3530, 3522, 3527] v2 = dup(0);
}
[3288, 3298, 3293, 3303] v3 = dup(1);
[3320, 3305] v4 = dup(2);
[3328, 3334, 3338, 3310, 3314, 3317, 3323, 3326] if ( v3 == -1 || v2 == -1 || v4 == -1 )
{
[3588, 3557, 3589, 3560, 3596, 3566, 3598, 3568, 3569, 3603, 3576, 3581, 3614] sshfatal("ssh.c", "ssh_session2_open", 2085LL, 0LL, 1LL, 0LL, "dup() in/out/err failed", a2);
[3615] control_persist_detach();
}
else
{
[3344, 3351, 3354, 3357, 3360, 3362, 3369, 3375, 3381, 3388, 3390, 3394, 3400, 3402, 3408, 3409, 3411, 3412, 3419, 3420, 3425, 3430, 3434, 3439, 3442] v5 = channel_new(a1, "session", 3LL, v2, v3);
[3459, 3466, 3473, 3474, 3445, 3448, 3481, 3482, 3484, 3453] sshlog("ssh.c", "ssh_session2_open", 2098LL, 1LL, 7LL, 0LL, "channel_new: %d", *(unsigned int *)(v5 + 4));
[3489, 3492, 3495] channel_send_open(a1, *(unsigned int *)(v5 + 4));
[3500, 3506, 3507, 3508, 3510] if ( options[1258] )
[3555, 3535, 3538, 3540, 3547, 3550] channel_register_open_confirm(a1, *(unsigned int *)(v5 + 4), ssh_session2_setup, 0LL);
[3512] }
}
// 3234: using guessed type int tty_flag;
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9608: using guessed type long channel_register_open_confirm(_QWORD, _QWORD, _QWORD, _QWORD);
// 9680: using guessed type long channel_new(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9688: using guessed type long channel_send_open(_QWORD, _QWORD);
//----- (0000000000000E20) ----------------------------------------------------
void control_persist_detach()
[3616] {
__pid_t v0; // eax
int v1; // eax
_BOOL8 v2; // rdx
int v3; // edi
long v4; // rdi
int *v5; // rax
char *v6; // rax
[3616, 3648, 3620, 3653, 3654, 3623, 3629, 3661, 3663, 3634, 3641] sshlog("ssh.c", "control_persist_detach", 1720LL, 1LL, 5LL, 0LL, "backgrounding master process");
[3668] v0 = fork();
[3673, 3674, 3675, 3678] if ( v0 == -1 )
goto LABEL_9;
[3684, 3686] if ( v0 )
{
[3872, 3877, 3848, 3850, 3884, 3853, 3885, 3859, 3892, 3894, 3864, 3865] sshlog("ssh.c", "control_persist_detach", 1734LL, 1LL, 6LL, 0LL, "background process is %ld", v0);
[3905, 3899] v3 = muxserver_sock;
[3911] options[1259] = ostdin_null_flag;
[3923, 3917] options[1257] = orequest_tty;
[3929, 3935] tty_flag = otty_flag;
[3947, 3941] options[1258] = osession_type;
[3953] close(v3);
[3958] v4 = *(_QWORD *)&options[1240];
[3965] muxserver_sock = -1;
[3975] options[1242] = 0;
[3985] muxclient(v4);
[4001, 4031, 4033, 4008, 4013, 4020, 3990, 4024, 3993, 3999] sshfatal("ssh.c", "control_persist_detach", 1744LL, 0LL, 1LL, 0LL, "Failed to connect to new control master");
LABEL_9:
[4038] v5 = _errno_location();
[4043, 4045] v6 = strerror(*v5);
[4064, 4065, 4099, 4072, 4077, 4110, 4050, 4084, 4053, 4085, 4059, 4092, 4094] sshfatal("ssh.c", "control_persist_detach", 1728LL, 1LL, 1LL, 0LL, "fork: %s", v6);
[4111] fork_postauth();
return;
[3692] }
[3697] v1 = log_is_on_stderr();
[3704, 3702] v2 = 1LL;
[3776, 3782, 3784, 3786, 3789] if ( v1 )
[3716, 3721, 3724, 3706, 3711] v2 = debug_flag == 0;
[3809, 3844, 3845, 3846, 3816, 3822, 3792, 3796, 3829, 3830, 3801, 3804, 3837, 3839] if ( (unsigned int)stdfd_devnull(1LL, 1LL, v2) == -1 )
[3736, 3731, 3726] sshlog("ssh.c", "control_persist_detach", 1747LL, 1LL, 2LL, 0LL, "stdfd_devnull failed");
[3748, 3755, 3757, 3761, 3741] daemon(1, 1);
setproctitle("%s [mux]", *(const char **)&options[1240]);
}
// 3234: using guessed type int tty_flag;
// 3238: using guessed type int debug_flag;
// 94C8: using guessed type int options[1482];
// 94E0: using guessed type int ostdin_null_flag;
// 94E8: using guessed type int orequest_tty;
// 94F0: using guessed type int otty_flag;
// 94F8: using guessed type int osession_type;
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 96A0: using guessed type long stdfd_devnull(_QWORD, _QWORD, _QWORD);
// 96B0: using guessed type long setproctitle(const char *, ...);
// 96C8: using guessed type long muxclient(_QWORD);
//----- (0000000000001010) ----------------------------------------------------
void fork_postauth()
[4112] {
int v0; // eax
_BOOL8 v1; // rdx
int *v2; // rax
char *v3; // rax
if ( need_controlpersist_detach )
control_persist_detach();
[4112, 4123, 4116, 4126] sshlog("ssh.c", "fork_postauth", 1758LL, 0LL, 5LL, 0LL, "forking to background");
[4272, 4277] options[1260] = 0;
[4162, 4132, 4136, 4169, 4143, 4176, 4146, 4148, 4149, 4155, 4157] if ( daemon(1, 1) == -1 )
[4186, 4181, 4191] {
[4201, 4206, 4207, 4208, 4211] v2 = _errno_location();
v3 = strerror(*v2);
[4347] sshfatal("ssh.c", "fork_postauth", 1761LL, 0LL, 1LL, 0LL, "daemon() failed: %.200s", v3);
[4352, 4354] forwarding_success();
[4390, 4359, 4391, 4362, 4398, 4368, 4400, 4370, 4371, 4405, 4378, 4383] }
[4406] else
{
v0 = log_is_on_stderr();
v1 = 1LL;
[4217] if ( v0 )
[4222] v1 = debug_flag == 0;
[4227, 4229] if ( (unsigned int)stdfd_devnull(1LL, 1LL, v1) == -1 )
[4256, 4262, 4264, 4266, 4269] sshlog("ssh.c", "fork_postauth", 1763LL, 1LL, 2LL, 0LL, "stdfd_devnull failed");
[4241, 4236, 4231] }
[4249, 4246] }
// 3230: using guessed type int need_controlpersist_detach;
// 3238: using guessed type int debug_flag;
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 96A0: using guessed type long stdfd_devnull(_QWORD, _QWORD, _QWORD);
//----- (0000000000001140) ----------------------------------------------------
void forwarding_success()
[4416] {
long v0; // rax
int v1; // edi
[4416] v1 = forward_confirms_pending;
[4425, 4422] if ( forward_confirms_pending != -1 )
{
[4445] --forward_confirms_pending;
[4451, 4453] if ( v1 == 1 )
{
[4512, 4544, 4546, 4516, 4521, 4553, 4559, 4528, 4531, 4532, 4539] sshlog("ssh.c", "forwarding_success", 1772LL, 1LL, 5LL, 0LL, "all expected forwarding replies received");
[4564, 4570, 4571, 4572, 4574] if ( options[1260] )
[4576, 4580] fork_postauth();
}
else
{
[4440, 4435, 4431] LODWORD(v0) = v1 - 1;
[4480, 4485, 4504, 4455, 4456, 4492, 4463, 4499, 4468, 4471, 4472, 4505, 4506, 4478] sshlog("ssh.c", "forwarding_success", 1776LL, 1LL, 6LL, 0LL, "%d expected forwarding replies remaining", v0);
}
}
[4592, 4510] }
// 1193: variable 'v0' is possibly undefined
// 3218: using guessed type int forward_confirms_pending;
// 94C8: using guessed type int options[1482];
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
//----- (0000000000001200) ----------------------------------------------------
void ssh_tun_confirm(long a1, unsigned int a2, int a3)
[4608] {
[4608, 4612, 4615, 4617, 4619, 4623, 4630, 4632, 4635, 4636, 4643, 4648, 4650, 4657, 4663, 4668, 4674, 4675, 4676, 4678, 4680, 4687, 4688, 4693] long v3; // rdx
long v4; // rcx
[4737, 4747, 4742] int v5; // [rsp-8h] [rbp-10h]
[4748]
if ( !a3 && (sshlog("ssh.c", "ssh_tun_confirm", 1862LL, 0LL, 2LL, 0LL, "Tunnel forwarding failed"), options[7]) )
{
cleanup_exit(255LL);
[4705, 4613, 4710, 4717, 4729, 4724, 4696, 4697, 4730, 4703] ssh_confirm_remote_forward(255LL, v5, v3, v4);
[4732] }
else
[4731] {
sshlog("ssh.c", "ssh_tun_confirm", 1867LL, 1LL, 5LL, 0LL, "tunnel forward established, id=%d", a2);
forwarding_success();
}
}
// 128C: variable 'v5' is possibly undefined
// 128C: variable 'v3' is possibly undefined
// 128C: variable 'v4' is possibly undefined
// 94C8: using guessed type int options[1482];
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9540: using guessed type long cleanup_exit(_QWORD);
//----- (0000000000001290) ----------------------------------------------------
long ssh_confirm_remote_forward(long a1, int a2, long a3, long a4)
[4752] {
const char *v7; // rdx
long v8; // rdi
const char *v9; // rax
long v10; // rsi
const char *v11; // rcx
unsigned int u32; // eax
long v14; // rax
long v15; // rcx
long v16; // rax
const char *v17; // rdx
long v18; // rax
long v19; // r8
unsigned int v20; // [rsp+4h] [rbp-24h] BYREF
unsigned long v21; // [rsp+8h] [rbp-20h]
[4768, 4772, 4752, 4756, 4758, 4761, 4762, 4764, 4765] v7 = *(const char **)(a4 + 40);
[4776] v8 = *(unsigned int *)(a4 + 32);
[4779, 4788] v21 = __readfsqword(0x28u);
[4793, 4795, 4798] if ( !v7 )
[5264, 5268] v7 = *(const char **)(a4 + 24);
[4804] v9 = *(const char **)(a4 + 16);
[4808] v10 = *(unsigned int *)(a4 + 8);
[4811] v11 = ":";
[4818, 4821] if ( !v9 )
{
[5232, 5235, 5238] v9 = *(const char **)a4;
[5232] if ( !*(_QWORD *)a4 )
{
[5244] v11 = (const char *)&LC55;
[5251, 5254] v9 = (const char *)&LC55;
}
}
[4827, 4830] if ( a2 != 81 )
{
[4864, 4891, 4836, 4871, 4840, 4872, 4874, 4843, 4875, 4849, 4850, 4882, 4883, 4857, 4858, 4890, 4893, 4863] sshlog(
"ssh.c",
"ssh_confirm_remote_forward",
1790LL,
0LL,
5LL,
0LL,
"remote forward %s for: listen %s%s%d, connect %s:%d",
"failure",
v9,
v11,
v10,
v7,
v8);
[5280, 4898, 5283, 5285, 4902, 4907] if ( !*(_QWORD *)(a4 + 16) && !*(_DWORD *)(a4 + 8) )
[5291, 5294, 5299, 5302, 5307] channel_update_permission(a1, *(unsigned int *)(a4 + 52), 0xFFFFFFFFLL);
[4913, 4916] if ( a2 != 82 )
goto LABEL_7;
LABEL_13:
[5152, 5162, 5164, 5158] v16 = *(_QWORD *)(a4 + 16);
[5152] if ( options[7] )
{
[5312, 5315] if ( v16 )
[5344, 5317, 5158, 5318, 5351, 5325, 5358, 5328, 5330, 5331, 5363, 5337, 5339] sshfatal(
"ssh.c",
"ssh_confirm_remote_forward",
1827LL,
0LL,
1LL,
0LL,
"Error: remote port forwarding failed for listen path %s",
*(const char **)(a4 + 16));
[5409, 5410, 5380, 5412, 5382, 5417, 5387, 5394, 5368, 5401, 5402, 5371, 5374] sshfatal(
"ssh.c",
"ssh_confirm_remote_forward",
1830LL,
0LL,
1LL,
0LL,
"Error: remote port forwarding failed for listen port %d",
*(unsigned int *)(a4 + 8));
}
[5170, 5173] else if ( v16 )
{
[5218, 5187, 5220, 5190, 5192, 5193, 5211, 5225, 5226, 5227, 5199, 5204, 5179, 5180] sshlog(
"ssh.c",
"ssh_confirm_remote_forward",
1834LL,
0LL,
3LL,
0LL,
"Warning: remote port forwarding failed for listen path %s");
LABEL_7:
[4922] forwarding_success();
[4955, 4932, 4941, 4927] return __readfsqword(0x28u) ^ v21;
}
[5443, 5444, 5451, 5452, 5424, 5427, 5204, 5430, 5211, 5436, 5438] sshlog(
"ssh.c",
"ssh_confirm_remote_forward",
1837LL,
0LL,
3LL,
0LL,
"Warning: remote port forwarding failed for listen port %d");
[5452] goto LABEL_7;
}
[4960, 4995, 4964, 4996, 4998, 4967, 4999, 4973, 4974, 5006, 5007, 5015, 4981, 4982, 5014, 5017, 4987, 4988] sshlog(
"ssh.c",
"ssh_confirm_remote_forward",
1790LL,
0LL,
5LL,
0LL,
"remote forward %s for: listen %s%s%d, connect %s:%d",
"success",
v9,
v11,
v10,
v7,
v8);
[5026, 5031, 5033, 5036, 5038, 5022] if ( *(_QWORD *)(a4 + 16) || *(_DWORD *)(a4 + 8) )
goto LABEL_7;
[5040, 5045, 5048] u32 = sshpkt_get_u32(a1, &v20);
[5053, 5055] if ( !u32 )
{
[5061] v14 = v20;
[5065] v15 = *(unsigned int *)(a4 + 32);
[5073, 5068] if ( v20 <= 0xFFFF )
{
[5464] v17 = *(const char **)(a4 + 40);
[5468] *(_DWORD *)(a4 + 48) = v20;
[5474, 5471] if ( !v17 )
[5552, 5556] v17 = *(const char **)(a4 + 24);
[5476, 5477, 5508, 5509, 5480, 5482, 5516, 5517, 5519, 5488, 5489, 5496, 5501] sshlog(
"ssh.c",
"ssh_confirm_remote_forward",
1811LL,
0LL,
3LL,
0LL,
"Allocated port %u for remote forward to %s:%d",
v14,
v17,
v15);
[5537, 5524, 5527, 5530, 5534] channel_update_permission(a1, *(unsigned int *)(a4 + 52), *(unsigned int *)(a4 + 48));
[5542] goto LABEL_7;
}
[5121, 5122, 5092, 5124, 5095, 5065, 5098, 5105, 5111, 5079, 5080, 5113, 5114, 5085] sshlog(
"ssh.c",
"ssh_confirm_remote_forward",
1802LL,
0LL,
2LL,
0LL,
"Invalid allocated port %u for remote forward to %s:%d",
v20,
*(const char **)(a4 + 24),
*(unsigned int *)(a4 + 32));
[5129, 5132, 5136, 5139, 5144, 5149] channel_update_permission(a1, *(unsigned int *)(a4 + 52), 0xFFFFFFFFLL);
goto LABEL_13;
}
[5563, 5565] v18 = ssh_err(u32);
[5570, 5606, 5575, 5607, 5580, 5613, 5615, 5587, 5620, 5590, 5597, 5599] sshfatal("ssh.c", "ssh_confirm_remote_forward", 1800LL, 1LL, 1LL, v18, "parse packet", v19);
[4947, 5631, 5599] return is_addr("ssh.c", (long)"ssh_confirm_remote_forward");
[4952, 4953, 4951] }
// 15EF: variable 'v19' is possibly undefined
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95E0: using guessed type long ssh_err(_QWORD);
// 96D0: using guessed type long sshpkt_get_u32(_QWORD, _QWORD);
// 96D8: using guessed type long channel_update_permission(_QWORD, _QWORD, _QWORD);
//----- (0000000000001600) ----------------------------------------------------
long is_addr(char *name, long a2)
[5632] {
unsigned int v2; // r12d
long v4; // rdx
long v5; // rcx
long v6; // r8
long v7; // r9
unsigned int v9; // eax
long v10; // rcx
int *p_ai_socktype; // rdi
int v12; // eax
struct addrinfo *pai; // [rsp+8h] [rbp-80h] BYREF
[5632, 5634, 5636, 5642, 5643, 5646] struct addrinfo req; // [rsp+10h] [rbp-78h] BYREF
[5650, 5659] char service[40]; // [rsp+40h] [rbp-48h] BYREF
[5664, 5666, 5671, 5673, 5675, 5680, 5689] unsigned long v16; // [rsp+68h] [rbp-20h]
[5708] v2 = 1;
[5716, 5711] v16 = __readfsqword(0x28u);
[5729, 5734, 5737, 5744, 5749, 5751, 5721, 5726] if ( !(unsigned int)is_addr_fast(name) )
[5761, 5764, 5756] {
[5769] v2 = 0;
[5772] v9 = default_ssh_port(name, a2, v4, v5, v6, v7);
_snprintf_chk(service, 32LL, 1LL, 32LL, "%u", v9);
[5772] v10 = 10LL;
[5772] p_ai_socktype = &req.ai_socktype;
while ( v10 )
[5774] {
[5780, 5783] *p_ai_socktype++ = 0;
[5785] --v10;
[5803] }
[5807] v12 = options[35];
[5815] if ( v12 == -1 )
[5792, 5828, 5797, 5830, 5800, 5787, 5823] v12 = 0;
req.ai_family = v12;
[5841, 5851, 5844, 5846] req.ai_socktype = 1;
req.ai_flags = 1028;
[5866, 5836] if ( !getaddrinfo(name, service, &req, &pai) )
[5877, 5871] {
if ( pai && !pai->ai_next )
{
freeaddrinfo(pai);
[5836, 5853] return 1;
[5858, 5861] }
else
{
freeaddrinfo(pai);
[5699, 5695] return 0;
[5705, 5707, 5702, 5703] }
}
}
return v2;
}
// 1654: variable 'v4' is possibly undefined
// 1654: variable 'v5' is possibly undefined
// 1654: variable 'v6' is possibly undefined
// 1654: variable 'v7' is possibly undefined
// 94C8: using guessed type int options[1482];
// 95D0: using guessed type long _snprintf_chk(_QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 96E0: using guessed type long default_ssh_port(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000001700) ----------------------------------------------------
unsigned long load_public_identity_files(_QWORD *a1)
[5888] {
bool v1; // zf
unsigned int v2; // r15d
int v3; // ebp
__uid_t v4; // eax
const char *v5; // rax
const char *v6; // r12
unsigned int v7; // eax
long v8; // rax
unsigned int *v9; // rdx
unsigned int v10; // eax
long v11; // rax
long v12; // rax
int v13; // edx
long v14; // rbx
long v15; // r12
char *v16; // rdi
int v17; // eax
int v18; // eax
unsigned int v19; // r13d
int *v20; // r12
long v21; // rbx
unsigned int *v22; // rdx
long v23; // rax
bool v24; // cc
__uid_t v25; // eax
char *v26; // rax
char *v27; // rbp
unsigned int v28; // eax
long v29; // rax
unsigned int *v30; // rdi
const char *v32; // rax
const char *v33; // rax
int v34; // ebp
_QWORD *v35; // rax
long v36; // rbx
unsigned int v37; // r12d
_QWORD *v38; // rcx
long v39; // rdx
long v40; // rdi
int v41; // [rsp+0h] [rbp-1048h]
unsigned int v42; // [rsp+0h] [rbp-1048h]
char *v43; // [rsp+0h] [rbp-1048h]
void *ptr; // [rsp+40h] [rbp-1008h] BYREF
unsigned int *v46; // [rsp+48h] [rbp-1000h] BYREF
void *v47; // [rsp+50h] [rbp-FF8h] BYREF
void *v48; // [rsp+58h] [rbp-FF0h] BYREF
int v49[100]; // [rsp+60h] [rbp-FE8h] BYREF
int v50[100]; // [rsp+1F0h] [rbp-E58h] BYREF
long v51[100]; // [rsp+380h] [rbp-CC8h] BYREF
long v52[100]; // [rsp+6A0h] [rbp-9A8h] BYREF
long v53[100]; // [rsp+9C0h] [rbp-688h] BYREF
long v54[101]; // [rsp+CE0h] [rbp-368h] BYREF
[5888, 5890, 5892, 5894, 5896, 5897, 5898, 5932, 5905, 5941, 5910] unsigned long v55; // [rsp+1008h] [rbp-40h]
[5956, 5949, 5951]
[5964] v55 = __readfsqword(0x28u);
[5973] v1 = *(_QWORD *)&options[196] == 0LL;
[5914, 5924, 5982, 5919] v47 = 0LL;
[5985, 5993, 6003, 5998] v48 = 0LL;
[6016, 6011, 6021, 6006] memset(v51, 0, sizeof(v51));
[6024, 6042, 6032, 6037] memset(v52, 0, sizeof(v52));
[6063, 6058, 6045, 6053] memset(v49, 0, sizeof(v49));
[6074, 6066, 6084, 6079] memset(v53, 0, sizeof(v53));
[7520, 7491, 7525, 6087, 7495, 6089, 7527, 7500, 7532, 7502, 7534, 6096, 7536, 7508, 7515, 7484] memset(v54, 0, 0x320uLL);
memset(v50, 0, sizeof(v50));
if ( v1
|| options[201] > 99
|| (unsigned int)pkcs11_init(options[22] == 0)
[6102] || (v34 = pkcs11_add_provider(*(_QWORD *)&options[196], 0LL, &v47, &v48), v34 <= 0) )
{
v41 = 0;
}
[7542] else
[7547] {
[7552, 7549] v35 = v47;
v36 = 0LL;
v37 = 0;
[7594] do
[7602, 7598] {
v40 = v35[v36];
[7554] if ( v37 <= 0x63 )
[7559] {
[7562, 7566] v38 = v48;
[7578, 7574] v39 = v37++;
v52[v39] = v40;
v51[v39] = v38[v36];
}
[7604] else
[7609, 7618, 7614] {
[7628, 7623] sshkey_free(v40);
free(*((void **)v48 + v36));
[7586] v35 = v47;
}
[7592, 7590] ++v36;
[7633] }
[7637, 7630] while ( v34 > (int)v36 );
[7642, 7652, 7647] v41 = v37;
free(v35);
[6117, 6115, 6109] free(v48);
}
[6123] if ( options[201] <= 0 )
[6129, 6141, 6134, 6127] goto LABEL_21;
v2 = v41;
v3 = 0;
[6626] do
[6626, 6629] {
[6633] v14 = v3;
[6642, 6638] v15 = v3 + 100LL;
v16 = *(char **)&options[2 * v15 + 2];
[6633, 6651] if ( v2 > 0x63 )
[6644, 6655] goto LABEL_18;
[6660] v43 = *(char **)&options[2 * v15 + 2];
[6664, 6666] v17 = strcasecmp(v16, "none");
v16 = v43;
[6152] if ( !v17 )
[6177, 6162, 6164, 6157] goto LABEL_18;
[6182, 6169, 6192, 6174] v4 = getuid();
[6195, 6187] ptr = (void *)tilde_expand_filename(*(_QWORD *)&options[2 * v15 + 2], v4);
[6200, 6202, 6208, 6205] default_client_percent_dollar_expand((long)ptr, a1);
[6213, 6216, 6223, 6226, 6228] v6 = v5;
[6233, 6238] free(ptr);
[6243, 6246] v7 = sshkey_load_public(v6, &v46, 0LL);
[6248] check_load(v7, (void **)&v46, v6, "pubkey");
[6272, 6297, 6278, 6250, 6285, 6254, 6287, 6259, 6262, 6294, 6264, 6265, 6295] v8 = 0xFFFFFFFFLL;
[6626, 6314, 6310, 6302] if ( v46 )
[6319] v8 = *v46;
[6324, 6327] sshlog("ssh.c", "load_public_identity_files", 2278LL, 0LL, 5LL, 0LL, "identity file %s type %d", v6, v8);
[6324, 6335] free(*(void **)&options[2 * v3 + 202]);
[6626, 6351, 6324, 6343] v9 = v46;
[6355, 6359] v51[v2] = (long)v6;
[6362, 6366] v52[v2] = (long)v9;
v49[v2] = options[v3 + 402];
[7337, 7339, 7344, 7349, 7355, 7357] v42 = v2 + 1;
if ( v2 == 99 )
[6708, 6701] {
if ( ++v3 >= options[201] )
{
[7363] v41 = 100;
[7366] goto LABEL_21;
[7363, 7372, 7380] }
v14 = v3;
[6672] v2 = 100;
[6677] v16 = *(char **)&options[2 * v3 + 202];
[6689] LABEL_18:
free(v16);
[6378, 6380, 6372] *(_QWORD *)&options[2 * v14 + 202] = 0LL;
goto LABEL_15;
[6696, 6699] }
if ( options[702] )
{
++v2;
[6401, 6403, 6386, 6391, 6394] }
[6408, 6418, 6413, 6415] else
[6433, 6436, 6438, 6423, 6426] {
[6448, 6443] xasprintf(&ptr, "%s-cert", v6);
[6456, 6453] v10 = sshkey_load_public(ptr, &v46, 0LL);
[6458] check_load(v10, (void **)&v46, v6, "pubkey");
[6464, 6499, 6471, 6474, 6506, 6476, 6477, 6507, 6509, 6484, 6490, 6460, 6495] v11 = 0xFFFFFFFFLL;
if ( v46 )
v11 = *v46;
sshlog(
"ssh.c",
"load_public_identity_files",
2297LL,
0LL,
5LL,
0LL,
[6514, 6523, 6526, 6519] "identity file %s type %d",
(const char *)ptr,
[6537, 6539, 6532] v11);
if ( v46 )
[6548] {
[6552, 6545] if ( (unsigned int)sshkey_is_cert() )
[6568, 6565] {
[6576, 6626] v2 += 2;
[6584, 6565] v12 = xstrdup(v6);
[6592, 6562, 6596, 6565, 6557] v52[v42] = (long)v46;
v13 = options[v3 + 402];
v51[v42] = v12;
[7385, 7390] v49[v42] = v13;
[7395, 7429, 7430, 7402, 7405, 7437, 7441, 7442, 7411, 7412, 7444, 7417, 7422] goto LABEL_15;
}
v33 = (const char *)sshkey_type(v46);
sshlog(
"ssh.c",
"load_public_identity_files",
2304LL,
1LL,
5LL,
0LL,
[7449, 7458, 7454] "key %s type %s is not a certificate",
(const char *)ptr,
[7468, 7463] v33);
[7473, 7477] sshkey_free(v46);
}
free(ptr);
[6600, 6618] ++v2;
}
[6602, 6620, 6612, 6607] LABEL_15:
[7328, 7332] ++v3;
}
[6712] while ( options[201] > v3 );
[6721, 6718] v41 = v2;
[7680, 7682, 7687, 7657, 7658, 7694, 7665, 7706, 7668, 7701, 6712, 7673, 7674] LABEL_21:
v18 = options[702];
if ( v18 > 100 )
sshfatal(
"ssh.c",
"load_public_identity_files",
2319LL,
1LL,
1LL,
[6727] 0LL,
[6730] "too many certificates",
[6737, 6739] (unsigned int)options[702]);
v19 = 0;
[6745] v20 = &options[704];
[6752] if ( v18 > 0 )
[6754, 6770, 6762, 6759] {
v20 = &options[704];
v21 = 0LL;
[6844] v19 = 0;
do
[6844] {
[6849, 6868, 6853, 6855] while ( 1 )
[6865, 6873, 6860, 6883] {
[6886, 6878] v25 = getuid();
[6896, 6891, 6893, 6899] ptr = (void *)tilde_expand_filename(*(_QWORD *)&v20[2 * v21], v25);
[6914, 6917, 6919, 6904, 6907] default_client_percent_dollar_expand((long)ptr, a1);
[6929, 6924] v27 = v26;
[6937, 6934] free(ptr);
[6939] v28 = sshkey_load_public(v27, &v46, 0LL);
[6976, 6945, 6977, 6948, 6984, 6985, 6954, 6987, 6956, 6957, 6964, 6969, 6941] check_load(v28, (void **)&v46, v27, "certificate");
[6992, 7000, 6996] v29 = 0xFFFFFFFFLL;
[7005] if ( v46 )
[7010] v29 = *v46;
[7018, 7021] sshlog("ssh.c", "load_public_identity_files", 2328LL, 0LL, 5LL, 0LL, "certificate file %s type %d", v27, v29);
free(*(void **)&v20[2 * v21]);
[7027, 7030] v30 = v46;
*(_QWORD *)&v20[2 * v21] = 0LL;
[7035, 7045, 7039] if ( v30 )
break;
free(v27);
[6776, 6781, 6783] LABEL_30:
if ( options[702] <= (int)++v21 )
[7232, 7237] goto LABEL_31;
[7268, 7273, 7242, 7274, 7246, 7249, 7281, 7255, 7256, 7289, 7291, 7288, 7263] }
if ( !(unsigned int)sshkey_is_cert() )
{
v32 = (const char *)sshkey_type(v46);
sshlog(
"ssh.c",
"load_public_identity_files",
2337LL,
1LL,
5LL,
[7296, 7305, 7301] 0LL,
[7313, 7310] "key %s type %s is not a certificate",
[7318] v27,
v32);
[6789] sshkey_free(v46);
[6794] free(v27);
[6801, 6797] goto LABEL_30;
[6809] }
[6817] v22 = v46;
[6825, 6821] v23 = v19++;
[6831] v53[v23] = (long)v27;
v54[v23] = (long)v22;
[7021, 6838] LODWORD(v22) = options[v21++ + 904];
v24 = options[702] <= (int)v21;
v50[v23] = (int)v22;
[7081, 7051] }
[7074, 7088, 7058, 7063, 7068, 7071] while ( !v24 );
[7091] }
[7120, 7097, 7123, 7110] LABEL_31:
[7136, 7107, 7126, 7131, 7102] options[702] = v19;
[7144, 7139, 7149, 7152] qmemcpy(&options[202], v51, 0x320uLL);
[7171, 7113, 7155, 7174] options[201] = v41;
[7168, 7177, 7182, 7187, 7160, 7165] qmemcpy(&options[502], v52, 0x320uLL);
[7213, 7207, 7190, 7198] qmemcpy(&options[402], v49, 0x190uLL);
[7220, 7221, 7222, 7224, 7226, 7228, 7230] qmemcpy(v20, v53, 0x320uLL);
qmemcpy(&options[1004], v54, 0x320uLL);
qmemcpy(v20 + 200, v50, 0x190uLL);
return __readfsqword(0x28u) ^ v55;
}
// 1830: variable 'v5' is possibly undefined
// 1AE3: variable 'v26' is possibly undefined
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9528: using guessed type long tilde_expand_filename(_QWORD, _QWORD);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95B0: using guessed type long xstrdup(_QWORD);
// 96F8: using guessed type long sshkey_load_public(_QWORD, _QWORD, _QWORD);
// 9700: using guessed type long xasprintf(_QWORD, const char *, ...);
// 9708: using guessed type long sshkey_is_cert(void);
// 9710: using guessed type long sshkey_type(_QWORD);
// 9718: using guessed type long sshkey_free(_QWORD);
// 9720: using guessed type long pkcs11_init(_QWORD);
// 9728: using guessed type long pkcs11_add_provider(_QWORD, _QWORD, _QWORD, _QWORD);
// 1700: using guessed type long var_CC8[100];
// 1700: using guessed type long var_9A8[100];
// 1700: using guessed type int var_FE8[100];
// 1700: using guessed type long var_688[100];
// 1700: using guessed type long var_368[101];
// 1700: using guessed type int var_E58[100];
//----- (0000000000001E20) ----------------------------------------------------
unsigned long ssh_init_forward_permissions_constprop_0(long a1, const char **a2, int a3)
{
const char **v5; // rbx
const char **v6; // r14
void *v7; // rbp
long v8; // rdi
long v9; // r15
int v10; // eax
const char *v12; // r13
void *v13; // [rsp+0h] [rbp-48h] BYREF
unsigned long v14; // [rsp+8h] [rbp-40h]
v5 = a2;
v14 = __readfsqword(0x28u);
channel_clear_permission(a1, 256LL, 2LL);
if ( a3 )
{
if ( a3 != 1 )
{
LABEL_3:
v6 = &a2[(unsigned int)(a3 - 1) + 1];
while ( 1 )
{
v13 = (void *)xstrdup(*v5);
v7 = v13;
v8 = hpdelim(&v13);
if ( !v8 )
goto LABEL_13;
v9 = cleanhostname(v8);
if ( !v13 )
break;
v10 = permitopen_port();
if ( v10 < 0 )
break;
channel_add_permission(a1, 256LL, 2LL, v9, (unsigned int)v10);
++v5;
free(v7);
if ( v6 == v5 )
return __readfsqword(0x28u) ^ v14;
}
sshfatal(
"ssh.c",
"ssh_init_forward_permissions",
1922LL,
1LL,
1LL,
0LL,
"bad port number in %s",
"permitremoteopen");
LABEL_13:
sshfatal("ssh.c", "ssh_init_forward_permissions", 1919LL, 1LL, 1LL, 0LL, "missing host in %s", "permitremoteopen");
}
v12 = *a2;
if ( strcmp(*a2, "any") )
{
if ( strcmp(v12, "none") )
goto LABEL_3;
channel_disable_admin(a1, 2LL);
}
}
return __readfsqword(0x28u) ^ v14;
}
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95B0: using guessed type long xstrdup(_QWORD);
// 9730: using guessed type long channel_clear_permission(_QWORD, _QWORD, _QWORD);
// 9738: using guessed type long hpdelim(_QWORD);
// 9740: using guessed type long cleanhostname(_QWORD);
// 9748: using guessed type long permitopen_port(void);
// 9750: using guessed type long channel_add_permission(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9758: using guessed type long channel_disable_admin(_QWORD, _QWORD);
//----- (0000000000001FC0) ----------------------------------------------------
long ssh_init_forwarding(long a1, long *a2)
[8128] {
int v2; // r15d
int v3; // r12d
const char *v4; // rdx
long v5; // rsi
long v6; // rax
long v7; // r13
long v8; // rax
const char *v9; // rcx
bool v10; // dl
int v11; // r15d
long v12; // rbx
long v13; // rax
const char *v14; // rcx
const char *v15; // rdx
long v16; // r14
int v17; // eax
long v18; // r11
long v19; // rsi
long result; // rax
long v21; // rax
long v22; // r8
long v23; // [rsp-10h] [rbp-58h]
[8128, 8130, 8163, 8132, 8134, 8136, 8137, 8140, 8141, 8145, 8151, 8156] ssh_init_forward_permissions_constprop_0(a1, *(const char ***)&options[1218], options[1220]);
[8168, 8176, 8174] if ( options[7] )
[8178] forward_confirms_pending = 0;
[8194, 8188, 8196] if ( options[1208] <= 0 )
goto LABEL_18;
[8202] v2 = 0;
[8208, 8205, 8222, 8215] v3 = 0;
do
{
[8360, 8381] v7 = 56LL * v2;
[8389, 8363, 8371, 8374] v8 = v7 + *(_QWORD *)&options[1210];
[8392] v9 = *(const char **)(v8 + 40);
[8402, 8399] if ( v9 )
{
[8232] v4 = *(const char **)(v8 + 16);
[8236] v5 = *(unsigned int *)(v8 + 8);
[8242, 8239] if ( v4 )
goto LABEL_6;
}
else
{
[8408] v4 = *(const char **)(v8 + 16);
[8412] v9 = *(const char **)(v8 + 24);
[8416] v5 = *(unsigned int *)(v8 + 8);
[8419, 8422] if ( v4 )
goto LABEL_6;
}
[8434, 8428, 8431] v4 = *(const char **)v8;
[8428] if ( !*(_QWORD *)v8 )
{
[8446] v4 = "*";
[8440] if ( !options[10] )
[8459, 8453, 8455] v4 = "LOCALHOST";
}
LABEL_6:
[8288, 8289, 8261, 8263, 8264, 8396, 8271, 8272, 8274, 8275, 8248, 8282, 8283, 8252, 8255] sshlog(
"ssh.c",
"ssh_init_forwarding",
1944LL,
0LL,
5LL,
0LL,
"Local connections to %.200s:%d forwarded to remote address %.200s:%d",
v4,
v5,
v9,
*(unsigned int *)(v8 + 32));
[8294, 8301, 8305, 8308, 8315, 8318] v6 = channel_setup_local_fwd_listener(a1, v7 + *(_QWORD *)&options[1210], &options[10]);
[8323, 8326, 8328, 8333, 8336, 8341] v3 += v6;
[8344] LODWORD(v6) = ++v2;
}
[8355, 8349, 8358] while ( options[1208] > v2 );
[8464, 8466] v10 = v2 > 0;
[8472, 8466, 8475, 8469] LOBYTE(v6) = v2 > 0 && v3 != v2;
[8477] if ( (_BYTE)v6 )
{
[8472, 8466, 8488, 8486] v10 = v2 > 0 && v3 != v2;
[8479] if ( options[7] )
goto LABEL_41;
}
[8497, 8499, 8501, 8494] if ( !v3 && v10 )
[8512, 8545, 8514, 8516, 8550, 8552, 8523, 8528, 8503, 8536, 8506, 8535, 8543] sshlog("ssh.c", "ssh_init_forwarding", 1962LL, 0LL, 2LL, 0LL, "Could not request local forwarding.", v7);
LABEL_18:
[8561, 8554, 8564] if ( options[1212] <= 0 )
{
LABEL_31:
[8928] v19 = (unsigned int)options[1246];
[8936, 8934] if ( (_DWORD)v19 )
{
[9026, 9029, 9032, 9039, 9014, 9020] v21 = client_request_tun_fwd(
a1,
v19,
(unsigned int)options[1247],
(unsigned int)options[1248],
ssh_tun_confirm,
0LL);
[9049, 9044] *a2 = v21;
[9052, 9055] if ( v21 )
{
[9057, 9063, 9068, 9073, 9079] ++forward_confirms_pending;
}
else
{
[9091, 9084] if ( options[7] )
goto LABEL_40;
[9093, 9125, 9127, 9100, 9101, 9132, 9134, 9139, 9108, 9140, 9141, 9111, 9112, 9119] sshlog("ssh.c", "ssh_init_forwarding", 1999LL, 0LL, 2LL, 0LL, "Could not request tunnel forwarding.", a2);
}
}
[8938] result = (unsigned int)forward_confirms_pending;
[8944, 8946] if ( forward_confirms_pending > 0 )
{
[8992, 8961, 8964, 8965, 8971, 8973, 8978, 8948, 8949, 8985, 8956] sshlog(
"ssh.c",
"ssh_init_forwarding",
2002LL,
1LL,
5LL,
0LL,
"expecting replies for %d forwards",
(unsigned int)forward_confirms_pending);
[8997, 8998] return v23;
}
[8997] return result;
}
[8570, 8587, 8580, 8573] v11 = 0;
[8681] while ( 2 )
{
[8681, 8702] v12 = 56LL * v11;
[8706, 8684, 8692, 8695] v13 = v12 + *(_QWORD *)&options[1214];
[8709] v14 = *(const char **)(v13 + 40);
[8716, 8719] if ( !v14 )
[8912, 8916] v14 = *(const char **)(v13 + 24);
[8725] v15 = *(const char **)(v13 + 16);
[8741, 8745, 8748, 8754, 8756, 8732, 8735] if ( !v15 )
{
[8880] v15 = *(const char **)v13;
[8880] if ( !*(_QWORD *)v13 )
[8897, 8890, 8883, 8893] v15 = "LOCALHOST";
}
[8768, 8775, 8776, 8713, 8781, 8783, 8757, 8729, 8764, 8765, 8767] sshlog(
"ssh.c",
"ssh_init_forwarding",
1966LL,
0LL,
5LL,
0LL,
"Remote connections from %.200s:%d forwarded to local address %.200s:%d",
v15,
*(unsigned int *)(v13 + 8),
v14,
*(unsigned int *)(v13 + 32));
[8802, 8788] v16 = v12 + *(_QWORD *)&options[1214];
[8808, 8795, 8805, 8799] v17 = channel_request_remote_forwarding(a1, v16);
[8813] *(_DWORD *)(v16 + 52) = v17;
[8817, 8819] if ( v17 >= 0 )
{
[8832, 8825, 8842, 8839] client_register_global_confirm(ssh_confirm_remote_forward, *(_QWORD *)&options[1214] + v12);
[8869, 8847, 8853, 8858, 8863] ++forward_confirms_pending;
LABEL_22:
[8672, 8675, 8653, 8656, 8661, 8666] if ( options[1212] <= ++v11 )
goto LABEL_31;
continue;
}
break;
}
[8592, 8600, 8598] if ( !options[7] )
{
[8610, 8644, 8613, 8649, 8619, 8651, 8621, 8623, 8628, 8635, 8637, 8606] sshlog("ssh.c", "ssh_init_forwarding", 1987LL, 0LL, 3LL, 0LL, "Warning: Could not request remote forwarding.");
goto LABEL_22;
}
[9178, 9186, 9155, 9188, 9157, 9159, 9166, 9171, 9146, 9179, 9149] sshfatal("ssh.c", "ssh_init_forwarding", 1985LL, 0LL, 1LL, 0LL, "Could not request remote forwarding.", v18);
LABEL_40:
[9219, 9193, 9226, 9200, 9233, 9202, 9235, 9205, 9211, 9212, 9214] v6 = sshfatal("ssh.c", "ssh_init_forwarding", 1997LL, 0LL, 1LL, 0LL, "Could not request tunnel forwarding.", v22);
LABEL_41:
[9248, 9281, 9251, 9253, 9254, 9286, 9260, 9262, 9267, 9240, 9241, 9274] sshfatal("ssh.c", "ssh_init_forwarding", 1960LL, 0LL, 1LL, 0LL, "Could not request local forwarding.", v6);
[9287, 8999] return ssh_session2((long)"ssh.c", "ssh_init_forwarding");
[9003, 9004, 9005, 9007, 9009, 9011, 9013] }
// 2325: variable 'v23' is possibly undefined
// 23E4: variable 'v18' is possibly undefined
// 2413: variable 'v22' is possibly undefined
// 3218: using guessed type int forward_confirms_pending;
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9760: using guessed type long channel_setup_local_fwd_listener(_QWORD, _QWORD, _QWORD);
// 9768: using guessed type long channel_request_remote_forwarding(_QWORD, _QWORD);
// 9770: using guessed type long client_register_global_confirm(_QWORD, _QWORD);
// 9778: using guessed type long client_request_tun_fwd(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002450) ----------------------------------------------------
long ssh_session2(long a1, _QWORD *a2)
[9296] {
int v3; // ecx
long *v4; // rsi
long v5; // rdx
long v6; // rcx
long v7; // r8
long v8; // r9
long v9; // r12
const char *v10; // rax
int v11; // edx
bool v12; // zf
int v13; // eax
long v14; // rax
long v15; // rdx
long v17; // rax
long v18; // [rsp-10h] [rbp-38h]
long v19[5]; // [rsp+0h] [rbp-28h] BYREF
[9296, 9298, 9299, 9302, 9303, 9306, 9310] v3 = options[1243];
[9316, 9325] v19[1] = __readfsqword(0x28u);
[9330, 9332] v19[0] = 0LL;
[9340, 9342] if ( !v3 )
[10074, 10069] ssh_init_stdio_forwarding(a1);
[9348] v4 = v19;
[9354, 9348, 9351] ssh_init_forwarding(a1, v19);
[9369, 9366, 9359] if ( !*(_QWORD *)&options[1250] )
goto LABEL_6;
[9376, 9409, 9383, 9416, 9388, 9359, 9391, 9392, 9398, 9400, 9402, 9375] sshlog("ssh.c", "ssh_session2", 2121LL, 0LL, 7LL, 0LL, "expanding LocalCommand: %s", *(const char **)&options[1250]);
[9421, 9426, 9428, 9435, 9436, 9439] v9 = *(_QWORD *)&options[1250];
[9580] while ( 1 )
{
[9472, 9479, 9480, 9487, 9490, 9491, 9498, 9501, 9502, 9509, 9512, 9513, 9520, 9523, 9524, 9531, 9534, 9535, 9542, 9545, 9546, 9553, 9556, 9557, 9564, 9567, 9568, 9570, 9445, 9573, 9447, 9577, 9580, 9454, 9457, 9464, 9465] v10 = (const char *)percent_expand(
v9,
&LC4,
*a2,
&LC3,
a2[1],
"i",
a2[2],
&LC12,
a2[3],
&LC11,
a2[4],
&LC10,
a2[5],
&LC9,
a2[6],
&LC8,
a2[9],
&LC7,
a2[7],
&LC6,
a2[8],
&LC5,
a2[10],
"T");
[9603, 9585, 9588, 9594, 9596] *(_QWORD *)&options[1250] = v10;
[9610, 9615] v4 = (long *)"ssh_session2";
[9637, 9638, 9640, 9615, 9622, 9623, 9630] sshlog("ssh.c", "ssh_session2", 2127LL, 0LL, 7LL, 0LL, "expanded LocalCommand: %s", v10);
[9648, 9645] free((void *)v9);
[9653, 9655] v8 = v18;
LABEL_6:
[9657, 9667, 9660, 9665] if ( !(unsigned int)ssh_packet_get_mux(a1, v4, v5, v6, v7, v8) )
[10056, 10064, 10059] muxserver_listen(a1);
[9680, 9673, 9683] if ( options[1243] )
{
[9696, 9689] if ( muxserver_sock != -1 )
{
[9708] v11 = options[1257];
[9714, 9723, 9719] v12 = options[1260] == 0;
[9730, 9702] ostdin_null_flag = options[1259];
[9736] v13 = options[1258];
[9742] orequest_tty = v11;
[9754, 9748] osession_type = v13;
[9760] otty_flag = tty_flag;
[9766] *(_QWORD *)&options[1258] = 0x100000000LL;
[9773] tty_flag = 0;
[9797, 9783, 9785, 9787, 9789] if ( v12 && (v13 || *(_QWORD *)&options[1222]) )
[9799] need_controlpersist_detach = 1;
[9809] options[1260] = 1;
goto LABEL_15;
}
[9858, 9861, 9866] ssh_init_stdio_forwarding(a1);
}
[9872, 9880, 9878] if ( options[1258] )
{
[9882, 9885] ssh_session2_open(a1, (long)v4);
[9890] v9 = (unsigned int)v14;
goto LABEL_19;
}
LABEL_15:
[9843, 9847] v9 = 0xFFFFFFFFLL;
[9856, 9827, 9834, 9837, 9851, 9819, 9821] v14 = ssh_packet_set_interactive(a1, options[1242] == 0, (unsigned int)options[27], (unsigned int)options[28]);
LABEL_19:
[9899, 9893, 9901] if ( options[1242] )
break;
[9910, 9903] if ( (*(_BYTE *)(a1 + 2111) & 4) == 0 )
break;
[10176, 10179, 10181, 10187, 10160, 10161, 10194, 10168, 10201, 10170, 10175] sshlog("ssh.c", "ssh_session2", 2176LL, 0LL, 5LL, 0LL, "Requesting [email protected]", v14);
[10214, 10211, 10206] LODWORD(v14) = sshpkt_start(a1, 80LL);
[10219, 10220, 10221, 10223] if ( !(_DWORD)v14 )
{
[10232, 10225, 10235] LODWORD(v14) = sshpkt_put_cstring(a1, "[email protected]");
[10240, 10242] if ( !(_DWORD)v14 )
{
[10249, 10244, 10246] LODWORD(v14) = sshpkt_put_u8(a1, 0LL);
[10256, 10254] if ( !(_DWORD)v14 )
{
[10258, 10261] v14 = sshpkt_send(a1);
[10266, 10268] if ( !(_DWORD)v14 )
break;
}
}
}
[10274, 10276] v17 = ssh_err((unsigned int)v14);
[10337, 10308, 10309, 10281, 10282, 10316, 10287, 10323, 10292, 10325, 10295, 10330, 10302] sshfatal("ssh.c", "ssh_session2", 2182LL, 1LL, 1LL, v17, "send packet", a2);
}
[9923, 9926, 9928, 9935, 9938, 9916] if ( *(_QWORD *)&options[1250] && options[1252] )
[10049, 10054] v14 = ssh_local_cmd();
[9947, 9940, 9950] if ( !need_controlpersist_detach )
{
[10081, 10083, 10088, 10093, 10079] v14 = (unsigned int)stdfd_devnull(0LL, 1LL, 0LL) + 1;
[10096] if ( !(_DWORD)v14 )
[10113, 10146, 10119, 10120, 10151, 10153, 10155, 10125, 10127, 10132, 10102, 10139, 10109, 10110] v14 = sshlog("ssh.c", "ssh_session2", 2197LL, 1LL, 2LL, 0LL, "stdfd_devnull failed", 0LL);
}
[9952, 9960, 9958] if ( options[1260] )
{
[9969, 9962, 9971, 9978] if ( options[7] && options[1212] > 0 )
[10369, 10342, 10343, 10376, 10350, 10383, 10352, 10388, 10357, 10358, 10389, 10390, 10361, 10363] sshlog(
"ssh.c",
"ssh_session2",
2206LL,
0LL,
5LL,
0LL,
"deferring postauth fork until remote forward confirmation received",
v14);
else
[9984] fork_postauth();
}
[9995] v15 = 4294967294LL;
[10008] if ( tty_flag )
[10008, 10006] v15 = (unsigned int)options[58];
[10020, 9989, 10025, 10000, 10034, 10003, 10040, 10015] return client_loop(a1, (unsigned int)tty_flag, v15, (unsigned int)v9);
[10048, 10044, 10045, 10046] }
// 25B5: variable 'v18' is possibly undefined
// 25BC: variable 'v5' is possibly undefined
// 25BC: variable 'v6' is possibly undefined
// 25BC: variable 'v7' is possibly undefined
// 25BC: variable 'v8' is possibly undefined
// 26A2: variable 'v14' is possibly undefined
// 3230: using guessed type int need_controlpersist_detach;
// 3234: using guessed type int tty_flag;
// 94C8: using guessed type int options[1482];
// 94E0: using guessed type int ostdin_null_flag;
// 94E8: using guessed type int orequest_tty;
// 94F0: using guessed type int otty_flag;
// 94F8: using guessed type int osession_type;
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9530: using guessed type long percent_expand(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95E0: using guessed type long ssh_err(_QWORD);
// 9628: using guessed type long sshpkt_send(_QWORD);
// 9630: using guessed type long ssh_packet_set_interactive(_QWORD, _QWORD, _QWORD, _QWORD);
// 96A0: using guessed type long stdfd_devnull(_QWORD, _QWORD, _QWORD);
// 9780: using guessed type long ssh_packet_get_mux(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9788: using guessed type long client_loop(_QWORD, _QWORD, _QWORD, _QWORD);
// 9790: using guessed type long ssh_local_cmd(void);
// 9798: using guessed type long muxserver_listen(_QWORD);
// 97A0: using guessed type long sshpkt_start(_QWORD, _QWORD);
// 97A8: using guessed type long sshpkt_put_cstring(_QWORD, _QWORD);
// 97B0: using guessed type long sshpkt_put_u8(_QWORD, _QWORD);
//----- (00000000000028A0) ----------------------------------------------------
struct addrinfo * resolve_addr_constprop_0(char *name, long a2, _BYTE *a3, long a4, long a5)
{
long v5; // r9
int v7; // eax
unsigned int v8; // eax
struct addrinfo *v9; // r12
unsigned int v10; // eax
unsigned long v11; // rax
const char *v13; // rax
const char *v14; // rax
struct addrinfo *pai; // [rsp+8h] [rbp-490h] BYREF
struct addrinfo req; // [rsp+10h] [rbp-488h] BYREF
char service[32]; // [rsp+40h] [rbp-458h] BYREF
char host[1032]; // [rsp+60h] [rbp-438h] BYREF
unsigned long v19; // [rsp+468h] [rbp-30h]
v5 = (unsigned int)a2;
v19 = __readfsqword(0x28u);
if ( (int)a2 <= 0 )
v5 = (unsigned int)default_ssh_port(name, a2, a3, a4, a5, (unsigned int)a2);
_snprintf_chk(service, 32LL, 1LL, 32LL, "%u", v5);
v7 = options[35];
req.ai_next = 0LL;
*(_OWORD *)&req.ai_socktype = 0LL;
req.ai_socktype = 1;
if ( v7 == -1 )
v7 = 0;
*(_OWORD *)&req.ai_addr = 0LL;
req.ai_flags = 1028;
req.ai_family = v7;
v8 = getaddrinfo(name, service, &req, &pai);
if ( v8 )
{
v9 = 0LL;
v13 = (const char *)ssh_gai_strerror(v8);
sshlog("ssh.c", "resolve_addr", 345LL, 1LL, 6LL, 0LL, "could not resolve name %.100s as address: %s", name, v13);
return v9;
}
v9 = pai;
if ( !pai )
{
sshlog("ssh.c", "resolve_addr", 350LL, 1LL, 5LL, 0LL, "getaddrinfo %.100s returned no addresses", name);
return v9;
}
if ( pai->ai_next )
{
sshlog("ssh.c", "resolve_addr", 354LL, 1LL, 5LL, 0LL, "getaddrinfo %.100s returned multiple addresses", name);
LABEL_12:
v9 = 0LL;
freeaddrinfo(pai);
return v9;
}
v10 = getnameinfo(pai->ai_addr, pai->ai_addrlen, host, 0x401u, 0LL, 0, 1);
if ( v10 )
{
v14 = (const char *)ssh_gai_strerror(v10);
sshlog("ssh.c", "resolve_addr", 359LL, 1LL, 5LL, 0LL, "Could not format address for name %.100s: %s", name, v14);
goto LABEL_12;
}
v11 = strlcpy(a3, host, 1025LL);
v9 = pai;
if ( v11 > 0x400 )
{
sshlog(
"ssh.c",
"resolve_addr",
364LL,
1LL,
2LL,
0LL,
"host \"%s\" addr \"%s\" too long (max %lu)",
name,
host,
1025LL);
*a3 = 0;
goto LABEL_12;
}
return v9;
}
// 94C8: using guessed type int options[1482];
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95D0: using guessed type long _snprintf_chk(_QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 96E0: using guessed type long default_ssh_port(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 97C0: using guessed type long strlcpy(_QWORD, _QWORD, _QWORD);
// 97C8: using guessed type long ssh_gai_strerror(_QWORD);
//----- (0000000000002B50) ----------------------------------------------------
struct addrinfo * resolve_host_constprop_0(
char *name,
long a2,
long a3,
_BYTE *a4,
long a5,
long a6)
{
int v6; // r13d
long v8; // rbx
int v9; // eax
unsigned int v10; // eax
struct addrinfo *result; // rax
char *ai_canonname; // rsi
unsigned int v13; // ebx
const char *v14; // rax
struct addrinfo *pai; // [rsp+8h] [rbp-90h] BYREF
struct addrinfo req; // [rsp+10h] [rbp-88h] BYREF
char service[40]; // [rsp+40h] [rbp-58h] BYREF
unsigned long v18; // [rsp+68h] [rbp-30h]
v6 = a3;
v8 = (unsigned int)a2;
v18 = __readfsqword(0x28u);
if ( (int)a2 <= 0 )
v8 = (unsigned int)default_ssh_port(name, a2, a3, a4, a5, a6);
*a4 = 0;
sshlog("ssh.c", "resolve_host", 262LL, 1LL, 7LL, 0LL, "lookup %s:%d", name, v8);
_snprintf_chk(service, 32LL, 1LL, 32LL, "%d", (unsigned int)v8);
v9 = options[35];
req.ai_next = 0LL;
*(_OWORD *)&req.ai_socktype = 0LL;
req.ai_socktype = 1;
if ( v9 == -1 )
v9 = 0;
*(_OWORD *)&req.ai_addr = 0LL;
req.ai_flags = 2;
req.ai_family = v9;
v10 = getaddrinfo(name, service, &req, &pai);
if ( v10 )
{
v13 = 2;
if ( !v6 && (v10 == -2 || v10 == -5) )
v13 = 5;
v14 = (const char *)ssh_gai_strerror(v10);
sshlog(
"ssh.c",
"resolve_host",
274LL,
0LL,
v13,
0LL,
"%s: Could not resolve hostname %.100s: %s",
_progname,
name,
v14);
return 0LL;
}
else
{
result = pai;
ai_canonname = pai->ai_canonname;
if ( ai_canonname )
{
if ( (unsigned long)strlcpy(a4, ai_canonname, 1025LL) > 0x400 )
{
sshlog(
"ssh.c",
"resolve_host",
280LL,
1LL,
2LL,
0LL,
"host \"%s\" cname \"%s\" too long (max %lu)",
name,
pai->ai_canonname,
1025LL);
result = pai;
*a4 = 0;
}
else
{
return pai;
}
}
}
return result;
}
// 94C8: using guessed type int options[1482];
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95D0: using guessed type long _snprintf_chk(_QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 96E0: using guessed type long default_ssh_port(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 97C0: using guessed type long strlcpy(_QWORD, _QWORD, _QWORD);
// 97C8: using guessed type long ssh_gai_strerror(_QWORD);
//----- (0000000000002D70) ----------------------------------------------------
struct addrinfo * resolve_canonicalize_constprop_0(
unsigned int a1,
long a2,
long a3,
long a4,
long a5)
{
struct addrinfo *v6; // r12
int v7; // r15d
long v8; // r9
char v9; // dl
char *v10; // rbx
int v11; // edi
long v12; // rax
long v13; // rbx
const char *i; // r12
const char *v15; // r14
long v16; // r8
long v17; // r9
struct addrinfo *v18; // r14
const char *v20; // rbx
long v21; // r8
long v22; // r9
const char *v23; // r14
char v24; // [rsp+Ch] [rbp-46Ch]
char *s; // [rsp+28h] [rbp-450h] BYREF
char s2[1032]; // [rsp+30h] [rbp-448h] BYREF
unsigned long v27; // [rsp+438h] [rbp-40h]
v27 = __readfsqword(0x28u);
v6 = resolve_addr_constprop_0(host, a1, s2, a4, a5);
if ( v6 )
{
sshlog("ssh.c", "resolve_canonicalize", 432LL, 1LL, 6LL, 0LL, "hostname %.100s is address", host);
v20 = host;
if ( strcasecmp(host, s2) )
{
sshlog("ssh.c", "resolve_canonicalize", 434LL, 1LL, 6LL, 0LL, "canonicalised address \"%s\" => \"%s\"", v20, s2);
free(host);
host = (char *)xstrdup(s2);
}
}
else
{
v7 = is_addr_fast(host);
if ( v7 )
{
sshlog("ssh.c", "resolve_canonicalize", 448LL, 1LL, 5LL, 0LL, "hostname %.100s is an unrecognised address");
return v6;
}
if ( options[1328] )
{
if ( !(unsigned int)((long ( *)(_QWORD))option_clear_or_none)(*(_QWORD *)&options[54])
|| *(_QWORD *)&options[1470] )
{
if ( options[1328] != 2 )
return v6;
v24 = 0;
}
else
{
v24 = 1;
}
if ( host[strlen(host) - 1] == 46 )
{
sshlog("ssh.c", "resolve_canonicalize", 467LL, 1LL, 7LL, 0LL, "name is fully qualified", v8);
s = (char *)xstrdup(host);
v18 = resolve_host_constprop_0(s, a1, 0LL, s2, v21, v22);
if ( v18 )
{
LABEL_18:
s[strlen(s) - 1] = 0;
if ( !(unsigned int)check_follow_cname(v24, (const char **)&s, s2) )
sshlog(
"ssh.c",
"resolve_canonicalize",
504LL,
0LL,
5LL,
0LL,
"Canonicalized hostname \"%s\" => \"%s\"",
host,
s);
v6 = v18;
free(host);
host = s;
return v6;
}
free(s);
v23 = host;
}
else
{
v9 = *host;
v10 = host;
v11 = v7;
if ( *host )
{
do
{
if ( v9 == 46 )
++v11;
v9 = *++v10;
}
while ( v9 );
v7 = v11;
}
v12 = (unsigned int)options[1329];
v13 = 0LL;
if ( (int)v12 < v7 )
{
sshlog(
"ssh.c",
"resolve_canonicalize",
483LL,
1LL,
7LL,
0LL,
"not canonicalizing hostname \"%s\" (max dots %d)",
host,
v12);
return v6;
}
for ( i = host; options[1262] > (int)v13; i = host )
{
v15 = *(const char **)&options[2 * v13 + 1264];
if ( !strcasecmp(v15, "none") )
break;
++v13;
xasprintf(&s, "%s.%s.", i, v15);
sshlog("ssh.c", "resolve_canonicalize", 493LL, 1LL, 7LL, 0LL, "attempting \"%s\" => \"%s\"", host, s);
v18 = resolve_host_constprop_0(s, a1, 0LL, s2, v16, v17);
if ( v18 )
goto LABEL_18;
free(s);
}
v23 = i;
v6 = 0LL;
}
if ( !options[1330] )
{
sshfatal(
"ssh.c",
"resolve_canonicalize",
513LL,
0LL,
1LL,
0LL,
"%s: Could not resolve host \"%s\"",
_progname,
v23);
JUMPOUT(0x3216LL);
}
sshlog("ssh.c", "resolve_canonicalize", 514LL, 1LL, 6LL, 0LL, "host %s not found in any suffix");
}
}
return v6;
}
// 3211: control flows out of bounds to 3216
// 97D8: invalid function type has been ignored
// 2F12: variable 'v16' is possibly undefined
// 2F12: variable 'v17' is possibly undefined
// 30C6: variable 'v8' is possibly undefined
// 30E6: variable 'v21' is possibly undefined
// 30E6: variable 'v22' is possibly undefined
// 94C8: using guessed type int options[1482];
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95B0: using guessed type long xstrdup(_QWORD);
// 9700: using guessed type long xasprintf(_QWORD, const char *, ...);
//----- (0000000000004D20) ----------------------------------------------------
int main(int argc, const char **argv, const char **envp)
[19744] {
char *v3; // r12
long v4; // r14
char *v5; // r15
long v6; // rbp
long v7; // rax
unsigned long v8; // rbx
long v9; // r12
long v10; // rax
long v11; // rbx
__uid_t v12; // eax
struct passwd *v13; // rdi
long v14; // rax
long v15; // r9
long v16; // r13
unsigned int v17; // eax
long v18; // rdx
struct addrinfo *v19; // r8
const char *v20; // rdi
const char *v21; // rsi
long v22; // rax
int v23; // eax
unsigned long v24; // rsi
const char *v25; // rdi
int v26; // eax
void *v27; // rdi
char *v28; // rax
int v29; // eax
char *v30; // rcx
const char *v31; // rdx
int v32; // eax
long v33; // rax
char *v34; // rdx
char *v35; // rdi
__uid_t v36; // eax
void *v37; // rdi
const char *v38; // rax
long v39; // rax
long v40; // rax
long v41; // rdx
long v42; // rsi
long v43; // rsi
long v44; // r9
long v45; // r8
long v46; // r9
long v47; // rdi
void *v48; // rdi
long v49; // rdx
long v50; // rcx
long v51; // r8
long v52; // rax
const char *v53; // rdi
unsigned int v54; // eax
long v55; // rdx
long v56; // rcx
long v57; // r8
long v58; // r9
const char *v59; // r12
int v60; // eax
long v61; // rcx
long v62; // r9
const char *v63; // rdx
const char *v64; // r11
const char *v65; // rax
const char *v66; // rdi
const char *v67; // r9
const char *v68; // r8
const char *v69; // r10
const char *v70; // rsi
long v71; // rdi
const char *v72; // rdi
long v73; // rcx
unsigned int v74; // ebx
const char *v75; // r13
int v76; // eax
char *v77; // rdi
long v78; // rax
long v79; // rdx
long v80; // rdi
long v81; // rax
char *v82; // rdi
long v83; // rcx
void *v84; // r13
const char *v85; // rax
size_t v86; // rax
unsigned int v87; // eax
__uid_t v88; // eax
void *v89; // r13
long v90; // rax
__uid_t v91; // eax
void *v92; // r13
long v93; // rax
__uid_t v94; // eax
long v95; // rax
struct addrinfo *v96; // rbx
void *v97; // r13
unsigned int v98; // r13d
long v99; // r11
const char **v100; // rbx
__uid_t v101; // eax
char *v102; // rbp
const char *v103; // rax
const char *v104; // r13
const char *v105; // rax
const char *v106; // rbx
int v107; // eax
long v108; // rbx
char *v109; // r15
const char *v110; // rax
const char *v111; // rbp
const char *v112; // rax
const char *v113; // rbx
long v114; // rbx
char *v115; // r14
const char *v116; // rax
const char *v117; // rdi
int v118; // eax
int v119; // edi
int v120; // eax
unsigned int v121; // eax
bool v122; // zf
void *v123; // rax
void **v124; // r13
char *v125; // r13
int v126; // ebx
_QWORD *v127; // r13
long v128; // r15
int v129; // eax
int *v130; // rbx
long v131; // rdi
long v132; // rbx
int *j; // rbp
const char *v134; // rdi
int v136; // eax
int *v137; // rax
char *v138; // rax
unsigned int cert; // eax
void *v140; // rax
const char *v141; // rax
void **v142; // r13
unsigned int v143; // eax
const char *v144; // rax
void **v145; // r13
unsigned int v146; // eax
const char *v147; // rax
unsigned int v148; // eax
const char *v149; // rax
void **v150; // r13
unsigned int v151; // eax
const char *v152; // rax
void **v153; // r13
unsigned int v154; // eax
const char *v155; // rax
void **v156; // r13
unsigned int v157; // eax
const char *v158; // rax
void **v159; // r13
unsigned int v160; // eax
long v161; // r11
const char *v162; // rax
unsigned int v163; // eax
long v164; // r10
const char *v165; // rax
void **v166; // r13
unsigned int v167; // eax
const char *v168; // rax
long v169; // rdx
const char *v170; // rcx
const char *v171; // rdx
unsigned int v172; // eax
long v173; // rax
const char *v174; // rax
long v175; // r8
long v176; // r9
char v177; // al
int *v178; // rax
char *v179; // rax
char *v180; // rax
long v181; // r8
long v182; // r9
char *v183; // rdi
char *v184; // rsi
long v185; // rcx
long v186; // rax
size_t v187; // rdx
long i; // rax
char *v189; // rcx
const char *v190; // rdx
__uid_t v191; // eax
long v192; // rax
int *v193; // rax
char *v194; // rax
const char *v195; // [rsp-14h] [rbp-988h]
long v196; // [rsp-Ch] [rbp-980h]
long v197; // [rsp-4h] [rbp-978h]
struct addrinfo *v198; // [rsp+4h] [rbp-970h]
const char **v199; // [rsp+Ch] [rbp-968h]
struct addrinfo *ai; // [rsp+14h] [rbp-960h]
char *s; // [rsp+1Ch] [rbp-958h]
char *v202; // [rsp+24h] [rbp-950h]
long v203; // [rsp+2Ch] [rbp-948h] BYREF
long v204; // [rsp+34h] [rbp-940h] BYREF
long v205; // [rsp+3Ch] [rbp-938h] BYREF
void *ptr; // [rsp+44h] [rbp-930h] BYREF
long v207; // [rsp+4Ch] [rbp-928h] BYREF
long v208; // [rsp+54h] [rbp-920h]
long v209; // [rsp+5Ch] [rbp-918h]
void *v210; // [rsp+64h] [rbp-910h]
long v211; // [rsp+6Ch] [rbp-908h]
long v212; // [rsp+74h] [rbp-900h]
[19744, 19748, 19750, 19752, 19754, 19757, 19759, 19760, 19762, 19763] struct stat v213; // [rsp+7Ch] [rbp-8F8h] BYREF
[19770, 19779] char v214[1040]; // [rsp+10Ch] [rbp-868h] BYREF
[19787, 19789] char name[1032]; // [rsp+51Ch] [rbp-458h] BYREF
[19797] unsigned long v216; // [rsp+934h] [rbp-40h]
[19802, 19807]
[19812, 19816, 19821, 19826, 19828] LODWORD(v6) = argc;
[19840, 19848, 19835, 19845] v216 = __readfsqword(0x28u);
[19853] LODWORD(v205) = 0;
[19860, 19862] sanitise_stdfd(argc, argv, envp);
closefrom(3LL);
[30181, 30183] _progname = ssh_get_progname(*argv);
v7 = xcalloc(argc + 1, 8LL);
saved_av = v7;
if ( argc <= 0 )
[19872] {
[19874] v10 = 0LL;
[19881, 19868, 19877] }
[19904] else
{
[19904] v8 = 0LL;
[19912, 19899, 19907] v9 = v7;
[19916, 19919] v4 = 8LL * (unsigned int)(argc - 1);
while ( 1 )
[19888] {
[19895] v3 = (char *)(v8 + v9);
*(_QWORD *)v3 = xstrdup(argv[v8 / 8]);
[19921] if ( v4 == v8 )
break;
[19936] v9 = saved_av;
[19944, 19931, 19924, 19934] v8 += 8LL;
[19949] }
[19956] v10 = argc;
[19961] }
[19968, 19973, 19966] *(_QWORD *)(saved_av + 8 * v10) = 0LL;
[19976, 19979] compat_init_setproctitle((unsigned int)argc, argv);
v11 = saved_av;
seed_rng();
[32499] v12 = getuid();
[32544, 32513, 32545, 32515, 32547, 32517, 32524, 32529, 32530, 32504, 32537, 32507] v13 = getpwuid(v12);
[32552, 32557] if ( !v13 )
{
[19985, 19995, 19990] LABEL_474:
[20000] v191 = getuid();
[20005] sshlog("ssh.c", "main", 670LL, 0LL, 3LL, 0LL, "No user exists for uid %lu", v191);
[20017, 20010] exit(255);
[20022] }
[20027] s = (char *)pwcopy(v13);
[20032, 20035] umask(0x12u);
msetlocale();
initialize_options(options);
[32452, 32485, 32459, 32492, 32461, 32494, 32467, 32470, 32471, 32473, 32478] v14 = ssh_alloc_session_state();
ai = (struct addrinfo *)v14;
if ( !v14 )
[20044, 20047] {
[20041, 20054] LABEL_473:
[20059] sshfatal("ssh.c", "main", 696LL, 0LL, 1LL, 0LL, "Couldn't allocate session state", v15);
[20067] goto LABEL_474;
[20081, 20078] }
[20090] v16 = 0LL;
[20257] channel_init_channels(v14);
HIDWORD(v199) = 0;
[20117] host = 0LL;
v202 = 0LL;
[20107] v203 = *(_QWORD *)v11;
while ( 1 )
[20104, 20097, 20107, 20095] {
[20112] while ( 1 )
[20114, 20117] {
while ( 1 )
[20119] {
[20138, 20129, 20132, 20124] v17 = BSDgetopt((unsigned int)v6, v11, "1246ab:c:e:fgi:kl:m:no:p:qstvxAB:CD:E:F:GI:J:KL:MNO:PQ:R:S:TVw:W:XYy");
[20144, 20147, 20140] v20 = (const char *)v17;
if ( v17 == -1 )
break;
[30429, 30422] HIDWORD(v21) = 0;
[30464, 30434, 30440, 30441, 30443, 30448, 30455, 30462, 30431] v22 = v17 - 49;
switch ( (int)v22 )
{
case 0:
v198 = v19;
sshfatal("ssh.c", "main", 710LL, 0LL, 1LL, 0LL, "SSH protocol v.1 is no longer supported");
[22274] goto LABEL_407;
[22284] case 1:
case 31:
[22259] continue;
[22269] case 3:
options[35] = 2;
[22244] continue;
[22254] case 5:
options[35] = 10;
[22232, 22225] continue;
[22239] case 16:
options[0] = 1;
[22210] continue;
[22220] case 17:
*(_QWORD *)&options[194] = BSDoptarg;
[22156] continue;
[22178, 22183, 22185, 22161, 22168, 22170, 22175] case 18:
options[25] = 1;
[22191] continue;
[22198] case 19:
[22205] v4 = (long)&v207;
if ( (unsigned int)parse_forward(&v207, BSDoptarg, 1LL, 0LL) )
[22146, 22139] goto LABEL_94;
[22151] v30 = BSDoptarg;
v31 = "Bad dynamic forwarding specification '%s'\n";
[22120, 22127] goto LABEL_436;
[22134] case 20:
v202 = BSDoptarg;
[20158] continue;
[20166] case 21:
config = BSDoptarg;
[22069, 22062] continue;
[22081, 22074, 22086] case 22:
[22093] HIDWORD(v199) = 1;
continue;
[21977, 21985] case 24:
free(*(void **)&options[196]);
[21999, 21991] *(_QWORD *)&options[196] = xstrdup(BSDoptarg);
continue;
[22017, 22024, 22029, 22005, 22012] case 25:
[22032] if ( *(_QWORD *)&options[1470] )
goto LABEL_455;
[22050, 22045, 22038] if ( *(_QWORD *)&options[54] )
[22057] goto LABEL_453;
v40 = (unsigned int)parse_jump(BSDoptarg, options, 1LL) + 1;
[22098, 22108] if ( !(_DWORD)v40 )
[22115] goto LABEL_454;
*(_QWORD *)&options[54] = xstrdup("none");
[21863] continue;
[21889, 21868, 21875, 21877, 21879, 21882, 21887] case 26:
*(_QWORD *)&options[15] = 0x100000001LL;
continue;
[21905, 21898, 21895] case 27:
[21910] v4 = (long)&v207;
if ( !(unsigned int)parse_forward(&v207, BSDoptarg, 0LL, 0LL) )
[21956, 21949] goto LABEL_435;
[29920, 29910] LABEL_94:
add_local_forward(options, &v207);
[21962] continue;
[21972] case 28:
if ( options[1242] == 1 )
[21921, 21915] options[1242] = 3;
[21924, 21927] else
options[1242] = 1;
[21933] continue;
[21944] case 29:
v39 = (unsigned int)(options[1258] + 1);
[21799, 21791] if ( (unsigned int)v39 > 1 )
goto LABEL_452;
[21812, 21805] *(_QWORD *)&options[1257] = 1LL;
continue;
[21818] case 30:
[21825, 21832, 21835, 21840, 21842] if ( *(_QWORD *)&options[1222] )
goto LABEL_434;
[21848] if ( muxclient_command )
goto LABEL_451;
[26755, 26758, 26763, 26765, 26748] v4 = (long)BSDoptarg;
if ( !strcmp(BSDoptarg, "check") )
[27435, 27445] {
muxclient_command = 2;
[26786, 26788, 26771, 26778, 26781] }
else if ( !strcmp((const char *)v4, "forward") )
[26794, 26804] {
muxclient_command = 5;
[30337, 30340, 30345, 30347, 30330] }
else if ( !strcmp((const char *)v4, "exit") )
[30596, 30606] {
muxclient_command = 3;
[30368, 30370, 30353, 30360, 30363] }
else if ( !strcmp((const char *)v4, "stop") )
[30376, 30386] {
muxclient_command = 6;
}
else if ( !strcmp((const char *)v4, "cancel") )
[30880, 30883, 30888, 30890, 30873] {
muxclient_command = 7;
[31269, 31270, 31272, 31277, 31252, 31284, 31291, 31259, 31260, 31293, 31263] }
else
[31298, 31303, 31308, 31313, 31315, 31320] {
[31323] if ( strcmp((const char *)v4, "proxy") )
{
[30896, 30906] sshfatal("ssh.c", "main", 769LL, 0LL, 1LL, 0LL, "Invalid multiplex command.", v185);
LABEL_439:
[21858] v6 = sshkey_alg_list(0LL, 1LL, 1LL, 10LL);
goto LABEL_87;
[21681] }
[21698, 21703, 21705, 21707, 21714, 21717, 21688, 21722, 21724, 21695] muxclient_command = 8;
}
[21737, 21730, 21732, 21742] break;
case 32:
v6 = (long)BSDoptarg;
[21597] if ( strcmp(BSDoptarg, "cipher") && strcasecmp((const char *)v6, "Ciphers") )
[21602, 21635, 21640, 21609, 21611, 21645, 21616, 21648, 21619, 21653, 21655, 21624, 21626, 21628] goto LABEL_309;
v6 = cipher_alg_list(10LL, 0LL);
goto LABEL_87;
case 33:
v4 = (long)&v207;
[21664, 21661, 21671] if ( !(unsigned int)parse_forward(&v207, BSDoptarg, 0LL, 1LL)
[21676] && !(unsigned int)parse_forward(&v207, BSDoptarg, 1LL, 1LL) )
{
[21568, 21561] goto LABEL_456;
[21585, 21580, 21573] }
[21592] add_remote_forward(options, &v207);
continue;
[21546] case 34:
[21556] free(*(void **)&options[1240]);
*(_QWORD *)&options[1240] = xstrdup(BSDoptarg);
[21496, 21498] continue;
[21510, 21515, 21522, 21525, 21532, 21534, 21503] case 35:
options[1257] = 1;
continue;
case 37:
v38 = (const char *)OpenSSL_version(0LL);
((void (*)(struct _IO_FILE *, long, const char *, ...))_fprintf_chk)(
[21539, 21541] stderr,
1LL,
[21389, 21397] "%s, %s\n",
"OpenSSH_9.1p1",
[32900, 32873, 32874, 32907, 32881, 32914, 32884, 32886, 32887, 32893, 32895] v38);
exit(0);
[32933, 32926, 32919] case 38:
[32938, 32940] if ( *(_QWORD *)&options[1222] )
{
[21410, 21403] sshfatal("ssh.c", "main", 900LL, 0LL, 1LL, 0LL, "stdio forward already specified", (unsigned int)v22);
LABEL_484:
[21440, 21442, 21416, 21423, 21425, 21430, 21435] dump_client_config(options, host);
exit(0);
[21448, 21453] }
[21458] if ( muxclient_command )
[21465, 21469] goto LABEL_476;
[21475] if ( !(unsigned int)parse_forward(&v207, BSDoptarg, 1LL, 0LL) )
[21480] goto LABEL_477;
[21491] v37 = v210;
*(_QWORD *)&options[1222] = v207;
[21374] options[1224] = v208;
[21384] free(v37);
*(_QWORD *)&options[1257] = 1LL;
[21349] continue;
[21359] case 39:
[21369] options[4] = 1;
continue;
[21334] case 40:
[21344] options[4] = 1;
options[6] = 1;
[21218, 21211] continue;
[21225] case 48:
options[0] = 0;
[21136] continue;
[21154, 21156, 21143, 21146, 21148] case 49:
[26809, 26813] *(_QWORD *)&options[192] = BSDoptarg;
[21169, 21162, 21167] continue;
case 50:
[32854] v35 = BSDoptarg;
[32861] if ( *BSDoptarg == 43 || *BSDoptarg == 94 )
[32868] v35 = BSDoptarg + 1;
if ( !(unsigned int)ciphers_valid(v35, v21) )
[21182, 21175] {
[21194, 21187, 21199] v189 = BSDoptarg;
[21206] v190 = "Unknown cipher type '%s'\n";
goto LABEL_457;
[21059] }
[21066] free(*(void **)&options[40]);
[21074, 21070] *(_QWORD *)&options[40] = xstrdup(BSDoptarg);
continue;
case 52:
v4 = (long)BSDoptarg;
[21037, 21047] v5 = (char *)(unsigned char)*BSDoptarg;
[21054] if ( (_BYTE)v5 != 94 )
goto LABEL_59;
[21304] goto LABEL_381;
[21314] case 53:
*(_QWORD *)&options[1259] = 0x100000001LL;
[21230] continue;
[21242, 21235, 21244, 21260] case 54:
[21249, 21257, 21263, 21268, 21271] options[10] = 1;
continue;
[29861] case 56:
[29866, 29868] v36 = getuid();
[29890, 29893, 29898, 29900, 29873, 29905, 29880, 29883] v4 = tilde_expand_filename(BSDoptarg, v36);
if ( stat((const char *)v4, (struct stat *)&v213.st_nlink) == -1 )
{
v178 = _errno_location();
v179 = strerror(*v178);
((void (*)(struct _IO_FILE *, long, const char *, ...))_fprintf_chk)(
stderr,
1LL,
"Warning: Identity file %s not accessible: %s.\n",
[21282, 21285, 21287, 21294, 21277] (const char *)v4,
v179);
[21299] }
else
[21319] {
[21329] add_identity_file(options, 0LL, v4, 1LL);
}
[20708, 20700] goto LABEL_48;
[20721, 20714] case 58:
[20728] options[16] = 0;
continue;
[20912, 20905, 20917, 20919] case 59:
if ( !*(_QWORD *)&options[56] )
[20932, 20925] *(_QWORD *)&options[56] = BSDoptarg;
[20944, 20937, 20949] continue;
[20956] case 60:
if ( !(unsigned int)mac_valid(BSDoptarg, v21) )
[20890] goto LABEL_465;
[20900] free(*(void **)&options[42]);
*(_QWORD *)&options[42] = xstrdup(BSDoptarg);
[20798, 20791] continue;
[20803] case 61:
[20819, 20829, 20822] options[1259] = 1;
[20848] continue;
[20848, 20846] case 62:
[20865, 20869, 20838, 20871, 20841, 20810, 20843, 20812, 20852, 20857, 20860, 20831] v33 = xstrdup(BSDoptarg);
v34 = host;
v4 = v33;
[20880, 20877] if ( !host )
[20885] v34 = (char *)&LC55;
if ( (unsigned int)process_config_line(options, s, v34, v34, v33, "command-line", 0LL, 0LL, 2LL, v5) )
[20740, 20733] goto LABEL_437;
LABEL_48:
[20753, 20746] free((void *)v4);
[20758] continue;
[20764, 20766] case 63:
if ( options[34] != -1 )
[20772] continue;
[20779] v32 = a2port(BSDoptarg, v21);
[20786] options[34] = v32;
if ( v32 > 0 )
[20994] continue;
[21004] v30 = BSDoptarg;
v31 = "Bad port '%s'\n";
[20961, 20970, 20973, 20967] goto LABEL_436;
case 64:
[32965, 32970, 32945, 32977, 32978, 32948, 32985, 32954, 32987, 32956, 32958] options[30] = 0;
continue;
[32992, 33024, 33025, 32995, 33032, 33001, 33034, 33003, 33005, 33012, 33017] case 66:
[33039] if ( ((options[1258] + 1) & 0xFFFFFFFD) != 0 )
{
[20979] sshfatal("ssh.c", "main", 1037LL, 0LL, 1LL, 0LL, "Cannot specify -s with -N/SessionType", v4);
[20989] LABEL_486:
sshfatal("ssh.c", "main", 1112LL, 0LL, 1LL, 0LL, "sshbuf_new failed", v16);
[21016, 21009] JUMPOUT(0x810FLL);
[29856, 29846] }
options[1258] = 1;
[21022] continue;
[21032] case 67:
if ( options[1257] == 2 )
[20667, 20661, 20669] options[1257] = 3;
else
[26691] options[1257] = 2;
[26698, 26702] continue;
case 69:
[26723, 26726, 26708, 26713, 26718] if ( debug_flag )
[26737, 26732, 26743] {
v4 = (unsigned int)options[30];
if ( (int)v4 <= 6 )
{
++debug_flag;
[20675] options[30] = v4 + 1;
[20685] }
}
[20695] else
{
[20594, 20587] debug_flag = 1;
[20596] options[30] = 5;
[20620, 20613, 20606] }
[20625] continue;
[20636, 20631] case 70:
if ( options[1246] == -1 )
[20642] options[1246] = 1;
[20649] v29 = a2tun(BSDoptarg, &options[1248]);
[20656] options[1247] = v29;
if ( v29 != 2147483646 )
[20572] continue;
[20582] v30 = BSDoptarg;
v31 = "Bad tun device '%s'\n";
[20150] goto LABEL_436;
[20156] case 71:
options[4] = 0;
continue;
case 72:
v16 = 1LL;
[20176] continue;
[20183] default:
[20186, 20190] goto LABEL_405;
[20192, 20226, 20228, 20197, 20200, 20203, 20208, 20215, 20217, 20221] }
[20232, 20234] }
[20237] v4 = BSDoptind;
[20241] v5 = 0LL;
[20246] if ( BSDoptind > 1 )
[20241, 20253] v5 = (char *)(strcmp(*(const char **)(v11 + 8LL * (BSDoptind - 1)), "--") == 0);
[20257, 20255] v24 = (unsigned int)v4;
v11 += 8 * v4;
[20266, 20263] v23 = v6 - v4;
v25 = host;
[20272] v6 = (unsigned int)(v6 - v4);
[20280] if ( v23 <= 0 )
[20292, 20272, 20275, 20280, 20285] break;
[20297, 20300] if ( host )
goto LABEL_371;
[20306, 20308] v26 = parse_ssh_uri(*(_QWORD *)v11, &ptr, &host, (char *)&v205 + 4);
if ( v26 == -1 )
[20408] goto LABEL_405;
[20400, 20403, 20413] if ( v26 )
[20416] {
[20419, 20413] v4 = xstrdup(*(_QWORD *)v11);
[20424, 20427] v28 = strrchr((const char *)v4, 64);
if ( v28 )
[20432, 20429] {
if ( (char *)v4 == v28 )
[20446, 20438] goto LABEL_405;
if ( !*(_QWORD *)&options[56] )
[20560] {
[20570, 20567] *(_QWORD *)&options[56] = v4;
v4 = 0LL;
[20448] }
[20463, 20451, 20455] *v28 = 0;
[20475, 20460, 20470] host = (char *)xstrdup(v28 + 1);
free((void *)v4);
}
else
[20544, 20551] {
host = (char *)v4;
}
}
else
[20323, 20318] {
[20310] v27 = ptr;
if ( !*(_QWORD *)&options[56] )
[20512] {
[20519] *(_QWORD *)&options[56] = ptr;
[20521, 20530] v27 = 0LL;
ptr = 0LL;
[20329] }
[20484, 20341, 20334, 20487] free(v27);
[20499, 20493] if ( options[34] == -1 && HIDWORD(v205) != -1 )
options[34] = HIDWORD(v205);
[20347, 20356, 20350, 20359] }
if ( (int)v6 <= 1 || (_DWORD)v5 )
[22289, 22291] {
[22294] HIDWORD(v24) = 0;
[22303] v11 += 8LL;
[22298, 22310] v25 = host;
v6 = (unsigned int)(v6 - 1);
break;
[20365] }
[20385, 20375] BSDoptreset = 1;
BSDoptind = 1;
[22312, 22315] }
if ( !v25 )
[22321, 22326] goto LABEL_405;
[22336, 22331] v204 = xstrdup(v25);
[22346, 22343] command = sshbuf_new(v25, v24);
if ( !command )
[22352, 22354] goto LABEL_486;
if ( !(_DWORD)v6 )
[22360, 22367] {
if ( options[1258] == 1 )
[30391] {
[30410, 30405] ((void ( *)(struct _IO_FILE *, long, const char *))_fprintf_chk)(
[30412, 30398, 30391] stderr,
1LL,
"You must specify a subsystem to invoke.\n");
LABEL_405:
usage();
[30417] }
goto LABEL_119;
}
if ( (int)v6 > 0 )
[30272, 30278] {
LABEL_372:
v170 = *(const char **)v11;
[29396] v11 += 8LL;
[29402] v171 = (const char *)&LC55;
[29406] v6 = v11 + 8LL * (unsigned int)(v6 - 1);
[29413, 29399] v3 = " ";
[29424, 29417] while ( 1 )
[29467] {
v172 = sshbuf_putf(command, "%s%s", v171, v170);
[29467, 29458, 29451, 29460] if ( v172 )
[29472, 29474] {
v173 = ssh_err(v172);
[29476, 29478] v43 = (long)"main";
[29512] v53 = "ssh.c";
[29526, 29519] sshfatal("ssh.c", "main", 1131LL, 1LL, 1LL, v173, "buffer error", " ");
[29506, 29511, 29512, 29483, 29485, 29519, 29491, 29528, 29496, 29499] LABEL_377:
options[34] = default_ssh_port(v53, v43, v55, v56, v57, v58);
[29538, 29533] goto LABEL_173;
[29544] }
if ( v6 == v11 )
[29432, 29435] break;
v170 = *(const char **)v11;
[29441] v171 = " ";
[29444] v11 += 8LL;
[29447] }
}
LABEL_119:
ssh_signal(13LL, 1LL);
[22378, 22373, 22383] if ( ai )
[22394, 22388] {
if ( !(_DWORD)v16 )
[22405, 22410, 22413, 22396, 22399] {
log_redirect_stderr_to();
[22415] goto LABEL_122;
}
sshfatal("ssh.c", "main", 1142LL, 0LL, 1LL, 0LL, "Can't specify both -y and -E", v6);
[32417, 32418, 32425, 32430, 32447, 32437, 32406, 32438, 32409, 32445, 32415] goto LABEL_473;
}
LABEL_122:
v41 = (unsigned int)options[29];
[22420] v16 = (unsigned int)v16 ^ 1;
[22426] if ( (_DWORD)v41 == -1 )
[22433, 22430] v41 = 1LL;
[22435] v42 = (unsigned int)options[30];
[22440] if ( (_DWORD)v42 == -1 )
[22449, 22446] v42 = 3LL;
[22451] log_init(s, v42, v41, (unsigned int)v16);
[22456, 22461, 22464] if ( debug_flag )
[22476, 22469] {
v174 = (const char *)OpenSSL_version(0LL);
[29605, 29607] sshlog("ssh.c", "main", 1153LL, 0LL, 3LL, 0LL, "%s, %s", "OpenSSH_9.1p1", v174);
[29632, 29667, 29637, 29638, 29671, 29612, 29613, 29645, 29616, 29652, 29653, 29622, 29623, 29662, 29660, 29630] }
v43 = (long)v199;
[22482] process_config_files((long)v202, v199, 0, (const char *)&v203);
[22499, 22482, 22487, 22492, 22494] if ( (_DWORD)v203 )
[22504, 22509] {
v43 = (long)"main";
[29568, 29570, 29575] sshlog("ssh.c", "main", 1158LL, 0LL, 5LL, 0LL, "configuration requests final Match pass", v44);
[29600, 29575, 29596, 29549, 29582, 29556, 29589, 29558, 29591, 29564, 29598, 29567] }
fill_default_options_for_canonicalization(options);
[22522, 22515] v47 = *(_QWORD *)&options[50];
[22527] if ( v47 )
[22537, 22534] {
v43 = (long)&LC7;
[22546, 22555, 22548] v11 = percent_expand(
[22569, 22539, 22548, 22557] v47,
&LC7,
host,
0LL,
v45,
v46,
v197,
v198,
v199,
ai,
s,
v202,
v203,
v204,
v205,
ptr,
v207,
v208,
v209,
v210,
v211,
v212,
v213.st_dev,
v213.st_ino);
free(host);
[22562, 22572] v48 = *(void **)&options[50];
[22577] host = (char *)v11;
[22584] free(v48);
[22591] *(_QWORD *)&options[50] = xstrdup(host);
[22608, 22603, 22596] }
if ( (unsigned int)is_addr(host, v43) || (lowercase(host), options[1328]) )
[22848, 22627, 22629, 22853, 22860, 22615, 22841, 22622] {
ai = resolve_canonicalize_constprop_0(options[34], v43, v49, v50, v51);
[22641, 22635, 22653] LODWORD(v6) = ((long ( *)(_QWORD))option_clear_or_none)(*(_QWORD *)&options[54]);
[22658, 22646, 22663] if ( !(_DWORD)v6 )
[22665, 22667] goto LABEL_134;
}
else
{
ai = 0LL;
[22878, 22887] if ( !(unsigned int)((long ( *)(_QWORD))option_clear_or_none)(*(_QWORD *)&options[54]) )
[22873, 22866, 22889] {
if ( !(unsigned int)config_has_permitted_cnames(options) )
[30250, 30252, 30245, 30238] goto LABEL_396;
goto LABEL_417;
}
}
LODWORD(v6) = *(_QWORD *)&options[1470] == 0LL;
[22897, 22905, 22909, 22895] LABEL_134:
if ( !ai )
[22673, 22679] {
LABEL_468:
if ( !(unsigned int)config_has_permitted_cnames(options) )
[32337, 32339, 32332, 32325] goto LABEL_396;
if ( (_DWORD)v6 )
[32345, 32347] {
v3 = (char *)&v213.__unused[1];
[32371, 32366] v198 = resolve_host_constprop_0(host, (unsigned int)options[34], 1LL, &v213.__unused[1], v181, v182);
[32353, 32387, 32359, 32379, 32382] if ( !v198 )
[32392, 32401, 32395] goto LABEL_380;
LABEL_419:
v43 = (long)&host;
[30777, 30780] check_follow_cname(v6, (const char **)&host, (const char *)&v213.__unused[1]);
[30787, 30789, 30794, 30777, 30780] }
else
{
LABEL_417:
if ( options[1328] == 2 )
[30724, 30717] {
v43 = (unsigned int)options[34];
[30730] LOBYTE(v6) = 0;
[30745, 30743] v3 = (char *)&v213.__unused[1];
[30747] v198 = resolve_host_constprop_0(host, v43, 0LL, &v213.__unused[1], v181, v182);
[30736, 30763, 30755, 30758] if ( v198 )
[30768, 30771] goto LABEL_419;
}
LABEL_396:
v198 = 0LL;
[30258, 30267] }
}
v52 = (unsigned int)v203;
[22696, 22692] if ( options[1328] )
[22685] {
if ( !(_DWORD)v203 )
[22704, 22702] {
v52 = sshlog(
[27557, 27579, 27564, 27569, 27538, 27570, 27544, 27577, 27547, 27549, 27550] "ssh.c",
"main",
1216LL,
0LL,
5LL,
0LL,
"hostname canonicalisation enabled, will re-parse configuration",
v43);
LODWORD(v203) = 1;
[27584, 27593, 27595, 27592] }
}
else if ( !(_DWORD)v203 )
[22914, 22916] {
goto LABEL_145;
}
sshlog("ssh.c", "main", 1222LL, 0LL, 5LL, 0LL, "re-parsing configuration", v52);
[22721, 22723, 22724, 22730, 22732, 22737, 22710, 22711, 22744, 22718, 22751] free(*(void **)&options[50]);
[22763, 22756] v43 = (long)v199;
[22780] *(_QWORD *)&options[50] = xstrdup(host);
[22768, 22797, 22775] process_config_files((long)v202, v199, 1u, 0LL);
[22785, 22790, 22792, 22804, 22780] if ( ai )
[22809, 22810, 22811, 22817] {
v43 = (unsigned int)options[34];
[22819] if ( (int)v43 > 0 )
[22825, 22827] set_addrinfo_port((long)ai, v43);
[22834, 22829, 22839] }
LABEL_145:
v53 = (const char *)options;
[22922] v54 = fill_default_options(options);
[22929, 22922] v6 = v54;
[22934] if ( v54 )
[22936, 22938] goto LABEL_380;
if ( !*(_QWORD *)&options[56] )
[22944, 22952] {
v53 = *v199;
[30218, 30213] *(_QWORD *)&options[56] = xstrdup(*v199);
[30233, 30218, 30226, 30221] }
if ( *(_QWORD *)&options[1470] )
[22966, 22958] {
v4 = (unsigned int)options[34];
[22972] v59 = *(const char **)&options[1468];
[22979] v11 = (unsigned int)options[1472];
[22986] if ( (int)v4 <= 0 )
[22992, 22995] v4 = (unsigned int)default_ssh_port(v53, v43, v55, v56, v57, v58);
[30200, 30208, 30205] if ( (int)v11 <= 0 )
[23001, 23003] v11 = (unsigned int)default_ssh_port(v53, v43, v55, v56, v57, v58);
[30193, 30195, 30188] if ( !v59 )
[23009, 23012] v59 = *(const char **)&options[56];
[30150, 30143] v5 = *(char **)&options[1470];
[23018] v60 = strcmp(v5, host);
[23032, 23025, 23035] if ( (_DWORD)v4 == (_DWORD)v11 && !v60 && !strcmp(*(const char **)&options[56], v59) )
[23040, 23043, 29124, 23045, 23047, 29131, 29134, 29139, 29141] {
sshfatal("ssh.c", "main", 1258LL, 0LL, 1LL, 0LL, "jumphost loop via %s", v5);
[29154, 29156, 29189, 29159, 29161, 29162, 29168, 29170, 29175, 29147, 29182] LABEL_364:
v6 = mac_alg_list(10LL);
[29207, 29194, 29204, 29199] LABEL_87:
if ( v6 )
[21745, 21748] goto LABEL_88;
goto LABEL_370;
}
v11 = (long)s;
[23053] v3 = s;
[23066] if ( strchr(s, 47) )
[23074, 23077, 23058, 23063, 23069] {
v3 = "ssh";
[23087] if ( !access(s, 1) )
[23084, 23094, 23079] v3 = s;
[23099, 23101] }
if ( *(_QWORD *)&options[54] )
[23113, 23105] {
v117 = "ssh.c";
[32272, 32265] sshfatal("ssh.c", "main", 1269LL, 0LL, 1LL, 0LL, "inconsistent options: ProxyCommand+ProxyJump", v61);
[32258, 32233, 32265, 32240, 32241, 32274, 32244, 32250, 32251, 32253] LABEL_467:
v43 = (long)"main";
[32303, 32279] sshfatal("ssh.c", "main", 1531LL, 0LL, 1LL, 0LL, "No ControlPath specified for \"-O\" command", v117);
[32288, 32320, 32290, 32291, 32298, 32303, 32310, 32311, 32282, 32318] goto LABEL_468;
}
v62 = (unsigned int)options[1472];
[23119] v11 = (long)name;
[23126] options[1261] = 0;
[23154] v4 = (long)" -F ";
[23171] _snprintf_chk(name, 8LL, 1LL, 8LL, "%d", v62);
[23139, 23141, 23146, 23178, 23151, 23164, 23134] v63 = config;
[23189, 23183] v64 = " -";
[23203, 23196] if ( !debug_flag )
[23219] v64 = (const char *)&LC55;
[23217, 23219] if ( !config )
[23226, 23223] {
v63 = (const char *)&LC55;
[30170] v4 = (long)&LC55;
[30176, 30173] }
v65 = *(const char **)&options[1474];
[23232] v66 = " -J ";
[23239] if ( !v65 )
[23249, 23246] {
v65 = (const char *)&LC55;
[30155] v66 = (const char *)&LC55;
[30162, 30165] }
v67 = " -p ";
[23262] if ( options[1472] <= 0 )
[23269, 23255] {
v11 = (long)&LC55;
[23271] v67 = (const char *)&LC55;
[23278] }
v68 = *(const char **)&options[1468];
[23281] v69 = " -l ";
[23288] if ( !v68 )
[23298, 23304, 23306, 23307, 23295] {
v68 = (const char *)&LC55;
[30128] v69 = (const char *)&LC55;
[30138, 30135] }
xasprintf(
[23328, 23329, 23332, 23334, 23335, 23337, 23210, 23338, 23345, 23314, 23315, 23346, 23322, 23323, 23326] &options[54],
"%s%s%s%s%s%s%s%s%s%s%.*s -W '[%%h]:%%p' %s",
v3,
v69,
v68,
v67,
(const char *)v11,
v66,
v65,
(const char *)v4,
v63,
v64,
debug_flag,
"vvv",
*(const char **)&options[1470]);
v43 = (long)"main";
[23385] v53 = "ssh.c";
[23392, 23394] sshlog(
[23360, 23362, 23394, 23369, 23401, 23375, 23378, 23351, 23384, 23385, 23355] "ssh.c",
"main",
1293LL,
0LL,
5LL,
0LL,
"Setting implicit ProxyCommand from ProxyJump: %s",
*(const char **)&options[54]);
v55 = v196;
[23406, 23407] }
if ( !options[34] )
[23408, 23415] goto LABEL_377;
LABEL_173:
v70 = (const char *)(unsigned int)options[35];
[23426, 23421] channel_set_af(v198, v70, v55);
[23432, 23421] v71 = *(_QWORD *)&options[52];
[23437] if ( v71 )
[23444, 23447] lowercase(v71);
[23449] v72 = *(const char **)&options[54];
[23454] if ( v72 )
[23464, 23461] {
v70 = "-";
[23466] if ( !strcmp(v72, "-") )
[23480, 23473, 23466, 23478] {
if ( options[1261] )
[26825, 26818] {
v134 = "ssh.c";
[26870, 26863] sshfatal("ssh.c", "main", 1307LL, 0LL, 1LL, 0LL, "ProxyCommand=- and ProxyUseFDPass are incompatible", v11);
[26872, 26850, 26855, 26862, 26831, 26863, 26834, 26840, 26842, 26843] goto LABEL_303;
}
}
}
if ( options[1463] == 2 )
[23493, 23486] {
if ( options[1243] && *(_QWORD *)&options[1240] )
[29242, 29234, 29228, 29221] {
v169 = 1310LL;
[29248, 29251, 29257, 29259, 29261, 29268] v195 = "UpdateHostKeys=ask is incompatible with ControlPersist; disabling";
[29273] }
else
{
v72 = (const char *)command;
[30066] if ( !sshbuf_len(command) && !*(_QWORD *)&options[1254] && options[1257] != 1 )
[30081, 30083, 30091, 30799, 30066, 30806, 30073, 30078] {
if ( options[30] <= 2 )
[30819, 30812] options[1463] = 0;
[30825] goto LABEL_178;
[30835] }
v169 = 1316LL;
[30097, 30106, 30108, 30100] v195 = "UpdateHostKeys=ask is incompatible with remote command execution; disabling";
[30120, 30113, 30122, 30123] }
v70 = "main";
[29274] v72 = "ssh.c";
[29281] sshlog("ssh.c", "main", v169, 0LL, 5LL, 0LL, v195);
[29288, 29281, 29274, 29290] options[1463] = 0;
[29297, 29299, 29309, 29295] }
LABEL_178:
if ( options[36] <= 0 )
[23506, 23499] {
v70 = "main";
[32696, 32708, 32703] sshfatal("ssh.c", "main", 1325LL, 0LL, 1LL, 0LL, "Invalid number of ConnectionAttempts", v72);
[32708, 32715, 32684, 32716, 32687, 32723, 32693, 32725, 32695] LABEL_479:
sshfatal("ssh.c", "main", 1328LL, 0LL, 1LL, 0LL, "Cannot execute command-line and remote command.", v70);
[32769, 32762, 32739, 32771, 32741, 32742, 32749, 32754, 32761, 32730, 32733] LABEL_480:
v193 = _errno_location();
[32776] v194 = strerror(*v193);
[32781, 32783] sshfatal("ssh.c", "main", 1370LL, 0LL, 1LL, 0LL, "gethostname: %s", v194);
[32800, 32834, 32807, 32812, 32819, 32788, 32820, 32829, 32791, 32827, 32797, 32799] }
if ( sshbuf_len(command) && *(_QWORD *)&options[1254] )
[23524, 23527, 23529, 23537, 23512, 23519] goto LABEL_479;
if ( options[1260] && !sshbuf_len(command) && !*(_QWORD *)&options[1254] && options[1258] )
[23552, 26913, 23559, 26919, 23564, 26926, 23567, 23543, 26905, 23550] {
sshfatal("ssh.c", "main", 1334LL, 0LL, 1LL, 0LL, "Cannot fork into background without a command to execute.", v73);
[26949, 26950, 26952, 26957, 26971, 26932, 26964, 26939, 26940, 26973, 26943] LABEL_309:
if ( !strcmp((const char *)v6, "cipher-auth") )
[26978, 26985, 26988, 26993, 26995] {
v6 = cipher_alg_list(10LL, 1LL);
[30704, 30699, 30709, 30694] goto LABEL_87;
[30712] }
if ( !strcmp((const char *)v6, "mac") || !strcasecmp((const char *)v6, "MACs") )
[27008, 27041, 27011, 27016, 27018, 27024, 27031, 27001, 27034, 27039] goto LABEL_364;
if ( !strcmp((const char *)v6, "kex") || !strcasecmp((const char *)v6, "KexAlgorithms") )
[27077, 27047, 27080, 27085, 27054, 27087, 27057, 27062, 27064, 27070] {
v6 = kex_alg_list(10LL);
[30865, 30860, 30855] goto LABEL_87;
[30868] }
if ( !strcmp((const char *)v6, "key") )
[27108, 27110, 27093, 27100, 27103] {
v6 = sshkey_alg_list(0LL, 0LL, 0LL, 10LL);
[31008, 30992, 30997, 30999, 31001, 31003] goto LABEL_87;
[31011] }
if ( !strcmp((const char *)v6, "key-cert") )
[27116, 27123, 27126, 27131, 27133] {
v6 = sshkey_alg_list(1LL, 0LL, 0LL, 10LL);
[30945, 30947, 30952, 30957, 30938, 30943] goto LABEL_87;
[30960] }
if ( !strcmp((const char *)v6, "key-plain") )
[27139, 27146, 27149, 27154, 27156] {
v6 = sshkey_alg_list(0LL, 1LL, 0LL, 10LL);
[30916, 30918, 30923, 30925, 30930, 30911] goto LABEL_87;
[30933] }
if ( !strcmp((const char *)v6, "key-sig")
[27264, 27269, 27271, 27277, 27284, 27287, 27162, 27292, 27294, 27169, 27172, 27300, 27177, 27179, 27307, 27310, 27185, 27315, 27317, 27192, 27195, 27200, 27202, 27208, 27215, 27218, 27223, 27225, 27231, 27238, 27241, 27246, 27248, 27254, 27261] || !strcasecmp((const char *)v6, "PubkeyAcceptedKeyTypes")
|| !strcasecmp((const char *)v6, "PubkeyAcceptedAlgorithms")
|| !strcasecmp((const char *)v6, "HostKeyAlgorithms")
|| !strcasecmp((const char *)v6, "HostbasedKeyTypes")
|| !strcasecmp((const char *)v6, "HostbasedAcceptedKeyTypes")
|| !strcasecmp((const char *)v6, "HostbasedAcceptedAlgorithms") )
{
v6 = sshkey_alg_list(0LL, 0LL, 1LL, 10LL);
[30977, 30979, 30984, 30965, 30970, 30975] goto LABEL_87;
[30987] }
if ( !strcmp((const char *)v6, "sig") )
[27330, 27333, 27338, 27340, 27323] goto LABEL_439;
if ( !strcmp((const char *)v6, "protocol-version") )
[27361, 27363, 27346, 27353, 27356] {
v6 = xstrdup("2");
[31394, 31387, 31399] goto LABEL_87;
[31402] }
if ( !strcmp((const char *)v6, "compression") )
[27369, 27376, 27379, 27384, 27386] {
v186 = compression_alg_list(0LL);
[31328, 31330] v6 = xstrdup(v186);
[31338, 31346, 31335] v187 = strlen((const char *)v6);
[31354, 31349, 31343] for ( i = 0LL; i != v187; ++i )
[31373, 31377, 31380, 31382, 31357, 31359] {
if ( *(_BYTE *)(v6 + i) == 44 )
[31361, 31366] *(_BYTE *)(v6 + i) = 10;
[31368] }
LABEL_88:
_printf_chk(1LL, "%s\n", (const char *)v6);
[21764, 21769, 21771, 21754, 21757] free((void *)v6);
[21776, 21779] exit(0);
[21784, 21786] }
if ( !strcmp((const char *)v6, "help") )
[27392, 27399, 27402, 27407, 27409] {
v6 = xstrdup("cipher\ncipher-auth\ncompression\nkex\nkey\nkey-cert\nkey-plain\nkey-sig\nmac\nprotocol-version\nsig");
[27427, 27422, 27415] goto LABEL_87;
[27430] }
LABEL_370:
v24 = (unsigned long)"main";
[29314, 29320, 29323, 29325, 29330, 29337, 29343] v25 = "ssh.c";
[29358, 29351] sshfatal("ssh.c", "main", 817LL, 0LL, 1LL, 0LL, "Unsupported query \"%s\"", BSDoptarg);
[29314, 29350, 29351, 29360, 29343] LABEL_371:
v202 = (char *)xstrdup(v25);
[29370, 29365] command = sshbuf_new(v25, v24);
[29380, 29375] if ( !command )
[29387, 29390] goto LABEL_486;
goto LABEL_372;
}
v74 = 0;
[23587] log_init(s, (unsigned int)options[30], (unsigned int)options[29], (unsigned int)v16);
[23584, 23589, 23595, 23602, 23573, 23579] if ( options[31] )
[23616, 23614, 23607] {
do
{
v75 = *(const char **)(*(_QWORD *)&options[32] + 8LL * v74);
[23650, 23643, 23655] if ( !strcasecmp(v75, "none") )
[23652, 23659, 23662, 23667, 23669] break;
++v74;
[23627] log_verbose_add(v75);
[23624, 23630] }
while ( options[31] > v74 );
[23641, 23635] }
if ( (unsigned int)(options[1257] - 2) <= 1 )
[23680, 23683, 23677, 23671] tty_flag = 1;
[23685] if ( !sshbuf_len(command) && !*(_QWORD *)&options[1254] )
[23712, 23720, 23695, 23702, 23707, 23710] tty_flag = options[1257] != 1;
[27654, 27656, 27663, 27666, 27672] if ( options[1257] == 1 || (muxclient_command & 0xFFFFFFF7) != 0 || !options[1258] )
[23745, 26887, 23726, 26894, 26900, 23733, 23735] tty_flag = 0;
[23751] v76 = fileno(stdin);
[23768, 23761] if ( (!isatty(v76) || options[1259]) && options[1257] != 3 )
[23780, 23782, 23788, 23795, 24819, 24826, 23773, 23775] {
if ( tty_flag )
[24832, 24839] sshlog(
[27616, 27648, 27649, 27623, 27625, 27600, 27632, 27633, 27640, 27605, 27608, 27642, 27614, 27647] "ssh.c",
"main",
1362LL,
0LL,
3LL,
0LL,
"Pseudo-terminal will not be allocated because stdin is not a terminal.",
v5);
tty_flag = 0;
[24845, 24855] }
v3 = (char *)xcalloc(1LL, 88LL);
[23811, 23819, 23832, 23801, 23806] if ( gethostname(name, 0x401uLL) == -1 )
[23840, 23843, 23824, 23829, 23835] goto LABEL_480;
*((_QWORD *)v3 + 4) = xstrdup(name);
[23849, 23867, 23852] name[strcspn(name, ".")] = 0;
[23864, 23857, 23872, 23880] *((_QWORD *)v3 + 1) = xstrdup(name);
[23888, 23905, 23877] xasprintf(v3 + 48, "%d", (unsigned int)options[34]);
[23910, 23916, 23918, 23893, 23898] v11 = (long)v199;
[23923] xasprintf(v3 + 16, "%llu", *((unsigned int *)v199 + 4));
[23937, 23942, 23945, 23928, 23935] v77 = *(char **)&options[52];
[23950] v5 = v202;
[23957] if ( !v77 )
[23965] v77 = v202;
[23962, 23965] v78 = xstrdup(v77);
[23969] v79 = *((_QWORD *)v3 + 6);
[23974] v80 = *((_QWORD *)v3 + 4);
[23979] *((_QWORD *)v3 + 3) = v78;
[23984] *(_QWORD *)v3 = ssh_connection_hash(v80, host, v79, *(_QWORD *)&options[56]);
[24003, 23996, 23989, 24011] v81 = xstrdup(v202);
[24008, 24015] v82 = host;
[24020] *((_QWORD *)v3 + 5) = v81;
[24027] *((_QWORD *)v3 + 7) = xstrdup(v82);
[24032, 24037] *((_QWORD *)v3 + 8) = xstrdup(*(_QWORD *)&options[56]);
[24049, 24042, 24054] *((_QWORD *)v3 + 9) = xstrdup(v199[4]);
[24059, 24068, 24063] *((_QWORD *)v3 + 10) = xstrdup(*v199);
[24073, 24076, 24081] if ( *(_QWORD *)&options[1254] )
[24096, 24093, 24086] {
sshlog("ssh.c", "main", 1393LL, 0LL, 7LL, 0LL, "expanding RemoteCommand: %s", *(const char **)&options[1254]);
[24129, 24102, 24103, 24136, 24110, 24143, 24113, 24115, 24116, 24086, 24122, 24124] v84 = *(void **)&options[1254];
[24148] v85 = (const char *)default_client_percent_expand((long)v84, v3);
[24161, 24155, 24158] *(_QWORD *)&options[1254] = v85;
[24204, 24197] sshlog("ssh.c", "main", 1397LL, 0LL, 7LL, 0LL, "expanded RemoteCommand: %s", v85);
[24166, 24169, 24171, 24176, 24177, 24211, 24212, 24214, 24184, 24190] free(v84);
[24226, 24219, 24223] v86 = strlen(*(const char **)&options[1254]);
[24241, 24238, 24231] v87 = sshbuf_put(command, *(_QWORD *)&options[1254], v86);
[24256, 24259, 24231, 24246, 24253] if ( v87 )
[24264, 24266] {
v192 = ssh_err(v87);
[32562, 32564] v22 = sshfatal("ssh.c", "main", 1401LL, 1LL, 1LL, v192, "buffer error", v4);
[32577, 32612, 32582, 32614, 32585, 32592, 32597, 32598, 32569, 32571, 32605] LABEL_476:
sshfatal("ssh.c", "main", 902LL, 0LL, 1LL, 0LL, "Cannot specify stdio forward with -O", v22);
[32641, 32646, 32619, 32620, 32653, 32627, 32660, 32630, 32632, 32633, 32639] LABEL_477:
v30 = BSDoptarg;
[32665] v31 = "Bad stdio forwarding specification '%s'\n";
[32672, 32679] LABEL_436:
((void ( *)(struct _IO_FILE *, long, const char *, char *))_fprintf_chk)(stderr, 1LL, v31, v30);
[31235, 31237, 31230, 31223] LABEL_437:
exit(255);
[31242, 31247] }
}
if ( *(_QWORD *)&options[1240] )
[24272, 24280] {
v88 = getuid();
[24282] v89 = (void *)tilde_expand_filename(*(_QWORD *)&options[1240], v88);
[24296, 24308, 24294, 24287] free(*(void **)&options[1240]);
[24301, 24311] default_client_percent_dollar_expand((long)v89, v3);
[24322, 24330, 24316, 24319] *(_QWORD *)&options[1240] = v90;
[24337, 24327] free(v89);
}
[24342, 24350] if ( *(_QWORD *)&options[1206] )
{
[24352] v91 = getuid();
[24374, 24364, 24357, 24366] v92 = (void *)tilde_expand_filename(*(_QWORD *)&options[1206], v91);
[24377, 24371, 24380, 24388] default_client_percent_dollar_expand((long)v92, v3);
[24385, 24391] v11 = v93;
[24403, 24396] free(v92);
[24408] free(*(void **)&options[1206]);
*(_QWORD *)&options[1206] = v11;
[24423, 24415] }
if ( !*(_QWORD *)&options[2] )
[24425] break;
[24447, 24437, 24430, 24439] v94 = getuid();
[24450, 24444, 24453, 24461] v4 = tilde_expand_filename(*(_QWORD *)&options[2], v94);
[24464, 24458] default_client_percent_dollar_expand(v4, v3);
[24476, 24469] v16 = v95;
[24492] free((void *)v4);
[24481, 24489, 24499, 24504, 24506] free(*(void **)&options[2]);
*(_QWORD *)&options[2] = v16;
[27450] if ( !stat((const char *)v16, &v213) )
[27457, 27455] break;
[27488, 27462, 27494, 27464, 27467, 27469, 27470, 27501, 27508, 27477, 27509, 27511, 27483] v137 = _errno_location();
v138 = strerror(*v137);
sshlog(
"ssh.c",
"main",
1428LL,
0LL,
2LL,
0LL,
"Cannot forward agent socket path \"%s\": %s",
[27520, 27516, 27533, 27527] *(const char **)&options[2],
v138);
if ( !options[7] )
[29803, 29798] break;
LABEL_380:
[29824, 29826, 29808, 29813, 29819] cleanup_exit(255LL);
LABEL_381:
if ( *(_BYTE *)(v4 + 2) || (v177 = *(_BYTE *)(v4 + 1), v177 <= 63) )
[21080, 21083, 21088, 21092] {
LABEL_59:
[29932, 29925] if ( strlen((const char *)v4) == 1 )
{
options[58] = (int)v5;
}
[21098, 21105, 21108, 21113, 21115] else
{
[32839] if ( strcmp((const char *)v4, "none") )
[32842] {
[32849] v30 = (char *)v4;
v31 = "Bad escape character '%s'.\n";
[21121, 21131] goto LABEL_436;
}
options[58] = -2;
}
}
[29832, 29841, 29835] else
{
options[58] = v177 & 0x1F;
[24512] }
[24520, 24518] }
v96 = (struct addrinfo *)(unsigned int)options[59];
[24522] if ( (_DWORD)v96 )
[24544, 24546, 24529, 24536, 24539] {
v97 = *(void **)&options[60];
[24548, 24551] if ( !strcasecmp((const char *)v97, "none") )
{
[24560, 24557] if ( (unsigned int)v96 > 1 )
[24565] goto LABEL_459;
[24576] free(v97);
*(_QWORD *)&options[60] = 0LL;
options[59] = 0;
[24586] }
[24593, 24596] }
v98 = options[124];
[24602] if ( v98 )
[24609, 24616, 24619, 24624, 24626] {
v4 = *(_QWORD *)&options[126];
[24864, 24860] if ( !strcasecmp((const char *)v4, "none") )
{
[24873, 24870] if ( v98 > 1 )
[24878] goto LABEL_460;
[24889] free((void *)v4);
*(_QWORD *)&options[126] = 0LL;
options[124] = 0;
}
[24632] else
[24636] {
[24643, 24646] LODWORD(s) = v6;
v100 = (const char **)&options[126];
LODWORD(v5) = 0;
[24699, 24703] do
{
[24705] if ( *v100 )
[24726, 24713, 24715, 24710] {
[24720, 24729, 24723] v101 = getuid();
[24734] v4 = tilde_expand_filename(*v100, v101);
[24740] default_client_percent_dollar_expand(v4, v3);
[24737, 24743, 24746, 24751, 24753] v102 = (char *)*v100;
v104 = v103;
[24800, 24769, 24802, 24771, 24773, 24779, 24784, 24755, 24759, 24792, 24791, 24766, 24799] if ( strcmp(*v100, v103) )
[24810, 24814, 24807] {
sshlog("ssh.c", "main", 1460LL, 0LL, 7LL, 0LL, "expanded UserKnownHostsFile '%s' -> '%s'", v102, v104);
[24656, 24659] v102 = (char *)*v100;
[24664, 24667] }
[24672] free(v102);
[24675] free((void *)v4);
*v100 = v104;
[24682] v98 = options[124];
[24686] }
v5 = (char *)(unsigned int)((_DWORD)v5 + 1);
[24690, 24693] ++v100;
[29216, 29212] }
while ( (unsigned int)v5 < v98 );
LODWORD(v6) = (_DWORD)s;
[24899] }
[24909, 24902] }
v16 = 0LL;
[24915, 24919] if ( options[1208] > 0 )
{
LODWORD(s) = v6;
[25049, 25028] do
[25053, 25046, 25038, 25031] {
[25056] v108 = 56LL * (int)v16;
[25060, 25063] v4 = v108 + *(_QWORD *)&options[1210];
v109 = *(char **)(v4 + 16);
[25056, 25065, 25068, 25071] if ( v109 )
[25079] {
[25086] v110 = (const char *)default_client_percent_expand(*(_QWORD *)(v4 + 16), v3);
[25089, 25094, 25096, 25076, 25083] *(_QWORD *)(v4 + 16) = v110;
[25154, 25125, 25158, 25130, 25102, 25137, 25106, 25139, 25113, 25146, 25147, 25116, 25149, 25118, 25119] v111 = v110;
[24928, 24931] if ( strcmp(v109, v110) )
[24936, 24943] sshlog("ssh.c", "main", 1473LL, 0LL, 7LL, 0LL, "expanded LocalForward listen path '%s' -> '%s'", v109, v111);
free(v109);
[24946] v4 = *(_QWORD *)&options[1210] + v108;
[24953, 24950] }
v5 = *(char **)(v4 + 40);
[24961, 24946, 24955, 24958] if ( v5 )
[24969] {
[24976] v105 = (const char *)default_client_percent_expand(*(_QWORD *)(v4 + 40), v3);
[24966, 24973, 24979, 24984, 24986] *(_QWORD *)(v4 + 40) = v105;
[25184, 25185, 25220, 25191, 25224, 25196, 25168, 25203, 25172, 25205, 25179, 25212, 25213, 25182, 25215] v106 = v105;
[24992, 24995] if ( strcmp(v5, v105) )
sshlog("ssh.c", "main", 1482LL, 0LL, 7LL, 0LL, "expanded LocalForward connect path '%s' -> '%s'", v5, v106);
[25000, 25003, 25008] free(v5);
[25008, 25019] }
v107 = v16 + 1;
[25013, 25022] v16 = (unsigned int)(v16 + 1);
[25229] }
while ( options[1208] > v107 );
[25240, 25233, 25242] LODWORD(v6) = (_DWORD)s;
}
if ( options[1212] > 0 )
{
[25346, 25367] do
[25364, 25371, 25356, 25349] {
[25374] v114 = 56LL * (int)v6;
[25378, 25381] v16 = v114 + *(_QWORD *)&options[1214];
v115 = *(char **)(v16 + 16);
[25386, 25389, 25374, 25383] if ( v115 )
[25397] {
[25404] v116 = (const char *)default_client_percent_expand(*(_QWORD *)(v16 + 16), v3);
[25412, 25414, 25394, 25401, 25407] *(_QWORD *)(v16 + 16) = v116;
[25473, 25444, 25477, 25468, 25449, 25420, 25466, 25424, 25456, 25458, 25431, 25465, 25434, 25436, 25438] v5 = (char *)v116;
[25248, 25251] if ( strcmp(v115, v116) )
[25256, 25263] sshlog("ssh.c", "main", 1494LL, 0LL, 7LL, 0LL, "expanded RemoteForward listen path '%s' -> '%s'", v115, v5);
free(v115);
[25266] v16 = *(_QWORD *)&options[1214] + v114;
[25273, 25270] }
v4 = *(_QWORD *)(v16 + 40);
[25281, 25266, 25275, 25278] if ( v4 )
[25289] {
[25296] v112 = (const char *)default_client_percent_expand(*(_QWORD *)(v16 + 40), v3);
[25286, 25293, 25299, 25304, 25306] *(_QWORD *)(v16 + 40) = v112;
[25504, 25505, 25540, 25511, 25544, 25516, 25488, 25523, 25492, 25525, 25499, 25532, 25533, 25502, 25535] v113 = v112;
if ( strcmp((const char *)v4, v112) )
sshlog(
"ssh.c",
"main",
1503LL,
0LL,
7LL,
0LL,
"expanded RemoteForward connect path '%s' -> '%s'",
[25312, 25315] (const char *)v4,
v113);
[25338] free((void *)v4);
}
[25320, 25322, 25327, 25332, 25340] LODWORD(v6) = v6 + 1;
}
[25554, 25549] while ( options[1212] > (int)v6 );
}
[25560] if ( HIDWORD(v197) )
[25570, 25572, 25575, 29937, 29940, 25560, 29945, 29949, 25567] goto LABEL_484;
v11 = *(_QWORD *)&options[198];
[29955, 29959] if ( v11 && *(_BYTE *)v11 == 36 && strlen(*(const char **)&options[198]) > 1 )
[29964] {
[29970, 29967] v180 = getenv((const char *)(v11 + 1));
v6 = (long)v180;
[29987, 29989, 29990, 30022, 30023, 30025, 29997, 30002, 29976, 30009, 29978, 29981, 30015] if ( v180 )
{
sshlog(
"ssh.c",
"main",
1523LL,
0LL,
6LL,
0LL,
"resolved SecurityKeyProvider %s => %s",
[30041, 30037, 30030] *(const char **)&options[198],
[30049, 30054, 30061, 30046] v180);
free(*(void **)&options[198]);
*(_QWORD *)&options[198] = xstrdup(v6);
}
[30657, 30627, 30634, 30640, 30611, 30647, 30648, 30617, 30620, 30622, 30655] else
{
sshlog(
"ssh.c",
"main",
1518LL,
0LL,
5LL,
0LL,
[30669, 30662] "Authenticator provider %s did not resolve; disabling",
[30689, 30674, 30676, 30678] *(const char **)&options[198]);
free(*(void **)&options[198]);
*(_QWORD *)&options[198] = 0LL;
[25588, 25581] }
[25595] }
v117 = *(const char **)&options[1240];
[25601, 25604] if ( muxclient_command )
{
if ( v117 )
goto LABEL_254;
[26680, 26677, 26686] goto LABEL_467;
}
if ( v117 )
[25610] {
[25617, 25615] LABEL_254:
v118 = muxclient(v117);
[30283, 30288, 30290, 30292, 30295] if ( v118 >= 0 )
[30300, 30303] {
[30308] ssh_packet_set_connection(v198, (unsigned int)v118, (unsigned int)v118);
ssh_packet_set_mux(v198);
goto LABEL_286;
[29684, 29676, 25629, 25623] }
}
[29696, 29697, 29728, 29700, 29735, 29706, 29708, 29741, 29742, 29744, 29713, 29720, 29721, 29690] if ( !ai && !*(_QWORD *)&options[54] )
[29766, 29774, 29779, 29749, 29784, 29753, 29759] {
[29792, 29789] sshlog("ssh.c", "main", 1546LL, 0LL, 6LL, 0LL, "resolving \"%s\" port %d", host, (unsigned int)options[34]);
ai = resolve_host_constprop_0(host, (unsigned int)options[34], 1LL, v214, v175, v176);
if ( !ai )
[25635] goto LABEL_380;
[25641] }
[25652, 25646] v119 = options[37];
[25659, 25654] v120 = 0x7FFFFFFF;
[25664] if ( v119 <= 2147482 )
[25710, 25711] v120 = 1000 * v119;
[25696, 25697, 25698, 25721, 25668, 25729, 25703, 25704, 25674, 25681, 25716, 25689, 25726] LODWORD(v204) = v120;
v96 = ai;
v121 = ssh_connect(
v198,
host,
v202,
ai,
hostaddr,
LOWORD(options[34]),
(unsigned int)options[36],
&v204,
[25738, 25734] (unsigned int)options[26],
[25740, 25742] v83);
v6 = v121;
[25748, 25751] if ( v121 )
[25753, 25756] goto LABEL_437;
[25761, 25778, 25773, 25767] if ( ai )
[25787, 25789, 25783] freeaddrinfo(ai);
[25792, 25825, 25799, 25832, 25804, 25837, 25838, 25807, 25808, 25814, 25816, 25818, 25791] ssh_packet_set_timeout(v198, (unsigned int)options[1231], (unsigned int)options[1232]);
[25839] if ( (int)v204 > 0 )
[25846] sshlog("ssh.c", "main", 1570LL, 0LL, 7LL, 0LL, "timeout: %d ms remain after connect", (unsigned int)v204);
[25856] v122 = options[14] == 0;
[25867] *((_DWORD *)&sensitive_data + 2) = 0;
sensitive_data = 0LL;
[25874, 25869, 25879] if ( !v122 )
[25889] {
[25894] *((_DWORD *)&sensitive_data + 2) = 10;
[25901] v123 = (void *)xcalloc(10LL, 168LL);
[25908] v122 = options[14] == 1;
[25911] sensitive_data = v123;
v124 = (void **)v123;
[27684, 27677] if ( v122 )
{
[31904, 31874, 31875, 31911, 31882, 31885, 31918, 31890, 31891, 31897, 31899] if ( *((int *)&sensitive_data + 2) <= 0 )
{
[31942, 31947, 31954, 31923, 31955, 31964, 31926, 31962, 31932, 31934, 31935] sshfatal("ssh.c", "main", 1605LL, 1LL, 1LL, 0LL, "cert out of array bounds", v123);
LABEL_459:
sshfatal(
"ssh.c",
"main",
1438LL,
0LL,
1LL,
0LL,
"Invalid GlobalKnownHostsFiles: \"none\" appears with other entries",
[31969, 32001, 32002, 31972, 32009, 31978, 32011, 31980, 31982, 31989, 31994] v96);
LABEL_460:
sshfatal(
"ssh.c",
"main",
1448LL,
0LL,
1LL,
0LL,
"Invalid UserKnownHostsFiles: \"none\" appears with other entries",
v99);
}
[27690, 27700, 27693] else
[27712, 27719, 27722, 27724, 27705] {
[27729] cert = sshkey_load_cert("/usr/local/etc/ssh_host_ecdsa_key", v123);
[27736, 27739, 27742] check_load(cert, v124, "/usr/local/etc/ssh_host_ecdsa_key", "cert");
v140 = sensitive_data;
[27744] if ( *(_QWORD *)sensitive_data )
[27780, 27749, 27781, 27756, 27788, 27800, 27759, 27795, 27765, 27766, 27797, 27798, 27805, 27771, 27773] {
v141 = (const char *)sshkey_ssh_name();
v140 = (void *)sshlog(
"ssh.c",
"main",
1605LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s cert from \"%s\"",
0LL,
v141,
[27816, 27809] "/usr/local/etc/ssh_host_ecdsa_key");
}
[27836] if ( *((int *)&sensitive_data + 2) <= 1 )
[27840, 27843, 27829, 27822] goto LABEL_449;
[27848, 27855, 27862, 27865, 27867] v142 = (void **)((char *)sensitive_data + 8);
[27872, 27883, 27886, 27879] v143 = sshkey_load_cert("/usr/local/etc/ssh_host_ed25519_key", (char *)sensitive_data + 8);
check_load(v143, v142, "/usr/local/etc/ssh_host_ed25519_key", "cert");
[27888] if ( *((_QWORD *)sensitive_data + 1) )
[27939, 27909, 27910, 27941, 27942, 27944, 27915, 27917, 27949, 27924, 27893, 27925, 27932, 27900, 27903] {
v144 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1606LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s cert from \"%s\"",
1LL,
v144,
[27960, 27953] "/usr/local/etc/ssh_host_ed25519_key");
}
if ( *((int *)&sensitive_data + 2) <= 2 )
[31584, 31553] {
[31584, 31591, 31560, 31562, 31565, 31598, 31571, 31572, 31577, 31579] LABEL_450:
v21 = "main";
[31622, 31644, 31627, 31634, 31603, 31635, 31606, 31642, 31612, 31614, 31615] sshfatal("ssh.c", "main", 1607LL, 1LL, 1LL, 0LL, "cert out of array bounds", v5);
LABEL_451:
[31649, 31650, 31683, 31657, 31690, 31660, 31662, 31663, 31669, 31671, 31676] v39 = sshfatal("ssh.c", "main", 755LL, 0LL, 1LL, 0LL, "Multiplexing command already specified", v21);
LABEL_452:
[31715, 31717, 31722, 31695, 31696, 31729, 31703, 31736, 31706, 31708, 31709] v22 = sshfatal("ssh.c", "main", 1019LL, 0LL, 1LL, 0LL, "Cannot specify -N with -s/SessionType", v39);
LABEL_453:
[31749, 31782, 31752, 31754, 31755, 31761, 31763, 31768, 31741, 31742, 31775] v40 = sshfatal("ssh.c", "main", 860LL, 0LL, 1LL, 0LL, "Cannot specify -J with ProxyCommand", v22);
LABEL_454:
[31812, 31787, 31819, 31794, 31795, 31826, 31828, 31798, 31804, 31805, 31807] sshfatal("ssh.c", "main", 862LL, 0LL, 1LL, 0LL, "Invalid -J argument", v40);
LABEL_455:
sshfatal(
"ssh.c",
"main",
855LL,
0LL,
1LL,
0LL,
"Only a single -J option is permitted (use commas to separate multiple jump hops)",
[31833] v18);
[31840] LABEL_456:
v189 = BSDoptarg;
[31859, 31854, 31847] v190 = "Bad remote forwarding specification '%s'\n";
[31864, 31869] LABEL_457:
((void ( *)(struct _IO_FILE *, long, const char *, char *))_fprintf_chk)(stderr, 1LL, v190, v189);
[27980] exit(255);
[27984, 27987, 27973, 27966] }
[28006, 28009, 28011, 27992, 27999] v145 = (void **)((char *)sensitive_data + 16);
[28016, 28027, 28030, 28023] v146 = sshkey_load_cert("/usr/local/etc/ssh_host_rsa_key", (char *)sensitive_data + 16);
check_load(v146, v145, "/usr/local/etc/ssh_host_rsa_key", "cert");
[28032] if ( *((_QWORD *)sensitive_data + 2) )
[28068, 28037, 28069, 28088, 28044, 28076, 28047, 28083, 28053, 28054, 28085, 28086, 28059, 28061, 28093] {
v147 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1607LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s cert from \"%s\"",
2LL,
v147,
[28104, 28097] "/usr/local/etc/ssh_host_rsa_key");
}
[28124] if ( *((int *)&sensitive_data + 2) <= 3 )
[28128, 28131, 28117, 28110] goto LABEL_433;
[28136, 28143, 28150, 28153, 28155] v125 = (char *)sensitive_data + 24;
[28160, 28171, 28174, 28167] v148 = sshkey_load_cert("/usr/local/etc/ssh_host_dsa_key", (char *)sensitive_data + 24);
check_load(v148, (void **)v125, "/usr/local/etc/ssh_host_dsa_key", "cert");
[28176] if ( *((_QWORD *)sensitive_data + 3) )
[28227, 28197, 28198, 28229, 28230, 28232, 28203, 28205, 28237, 28212, 28181, 28213, 28188, 28220, 28191] {
v149 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1608LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s cert from \"%s\"",
3LL,
v149,
[28248, 28241] "/usr/local/etc/ssh_host_dsa_key");
}
[28270] if ( *((int *)&sensitive_data + 2) <= 4 )
[28261, 28263, 28274, 28277, 28254] goto LABEL_432;
[28289, 28296, 28299, 28301, 28282] v150 = (void **)((char *)sensitive_data + 32);
[28320, 28313, 28306, 28317] v151 = sshkey_load_public("/usr/local/etc/ssh_host_ecdsa_key", (char *)sensitive_data + 32, 0LL);
check_load(v151, v150, "/usr/local/etc/ssh_host_ecdsa_key", "pubkey");
[28322] if ( *((_QWORD *)sensitive_data + 4) )
[28358, 28327, 28359, 28375, 28334, 28366, 28376, 28337, 28383, 28373, 28343, 28344, 28378, 28349, 28351] {
v152 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1609LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s key from \"%s\"",
4LL,
v152,
[28394, 28387] "/usr/local/etc/ssh_host_ecdsa_key");
}
[28416] if ( *((int *)&sensitive_data + 2) <= 5 )
[28420, 28423, 28400, 28407, 28409] goto LABEL_462;
[28428, 28435, 28442, 28445, 28447] v153 = (void **)((char *)sensitive_data + 40);
[28466, 28459, 28452, 28463] v154 = sshkey_load_public("/usr/local/etc/ssh_host_ed25519_key", (char *)sensitive_data + 40, 0LL);
check_load(v154, v153, "/usr/local/etc/ssh_host_ed25519_key", "pubkey");
[28468] if ( *((_QWORD *)sensitive_data + 5) )
[28480, 28512, 28483, 28519, 28489, 28490, 28521, 28522, 28524, 28495, 28497, 28529, 28505, 28504, 28473] {
v155 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1610LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s key from \"%s\"",
5LL,
v155,
[28540, 28533] "/usr/local/etc/ssh_host_ed25519_key");
}
[28562] if ( *((int *)&sensitive_data + 2) > 6 )
[28546, 28553, 28555, 28566, 28569] {
[28581, 28588, 28591, 28593, 28574] v156 = (void **)((char *)sensitive_data + 48);
[28609, 28612, 28605, 28598] v157 = sshkey_load_public("/usr/local/etc/ssh_host_rsa_key", (char *)sensitive_data + 48, 0LL);
check_load(v157, v156, "/usr/local/etc/ssh_host_rsa_key", "pubkey");
[28614] if ( *((_QWORD *)sensitive_data + 6) )
[28641, 28643, 28675, 28667, 28650, 28619, 28651, 28668, 28626, 28658, 28629, 28665, 28635, 28636, 28670] {
v158 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1611LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s key from \"%s\"",
6LL,
v158,
[28686, 28679] "/usr/local/etc/ssh_host_rsa_key");
}
if ( *((int *)&sensitive_data + 2) <= 7 )
[32195, 32165, 32202, 32172, 32173, 32176, 32209, 32182, 32183, 32188, 32190] {
LABEL_464:
[32214] sshfatal("ssh.c", "main", 1612LL, 1LL, 1LL, 0LL, "pubkey out of array bounds", v96);
[32221] LABEL_465:
[32228] v30 = BSDoptarg;
v31 = "Unknown mac type '%s'\n";
[28708] goto LABEL_436;
[28712, 28715, 28692, 28699, 28701] }
[28737, 28739, 28720, 28727, 28734] v159 = (void **)((char *)sensitive_data + 56);
[28744, 28755, 28758, 28751] v160 = sshkey_load_public("/usr/local/etc/ssh_host_dsa_key", (char *)sensitive_data + 56, 0LL);
check_load(v160, v159, "/usr/local/etc/ssh_host_dsa_key", "pubkey");
[28760] if ( *((_QWORD *)sensitive_data + 7) )
[28772, 28804, 28775, 28811, 28781, 28782, 28813, 28814, 28816, 28787, 28789, 28797, 28821, 28796, 28765] {
v162 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1612LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s key from \"%s\"",
7LL,
v162,
[28832, 28825] "/usr/local/etc/ssh_host_dsa_key");
}
[28852] if ( *((int *)&sensitive_data + 2) > 8 )
[28856, 28859, 28845, 28838] {
[28864, 28871, 28878, 28881, 28883] v16 = (long)sensitive_data + 64;
[28888, 28899, 28902, 28895] v163 = sshkey_load_cert("/usr/local/etc/ssh_host_xmss_key", (char *)sensitive_data + 64);
check_load(v163, (void **)v16, "/usr/local/etc/ssh_host_xmss_key", "cert");
[28904] if ( *((_QWORD *)sensitive_data + 8) )
[28960, 28931, 28933, 28965, 28940, 28909, 28941, 28916, 28948, 28919, 28957, 28955, 28925, 28926, 28958] {
v165 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1613LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s cert from \"%s\"",
8LL,
v165,
[28976, 28969] "/usr/local/etc/ssh_host_xmss_key");
}
[28998] if ( *((int *)&sensitive_data + 2) > 9 )
[29002, 29005, 28982, 28989, 28991] {
[29024, 29027, 29029, 29010, 29017] v166 = (void **)((char *)sensitive_data + 72);
[29048, 29041, 29034, 29045] v167 = sshkey_load_public("/usr/local/etc/ssh_host_xmss_key", (char *)sensitive_data + 72, 0LL);
check_load(v167, v166, "/usr/local/etc/ssh_host_xmss_key", "pubkey");
[29054] if ( *((_QWORD *)sensitive_data + 9) )
[29090, 29059, 29091, 29066, 29098, 29069, 29105, 29075, 29076, 29107, 29108, 29110, 29115, 29081, 29083] {
v168 = (const char *)sshkey_ssh_name();
sshlog(
"ssh.c",
"main",
1614LL,
0LL,
6LL,
0LL,
"hostbased key %d: %s key from \"%s\"",
9LL,
v168,
[29119] "/usr/local/etc/ssh_host_xmss_key");
}
[31425, 31426, 31431, 31433, 31438, 31407, 31445, 31414, 31416, 31419, 31452] goto LABEL_265;
}
sshfatal("ssh.c", "main", 1614LL, 1LL, 1LL, 0LL, "pubkey out of array bounds", v164);
goto LABEL_448;
[32160, 32133, 32134, 32139, 32141, 32146, 32115, 32153, 32122, 32124, 32127] }
LABEL_463:
sshfatal("ssh.c", "main", 1613LL, 1LL, 1LL, 0LL, "cert out of array bounds", v161);
goto LABEL_464;
[32033, 32034, 32039, 32041, 32046, 32016, 32053, 32023, 32024, 32027, 32060] }
}
[32096, 32065, 32103, 32072, 32074, 32077, 32110, 32083, 32084, 32089, 32091] sshfatal("ssh.c", "main", 1611LL, 1LL, 1LL, 0LL, "pubkey out of array bounds", v6);
LABEL_462:
sshfatal("ssh.c", "main", 1610LL, 1LL, 1LL, 0LL, "pubkey out of array bounds", v3);
goto LABEL_463;
}
[25920, 25917] }
[25925] LABEL_265:
[25952, 25954, 25925, 25932, 25935, 25937, 25944, 25947] load_public_identity_files(v3);
v125 = *(char **)&options[1206];
[25956, 25963, 25966, 25971, 25973] if ( v125 && strcmp(*(const char **)&options[1206], "SSH_AUTH_SOCK") )
{
if ( !strcmp(v125, "none") )
[30320, 30313] {
[30325] LABEL_400:
unsetenv("SSH_AUTH_SOCK");
[25984, 25986, 25979, 25991] goto LABEL_271;
}
[26002, 26012, 25997, 26005] if ( *v125 != 36 || v125[1] == 123 )
{
setenv("SSH_AUTH_SOCK", v125, 1);
[30534] goto LABEL_271;
[30538, 30548, 30541, 30546] }
v4 = (long)(v125 + 1);
[30554, 30557, 30562] if ( (unsigned int)valid_env_name(v125 + 1) )
[30568, 30565] {
v184 = getenv(v125 + 1);
[30586, 30579, 30574] if ( v184 )
[30591] {
setenv("SSH_AUTH_SOCK", v184, 1);
goto LABEL_271;
}
[31044, 31016, 31051, 31023, 31025, 31058, 31028, 31030, 31031, 31037, 31039] goto LABEL_400;
}
[31072, 31075, 31108, 31081, 31082, 31087, 31089, 31094, 31063, 31101, 31070] sshfatal("ssh.c", "main", 1631LL, 0LL, 1LL, 0LL, "Invalid IdentityAgent environment variable name %s", v125);
LABEL_432:
[31113, 31151] sshfatal("ssh.c", "main", 1609LL, 1LL, 1LL, 0LL, "pubkey out of array bounds", v125);
[31137, 31139, 31144, 31151, 31120, 31122, 31125, 31158, 31131, 31132] LABEL_433:
v20 = "ssh.c";
[31202, 31172, 31204, 31174, 31175, 31182, 31187, 31195, 31194, 31163, 31166] sshfatal("ssh.c", "main", 1608LL, 1LL, 1LL, 0LL, "cert out of array bounds", v4);
LABEL_434:
[31209] sshfatal("ssh.c", "main", 752LL, 0LL, 1LL, 0LL, "Cannot specify multiplexing command with -W", v20);
[31216] LABEL_435:
v30 = BSDoptarg;
v31 = "Bad local forwarding specification '%s'\n";
goto LABEL_436;
[26024, 26017] }
LABEL_271:
[26026] if ( options[0] )
[26033, 26036] {
v16 = *(_QWORD *)&options[2];
[26043, 26038] if ( v16 )
{
[26049, 26026] if ( *(_BYTE *)v16 != 36 )
{
forward_agent_sock_path = *(_QWORD *)&options[2];
goto LABEL_275;
[30469, 30473, 30476, 30481, 30483] }
LABEL_407:
[30489, 30492, 30497] if ( (unsigned int)valid_env_name(v16 + 1) )
[30500, 30503] {
[30514, 30509] v183 = getenv((const char *)(v16 + 1));
if ( v183 )
[30840, 30850] forward_agent_sock_path = xstrdup(v183);
[30521, 30524] else
[30529] options[0] = 0;
free((void *)v16);
goto LABEL_275;
[31457, 31492, 31464, 31466, 31499, 31469, 31471, 31472, 31478, 31480, 31485] }
LABEL_448:
v140 = (void *)sshfatal(
"ssh.c",
"main",
1649LL,
0LL,
1LL,
0LL,
"Invalid ForwardAgent environment variable name %s",
[31520, 31521, 31527, 31529, 31534, 31504, 31505, 31541, 31512, 31515, 31548] (const char *)v16);
LABEL_449:
sshfatal("ssh.c", "main", 1606LL, 1LL, 1LL, 0LL, "cert out of array bounds", v140);
goto LABEL_450;
}
[26056, 26069, 26062] }
[26080, 26074, 26087] LABEL_275:
[26104, 26099, 26092] tilde_expand_paths((long *)&options[60], options[59]);
[26144, 26145, 26115, 26150, 26122, 26155, 26130, 26137, 26109, 26111] tilde_expand_paths((long *)&options[126], options[124]);
[26160] ssh_signal(17LL, main_sigchld_handler);
[26168, 26170, 26172, 26166] ssh_login(v198, &sensitive_data, host, hostaddr, LOWORD(options[34]), v199, (unsigned int)v204, v3);
v126 = *((_DWORD *)&sensitive_data + 2);
[26178] if ( v126 )
[26185] {
[26197, 26191] v127 = sensitive_data;
v128 = 0LL;
if ( v126 > 0 )
{
[26200, 26209, 26203] do
{
[26243, 26215, 26250, 26222, 26224, 26257, 26227, 26229, 26230, 26236, 26238] while ( v127[(int)v128] )
[26200, 26273, 26269, 26262] {
[26278, 26285, 26288, 26293, 26200] sshlog("ssh.c", "main", 1677LL, 0LL, 7LL, 0LL, "clear hostkey %d", v128);
[26301] sshkey_free(*((_QWORD *)sensitive_data + (int)v128));
[26307] *((_QWORD *)sensitive_data + (int)v128) = 0LL;
[26314] v126 = *((_DWORD *)&sensitive_data + 2);
[26320, 26321, 26314, 26319] v127 = sensitive_data;
[26324, 26326] v129 = v128 + 1;
v128 = (unsigned int)(v128 + 1);
if ( v129 >= v126 )
[26648, 26656, 26651] goto LABEL_279;
[26656, 26661] }
v136 = v128 + 1;
[26664, 26666, 26672] v128 = (unsigned int)(v128 + 1);
}
while ( v136 < v126 );
[26328, 26335] }
LABEL_279:
[26347] free(sensitive_data);
[26354, 26340, 26356] }
v130 = &options[202];
if ( options[201] > 0 )
{
[26363] do
{
[26360, 26363] while ( 1 )
[26368] {
[26375] free(*(void **)v130);
[26385, 26382] v131 = *((_QWORD *)v130 + 150);
*(_QWORD *)v130 = 0LL;
[26391] if ( !v131 )
[26403, 26396, 26398] break;
[26407] sshkey_free(v131);
[26429] v130 += 2;
[26418, 26431, 26423] *((_QWORD *)v130 + 149) = 0LL;
LODWORD(v6) = v6 + 1;
if ( (int)v6 >= options[201] )
[26608, 26610, 26615] goto LABEL_283;
[26630] }
v130 += 2;
[26624, 26632, 26619, 26638] LODWORD(v6) = v6 + 1;
}
while ( options[201] > (int)v6 );
[26433] }
[26435, 26442, 26475, 26479, 26449, 26451, 26485] LABEL_283:
v132 = 0LL;
[26456, 26461] for ( j = &options[704]; options[702] > (int)v132; ++v132 )
[26466] {
free(*(void **)&j[2 * v132]);
[26494, 26487] *(_QWORD *)&j[2 * v132] = 0LL;
}
[26499, 26504, 26507, 26510, 26518] pkcs11_del_provider(*(_QWORD *)&options[196]);
[26521, 26515] LABEL_286:
[26529, 26526] LODWORD(v16) = ssh_session2((long)v198, v3);
[26534] ssh_conn_info_free((void **)v3);
[26544, 26553, 26546, 26541] ssh_packet_close(v198);
v134 = *(const char **)&options[1240];
[26882, 26877] if ( v134 && muxserver_sock != -1 )
[26572, 26564, 26581, 26559] LABEL_303:
[26594, 26587] unlink(v134);
[26597, 26598, 26599, 26601, 26603, 26605, 26607] ssh_kill_proxy_command();
return v16;
}
// 810A: control flows out of bounds to 810F
// 9568: invalid function type has been ignored
// 97D8: invalid function type has been ignored
// 578D: conditional instruction was optimized away because %ai.8!=0
// 5111: variable 'v21' is possibly undefined
// 517C: variable 's' is possibly undefined
// 517C: variable 'v5' is possibly undefined
// 525B: variable 'v4' is possibly undefined
// 573B: variable 'v24' is possibly undefined
// 57D2: variable 'v199' is possibly undefined
// 57E3: variable 'v202' is possibly undefined
// 7397: variable 'v44' is possibly undefined
// 581D: variable 'v45' is possibly undefined
// 581D: variable 'v46' is possibly undefined
// 581D: variable 'v197' is possibly undefined
// 581D: variable 'v198' is possibly undefined
// 5871: variable 'v49' is possibly undefined
// 5871: variable 'v50' is possibly undefined
// 5871: variable 'v51' is possibly undefined
// 75F8: variable 'v55' is possibly undefined
// 75F8: variable 'v56' is possibly undefined
// 75F8: variable 'v57' is possibly undefined
// 75F8: variable 'v58' is possibly undefined
// 5B6F: variable 'v196' is possibly undefined
// 5F0A: variable 'v90' is possibly undefined
// 5F44: variable 'v93' is possibly undefined
// 5F8D: variable 'v95' is possibly undefined
// 60A4: variable 'v103' is possibly undefined
// 6481: variable 'v83' is possibly undefined
// 662B: variable 'v3' is possibly undefined
// 695D: variable 'v73' is possibly undefined
// 7453: variable 'v175' is possibly undefined
// 7453: variable 'v176' is possibly undefined
// 76DD: variable 'v19' is possibly undefined
// 7826: variable 'v181' is possibly undefined
// 7826: variable 'v182' is possibly undefined
// 79E4: variable 'v20' is possibly undefined
// 7A3D: variable 'v185' is possibly undefined
// 7ADC: variable 'v164' is possibly undefined
// 7C54: variable 'v18' is possibly undefined
// 7D0B: variable 'v99' is possibly undefined
// 7DA0: variable 'v161' is possibly undefined
// 7E12: variable 'v61' is possibly undefined
// 7EEE: variable 'v15' is possibly undefined
// 3220: using guessed type long forward_agent_sock_path;
// 3234: using guessed type int tty_flag;
// 3238: using guessed type int debug_flag;
// 3240: using guessed type long saved_av;
// 94C8: using guessed type int options[1482];
// 94D8: using guessed type long command;
// 9510: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9528: using guessed type long tilde_expand_filename(_QWORD, _QWORD);
// 9530: using guessed type long percent_expand(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9538: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 9540: using guessed type long cleanup_exit(_QWORD);
// 9598: using guessed type long config_has_permitted_cnames(_QWORD);
// 95B0: using guessed type long xstrdup(_QWORD);
// 95D0: using guessed type long _snprintf_chk(_QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// 95E0: using guessed type long ssh_err(_QWORD);
// 96C8: using guessed type long muxclient(_QWORD);
// 96E0: using guessed type long default_ssh_port(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 96F8: using guessed type long sshkey_load_public(_QWORD, _QWORD, _QWORD);
// 9700: using guessed type long xasprintf(_QWORD, const char *, ...);
// 9718: using guessed type long sshkey_free(_QWORD);
// 97F0: using guessed type long sanitise_stdfd(_QWORD, _QWORD, _QWORD);
// 97F8: using guessed type long closefrom(_QWORD);
// 9800: using guessed type long ssh_get_progname(_QWORD);
// 9808: using guessed type long xcalloc(_QWORD, _QWORD);
// 9810: using guessed type long compat_init_setproctitle(_QWORD, _QWORD);
// 9818: using guessed type long seed_rng(void);
// 9828: using guessed type long pwcopy(_QWORD);
// 9838: using guessed type long msetlocale(void);
// 9840: using guessed type long initialize_options(_QWORD);
// 9848: using guessed type long ssh_alloc_session_state(void);
// 9850: using guessed type long channel_init_channels(_QWORD);
// 9858: using guessed type long BSDgetopt(_QWORD, _QWORD, _QWORD);
// 9868: using guessed type long parse_ssh_uri(_QWORD, _QWORD, _QWORD, _QWORD);
// 9888: using guessed type long a2tun(_QWORD, _QWORD);
// 9890: using guessed type long a2port(_QWORD, _QWORD);
// 9898: using guessed type long process_config_line(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 98A0: using guessed type long mac_valid(_QWORD, _QWORD);
// 98A8: using guessed type long ciphers_valid(_QWORD, _QWORD);
// 98B8: using guessed type long add_identity_file(_QWORD, _QWORD, _QWORD, _QWORD);
// 98C8: using guessed type long parse_forward(_QWORD, _QWORD, _QWORD, _QWORD);
// 98D0: using guessed type long OpenSSL_version(_QWORD);
// 98D8: using guessed type long add_remote_forward(_QWORD, _QWORD);
// 98E0: using guessed type long cipher_alg_list(_QWORD, _QWORD);
// 98E8: using guessed type long _printf_chk(_QWORD, const char *, ...);
// 98F0: using guessed type long add_local_forward(_QWORD, _QWORD);
// 98F8: using guessed type long parse_jump(_QWORD, _QWORD, _QWORD);
// 9900: using guessed type long sshbuf_new(_QWORD, _QWORD);
// 9908: using guessed type long ssh_signal(_QWORD, _QWORD);
// 9910: using guessed type long log_redirect_stderr_to(void);
// 9918: using guessed type long log_init(_QWORD, _QWORD, _QWORD, _QWORD);
// 9920: using guessed type long fill_default_options_for_canonicalization(_QWORD);
// 9928: using guessed type long lowercase(_QWORD);
// 9930: using guessed type long fill_default_options(_QWORD);
// 9940: using guessed type long channel_set_af(_QWORD, _QWORD, _QWORD);
// 9948: using guessed type long sshbuf_len(_QWORD);
// 9950: using guessed type long log_verbose_add(_QWORD);
// 9970: using guessed type long ssh_connection_hash(_QWORD, _QWORD, _QWORD, _QWORD);
// 9978: using guessed type long sshbuf_put(_QWORD, _QWORD, _QWORD);
// 9980: using guessed type long ssh_connect(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 9988: using guessed type long ssh_packet_set_timeout(_QWORD, _QWORD, _QWORD);
// 9998: using guessed type long ssh_login(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 99A0: using guessed type long pkcs11_del_provider(_QWORD);
// 99A8: using guessed type long ssh_packet_close(_QWORD);
// 99B0: using guessed type long ssh_kill_proxy_command(void);
// 99C0: using guessed type long sshkey_load_cert(_QWORD, _QWORD);
// 99C8: using guessed type long sshkey_ssh_name(void);
// 99D0: using guessed type long mac_alg_list(_QWORD);
// 99D8: using guessed type long sshbuf_putf(_QWORD, const char *, ...);
// 99E0: using guessed type long ssh_packet_set_connection(_QWORD, _QWORD, _QWORD);
// 99E8: using guessed type long ssh_packet_set_mux(_QWORD);
// 99F8: using guessed type long valid_env_name(_QWORD);
// 9A00: using guessed type long kex_alg_list(_QWORD);
// 9A08: using guessed type long sshkey_alg_list(_QWORD, _QWORD, _QWORD, _QWORD);
// 9A10: using guessed type long compression_alg_list(_QWORD);
// 9A18: using guessed type long dump_client_config(_QWORD, _QWORD);
// 4D20: using guessed type char name[1032];
// 4D20: using guessed type char var_868[1040];
// nfuncs=185 queued=32 decompiled=32 lumina nreq=0 worse=0 better=0
// ALL OK, 32 function(s) have been successfully decompiled
|
long ssh_init_stdio_forwarding(long a1)
[26203] {
long result; // rax
unsigned int v2; // [rsp+10h] [rbp-10h]
unsigned int v3; // [rsp+14h] [rbp-Ch]
long v4; // [rsp+18h] [rbp-8h]
[26208, 26211, 26215, 26219, 26203, 26207] result = *(_QWORD *)&options[1222];
[26226, 26229] if ( result )
{
[26241, 26274, 26279, 26248, 26252, 26253, 26254, 26284, 26291, 26261, 26262, 26298, 26235, 26268, 26303] sshlog(
"ssh.c",
"ssh_init_stdio_forwarding",
1880LL,
1LL,
7LL,
0LL,
"%s:%d",
*(const char **)&options[1222],
(unsigned int)options[1224]);
[26312, 26322, 26308, 26317] v2 = dup(0);
[26336, 26341, 26344, 26348, 26325, 26329, 26331] if ( v2 == -1 || (v3 = dup(1), v3 == -1) )
[26368, 26403, 26374, 26379, 26350, 26384, 26354, 26391, 26361, 26362, 26398] sshfatal("ssh.c", "ssh_init_stdio_forwarding", 1885LL, 1LL, 1LL, 0LL, "dup() in/out failed");
[26434, 26408, 26440, 26443, 26414, 26446, 26417, 26451, 26424, 26427, 26430] v4 = channel_connect_stdio_fwd(a1, *(_QWORD *)&options[1222], (unsigned short)options[1224], v2, v3, 2LL);
[26460, 26455] if ( !v4 )
[26496, 26466, 26503, 26473, 26474, 26510, 26480, 26515, 26486, 26491, 26462] sshfatal("ssh.c", "ssh_init_stdio_forwarding", 1889LL, 1LL, 1LL, 0LL, "channel_connect_stdio_fwd failed");
[26531, 26536, 26543, 26546, 26520, 26524, 26527] channel_register_cleanup(a1, *(unsigned int *)(v4 + 4), client_cleanup_stdio_fwd, 0LL);
[26562, 26567, 26574, 26577, 26582, 26551, 26555, 26558] return channel_register_open_confirm(a1, *(unsigned int *)(v4 + 4), ssh_stdio_confirm, 0LL);
}
[26585] return result;
[26586] }
// 6748: variable 'v3' is possibly undefined
// 64E7: using guessed type long client_cleanup_stdio_fwd();
// A918: using guessed type int options[1482];
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AD30: using guessed type long channel_connect_stdio_fwd(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// AD38: using guessed type long channel_register_cleanup(_QWORD, _QWORD, _QWORD, _QWORD);
// AD40: using guessed type long channel_register_open_confirm(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000067DB) ----------------------------------------------------
unsigned long ssh_init_forward_permissions(long a1, long a2, const char **a3, unsigned int a4)
[26587] {
unsigned int i; // [rsp+24h] [rbp-2Ch]
int v8; // [rsp+2Ch] [rbp-24h]
void *v9; // [rsp+30h] [rbp-20h] BYREF
void *ptr; // [rsp+38h] [rbp-18h]
long v11; // [rsp+40h] [rbp-10h]
unsigned long v12; // [rsp+48h] [rbp-8h]
[26592, 26623, 26595, 26599, 26603, 26607, 26611, 26614, 26587, 26591] v12 = __readfsqword(0x28u);
[26627, 26629, 26636, 26639, 26643, 26648, 26651] channel_clear_permission(a1, 256LL, 2LL);
[26656, 26689, 26660, 26694, 26696, 26666, 26670, 26672, 26676, 26679, 26686] if ( a4 && (a4 != 1 || strcmp(*a3, "any")) )
{
[26722, 26725, 26730, 26732, 26702, 26706, 26708, 26712, 26715] if ( a4 == 1 && !strcmp(*a3, "none") )
{
[26734, 26737, 26741, 26743, 26746, 26751] channel_disable_admin(a1, 2LL);
}
else
{
[27041, 26756, 27044, 27050, 26763, 27034, 27038] for ( i = 0; i < a4; ++i )
{
[26786, 26789, 26792, 26797, 26768, 26771, 26779, 26783] v9 = (void *)xstrdup(a3[i]);
[26801, 26805] ptr = v9;
[26816, 26809, 26821, 26813] v11 = hpdelim(&v9);
[26825, 26830] if ( !v11 )
[26849, 26884, 26855, 26860, 26832, 26865, 26835, 26872, 26842, 26843, 26879] sshfatal("ssh.c", "ssh_init_forward_permissions", 1919LL, 1LL, 1LL, 0LL, "missing host in %s");
[26896, 26889, 26901, 26893] v11 = cleanhostname(v11);
[26912, 26914, 26918, 26921, 26926, 26929, 26933, 26905, 26909] if ( !v9 || (v8 = permitopen_port(v9), v8 < 0) )
[26945, 26946, 26982, 26952, 26987, 26958, 26963, 26935, 26968, 26938, 26975] sshfatal("ssh.c", "ssh_init_forward_permissions", 1922LL, 1LL, 1LL, 0LL, "bad port number in %s");
[27009, 27014, 27017, 26992, 26995, 26999, 27002, 27006] channel_add_permission(a1, 256LL, 2LL, v11, (unsigned int)v8);
[27026, 27029, 27022] free(ptr);
}
}
}
[27076, 27056, 27060, 27069, 27071] return __readfsqword(0x28u) ^ v12;
[27077] }
// 697E: variable 'v8' is possibly undefined
// AA18: using guessed type long xstrdup(_QWORD);
// AD48: using guessed type long channel_clear_permission(_QWORD, _QWORD, _QWORD);
// AD50: using guessed type long channel_disable_admin(_QWORD, _QWORD);
// AD58: using guessed type long hpdelim(_QWORD);
// AD60: using guessed type long cleanhostname(_QWORD);
// AD68: using guessed type long permitopen_port(_QWORD);
// AD70: using guessed type long channel_add_permission(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000069C6) ----------------------------------------------------
long ssh_init_forwarding(long a1, _QWORD *a2)
[27078] {
const char *v2; // rdx
const char *v3; // rax
const char *v4; // rdx
const char *v5; // rax
long v6; // rbx
long result; // rax
int v8; // [rsp+18h] [rbp-18h]
int i; // [rsp+1Ch] [rbp-14h]
int j; // [rsp+1Ch] [rbp-14h]
[27078, 27082, 27083, 27086, 27087, 27091, 27095, 27099] v8 = 0;
[27106, 27112, 27119, 27123, 27130, 27133] ssh_init_forward_permissions(a1, (long)"permitremoteopen", *(const char ***)&options[1218], options[1220]);
[27144, 27138, 27146] if ( options[7] )
[27148] forward_confirms_pending = 0;
[27663, 27666, 27158, 27672, 27675, 27165] for ( i = 0; i < options[1208]; ++i )
{
[27233, 27203, 27237, 27240, 27210, 27213, 27216, 27219, 27223, 27226, 27230] if ( *(_QWORD *)(*(_QWORD *)&options[1210] + 56LL * i + 40) )
[27265, 27269, 27272, 27242, 27276, 27249, 27252, 27255, 27258, 27262] v2 = *(const char **)(*(_QWORD *)&options[1210] + 56LL * i + 40);
else
[27298, 27301, 27305, 27308, 27278, 27285, 27288, 27291, 27294] v2 = *(const char **)(*(_QWORD *)&options[1210] + 56LL * i + 24);
[27361, 27365, 27368, 27372, 27375, 27345, 27379, 27382, 27352, 27355, 27358] if ( *(_QWORD *)(*(_QWORD *)&options[1210] + 56LL * i + 16) )
{
[27394, 27397, 27400, 27404, 27407, 27411, 27414, 27384, 27418, 27391] v3 = *(const char **)(*(_QWORD *)&options[1210] + 56LL * i + 16);
}
[27456, 27427, 27430, 27433, 27436, 27440, 27443, 27447, 27450, 27420, 27453] else if ( *(_QWORD *)(*(_QWORD *)&options[1210] + 56LL * i) )
{
[27523, 27493, 27496, 27499, 27502, 27506, 27509, 27513, 27516, 27486, 27519] v3 = *(const char **)(*(_QWORD *)&options[1210] + 56LL * i);
}
[27464, 27458, 27466] else if ( options[10] )
{
[27475, 27468] v3 = "*";
}
else
{
[27484, 27477] v3 = "LOCALHOST";
}
[27524, 27525, 27526, 27527, 27534, 27535, 27541, 27547, 27552, 27170, 27557, 27177, 27180, 27564, 27183, 27312, 27186, 27571, 27190, 27319, 27576, 27193, 27322, 27325, 27197, 27200, 27328, 27332, 27335, 27339, 27342] sshlog(
"ssh.c",
"ssh_init_forwarding",
1944LL,
0LL,
5LL,
0LL,
"Local connections to %.200s:%d forwarded to remote address %.200s:%d",
v3,
*(unsigned int *)(*(_QWORD *)&options[1210] + 56LL * i + 8),
v2,
*(unsigned int *)(*(_QWORD *)&options[1210] + 56LL * i + 32));
[27650, 27655, 27658, 27581, 27585, 27592, 27595, 27598, 27601, 27605, 27608, 27612, 27615, 27619, 27626, 27629, 27632, 27637, 27639, 27642, 27647] v8 += channel_setup_local_fwd_listener(a1, 56LL * i + *(_QWORD *)&options[1210], &options[10]);
}
[27681, 27685, 27687, 27690, 27693, 27695, 27701, 27703] if ( i > 0 && v8 != i && options[7] )
[27746, 27716, 27717, 27753, 27723, 27758, 27729, 27734, 27705, 27739, 27709] sshfatal("ssh.c", "ssh_init_forwarding", 1960LL, 0LL, 1LL, 0LL, "Could not request local forwarding.");
[27769, 27763, 27773, 27767] if ( i > 0 && !v8 )
[27809, 27779, 27816, 27786, 27787, 27823, 27793, 27828, 27799, 27833, 27804, 27775] sshlog("ssh.c", "ssh_init_forwarding", 1962LL, 0LL, 2LL, 0LL, "Could not request local forwarding.");
[28548, 27844, 28551, 28557, 28560, 27837] for ( j = 0; j < options[1212]; ++j )
{
[27905, 27909, 27912, 27882, 27916, 27919, 27889, 27892, 27895, 27898, 27902] if ( *(_QWORD *)(*(_QWORD *)&options[1214] + 56LL * j + 40) )
[27937, 27941, 27944, 27948, 27951, 27921, 27955, 27928, 27931, 27934] v4 = *(const char **)(*(_QWORD *)&options[1214] + 56LL * j + 40);
else
[27970, 27973, 27977, 27980, 27984, 27987, 27957, 27964, 27967] v4 = *(const char **)(*(_QWORD *)&options[1214] + 56LL * j + 24);
[28034, 28037, 28040, 28044, 28047, 28051, 28054, 28024, 28058, 28061, 28031] if ( *(_QWORD *)(*(_QWORD *)&options[1214] + 56LL * j + 16) )
{
[28097, 28070, 28073, 28076, 28079, 28083, 28086, 28090, 28093, 28063] v5 = *(const char **)(*(_QWORD *)&options[1214] + 56LL * j + 16);
}
[28129, 28099, 28132, 28135, 28106, 28109, 28112, 28115, 28119, 28122, 28126] else if ( *(_QWORD *)(*(_QWORD *)&options[1214] + 56LL * j) )
{
[28160, 28164, 28167, 28137, 28170, 28144, 28147, 28150, 28153, 28157] v5 = *(const char **)(*(_QWORD *)&options[1214] + 56LL * j);
}
else
{
[28179, 28172, 28183] v5 = "LOCALHOST";
}
[28184, 28185, 28186, 28187, 28194, 28195, 28201, 28207, 28212, 28217, 28224, 28231, 27849, 28236, 27856, 27859, 27862, 27991, 27865, 27869, 27998, 27872, 28001, 27876, 28004, 27879, 28007, 28011, 28014, 28018, 28021] sshlog(
"ssh.c",
"ssh_init_forwarding",
1966LL,
0LL,
5LL,
0LL,
"Remote connections from %.200s:%d forwarded to local address %.200s:%d",
v5,
*(unsigned int *)(*(_QWORD *)&options[1214] + 56LL * j + 8),
v4,
*(unsigned int *)(*(_QWORD *)&options[1214] + 56LL * j + 32));
[28288, 28258, 28291, 28261, 28295, 28265, 28298, 28268, 28302, 28272, 28241, 28275, 28245, 28282, 28252, 28285, 28255] v6 = *(_QWORD *)&options[1214] + 56LL * j;
[28321, 28306, 28310, 28313, 28316] *(_DWORD *)(v6 + 52) = channel_request_remote_forwarding(a1, v6);
[28329, 28324, 28327] if ( *(int *)(v6 + 52) < 0 )
{
[28413, 28411, 28405] if ( options[7] )
[28449, 28419, 28456, 28426, 28427, 28463, 28433, 28468, 28439, 28444, 28415] sshfatal("ssh.c", "ssh_init_forwarding", 1985LL, 0LL, 1LL, 0LL, "Could not request remote forwarding.");
[28514, 28484, 28485, 28521, 28491, 28526, 28497, 28531, 28502, 28535, 28473, 28507, 28540, 28477, 28543] sshlog("ssh.c", "ssh_init_forwarding", 1987LL, 0LL, 3LL, 0LL, "Warning: Could not request remote forwarding.");
}
else
{
[28354, 28358, 28361, 28331, 28364, 28338, 28371, 28341, 28344, 28347, 28351] client_register_global_confirm(ssh_confirm_remote_forward, *(_QWORD *)&options[1214] + 56LL * j);
[28387, 28389, 28394, 28400, 28376, 28382] ++forward_confirms_pending;
}
}
[28574, 28572, 28566] if ( options[1246] )
{
[28608, 28580, 28615, 28586, 28618, 28623, 28592, 28627, 28598, 28602] *a2 = client_request_tun_fwd(
a1,
(unsigned int)options[1246],
(unsigned int)options[1247],
(unsigned int)options[1248],
ssh_tun_confirm,
0LL);
[28640, 28634, 28637, 28630] if ( *a2 )
{
[28642, 28648, 28653, 28655, 28660, 28666] ++forward_confirms_pending;
}
else
{
[28679, 28677, 28671] if ( options[7] )
[28705, 28710, 28681, 28715, 28685, 28722, 28692, 28693, 28729, 28699, 28734] sshfatal("ssh.c", "ssh_init_forwarding", 1997LL, 0LL, 1LL, 0LL, "Could not request tunnel forwarding.");
[28768, 28739, 28773, 28743, 28780, 28750, 28751, 28787, 28757, 28792, 28763, 28797] sshlog("ssh.c", "ssh_init_forwarding", 1999LL, 0LL, 2LL, 0LL, "Could not request tunnel forwarding.");
}
}
[28801] result = (unsigned int)forward_confirms_pending;
[28809, 28807] if ( forward_confirms_pending > 0 )
[28832, 28867, 28838, 28872, 28811, 28843, 28848, 28817, 28818, 28855, 28825, 28826, 28862] return sshlog(
"ssh.c",
"ssh_init_forwarding",
2002LL,
1LL,
5LL,
0LL,
"expecting replies for %d forwards",
(unsigned int)forward_confirms_pending);
[28876, 28877] return result;
[28881, 28882] }
// 8624: using guessed type int forward_confirms_pending;
// A918: using guessed type int options[1482];
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AD78: using guessed type long channel_setup_local_fwd_listener(_QWORD, _QWORD, _QWORD);
// AD80: using guessed type long channel_request_remote_forwarding(_QWORD, _QWORD);
// AD88: using guessed type long client_register_global_confirm(_QWORD, _QWORD);
// AD90: using guessed type long client_request_tun_fwd(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000070D3) ----------------------------------------------------
long check_agent_present()
[28883] {
long result; // rax
long v1; // rax
[28883, 28887, 28888, 28891, 28895] result = (unsigned int)options[0];
[28901, 28903] if ( options[0] )
{
[28905, 28910] result = ssh_get_authentication_socket(0LL);
[28922, 28915, 28918] if ( (_DWORD)result )
{
[28924] options[0] = 0;
[28938, 28934] if ( (_DWORD)result != -47 )
{
[28945, 28940, 28943] v1 = ssh_err((unsigned int)result);
[28961, 28962, 28995, 28965, 29000, 28971, 29005, 28976, 28981, 28950, 28954, 28988] return sshlog("ssh.c", "check_agent_present", 2017LL, 0LL, 5LL, v1, "ssh_get_authentication_socket");
}
}
}
[29009, 29010] return result;
[29011] }
// A918: using guessed type int options[1482];
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AA40: using guessed type long ssh_err(_QWORD);
// AD98: using guessed type long ssh_get_authentication_socket(_QWORD);
//----- (0000000000007154) ----------------------------------------------------
unsigned long ssh_session2_setup(long a1, unsigned int a2, int a3)
[29012] {
long v3; // rax
char **v4; // r12
long v5; // rbx
unsigned int v6; // eax
unsigned int v8; // [rsp+20h] [rbp-40h]
unsigned int v9; // [rsp+24h] [rbp-3Ch]
long v10; // [rsp+28h] [rbp-38h] BYREF
long v11; // [rsp+30h] [rbp-30h] BYREF
char *v12; // [rsp+38h] [rbp-28h]
char *v13; // [rsp+40h] [rbp-20h]
unsigned long v14; // [rsp+48h] [rbp-18h]
[29027, 29031, 29034, 29037, 29041, 29012, 29016, 29017, 29050, 29020, 29022, 29023] v14 = __readfsqword(0x28u);
[29056, 29062, 29054] v8 = tty_flag;
[29065] v10 = 0LL;
[29073] v11 = 0LL;
[29081, 29085] if ( a3 )
{
[29098, 29091, 29103] v13 = getenv("DISPLAY");
[29120, 29122, 29107, 29112, 29114] if ( !v13 && options[4] )
[29153, 29124, 29158, 29128, 29165, 29135, 29136, 29172, 29142, 29177, 29148, 29182] sshlog("ssh.c", "ssh_session2_setup", 2035LL, 0LL, 5LL, 0LL, "X11 forwarding requested but DISPLAY not set");
[29186, 29192, 29194, 29200, 29206, 29209, 29215, 29218, 29225, 29229, 29233, 29237, 29241, 29245, 29246, 29249, 29252, 29255, 29260, 29264, 29266] if ( options[4]
&& !(unsigned int)client_x11_get_proto(
a1,
v13,
*(_QWORD *)&options[8],
(unsigned int)options[6],
(unsigned int)options[5],
&v10,
&v11) )
{
[29313, 29283, 29284, 29320, 29290, 29325, 29296, 29301, 29272, 29306, 29276] sshlog(
"ssh.c",
"ssh_session2_setup",
2040LL,
0LL,
5LL,
0LL,
"Requesting X11 forwarding with authentication spoofing.");
[29346, 29349, 29353, 29359, 29330, 29362, 29365, 29334, 29338, 29342] x11_request_forwarding_with_spoofing(a1, a2, v13, v10, v11, 1LL);
[29377, 29382, 29389, 29392, 29370, 29373] client_expect_confirm(a1, a2, "X11 forwarding", 0LL);
[29397] v8 = 1;
}
[29404] check_agent_present();
[29409, 29417, 29415] if ( options[0] )
{
[29441, 29476, 29447, 29452, 29423, 29457, 29427, 29464, 29434, 29435, 29471] sshlog("ssh.c", "ssh_session2_setup", 2051LL, 0LL, 5LL, 0LL, "Requesting authentication agent forwarding.");
[29504, 29507, 29481, 29485, 29488, 29492, 29497] channel_request_start(a1, a2, "[email protected]", 0LL);
[29512, 29524, 29516, 29519] v9 = sshpkt_send(a1);
[29531, 29527] if ( v9 )
{
[29536, 29538, 29533] v3 = ssh_err(v9);
[29569, 29574, 29543, 29547, 29581, 29554, 29555, 29588, 29558, 29593, 29564] sshfatal("ssh.c", "ssh_session2_setup", 2054LL, 1LL, 1LL, v3, "send packet");
}
}
[29604, 29610, 29613, 29617, 29620, 29598] ssh_packet_set_interactive(a1, v8, (unsigned int)options[27], (unsigned int)options[28]);
[29633, 29640, 29643, 29650, 29655, 29625, 29631] v12 = (char *)lookup_env_in_list("TERM", *(_QWORD *)&options[1238], (unsigned int)options[1236]);
[29664, 29666, 29670, 29673, 29675, 29659] if ( !v12 || !*v12 )
[29689, 29684, 29677] v12 = getenv("TERM");
[29693] v4 = environ;
[29700] v5 = command;
[29714, 29707, 29717] v6 = fileno(stdin);
[29760, 29730, 29762, 29763, 29733, 29764, 29736, 29770, 29739, 29773, 29756, 29745, 29778, 29749, 29782, 29752, 29722, 29724] client_session2_setup(a1, a2, (unsigned int)tty_flag, options[1258] == 1, v12, 0LL, v6, v5, v4);
}
[29798, 29800, 29805, 29785, 29789] return __readfsqword(0x28u) ^ v14;
[29809, 29810, 29812, 29813] }
// 862C: using guessed type int tty_flag;
// A918: using guessed type int options[1482];
// A938: using guessed type long command;
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AA40: using guessed type long ssh_err(_QWORD);
// ADA0: using guessed type long client_x11_get_proto(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// ADA8: using guessed type long x11_request_forwarding_with_spoofing(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// ADB0: using guessed type long client_expect_confirm(_QWORD, _QWORD, _QWORD, _QWORD);
// ADB8: using guessed type long channel_request_start(_QWORD, _QWORD, _QWORD, _QWORD);
// ADC0: using guessed type long sshpkt_send(_QWORD);
// ADC8: using guessed type long ssh_packet_set_interactive(_QWORD, _QWORD, _QWORD, _QWORD);
// ADD0: using guessed type long lookup_env_in_list(_QWORD, _QWORD, _QWORD);
// ADE0: using guessed type long client_session2_setup(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000007476) ----------------------------------------------------
long ssh_session2_open(long a1)
[29814] {
unsigned int v2; // [rsp+14h] [rbp-1Ch]
unsigned int v3; // [rsp+18h] [rbp-18h]
unsigned int v4; // [rsp+1Ch] [rbp-14h]
unsigned int v5; // [rsp+20h] [rbp-10h]
unsigned int v6; // [rsp+24h] [rbp-Ch]
long v7; // [rsp+28h] [rbp-8h]
[29826, 29830, 29836, 29838, 29814, 29818, 29819, 29822] if ( options[1259] )
[29857, 29862, 29865, 29840, 29845, 29852] v4 = open("/dev/null", 0);
else
[29872, 29867, 29877] v4 = dup(0);
[29880, 29890, 29885] v5 = dup(1);
[29898, 29893, 29903] v6 = dup(2);
[29922, 29906, 29910, 29912, 29916, 29918] if ( v4 == -1 || v5 == -1 || v6 == -1 )
[29953, 29924, 29958, 29928, 29965, 29935, 29936, 29972, 29942, 29977, 29948] sshfatal("ssh.c", "ssh_session2_open", 2085LL, 0LL, 1LL, 0LL, "dup() in/out/err failed");
[29982] v2 = 0x200000;
[29989] v3 = 0x8000;
[30002, 29996, 30004] if ( tty_flag )
{
[30006] v2 = 0x100000;
[30009] v3 = 0x4000;
}
[30012, 30015, 30018, 30022, 30026, 30029, 30033, 30037, 30039, 30046, 30047, 30049, 30050, 30051, 30053, 30058, 30065, 30068, 30073, 30077] v7 = channel_new(a1, "session", 3LL, v4, v5, v6, v2, v3, 2LL, "client-session", 2LL);
[30081, 30114, 30085, 30119, 30088, 30089, 30126, 30096, 30097, 30133, 30103, 30138, 30109] sshlog("ssh.c", "ssh_session2_open", 2098LL, 1LL, 7LL, 0LL, "channel_new: %d", *(unsigned int *)(v7 + 4));
[30147, 30151, 30154, 30158, 30160, 30163, 30143] channel_send_open(a1, *(unsigned int *)(v7 + 4));
[30168, 30174, 30176] if ( options[1258] )
[30178, 30182, 30185, 30189, 30194, 30201, 30204] channel_register_open_confirm(a1, *(unsigned int *)(v7 + 4), ssh_session2_setup, 0LL);
[30216, 30209, 30213] return *(unsigned int *)(v7 + 4);
[30217] }
// 862C: using guessed type int tty_flag;
// A918: using guessed type int options[1482];
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AD40: using guessed type long channel_register_open_confirm(_QWORD, _QWORD, _QWORD, _QWORD);
// ADF0: using guessed type long channel_new(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// ADF8: using guessed type long channel_send_open(_QWORD, _QWORD);
//----- (000000000000760A) ----------------------------------------------------
long ssh_session2(long a1, _QWORD *a2)
[30218] {
long v2; // rax
unsigned int v3; // eax
unsigned int v5; // [rsp+10h] [rbp-40h]
unsigned int v6; // [rsp+14h] [rbp-3Ch]
long v7; // [rsp+18h] [rbp-38h] BYREF
void *ptr; // [rsp+20h] [rbp-30h]
unsigned long v9; // [rsp+28h] [rbp-28h]
[30241, 30245, 30218, 30222, 30223, 30254, 30226, 30228, 30230, 30232, 30233, 30237] v9 = __readfsqword(0x28u);
[30258, 30260] v6 = -1;
[30267] v7 = 0LL;
[30281, 30283, 30275] if ( !options[1243] )
[30289, 30292, 30285] ssh_init_stdio_forwarding(a1);
[30305, 30308, 30311, 30297, 30301] ssh_init_forwarding(a1, &v7);
[30323, 30316, 30326] if ( *(_QWORD *)&options[1250] )
{
[30370, 30339, 30340, 30377, 30347, 30348, 30384, 30354, 30389, 30360, 30332, 30365] sshlog("ssh.c", "ssh_session2", 2121LL, 0LL, 7LL, 0LL, "expanding LocalCommand: %s", *(const char **)&options[1250]);
[30405, 30409, 30413, 30416, 30418, 30422, 30394, 30398] ptr = *(void **)&options[1250];
[30592, 30594, 30467, 30471, 30601, 30602, 30475, 30603, 30479, 30610, 30483, 30611, 30612, 30487, 30491, 30619, 30622, 30495, 30499, 30629, 30503, 30507, 30636, 30511, 30641, 30515, 30518, 30591, 30646, 30522, 30524, 30525, 30653, 30532, 30533, 30535, 30542, 30543, 30545, 30552, 30553, 30554, 30431, 30561, 30562, 30435, 30564, 30439, 30443, 30571, 30572, 30574, 30447, 30451, 30581, 30582, 30455, 30584, 30459, 30463] *(_QWORD *)&options[1250] = percent_expand(
ptr,
"C",
*a2,
"L",
a2[1],
"i",
a2[2],
&aUrhdpnlk[7],
a2[3],
&aUrhdpnlk[6],
a2[4],
&aUrhdpnlk[5],
a2[5]);
[30688, 30660, 30693, 30698, 30667, 30668, 30705, 30675, 30676, 30712, 30682, 30717] sshlog("ssh.c", "ssh_session2", 2127LL, 0LL, 7LL, 0LL, "expanded LocalCommand: %s", *(const char **)&options[1250]);
[30722, 30730, 30733, 30726] free(ptr);
}
[30752, 30738, 30742, 30745, 30750] if ( !(unsigned int)ssh_packet_get_mux(a1) )
[30761, 30754, 30758] muxserver_listen(a1);
[30786, 30789, 30766, 30772, 30774, 30780] if ( options[1243] && muxserver_sock != -1 )
{
[30801, 30795] ostdin_null_flag = options[1259];
[30813, 30807] osession_type = options[1258];
[30825, 30819] orequest_tty = options[1257];
[30837, 30831] otty_flag = tty_flag;
[30843] options[1259] = 1;
[30853] options[1258] = 0;
[30863] tty_flag = 0;
[30881, 30883, 30889, 30891, 30893, 30900, 30903, 30873, 30879] if ( !options[1260] && (osession_type || *(_QWORD *)&options[1222]) )
[30905] need_controlpersist_detach = 1;
[30915] options[1260] = 1;
}
[30944, 30925, 30931, 30933, 30935, 30941] if ( options[1243] && muxserver_sock == -1 )
[30953, 30946, 30950] ssh_init_stdio_forwarding(a1);
[30964, 30966, 30958] if ( options[1258] )
[30980, 30983, 30968, 30972, 30975] v6 = ssh_session2_open(a1);
else
[31008, 31011, 31015, 30985, 31018, 30991, 30997, 31003, 31005] ssh_packet_set_interactive(a1, options[1242] == 0, (unsigned int)options[27], (unsigned int)options[28]);
[31041, 31047, 31052, 31054, 31023, 31029, 31031, 31037] if ( !options[1242] && (*(_DWORD *)(a1 + 2108) & 0x4000000) != 0 )
{
[31072, 31108, 31078, 31113, 31084, 31089, 31060, 31094, 31064, 31101, 31071] sshlog("ssh.c", "ssh_session2", 2176LL, 0LL, 5LL, 0LL, "Requesting [email protected]");
[31139, 31118, 31122, 31126, 31131, 31134] v5 = sshpkt_start(a1, 80LL);
[31142, 31146, 31148, 31152, 31159, 31162, 31167, 31170, 31174, 31176, 31180, 31185, 31188, 31193, 31196, 31200, 31202, 31206, 31209, 31214, 31217, 31221] if ( v5
|| (v5 = sshpkt_put_cstring(a1, "[email protected]")) != 0
|| (v5 = sshpkt_put_u8(a1, 0LL)) != 0
|| (v5 = sshpkt_send(a1)) != 0 )
{
[31226, 31228, 31223] v2 = ssh_err(v5);
[31264, 31233, 31237, 31271, 31244, 31245, 31278, 31248, 31283, 31254, 31259] sshfatal("ssh.c", "ssh_session2", 2182LL, 1LL, 1LL, v2, "send packet");
}
}
[31298, 31300, 31306, 31308, 31288, 31295] if ( *(_QWORD *)&options[1250] && options[1252] )
[31320, 31317, 31310] ssh_local_cmd(*(_QWORD *)&options[1250]);
[31331, 31333, 31335, 31340, 31345, 31350, 31355, 31325, 31358] if ( !need_controlpersist_detach && (unsigned int)stdfd_devnull(0LL, 1LL, 0LL) == -1 )
[31360, 31394, 31364, 31401, 31371, 31372, 31408, 31378, 31413, 31384, 31418, 31389] sshlog("ssh.c", "ssh_session2", 2197LL, 1LL, 2LL, 0LL, "stdfd_devnull failed");
[31428, 31430, 31422] if ( options[1260] )
{
[31432, 31438, 31440, 31442, 31448, 31450] if ( options[7] && options[1212] > 0 )
[31456, 31493, 31463, 31464, 31500, 31470, 31505, 31476, 31510, 31481, 31514, 31452, 31486] sshlog(
"ssh.c",
"ssh_session2",
2206LL,
0LL,
5LL,
0LL,
"deferring postauth fork until remote forward confirmation received");
else
[31516] fork_postauth();
}
[31521, 31529, 31527] if ( tty_flag )
[31537, 31531] v3 = options[58];
else
[31539] v3 = -2;
[31553, 31586, 31557, 31559, 31561, 31566, 31570, 31544, 31579, 31581, 31550] return client_loop(a1, (unsigned int)tty_flag, v3, v6);
[31590, 31591, 31593, 31595, 31597, 31598] }
// 862C: using guessed type int tty_flag;
// 8630: using guessed type int need_controlpersist_detach;
// 8850: using guessed type short aUrhdpnlk[8];
// A8F8: using guessed type int ostdin_null_flag;
// A900: using guessed type int osession_type;
// A908: using guessed type int otty_flag;
// A910: using guessed type int orequest_tty;
// A918: using guessed type int options[1482];
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AA40: using guessed type long ssh_err(_QWORD);
// AD00: using guessed type long stdfd_devnull(_QWORD, _QWORD, _QWORD);
// ADC0: using guessed type long sshpkt_send(_QWORD);
// ADC8: using guessed type long ssh_packet_set_interactive(_QWORD, _QWORD, _QWORD, _QWORD);
// AE00: using guessed type long ssh_packet_get_mux(_QWORD);
// AE08: using guessed type long muxserver_listen(_QWORD);
// AE10: using guessed type long sshpkt_start(_QWORD, _QWORD);
// AE18: using guessed type long sshpkt_put_cstring(_QWORD, _QWORD);
// AE20: using guessed type long sshpkt_put_u8(_QWORD, _QWORD);
// AE28: using guessed type long ssh_local_cmd(_QWORD);
// AE30: using guessed type long client_loop(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000007B6F) ----------------------------------------------------
unsigned long load_public_identity_files(_QWORD *a1)
[31599] {
__uid_t v1; // eax
unsigned int v2; // eax
long v3; // rax
unsigned int v4; // eax
long v5; // rax
const char *v6; // rax
__uid_t v7; // eax
unsigned int v8; // eax
long v9; // rax
const char *v10; // rax
int i; // [rsp+18h] [rbp-FE8h]
int j; // [rsp+18h] [rbp-FE8h]
int k; // [rsp+18h] [rbp-FE8h]
unsigned int v15; // [rsp+1Ch] [rbp-FE4h]
int v16; // [rsp+20h] [rbp-FE0h]
int v17; // [rsp+24h] [rbp-FDCh]
void *v18; // [rsp+28h] [rbp-FD8h] BYREF
unsigned int *v19; // [rsp+30h] [rbp-FD0h] BYREF
void *ptr; // [rsp+38h] [rbp-FC8h] BYREF
void *v21; // [rsp+40h] [rbp-FC0h] BYREF
void *v22; // [rsp+48h] [rbp-FB8h]
int v23[100]; // [rsp+50h] [rbp-FB0h] BYREF
int v24[100]; // [rsp+1E0h] [rbp-E20h] BYREF
long s[100]; // [rsp+370h] [rbp-C90h] BYREF
long src[100]; // [rsp+690h] [rbp-970h] BYREF
long v27[100]; // [rsp+9B0h] [rbp-650h] BYREF
long v28[101]; // [rsp+CD0h] [rbp-330h] BYREF
unsigned long v29; // [rsp+FF8h] [rbp-8h]
[31619, 31626, 31599, 31603, 31604, 31635, 31607, 31614] v29 = __readfsqword(0x28u);
[31641, 31639] ptr = 0LL;
[31652] v21 = 0LL;
[31663] v16 = 0;
[31673, 31679] v15 = 0;
[31685, 31692, 31697, 31702, 31705] memset(s, 0, sizeof(s));
[31717, 31722, 31727, 31730, 31710] memset(src, 0, sizeof(src));
[31747, 31752, 31755, 31735, 31742] memset(v23, 0, sizeof(v23));
[31777, 31780, 31760, 31767, 31772] memset(v27, 0, sizeof(v27));
[31785, 31792, 31797, 31802, 31805] memset(v28, 0, 0x320uLL);
[31810, 31817, 31822, 31827, 31830] memset(v24, 0, sizeof(v24));
[31842, 31835, 31845] if ( *(_QWORD *)&options[196] )
{
[31872, 31874, 31877, 31880, 31882, 31851, 31887, 31857, 31889, 31860, 31866] if ( options[201] <= 99 && !(unsigned int)pkcs11_init(options[22] == 0) )
{
[31909, 31916, 31921, 31924, 31895, 31929, 31902] v17 = pkcs11_add_provider(*(_QWORD *)&options[196], 0LL, &ptr, &v21);
[31942, 31935] if ( v17 > 0 )
{
[32163, 31948, 32145, 31958, 32151, 32157] for ( i = 0; i < v17; ++i )
{
[31970, 31963] if ( v15 <= 0x63 )
{
[32065, 32068, 32042, 32074, 32049, 32055, 32058, 32062] src[v15] = *((_QWORD *)ptr + i);
[32129, 32098, 32102, 32134, 32105, 32108, 32140, 32082, 32114, 32089, 32122, 32095] s[v15++] = *((_QWORD *)v21 + i);
}
else
{
[32001, 31972, 31979, 31985, 31988, 31992, 31995, 31998] sshkey_free(*((_QWORD *)ptr + i));
[32032, 32035, 32006, 32040, 32013, 32019, 32022, 32026, 32029] free(*((void **)v21 + i));
}
}
[32176, 32169, 32179] free(ptr);
[32184, 32194, 32191] free(v21);
}
}
}
[32199, 33259, 32209, 33265, 33271, 33277] for ( j = 0; j < options[201]; ++j )
{
[32229, 32261, 32231, 32264, 32235, 32269, 32271, 32243, 32214, 32250, 32221, 32254, 32223] if ( v15 > 0x63 || !strcasecmp(*(const char **)&options[2 * j + 202], "none") )
{
[32293, 32300, 32304, 32273, 32307, 32279, 32281, 32285] free(*(void **)&options[2 * j + 202]);
[32320, 32324, 32332, 32339, 32312, 32347, 32318] *(_QWORD *)&options[2 * j + 202] = 0LL;
}
else
{
[32352] v1 = getuid();
[32386, 32357, 32390, 32359, 32392, 32395, 32365, 32367, 32400, 32371, 32379] v18 = (void *)tilde_expand_filename(*(_QWORD *)&options[2 * j + 202], v1);
[32421, 32424, 32427, 32432, 32407, 32414] v22 = (void *)default_client_percent_dollar_expand((long)v18, a1);
[32449, 32446, 32439] free(v18);
[32454, 32461, 32468, 32473, 32476, 32479] v2 = sshkey_load_public(v22, &v19, 0LL);
[32484, 32486, 32493, 32500, 32507, 32510] check_load(v2, (void **)&v19, (const char *)v22, "pubkey");
[32522, 32515, 32525] if ( v19 )
[32536, 32534, 32527] v3 = *v19;
else
[32538] v3 = 0xFFFFFFFFLL;
[32547, 32548, 32579, 32584, 32554, 32591, 32561, 32562, 32598, 32568, 32603, 32574, 32543] sshlog(
"ssh.c",
"load_public_identity_files",
2278LL,
0LL,
5LL,
0LL,
"identity file %s type %d",
(const char *)v22,
v3);
[32608, 32643, 32612, 32646, 32618, 32620, 32624, 32632, 32639] free(*(void **)&options[2 * j + 202]);
[32664, 32657, 32651] s[v15] = (long)v22;
[32672, 32685, 32679] src[v15] = (long)v19;
[32707, 32731, 32715, 32722, 32693, 32725, 32699, 32701] v23[v15++] = options[j + 402];
[32738, 32745, 32752, 32758, 32764, 32766] if ( v15 <= 0x63 && !options[702] )
{
[32801, 32772, 32779, 32786, 32793, 32796] xasprintf(&v18, "%s-cert", (const char *)v22);
[32806, 32813, 32820, 32825, 32828, 32831] v4 = sshkey_load_public(v18, &v19, 0LL);
[32836, 32838, 32845, 32852, 32859, 32862] check_load(v4, (void **)&v19, (const char *)v22, "pubkey");
[32874, 32867, 32877] if ( v19 )
[32888, 32886, 32879] v5 = *v19;
else
[32890] v5 = 0xFFFFFFFFLL;
[32928, 32933, 32902, 32906, 32907, 32908, 32938, 32945, 32915, 32916, 32952, 32922, 32957, 32895] sshlog(
"ssh.c",
"load_public_identity_files",
2297LL,
0LL,
5LL,
0LL,
"identity file %s type %d",
(const char *)v18,
v5);
[32976, 32962, 32973, 32966] if ( v19 )
{
[32998, 33005, 33008, 33013, 33015] if ( (unsigned int)sshkey_is_cert(v19) )
{
[33156, 33135, 33142, 33145, 33150] s[v15] = xstrdup(v22);
[33177, 33171, 33164] src[v15] = (long)v19;
[33185, 33217, 33191, 33223, 33193, 33230, 33199, 33237, 33207, 33214] v23[v15++] = options[j + 402];
}
else
{
[33024, 33017, 33027] v6 = (const char *)sshkey_type(v19);
[33089, 33059, 33094, 33032, 33065, 33070, 33039, 33043, 33044, 33045, 33075, 33082, 33052, 33053] sshlog(
"ssh.c",
"load_public_identity_files",
2304LL,
1LL,
5LL,
0LL,
"key %s type %s is not a certificate",
(const char *)v18,
v6);
[33113, 33099, 33110, 33103] sshkey_free(v19);
[33128, 33133, 33125, 33118] free(v18);
}
}
else
{
[32985, 32978, 32988, 32993] free(v18);
}
}
}
}
[33289, 33283, 33292] if ( options[702] > 100 )
[33312, 33347, 33318, 33323, 33294, 33328, 33298, 33335, 33305, 33306, 33342] sshfatal("ssh.c", "load_public_identity_files", 2319LL, 1LL, 1LL, 0LL, "too many certificates");
[33984, 33990, 33352, 33996, 33362, 34002] for ( k = 0; k < options[702]; ++k )
{
[33367] v7 = getuid();
[33409, 33380, 33412, 33382, 33417, 33388, 33396, 33403, 33372, 33374, 33407] v18 = (void *)tilde_expand_filename(*(_QWORD *)&options[2 * k + 704], v7);
[33441, 33444, 33449, 33424, 33431, 33438] v22 = (void *)default_client_percent_dollar_expand((long)v18, a1);
[33456, 33466, 33463] free(v18);
[33478, 33485, 33490, 33493, 33496, 33471] v8 = sshkey_load_public(v22, &v19, 0LL);
[33510, 33517, 33524, 33527, 33501, 33503] check_load(v8, (void **)&v19, (const char *)v22, "certificate");
[33539, 33532, 33542] if ( v19 )
[33544, 33553, 33551] v9 = *v19;
else
[33555] v9 = 0xFFFFFFFFLL;
[33601, 33571, 33596, 33608, 33578, 33579, 33615, 33585, 33620, 33591, 33560, 33564, 33565] sshlog(
"ssh.c",
"load_public_identity_files",
2328LL,
0LL,
5LL,
0LL,
"certificate file %s type %d",
(const char *)v22,
v9);
[33665, 33635, 33637, 33643, 33651, 33625, 33658, 33629, 33662] free(*(void **)&options[2 * k + 704]);
[33699, 33670, 33676, 33678, 33684, 33692] *(_QWORD *)&options[2 * k + 704] = 0LL;
[33714, 33707, 33717] if ( v19 )
{
[33739, 33746, 33749, 33754, 33756] if ( (unsigned int)sshkey_is_cert(v19) )
{
[33880, 33874, 33887] v27[v16] = (long)v22;
[33908, 33902, 33895] v28[v16] = (long)v19;
[33922, 33954, 33924, 33961, 33930, 33968, 33948, 33938, 33973, 33945, 33979, 33916] v24[v16++] = options[k + 904];
}
else
{
[33768, 33765, 33758] v10 = (const char *)sshkey_type(v19);
[33792, 33828, 33798, 33833, 33804, 33773, 33777, 33778, 33809, 33814, 33784, 33821, 33791] sshlog(
"ssh.c",
"load_public_identity_files",
2337LL,
1LL,
5LL,
0LL,
"key %s type %s is not a certificate",
(const char *)v22,
v10);
[33849, 33842, 33852, 33838] sshkey_free(v19);
[33864, 33857, 33867, 33872] free(v22);
}
}
else
{
[33729, 33734, 33726, 33719] free(v22);
}
}
[34008, 34014] options[201] = v15;
[34020, 34027, 34032, 34035, 34042] memcpy(&options[202], s, 0x320uLL);
[34054, 34059, 34062, 34069, 34047] memcpy(&options[502], src, 0x320uLL);
[34081, 34086, 34089, 34096, 34074] memcpy(&options[402], v23, 0x190uLL);
[34107, 34101] options[702] = v16;
[34113, 34120, 34125, 34128, 34135] memcpy(&options[704], v27, 0x320uLL);
[34147, 34152, 34155, 34162, 34140] memcpy(&options[1004], v28, 0x320uLL);
[34179, 34182, 34189, 34167, 34174] memcpy(&options[904], v24, 0x190uLL);
[34208, 34210, 34215, 34194, 34195, 34199] return __readfsqword(0x28u) ^ v29;
[34216] }
// A918: using guessed type int options[1482];
// A960: using guessed type long tilde_expand_filename(_QWORD, _QWORD);
// A990: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// AA18: using guessed type long xstrdup(_QWORD);
// AA30: using guessed type long xasprintf(_QWORD, const char *, ...);
// AC90: using guessed type long sshkey_load_public(_QWORD, _QWORD, _QWORD);
// ACB8: using guessed type long sshkey_free(_QWORD);
// AE38: using guessed type long pkcs11_init(_QWORD);
// AE40: using guessed type long pkcs11_add_provider(_QWORD, _QWORD, _QWORD, _QWORD);
// AE48: using guessed type long sshkey_is_cert(_QWORD);
// AE50: using guessed type long sshkey_type(_QWORD);
// 7B6F: using guessed type long s[100];
// 7B6F: using guessed type long src[100];
// 7B6F: using guessed type int var_FB0[100];
// 7B6F: using guessed type long var_650[100];
// 7B6F: using guessed type long var_330[101];
// 7B6F: using guessed type int var_E20[100];
//----- (00000000000085A9) ----------------------------------------------------
unsigned long main_sigchld_handler()
[34217] {
int stat_loc; // [rsp+1Ch] [rbp-14h] BYREF
int v2; // [rsp+20h] [rbp-10h]
__pid_t v3; // [rsp+24h] [rbp-Ch]
unsigned long v4; // [rsp+28h] [rbp-8h]
[34241, 34217, 34221, 34222, 34225, 34229, 34232] v4 = __readfsqword(0x28u);
[34245, 34247, 34252, 34254, 34257] v2 = *_errno_location();
do
{
do
[34275, 34280, 34258, 34262, 34267, 34270] v3 = waitpid(-1, &stat_loc, 1);
[34283, 34287] while ( v3 > 0 );
}
[34305, 34289, 34293, 34295, 34300, 34302] while ( v3 == -1 && *_errno_location() == 4 );
[34312, 34315, 34307] *_errno_location() = v2;
[34338, 34317, 34318, 34322, 34331, 34333] return __readfsqword(0x28u) ^ v4;
[34339] }
// nfuncs=187 queued=31 decompiled=31 lumina nreq=0 worse=0 better=0
// ALL OK, 31 function(s) have been successfully decompiled
|
long long rev_xstrcoll_mtime(void* a0, void* a1) {
[9760] int tmp_1; // tmp #1
[9760]
[9760] tmp_1 = a0;
[9760, 9764] return cmp_mtime(a1, tmp_1, xstrcoll);
[11808, 11810, 11811, 11815, 9767, 11822, 11825] }
|
long long rev_xstrcoll_mtime(unsigned long long *a0, unsigned long long *a1) {
[25580] return cmp_mtime(a1, a0, xstrcoll);
[25621, 25608, 25626, 25627] }
|
long strunvisx(_BYTE *a1, char *a2, short a3)
[2208] {
[2208, 2212, 2214, 2217, 2224] return strnunvisx(a1, -1LL, a2, a3);
}
//----- (00000000000008C0) ----------------------------------------------------
long strunvis(_BYTE *a1, char *a2)
[2240] {
[2240, 2244, 2247, 2249, 2256] return strnunvisx(a1, -1LL, a2, 0);
}
//----- (00000000000008E0) ----------------------------------------------------
long strnunvis(_BYTE *a1, long a2, char *a3)
[2272] {
[2272, 2276, 2278] return strnunvisx(a1, a2, a3, 0);
}
// nfuncs=9 queued=5 decompiled=5 lumina nreq=0 worse=0 better=0
// ALL OK, 5 function(s) have been successfully decompiled
|
long strunvisx(_BYTE *a1, char *a2, short a3)
[2981] {
[3011, 2981, 3015, 2985, 2986, 2989, 3022, 2993, 3025, 2997, 3030, 3001, 3004, 3007] return strnunvisx(a1, -1LL, a2, a3);
[3031] }
//----- (0000000000000BD8) ----------------------------------------------------
long strunvis(_BYTE *a1, char *a2)
[3032] {
[3040, 3072, 3075, 3044, 3048, 3080, 3052, 3056, 3060, 3032, 3065, 3036, 3037] return strnunvisx(a1, -1LL, a2, 0);
[3081] }
//----- (0000000000000C0A) ----------------------------------------------------
long strnunvis(_BYTE *a1, long a2, char *a3)
[3082] {
[3106, 3110, 3082, 3114, 3086, 3087, 3118, 3090, 3123, 3094, 3126, 3098, 3131, 3102] return strnunvisx(a1, a2, a3, 0);
[3132] }
// nfuncs=9 queued=5 decompiled=5 lumina nreq=0 worse=0 better=0
// ALL OK, 5 function(s) have been successfully decompiled
|
int component_start(char *a0) {
[0] char *v1; // rax
[0]
[0] v1 = a0;
[0, 3] if (*(a0) == 47) {
[6] do {
[16] v1 += 1;
[16] } while (*(v1) == 47);
[16, 20, 23] }
return v1;
}
|
int component_start(unsigned long a0) {
[1818] char *v0; // [bp-0x10]
[1818]
[1818] for (v0 = a0; *(v0) == 47; v0 += 1);
[1826, 1832, 1837, 1841, 1844, 1846, 1818, 1822, 1823] return v0;
[1848, 1852, 1853] }
|
void usage(unsigned long a0) {
[2800] unsigned long v0; // [bp-0x8]
[2800] unsigned long v2; // r12
[2800]
[2800] v0 = v2;
[2800, 2804] if (a0) {
__fprintf_chk(stderr, 0x1, dcgettext(NULL, "Try '%s --help' for more information.\n", 0x5));
[2850, 2853, 2858, 2861, 2829, 2863, 2836, 2838, 2843] } else {
__printf_chk(0x1, dcgettext(NULL, "Usage: %s [OPTION]... MODE[,MODE]... FILE...\n or: %s [OPTION]... OCTAL-MODE FILE...\n or: %s [OPTION]... --reference=RFILE FILE...\n", 0x5));
[2884, 2889, 2892, 2895, 2898, 2901, 2906, 2875, 2908, 2877] fputs_unlocked(dcgettext(NULL, "Change the mode of each FILE to MODE.\nWith --reference, change the mode of each FILE to that of RFILE.\n\n", 0x5), stdout);
[2945, 2920, 2927, 2934, 2939, 2942] fputs_unlocked(dcgettext(NULL, " -c, --changes like verbose but report only when a change is made\n -f, --silent, --quiet suppress most error messages\n -v, --verbose output a diagnostic for every file processed\n", 0x5), stdout);
[2976, 2979, 2982, 2957, 2964, 2971] fputs_unlocked(dcgettext(NULL, " --no-preserve-root do not treat '/' specially (the default)\n --preserve-root fail to operate recursively on '/'\n", 0x5), stdout);
[3008, 3013, 3016, 3019, 2994, 3001] fputs_unlocked(dcgettext(NULL, " --reference=RFILE use RFILE's mode instead of MODE values\n", 0x5), stdout);
[3045, 3050, 3053, 3056, 3031, 3038] fputs_unlocked(dcgettext(NULL, " -R, --recursive change files and directories recursively\n", 0x5), stdout);
[3075, 3082, 3087, 3090, 3093, 3068] fputs_unlocked(dcgettext(NULL, " --help display this help and exit\n", 0x5), stdout);
[3105, 3112, 3119, 3124, 3127, 3130] fputs_unlocked(dcgettext(NULL, " --version output version information and exit\n", 0x5), stdout);
[3142, 3149, 3156, 3161, 3164, 3167] fputs_unlocked(dcgettext(NULL, "\nEach MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.\n", 0x5), stdout);
[3201, 3204, 3179, 3186, 3193, 3198] emit_ancillary_info();
[3209] }
exit(a0); /* do not return */
}
|
void usage(unsigned long a0) {
[3328] unsigned long v0; // [bp-0x20]
[3328] unsigned long v1; // [bp-0x18]
[3328] unsigned long v2; // [bp-0x10]
[3328] unsigned long v4; // r13
[3328] unsigned long v5; // r12
[3328] unsigned long v6; // rbx
[3328]
[3328] v2 = v4;
[3328, 3332, 3333, 3336] v1 = v5;
[3338] v0 = v6;
[3340] if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
[3392, 3361, 3397, 3368, 3373, 3376, 3383, 3386, 3389] } else {
printf(gettext("Usage: %s [OPTION]... MODE[,MODE]... FILE...\n or: %s [OPTION]... OCTAL-MODE FILE...\n or: %s [OPTION]... --reference=RFILE FILE...\n"));
[3457, 3428, 3435, 3440, 3443, 3446, 3449, 3452] fputs_unlocked(gettext("Change the mode of each FILE to MODE.\nWith --reference, change the mode of each FILE to that of RFILE.\n\n"), stdout);
[3469, 3476, 3481, 3484, 3487] fputs_unlocked(gettext(" -c, --changes like verbose but report only when a change is made\n -f, --silent, --quiet suppress most error messages\n -v, --verbose output a diagnostic for every file processed\n"), stdout);
[3499, 3506, 3511, 3514, 3517] fputs_unlocked(gettext(" --no-preserve-root do not treat '/' specially (the default)\n --preserve-root fail to operate recursively on '/'\n"), stdout);
[3529, 3536, 3541, 3544, 3547] fputs_unlocked(gettext(" --reference=RFILE use RFILE's mode instead of MODE values\n"), stdout);
[3559, 3566, 3571, 3574, 3577] fputs_unlocked(gettext(" -R, --recursive change files and directories recursively\n"), stdout);
[3589, 3596, 3601, 3604, 3607] fputs_unlocked(gettext(" --help display this help and exit\n"), stdout);
[3619, 3626, 3631, 3634, 3637] fputs_unlocked(gettext(" --version output version information and exit\n"), stdout);
[3649, 3656, 3661, 3664, 3667] fputs_unlocked(gettext("\nEach MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.\n"), stdout);
[3686, 3691, 3694, 3697, 3679] emit_ancillary_info("chmod");
[3709, 3702] }
exit(a0); /* do not return */
}
|
static int do_del(int argc, char **argv)
{
struct l2tp_parm p;
if (parse_args(argc, argv, L2TP_DEL, &p) < 0)
return -1;
if (!p.tunnel && !p.session)
missarg("tunnel or session");
if ((p.tunnel) && (p.tunnel_id == 0))
missarg("tunnel_id");
if ((p.session) && (p.session_id == 0))
missarg("session_id");
if (p.session_id)
return delete_session(&p);
else
return delete_tunnel(&p);
return -1;
}
static int do_show(int argc, char **argv)
{
struct l2tp_data data;
struct l2tp_parm *p = &data.config;
if (parse_args(argc, argv, L2TP_GET, p) < 0)
return -1;
if (!p->tunnel && !p->session)
missarg("tunnel or session");
if (p->session)
get_session(&data);
else
get_tunnel(&data);
return 0;
}
int do_ipl2tp(int argc, char **argv)
{
if (argc < 1 || !matches(*argv, "help"))
usage();
if (genl_init_handle(&genl_rth, "l2tp", &genl_family))
exit(1);
if (matches(*argv, "add") == 0)
return do_add(argc-1, argv+1);
if (matches(*argv, "delete") == 0)
return do_del(argc-1, argv+1);
if (matches(*argv, "show") == 0 ||
matches(*argv, "lst") == 0 ||
matches(*argv, "list") == 0)
return do_show(argc-1, argv+1);
fprintf(
stderr
,
"Command \"%s\" is unknown, try \"ip l2tp help\".\n", *argv);
exit(-1);
}
|
static int do_del(int argc, char **argv)
{
struct l2tp_parm p;
if (parse_args(argc, argv, L2TP_DEL, &p) < 0)
return -1;
if (!p.tunnel && !p.session)
missarg("tunnel or session");
if ((p.tunnel) && (p.tunnel_id == 0))
missarg("tunnel_id");
if ((p.session) && (p.session_id == 0))
missarg("session_id");
if (p.session_id)
return delete_session(&p);
else
return delete_tunnel(&p);
return -1;
}
static int do_show(int argc, char **argv)
{
struct l2tp_data data;
struct l2tp_parm *p = &data.config;
if (parse_args(argc, argv, L2TP_GET, p) < 0)
return -1;
if (!p->tunnel && !p->session)
missarg("tunnel or session");
if (p->session)
get_session(&data);
else
get_tunnel(&data);
return 0;
}
int do_ipl2tp(int argc, char **argv)
{
if (argc < 1 || !matches(*argv, "help"))
usage();
if (genl_init_handle(&genl_rth, "l2tp", &genl_family))
exit(1);
if (matches(*argv, "add") == 0)
return do_add(argc-1, argv+1);
if (matches(*argv, "delete") == 0)
return do_del(argc-1, argv+1);
if (matches(*argv, "show") == 0 ||
matches(*argv, "lst") == 0 ||
matches(*argv, "list") == 0)
return do_show(argc-1, argv+1);
fprintf(
stderr
,
"Command \"%s\" is unknown, try \"ip l2tp help\".\n", *argv);
exit(-1);
}
|
void remove_node(struct _node** head, struct _node* node) {
if (node==*head) {
if (node->next) {
node->next->last=(*head)->last;
node->next->prev=
((void *)0)
;
}
*head=node->next;
} else {
if (node==(*head)->last)
(*head)->last=node->prev;
if (node->prev)
node->prev->next=node->next;
if (node->next)
node->next->prev=node->prev;
}
node->prev=
((void *)0)
;
node->next=
((void *)0)
;
}
|
void remove_node(struct _node** head, struct _node* node) {
if (node==*head) {
if (node->next) {
node->next->last=(*head)->last;
node->next->prev=
((void *)0)
;
}
*head=node->next;
} else {
if (node==(*head)->last)
(*head)->last=node->prev;
if (node->prev)
node->prev->next=node->next;
if (node->next)
node->next->prev=node->prev;
}
node->prev=
((void *)0)
;
node->next=
((void *)0)
;
}
|
int install_file_in_file_parents(char *a0, unsigned long a1, void* a2) {
[4352] if (!mkancesdirs_safe_wd(a0, a1, a2, 0x0))
[4354, 4367] return 0;
[4376, 4377, 4379, 4380, 4382] return install_file_in_file(a0, a1, 0xffffff9c, a1, a2);
[6431, 6433, 6435, 6437, 6439, 6441, 6443, 6445, 4397, 6447, 6449, 6451, 6453, 6455, 6457, 6459, 6461, 6463, 6465, 6467, 6469, 6471, 6473, 6475, 6477, 6479, 6481, 6483, 6485, 6487, 6489, 6491, 6493, 6495, 6497, 6499, 6501, 6503, 6505, 6507, 6509, 6511, 6513, 6515, 6517, 6519, 6521, 6523, 6525, 6527, 6529, 6531, 6533, 6535, 6537, 6539, 6541, 6543, 6545, 6547, 6549, 6551, 6553, 6555, 6557, 6559, 6561, 6563, 6565, 6567, 6569, 6571, 6573, 6575, 6577, 6579, 6581, 6583, 6585, 6587, 6589, 6591, 6593, 6595, 6597, 6599, 6601, 6603, 6605, 6607, 6609, 6611, 6613, 6615, 6617, 6619, 6621, 6623, 6625, 6627] }
|
int install_file_in_file_parents(char *a0, unsigned long a1, void* a2) {
[6368] unsigned int v1; // eax
[6368] unsigned int v2; // eax
[6368]
[6368] if (mkancesdirs_safe_wd(a0, a1, a2, 0x0) && install_file_in_file(a0, a1, 0xffffff9c, a1, a2)) {
[6404, 6443, 6412, 6417, 6451, 6419] v1 = 1;
[6460] goto LABEL_401948;
[6465] }
v1 = 0;
LABEL_401948:
v2 = v1 & 1;
return v2;
}
|
int is_device_mode(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned long a3) {
[256] int tmp_27; // tmp #27
[256] char v2; // al
[256] unsigned int v3; // eax
[256] unsigned int v4; // eax
[256]
[256] tmp_27 = a0;
[256] *(&a2) = tmp_27 & 0xf000;
[264] v2 = (a0 & 0xb000) == 0x2000;
[258, 276, 270] *(&a2) = (tmp_27 & 0xf000) == 0x1000;
[288, 290, 296, 264] v4 = v3 | (tmp_27 & 0xf000) == 0xc000 | a2;
[288, 279, 264, 299, 285] return v4;
[301] }
|
int is_device_mode(unsigned long a0) {
[1713] unsigned int v1; // eax
[1713] unsigned int v2; // eax
[1713]
[1713] if ((a0 & 0xf000) != 0x2000 && (a0 & 0xf000) != 0x6000 && (a0 & 0xf000) != 0xc000 && (a0 & 0xf000) != 0x1000)
[1732, 1737, 1739, 1742, 1747, 1752, 1754, 1757, 1762, 1767, 1769, 1772, 1713, 1777, 1717, 1718, 1782, 1721, 1724, 1727] v1 = 0;
[1796, 1799, 1800, 1791] if ((a0 & 0xf000) == 0x1000 || (a0 & 0xf000) == 0x2000 || (a0 & 0xf000) == 0x6000 || (a0 & 0xf000) == 0xc000)
[1732, 1737, 1739, 1742, 1747, 1752, 1754, 1757, 1762, 1767, 1769, 1772, 1777, 1713, 1717, 1782, 1718, 1721, 1724, 1727] v1 = 1;
[1784] v2 = v1 & 1;
[1796] return v2;
[1800, 1799] }
|
long long input_userauth_failure(unsigned long long a0, unsigned long a1, struct_0 *a2) {
[22960] char v0; // [bp-0x29]
[22960] void* v1; // [bp-0x28]
[22960] void* v3; // rdi
[22960]
[22960] v1 = 0;
[22977, 22986, 22991, 22960, 22993, 22964, 22965, 22966, 22970] if (!a2->field_860)
sshfatal("sshconnect2.c", "input_userauth_failure", 0x290, 0x0, 0x1, 0x0, "input_userauth_failure: no authentication context", a0);
[23296, 23303, 23305, 23264, 23267, 23273, 23275, 23276, 23283, 23288, 23295] if (sshpkt_get_cstring(a2, &v1, 0x0)) {
[23024, 23019] LABEL_4059f9:
v3 = v1;
[23033, 23038] } else {
if (!(!sshpkt_get_u8(a2, &v0)))
[23080] goto LABEL_4059f9;
[23085, 23087] if (!(!sshpkt_get_end(a2)))
[23092] goto LABEL_4059f9;
[23097, 23099] if (v0) {
sshlog("sshconnect2.c", "input_userauth_failure");
[23235, 23236, 23238, 23192, 23196, 23198, 23205, 23208, 23214, 23219, 23226, 23228] pubkey_reset(a2->field_860->field_38);
[23243, 23247] }
sshlog("sshconnect2.c", "input_userauth_failure");
[23108, 23115, 23119, 23122, 23124, 23125, 23130, 23132, 23138, 23145, 23152] userauth(a2);
[23157, 23162, 23165] v3 = 0;
[23170] v1 = 0;
[23172] }
free(v3);
return 0;
}
|
long long input_userauth_failure(unsigned long a0, unsigned long a1, struct_0 *a2) {
[5700] unsigned long long v0; // [bp-0x48]
[5700] unsigned int v1; // [bp-0x30]
[5700] unsigned int v2; // [bp-0x2c]
[5700] char v3; // [bp-0x21]
[5700] void* v4; // [bp-0x20]
[5700] struct_1 *v5; // [bp-0x18]
[5700] unsigned long long v6; // [bp-0x10]
[5700] unsigned long v7; // [bp-0x8], Other Possible Types: void*
[5700] char v8; // [bp+0x0]
[5700]
[5700] v2 = a0;
[5700, 5704, 5705, 5708, 5712] v1 = a1;
[5715] v5 = a2->field_860;
[5731, 5735, 5737, 5741, 5748, 5718, 5722] v4 = 0;
[5752] if (!v5) {
v0 = "input_userauth_failure: no authentication context";
[5778, 5767, 5771] sshfatal("sshconnect2.c", "input_userauth_failure", 0x290, 0x0, 0x1, 0x0);
[5796, 5801, 5808, 5779, 5815, 5785, 5820, 5791] }
if (!sshpkt_get_cstring(a2, &v4, 0x0, &v4) && !sshpkt_get_u8(a2, &v3, &v3) && !sshpkt_get_end(a2)) {
if (v3) {
v7 = v5->field_20->field_0;
v6 = "Authenticated using \"%s\" with partial success.";
sshlog("sshconnect2.c", "input_userauth_failure", 0x298, 0x0, 0x4, 0x0, *(&v8));
pubkey_reset(v5);
}
v7 = v4;
v6 = "Authentications that can continue: %s";
sshlog("sshconnect2.c", "input_userauth_failure", 0x29d, 0x0, 0x5, 0x0, *(&v8));
userauth(a2, v4);
v4 = 0;
}
free(v4);
return 0;
}
|
long brelse(long a1)
[9344] {
long v2[2]; // [rsp+8h] [rbp-10h] BYREF
[9344, 9353, 9348, 9349] v2[0] = a1;
[9363, 9358, 9367] if ( (*(_BYTE *)(a1 + 24) & 1) != 0 )
[9392, 9395, 9403, 9400] ll_rw_block_constprop_1(v2);
[9369, 9377, 9372] return ext2fs_free_mem(v2);
[9408, 9412, 9413, 9381, 9382] }
// 4B40: using guessed type long ext2fs_free_mem(_QWORD);
//----- (00000000000024D0) ----------------------------------------------------
long e2fsck_get_journal(const void ***a1, _QWORD *a2)
[9424] {
const void **v4; // rax
unsigned int *v5; // r13
long v6; // rax
long v7; // rdx
_DWORD *v8; // rbp
const void **v9; // rax
const void **v10; // rdi
long v11; // rsi
long inode; // r14
long v14; // rax
long v15; // rsi
const void **v16; // rdi
long v17; // rsi
char v18; // r12
unsigned int v19; // eax
bool v20; // zf
int v21; // r10d
long v22; // rsi
const void **v23; // rdi
long v24; // rax
const void **v25; // rdi
long v26; // rcx
unsigned int v27; // edx
long v28; // r8
unsigned long v29; // rsi
unsigned long v30; // rax
int v31; // eax
long v32; // rdx
long v33; // rsi
long v34; // rsi
int v35; // edx
long v36; // r13
const void *v37; // r14
unsigned long v38; // rax
long v39; // rax
long v40; // rdx
long v41; // rdx
long ( *v42)(long, long, int, int, unsigned int); // rax
const void **devname; // rax
const void **v44; // rax
long v45; // rsi
int v46; // [rsp+8h] [rbp-A90h]
const void **v47; // [rsp+18h] [rbp-A80h]
long v48; // [rsp+20h] [rbp-A78h] BYREF
int *v49; // [rsp+28h] [rbp-A70h] BYREF
long v50; // [rsp+30h] [rbp-A68h] BYREF
long v51; // [rsp+38h] [rbp-A60h] BYREF
long memory; // [rsp+40h] [rbp-A58h] BYREF
long v53; // [rsp+48h] [rbp-A50h] BYREF
char v54[112]; // [rsp+50h] [rbp-A48h] BYREF
long v55[46]; // [rsp+C0h] [rbp-9D8h] BYREF
int v56[256]; // [rsp+230h] [rbp-868h] BYREF
_DWORD v57[256]; // [rsp+630h] [rbp-468h] BYREF
char v58[40]; // [rsp+A30h] [rbp-68h] BYREF
unsigned long v59; // [rsp+A58h] [rbp-40h]
[9440, 9447, 9424, 9456, 9426, 9429, 9431, 9433, 9435, 9436, 9437] v59 = __readfsqword(0x28u);
[9464, 9466, 9471] v4 = *a1;
[9474] v50 = 0LL;
[9483] v51 = 0LL;
[9495] memory = 0LL;
[9504] v5 = (unsigned int *)v4[4];
[9508] v53 = 0LL;
[9492, 9517] clear_problem_context(v54);
[9537, 9542, 9522, 9529, 9534] memory = e2fsck_allocate_memory(a1, 208LL, "journal");
[9547, 9550] if ( !memory )
[10960, 10966] return 2133571398LL;
[9568, 9571, 9563, 9556] v6 = e2fsck_allocate_memory(a1, 32LL, "kdev");
[9576] v51 = v6;
[9584, 9581] if ( !v6 )
goto LABEL_33;
[9590] v7 = memory;
[9595] *(_QWORD *)(v6 + 16) = a1;
[9599] v8 = (_DWORD *)(v6 + 16);
[9610, 9603] *(_QWORD *)v6 = a1;
[9616] *(_DWORD *)(v6 + 8) = 1;
[9623] *(_DWORD *)(v6 + 24) = 2;
[9630] *(_QWORD *)(v7 + 112) = v6;
[9634] v9 = *a1;
[9637] *(_QWORD *)(v7 + 104) = v8;
[9641] *(_QWORD *)(v7 + 136) = 0LL;
[9652, 9655] *(_DWORD *)(v7 + 120) = *((_DWORD *)v9 + 10);
[9665, 9658, 9613, 9663] if ( (unsigned int)uuid_is_null(v5 + 52) )
{
[9885, 9879] inode = 2133571369LL;
[9872, 9887] if ( !v5[56] )
{
LABEL_9:
[9760, 9762, 9765] e2fsck_use_inode_shortcuts(a1, 0LL);
[9776, 9770] if ( v51 )
[9778, 9783] ext2fs_free_mem(&v51);
[9794, 9788] if ( v50 )
[9801, 9796] ext2fs_free_mem(&v50);
[9812, 9806] if ( memory )
[9824, 9832, 9841, 9814, 9819] ext2fs_free_mem(&memory);
[9819, 9854] return inode;
}
[9905, 9908, 9900, 9893] v14 = e2fsck_allocate_memory(a1, 144LL, "journal inode");
[9913] v50 = v14;
[9921, 9918] if ( v14 )
{
[9927] v15 = v5[56];
[9934] v16 = *a1;
[9937] *(_QWORD *)v14 = a1;
[9944] *(_DWORD *)(v14 + 8) = v15;
[9952, 9947, 9940] inode = ext2fs_read_inode(v16, v15, v14 + 12);
[9955, 9958] if ( inode )
{
[10976, 10984] if ( *((_BYTE *)v5 + 253) == 1 )
{
[10990] v17 = v50;
[10995] goto LABEL_23;
}
}
else
{
[9964] v17 = v50;
[9969, 9974] if ( *(_WORD *)(v50 + 38) )
{
[9984] v18 = 0;
[9987] inode = 2133571416LL;
[9993, 9980, 9997, 10001] if ( (*(_WORD *)(v50 + 12) & 0xF000) == 0x8000 )
{
[11206] v21 = 0;
[11209] goto LABEL_26;
}
}
else
{
[11192] v18 = 0;
[11201, 11195] inode = 2133571416LL;
}
[10021, 10024, 10030, 10007, 10015] while ( *((_BYTE *)v5 + 253) == 1 && !v18 )
{
LABEL_23:
[10032, 10036, 10038] *(_QWORD *)(v17 + 12) = 0LL;
[10046] *(_QWORD *)(v17 + 132) = 0LL;
[10057, 10061, 10063, 10032, 10069, 10071, 10074] memset(
(void *)((v17 + 20) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL * (((unsigned int)v17 - (((_DWORD)v17 + 20) & 0xFFFFFFF8) + 140) >> 3));
[10080, 10089] *(__m128i *)(v17 + 52) = _mm_loadu_si128((const __m128i *)(v5 + 67));
[10093, 10102] *(__m128i *)(v17 + 68) = _mm_loadu_si128((const __m128i *)(v5 + 71));
[10106, 10115] *(__m128i *)(v17 + 84) = _mm_loadu_si128((const __m128i *)(v5 + 75));
[10126, 10119] *(_QWORD *)(v17 + 100) = *(_QWORD *)(v5 + 79);
[10137, 10130] *(_DWORD *)(v17 + 108) = v5[81];
[10152, 10147, 10140] *(_DWORD *)(v17 + 120) = v5[82];
[10155] v19 = v5[83];
[10162] *(_WORD *)(v17 + 12) = -32384;
[10166] *(_DWORD *)(v17 + 16) = v19;
[10169, 10178, 10174] *(_WORD *)(v17 + 38) = 1;
[10077, 10183] e2fsck_use_inode_shortcuts(a1, 1LL);
[10188] v17 = v50;
[10196] v20 = *(_WORD *)(v50 + 38) == 0;
[10193, 10201] *((_DWORD *)a1 + 134) = *(_DWORD *)(v50 + 8);
[10208, 10212] a1[68] = (const void **)(v17 + 12);
[10219, 10225, 10229, 10233, 10237] if ( v20 || (*(_WORD *)(v17 + 12) & 0xF000) != 0x8000 )
{
[11438] inode = 2133571416LL;
[11444] goto LABEL_9;
}
[10243] v18 = 1;
[10249] v21 = 1;
LABEL_26:
[10261, 10255] v46 = v21;
[10266] inode = 2133571413LL;
[10272, 10276, 10279, 10284, 10255, 10288, 10258, 10290, 10293, 10299] if ( (*(unsigned int *)(v17 + 16) | ((unsigned long)*(unsigned int *)(v17 + 120) << 32))
/ *(int *)(memory + 120) > 0x3FF )
{
[10305] v22 = *(unsigned int *)(v17 + 8);
[10308] v23 = *a1;
[10330] v48 = -1LL;
[10339, 10311, 10318, 10320, 10325] v24 = ext2fs_block_iterate3(v23, v22, 1LL, 0LL, process_journal_block, &v48);
[10344] v25 = *a1;
[10347] v26 = v50;
[10352] inode = v24;
[10364] v27 = *(_DWORD *)(v50 + 16);
[10367] v17 = v50;
[10370, 10374, 10344, 10378, 10381, 10384, 10355, 10360] if ( *((unsigned int *)*a1 + 10) * (v48 + 1) >= (int)v27 )
{
[10400, 10405, 10390, 10395, 10398] if ( v46 && (*((_BYTE *)a1 + 76) & 1) == 0 )
{
[11400, 11396, 11389, 11405] inode = ext2fs_write_inode(v25, v5[56], v50 + 12);
[11408, 11411] if ( inode )
goto LABEL_9;
[11417] v26 = v50;
[11422] v25 = *a1;
[11425, 11428] v27 = *(_DWORD *)(v50 + 16);
}
[10411] v28 = memory;
[10421] v29 = *(int *)(memory + 120);
[10416, 10425] v30 = (unsigned long)*(unsigned int *)(v26 + 120) << 32;
[10436, 10429, 10439] *(_QWORD *)(memory + 136) = v26;
[10441, 10419, 10451] *(_DWORD *)(v28 + 128) = (v27 | v30) / v29;
[10465, 10458] a1[77] = (const void **)v25[1];
[10472, 10444, 10462, 10446] v31 = jbd2_journal_bmap(v28, 0LL, &v53);
[10477, 10479] if ( v31 )
{
[11336, 11338] inode = -v31;
[11341] goto LABEL_9;
}
[10488, 10485] if ( inode )
goto LABEL_9;
[10497, 10504, 10507, 10511, 10494] (*((void ( **)(const void **, _QWORD))a1[77][1] + 4))(a1[77], *((unsigned int *)*a1 + 10));
[10514] v32 = memory;
[10519] v33 = v53;
[10524] goto LABEL_45;
}
[11331, 11325] inode = 2133571413LL;
}
}
}
goto LABEL_9;
}
LABEL_33:
[10536] inode = 2133571398LL;
[10542] goto LABEL_9;
}
[9671] v10 = a1[78];
[9681, 9678] if ( !v10 )
{
[11043, 11024, 11032, 11035, 11038] uuid_unparse(v5 + 52, v58);
[11048, 11067, 11060, 11055] devname = (const void **)blkid_get_devname(a1[17], "UUID", v58);
[11072] a1[78] = devname;
[11079] v10 = devname;
[11082, 11085] if ( !devname )
{
[11098, 11091] v44 = (const void **)blkid_devno_to_devname(v5[57]);
[11103] a1[78] = v44;
[11110] v10 = v44;
[11113, 11116] if ( !v44 )
{
[11133] inode = 2133571415LL;
[11122, 11139, 11125, 11130] fix_problem(a1, 17LL);
[11144] goto LABEL_9;
}
}
}
[9698, 9701, 9705, 9687, 9691, 9693, 9695] v11 = 2 * (unsigned int)((*((_DWORD *)a1 + 31) & 6) != 6) + 1;
[9709, 9711, 9713, 9687, 9723] if ( (*((_DWORD *)a1 + 31) & 4) != 0 && (*((_BYTE *)a1 + 77) & 1) != 0 )
[9723, 9718] v11 = 1LL;
[9740, 9733, 9726, 9743] inode = (*(long ( **)(const void **, long, const void ***))(unix_io_manager + 16LL))(
[9746, 9755, 9749] v10,
v11,
[10562, 10565, 10569, 10552, 10559] a1 + 77);
[10592, 10572, 10575, 10578, 10586] if ( inode )
[10595, 10589] goto LABEL_9;
[10598] (*((void ( **)(const void **, _QWORD))a1[77][1] + 4))(a1[77], *((unsigned int *)*a1 + 10));
[10608, 10603, 10583] v34 = (int)(ext2fs_journal_sb_start(*((unsigned int *)*a1 + 10)) - 1);
[10616, 10613] v35 = *((_DWORD *)*a1 + 10);
v53 = (int)v34;
[10618, 10623] v49 = (int *)getblk(v8, v34, v35);
[10628] if ( !v49 )
[10640, 10633, 10637] goto LABEL_33;
[10633] ll_rw_block_constprop_0((long *)&v49);
v36 = (long)v49;
[11008, 11011] inode = v49[5];
[11016] if ( v49[5] )
{
[10652, 10646] brelse((long)v49);
[10656] goto LABEL_9;
[10658] }
[10665, 10673, 10678, 10681, 10686] v37 = v49 + 10;
[10689, 10699, 10705, 10712, 10717, 10719] if ( !v53 )
v37 = v49 + 266;
[11152, 11155] qmemcpy(v56, v37, sizeof(v56));
if ( LOWORD(v56[14]) != 0xEF53 || !(unsigned int)ext2fs_has_feature_journal_dev_isra_0(v56[24]) )
[11160, 11163] {
[11160, 11169] v45 = 18LL;
[11179, 11174] LABEL_57:
[11184] inode = 2133571415LL;
fix_problem(a1, v45);
[10736, 10741] brelse((long)v49);
[10725, 10757, 10728, 10762, 10767, 10769, 10741, 10746, 10750] goto LABEL_9;
}
[11312, 11315] v47 = *a1;
[11320] if ( memcmp(&v56[26], (char *)(*a1)[4] + 208, 0x10uLL) )
{
[10787, 10789, 10782, 10775] v45 = 19LL;
goto LABEL_57;
[11232, 11240, 11243, 11214, 11222, 11227] }
[11246, 11251, 11254, 11259, 11263] if ( (unsigned int)ext2fs_has_feature_metadata_csum_isra_0(v56[25]) )
[11274] {
[11266, 11282] qmemcpy(v55, v47, sizeof(v55));
[11298, 11362, 11300, 11354, 11364, 11357, 11287, 11290, 11293] qmemcpy(v57, v47[4], sizeof(v57));
v55[4] = (long)v57;
[11369, 11372, 11366] ext2fs_set_feature_metadata_csum_isra_0(&v57[25]);
[11377, 11387, 11382] if ( !(unsigned int)ext2fs_superblock_csum_verify(v55, v37) && (unsigned int)fix_problem(a1, 74LL) )
{
[11307, 11302] ext2fs_superblock_csum_set(v55, v37);
mark_buffer_dirty((long)v49);
[10795, 10798] }
[10808, 10803] v36 = (long)v49;
[10818, 10813] }
[10826] brelse(v36);
[10826, 10823] v38 = ext2fs_blocks_count(v56);
[10830] v32 = memory;
[10841, 10836, 10845] if ( v38 > 0xFFFFFFFF )
LODWORD(v38) = -1;
[10856, 10850, 10853] *(_DWORD *)(memory + 128) = v38;
[10861] v33 = ++v53;
[10866, 10869] LABEL_45:
v39 = getblk(v8, v33, *(_DWORD *)(v32 + 120));
[10875] v49 = (int *)v39;
[10880] if ( !v39 )
[10888, 10884] goto LABEL_33;
[10915, 10892, 10895, 10899, 10902] v40 = memory;
[10917] *(_QWORD *)(memory + 16) = v39;
[10924] *(_QWORD *)(v40 + 24) = v39 + 40;
[10924] v20 = (unsigned int)ext2fs_has_feature_metadata_csum_isra_0(*((_DWORD *)(*a1)[4] + 23)) == 0;
[10928, 10930] v42 = ext4_fc_replay;
[10933] if ( v20 )
[10940] v42 = 0LL;
[10912, 10907, 10948, 10943] inode = 0LL;
[9854, 9847] *(_QWORD *)(v41 + 200) = v42;
[9857, 9858, 9859, 9861, 9863, 9865, 9867] *a2 = v41;
e2fsck_use_inode_shortcuts(a1, 0LL);
return inode;
}
// 2AB5: variable 'v41' is possibly undefined
// 4B10: using guessed type long ext2fs_blocks_count(_QWORD);
// 4B40: using guessed type long ext2fs_free_mem(_QWORD);
// 4BA0: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C58: using guessed type long e2fsck_allocate_memory(_QWORD, _QWORD, _QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4C78: using guessed type long uuid_is_null(_QWORD);
// 4C90: using guessed type long e2fsck_use_inode_shortcuts(_QWORD, _QWORD);
// 4C98: using guessed type long ext2fs_block_iterate3(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4CA0: using guessed type long ext2fs_journal_sb_start(_QWORD);
// 4CB0: using guessed type long uuid_unparse(_QWORD, _QWORD);
// 4CB8: using guessed type long blkid_get_devname(_QWORD, _QWORD, _QWORD);
// 4CC0: using guessed type long blkid_devno_to_devname(_QWORD);
// 4CC8: using guessed type long ext2fs_superblock_csum_verify(_QWORD, _QWORD);
// 4CD0: using guessed type long ext2fs_superblock_csum_set(_QWORD, _QWORD);
// 4CD8: using guessed type long ext2fs_write_inode(_QWORD, _QWORD, _QWORD);
// 24D0: using guessed type char var_A48[112];
//----- (0000000000002CC0) ----------------------------------------------------
long e2fsck_journal_release(long a1, long a2, long a3, int a4)
[11456] {
long v4; // r8
long v6; // rdi
long v7; // rdi
unsigned int v9; // edi
long v10; // rsi
long v11; // r8
int v12; // edx
long v13; // [rsp+8h] [rbp-10h] BYREF
[11456, 11457, 11460, 11463] v4 = a2;
[11467] v13 = a2;
[11472, 11474] if ( a4 )
{
[11680, 11684] mark_buffer_clean(*(_QWORD *)(a2 + 16));
[11689, 11694] v4 = v13;
}
[11480, 11484] else if ( (*(_BYTE *)(a1 + 76) & 1) == 0 )
{
[11608] v9 = *(_DWORD *)(a2 + 144);
[11615] v10 = *(_QWORD *)(a2 + 24);
[11624, 11619] *(_DWORD *)(v10 + 24) = _bswap_32(v9);
[11627, 11629] if ( v12 )
[11631] *(_DWORD *)(v10 + 28) = 0;
[11641, 11638] e2fsck_journal_sb_csum_set(v11, v10);
[11651, 11646, 11655] mark_buffer_dirty(*(_QWORD *)(v13 + 16));
[11665, 11660] v4 = v13;
}
[11490, 11486] brelse(*(_QWORD *)(v4 + 16));
[11495] v6 = *(_QWORD *)(a1 + 616);
[11505, 11502] if ( v6 )
{
[11507, 11510, 11513, 11515, 11519] if ( *(_QWORD *)a1 && v6 != *(_QWORD *)(*(_QWORD *)a1 + 8LL) )
[11521, 11525] (*(void (**)(void))(*(_QWORD *)(v6 + 8) + 24LL))();
[11528] *(_QWORD *)(a1 + 616) = 0LL;
}
[11539] v7 = v13;
[11544, 11552] if ( *(_QWORD *)(v13 + 136) )
{
[11561, 11554] ext2fs_free_mem(v13 + 136);
[11566] v7 = v13;
}
[11576, 11571] if ( *(_QWORD *)(v7 + 112) )
[11578, 11582] ext2fs_free_mem(v7 + 112);
[11592, 11587, 11597] return ext2fs_free_mem(&v13);
[11601, 11602] }
// 2D6D: variable 'v12' is possibly undefined
// 2D79: variable 'v11' is possibly undefined
// 4B40: using guessed type long ext2fs_free_mem(_QWORD);
//----- (0000000000002DC0) ----------------------------------------------------
long recover_ext3_journal(const void ***a1)
[11712] {
int inited; // eax
long journal; // r12
int v5; // eax
int v6; // eax
long v7; // rdi
int v8; // eax
long v9; // rdi
long v10; // [rsp+8h] [rbp-90h] BYREF
char v11[8]; // [rsp+10h] [rbp-88h] BYREF
int v12; // [rsp+18h] [rbp-80h]
unsigned long v13; // [rsp+78h] [rbp-20h]
[11712, 11714, 11716, 11717, 11720, 11724, 11733] v13 = __readfsqword(0x28u);
[11748, 11745, 11738, 11740] clear_problem_context(v11);
[11753] inited = jbd2_journal_init_revoke_record_cache();
[11758] journal = inited;
[11780, 11761, 11764, 11766, 11771] if ( !inited )
{
[11808] v5 = jbd2_journal_init_revoke_table_cache();
[11813] journal = v5;
[11816, 11819] if ( !v5 )
{
[11826, 11829, 11834, 11821] journal = e2fsck_get_journal(a1, &v10);
[11840, 11837] if ( !journal )
{
[11842, 11852, 11847] journal = e2fsck_journal_load(v10);
[11858, 11855] if ( !journal )
{
[11865, 11860, 11870] v6 = jbd2_journal_init_revoke(v10, 1024LL);
[11875] v7 = v10;
[11880] journal = v6;
[11883, 11886] if ( v6 )
{
LABEL_7:
[11888] jbd2_journal_destroy_revoke(v7);
[11893] jbd2_journal_destroy_revoke_record_cache();
[11898] jbd2_journal_destroy_revoke_table_cache();
[11908, 11910, 11913, 11918, 11903] e2fsck_journal_release((long)a1, v10, 1LL, 0);
[11923, 11790] return journal;
}
[11952, 11875] v8 = jbd2_journal_recover(v10);
[11957, 11959] if ( !v8 )
{
[11961] v7 = v10;
[11972, 11974, 11966] if ( *(_DWORD *)(v10 + 192) )
{
[12001, 11966] v12 = *(_DWORD *)(v10 + 192);
[11993, 11998, 11990, 12005] fix_problem(a1, 58LL);
[12019] v9 = *(_QWORD *)(v10 + 16);
[12010, 12023, 12015] *(_DWORD *)(*(_QWORD *)(v10 + 24) + 32LL) = -22;
[12030] mark_buffer_dirty(v9);
[12040, 12035] v7 = v10;
}
[11976, 11982] *(_DWORD *)(v7 + 144) = *(_DWORD *)(v7 + 148);
[11988] goto LABEL_7;
}
[11928, 11930, 11933] journal = -v8;
}
[11936] v7 = v10;
[11941] goto LABEL_7;
}
}
}
[11786, 11790] return journal;
[11793, 11794, 11796, 11798] }
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4CE0: using guessed type long jbd2_journal_init_revoke_record_cache(void);
// 4CE8: using guessed type long jbd2_journal_init_revoke_table_cache(void);
// 4CF0: using guessed type long jbd2_journal_init_revoke(_QWORD, _QWORD);
// 4CF8: using guessed type long jbd2_journal_destroy_revoke(_QWORD);
// 4D00: using guessed type long jbd2_journal_destroy_revoke_record_cache(void);
// 4D08: using guessed type long jbd2_journal_destroy_revoke_table_cache(void);
// 4D10: using guessed type long jbd2_journal_recover(_QWORD);
// 2DC0: using guessed type char var_88[8];
//----- (0000000000002F10) ----------------------------------------------------
_BOOL8 buffer_uptodate(long a1)
[12048] {
[12048, 12052, 12056, 12058, 12061] return (*(_BYTE *)(a1 + 24) & 2) != 0;
}
//----- (0000000000002F20) ----------------------------------------------------
long mark_buffer_uptodate(long a1, char a2)
[12064] {
long result; // rax
[12064, 12068, 12071] result = 2 * (a2 & 1u);
[12068, 12071, 12074, 12078, 12081, 12083] *(_BYTE *)(a1 + 24) = (2 * (a2 & 1)) | *(_BYTE *)(a1 + 24) & 0xFD;
[12087] return result;
}
//----- (0000000000002F40) ----------------------------------------------------
void wait_on_buffer(long a1)
[12096] {
long v1; // [rsp+8h] [rbp-10h] BYREF
[12096, 12104, 12100] v1 = a1;
[12113, 12109] if ( (*(_BYTE *)(a1 + 24) & 2) == 0 )
[12128, 12133] ll_rw_block_constprop_0(&v1);
[12138, 12115, 12142, 12119] }
//----- (0000000000002F70) ----------------------------------------------------
long e2fsck_check_ext3_journal(long a1)
[12144] {
long v2; // rbx
int has_feature_journal_needs_recovery_isra_0; // eax
int v4; // edx
long journal; // rax
long fixed; // r13
unsigned long v7; // rax
long v8; // rdx
long v10; // rax
int v11; // r12d
int v12; // edx
long v13; // rsi
unsigned int v14; // r15d
long v15; // rax
unsigned int v16; // edx
int v17; // esi
const void **v18; // rax
_DWORD *v19; // rdi
long v20; // rdi
long v21; // rsi
long v22; // [rsp+8h] [rbp-B0h] BYREF
char v23[80]; // [rsp+10h] [rbp-A8h] BYREF
long v24; // [rsp+60h] [rbp-58h]
unsigned long v25; // [rsp+78h] [rbp-40h]
[12160, 12161, 12168, 12144, 12177, 12148, 12150, 12152, 12154, 12156, 12157] v25 = __readfsqword(0x28u);
[12184, 12187, 12182] v2 = *(_QWORD *)(*(_QWORD *)a1 + 32LL);
[12194, 12191] ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 96));
[12202, 12204, 12199] has_feature_journal_needs_recovery_isra_0 = ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 92));
[12352, 12209, 12211, 12360] if ( !(v4 | has_feature_journal_needs_recovery_isra_0) && !*(_QWORD *)(v2 + 224) )
{
[12373] fixed = 0LL;
[12376, 12366] if ( (unsigned int)uuid_is_null(v2 + 208) )
[12336, 12381, 12389, 12383] return fixed;
}
[12217, 12225, 12222] clear_problem_context(v23);
[12244, 12230] v24 = *(unsigned int *)(v2 + 224);
[12249, 12241, 12236] journal = e2fsck_get_journal((const void ***)a1, &v22);
[12254] fixed = journal;
[12257, 12260] if ( journal )
{
[12266] v7 = journal - 2133571369;
[12273, 12277] if ( v7 <= 0x2F )
{
[12279] v8 = 0x900000000003LL;
[12289, 12293] if ( _bittest64(&v8, v7) )
[12323, 12295, 12298, 12301, 12306, 12309, 12314] return e2fsck_journal_fix_bad_inode((_DWORD *)a1, (long)v23);
}
[12336, 12306] return fixed;
}
[12400, 12405] v10 = e2fsck_journal_load(v22);
[12410] fixed = v10;
[12416, 12418, 12413] if ( v10 )
{
[12576, 12582] if ( v10 != 2133571504 )
{
[12594, 12588] if ( v10 == 2133571395 )
{
[13059, 13061, 13063, 13043, 13046, 13051, 13054] if ( (unsigned int)fix_problem(a1, 38LL) )
goto LABEL_25;
}
[12600, 12606] else if ( v10 == 2133571396 )
{
[13092, 13068, 13071, 13076, 13079, 13084, 13086] if ( (unsigned int)fix_problem(a1, 37LL) )
goto LABEL_25;
}
[12612, 12933, 12936, 12618, 12941, 12943, 12949] else if ( v10 != 2133571414 || (unsigned int)fix_problem(a1, 39LL) )
{
goto LABEL_25;
}
}
[12960, 12963, 12968, 12971, 12952, 12957] fixed = e2fsck_journal_fix_corrupt_super((_DWORD *)a1, v22);
LABEL_25:
[12624, 12629, 12634, 12636, 12639] e2fsck_journal_release(a1, v22, 0LL, 1);
[12336, 12644] return fixed;
}
[12492] while ( 1 )
{
[12489, 12492] ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 92));
[12497, 12507, 12500, 12502] v11 = ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 96));
[12512, 12510] if ( v12 )
break;
[12448, 12450, 12432, 12435, 12440, 12443] if ( !(unsigned int)fix_problem(a1, 22LL) )
{
[12656, 12660] if ( (*(_BYTE *)(a1 + 76) & 1) == 0 )
{
[12801, 12797] ext2fs_set_feature_journal_needs_recovery_isra_0((_DWORD *)(v2 + 92));
[12806] v18 = *(const void ***)a1;
[12810] *((_DWORD *)v18 + 4) &= ~0x200u;
[12817, 12826, 12821] ext2fs_mark_super_dirty_isra_0((_DWORD *)v18 + 4);
}
goto LABEL_28;
}
[12456, 12459] if ( !v11 )
{
[12720] if ( *(_DWORD *)(v2 + 76) )
[12792, 12795] v16 = *(_DWORD *)(v2 + 84);
else
[12738, 12733] v16 = 11;
[12740, 12742, 12746, 12723, 12729, 12731] v17 = *(_DWORD *)(v2 + 224) < v16;
LABEL_35:
[12757] *(_QWORD *)(v2 + 224) = 0LL;
[12775] *(_OWORD *)(v2 + 208) = 0LL;
[12768, 12787, 12772, 12782] e2fsck_clear_recover_isra_0(a1, v17);
LABEL_28:
[12666, 12669, 12677] v14 = ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 92));
[12680, 12674, 12685] v11 = ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 96));
[12688, 12691] if ( !v14 )
goto LABEL_29;
break;
}
[12481, 12483, 12465, 12468, 12473, 12476] if ( (unsigned int)fix_problem(a1, 23LL) )
{
[12752] v17 = 1;
goto LABEL_35;
}
}
[12514] v13 = v22;
[12519] v14 = 0;
[12522, 12525] if ( v11 )
goto LABEL_20;
[12527] v15 = *(_QWORD *)(v22 + 24);
[12531] v14 = 0;
[12537, 12539, 12534] if ( !*(_DWORD *)(v15 + 28) )
goto LABEL_18;
[12834, 12842, 12839, 12831] fix_problem(a1, 24LL);
[12864, 12867, 12872, 12874, 12847, 12849, 12854, 12857, 12861] if ( (unsigned int)fix_problem(a1, (unsigned int)(*(_QWORD *)(a1 + 96) != 0LL) + 43) )
{
[12880] *(_DWORD *)(a1 + 76) |= 0x100u;
[12891, 12887] ext2fs_set_feature_journal_needs_recovery_isra_0((_DWORD *)(v2 + 96));
[12896, 12904, 12900] ext2fs_mark_super_dirty_isra_0((_DWORD *)(*(_QWORD *)a1 + 16LL));
[12912, 12920, 12909, 12917] v11 = ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 96));
}
else
{
[13097, 13100, 13105, 13108, 13113] v14 = fix_problem(a1, 25LL);
[13116, 13118] if ( v14 )
{
[13136] *(_WORD *)(v2 + 58) &= ~1u;
[13145] v14 = 1;
[13155, 13160, 13163, 13168, 13171, 13141, 13151] ext2fs_mark_super_dirty_isra_0((_DWORD *)(*(_QWORD *)a1 + 16LL));
}
[13120, 13131, 13123, 13128] v11 = ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 96));
}
LABEL_29:
[12697] v13 = v22;
[12705, 12702] if ( v11 )
goto LABEL_20;
[12715, 12711] v15 = *(_QWORD *)(v22 + 24);
LABEL_18:
[12545, 12548, 12550] if ( *(_DWORD *)(v15 + 32) )
{
[12976, 12984] v19 = (_DWORD *)(*(_QWORD *)a1 + 16LL);
[12976, 12988, 12980] *(_WORD *)(*(_QWORD *)(*(_QWORD *)a1 + 32LL) + 58LL) |= 2u;
[12993] ext2fs_mark_super_dirty_isra_0(v19);
[12998] v20 = v22;
[13003] v21 = *(_QWORD *)(v22 + 24);
[13007] *(_DWORD *)(v21 + 32) = 0;
[13014] e2fsck_journal_sb_csum_set(v20, v21);
[13024, 13019, 13028] mark_buffer_dirty(*(_QWORD *)(v22 + 16));
[13033, 13038] v13 = v22;
}
LABEL_20:
[12556, 12558, 12561, 12564, 12569] e2fsck_journal_release(a1, v13, v14, 0);
[12336, 12329] return fixed;
[12339, 12340, 12341, 12343, 12345, 12347, 12349] }
// 2FB1: variable 'v4' is possibly undefined
// 30E0: variable 'v12' is possibly undefined
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4C78: using guessed type long uuid_is_null(_QWORD);
//----- (0000000000003380) ----------------------------------------------------
long e2fsck_run_ext3_journal(const void ***a1)
[13184] {
const void **v2; // rax
unsigned int v3; // r12d
long v4; // r13
char *v5; // rsi
const void **v6; // rdi
long v7; // rax
const void **v8; // rdi
long v9; // rbx
long v10; // r14
long v11; // r12
const void **v12; // rax
const void **v13; // rdx
long result; // rax
void ( *v15)(const void *, long *); // rax
const void **v16; // r13
char *v17; // rax
char *v18; // rax
long v19[7]; // [rsp+0h] [rbp-38h] BYREF
[13184, 13188, 13223, 13197, 13199, 13201, 13202, 13205, 13206, 13210, 13214] v19[1] = __readfsqword(0x28u);
[13228, 13230] v2 = *a1;
[13233, 13235] v19[0] = 0LL;
[13247] v3 = *((_DWORD *)v2 + 10);
[13243, 13251, 13255] v4 = *((_QWORD *)v2[1] + 1);
[13190, 13260, 13265, 13268, 13273] v5 = dcgettext(0LL, "%s: recovering journal\n", 5);
[13273, 13276, 13278] _printf_chk(1LL, v5);
[13283, 13287] if ( (*((_BYTE *)a1 + 76) & 1) != 0 )
{
[13664, 13666, 13648, 13652, 13657] v18 = dcgettext(0LL, "%s: won't do journal recovery while read-only\n", 5);
[13671, 13676, 13679, 13682, 13684] _printf_chk(1LL, v18);
[13689, 13694] return 2133571405LL;
}
else
{
[13293] v6 = *a1;
[13297, 13301, 13293] if ( ((_BYTE)(*a1)[2] & 4) != 0 )
[13568, 13573] ext2fs_flush(v6);
[13307, 13310] v7 = recover_ext3_journal(a1);
[13315] v8 = *a1;
[13319] v9 = v7;
[13322, 13315, 13326, 13334] if ( *((_QWORD *)(*a1)[4] + 47) )
{
[13528, 13532, 13536] v15 = *(void ( **)(const void *, long *))(*((_QWORD *)v8[1] + 1) + 80LL);
[13540, 13543] if ( v15 )
[13549, 13552, 13555, 13557, 13528, 13561] v15(v8[1], v19);
}
[13344, 13340] v10 = 0LL;
[13347, 13350] if ( v19[0] )
[13352, 13356] v10 = *(_QWORD *)(v19[0] + 16) >> 10;
[13360] ext2fs_mmp_stop();
[13369, 13365] ext2fs_free(*a1);
[13378, 13381, 13384, 13390, 13393, 13396, 13401, 13374] v11 = ext2fs_open(a1[2], *((unsigned int *)a1 + 32), *((unsigned int *)a1 + 24), v3, v4, a1);
[13404, 13407] if ( v11 )
{
[13584] v16 = a1[3];
[13602, 13595, 13588, 13590] v17 = dcgettext(0LL, "while trying to re-open %s", 5);
[13607, 13611, 13614, 13617, 13620, 13622] com_err(a1[1], v11, v17, v16);
[13632, 13627, 13637, 13629] fatal_error(a1, 0LL);
}
[13413] v12 = *a1;
[13417] v13 = a1[105];
[13429] *((_DWORD *)v12 + 4) |= 0x200u;
[13436] v12[23] = v13;
[13443] v12[28] = a1;
[13450, 13461, 13454] *((_QWORD *)v12[4] + 47) += v10;
[13424, 13426, 13468, 13464] e2fsck_clear_recover_isra_0((long)a1, v9 != 0);
[13473, 13476] result = e2fsck_check_ext3_journal((long)a1);
[13481, 13484, 13488, 13493, 13502] if ( !result )
[13484] return v9;
}
[13508] return result;
[13512, 13513, 13514, 13516, 13518, 13520] }
// 4BC8: using guessed type long _printf_chk(_QWORD, _QWORD);
// 4C08: using guessed type long com_err(_QWORD, _QWORD, const char *, ...);
// 4C20: using guessed type long ext2fs_flush(_QWORD);
// 4D18: using guessed type long ext2fs_mmp_stop(void);
// 4D20: using guessed type long ext2fs_free(_QWORD);
// 4D28: using guessed type long ext2fs_open(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4D30: using guessed type long fatal_error(_QWORD, _QWORD);
//----- (0000000000003590) ----------------------------------------------------
unsigned long e2fsck_move_ext3_journal(long *a1)
[13712] {
long v1; // rbx
long v2; // r12
long v3; // rsi
char v4; // al
long v6; // rdx
int v7; // eax
__m128i v8; // xmm0
__m128i v9; // xmm1
int v10; // eax
__m128i v11; // xmm2
char **v12; // r15
const char *v13; // rdx
size_t v14; // rax
long v15; // rax
long v16; // rsi
long v17; // rax
long v18; // rsi
unsigned int v19; // ebp
int v20; // eax
const char *v21; // [rsp+0h] [rbp-158h]
unsigned int v22; // [rsp+18h] [rbp-140h] BYREF
char v23[4]; // [rsp+1Ch] [rbp-13Ch] BYREF
long v24[14]; // [rsp+20h] [rbp-138h] BYREF
char v25[4]; // [rsp+90h] [rbp-C8h] BYREF
int v26; // [rsp+94h] [rbp-C4h]
int v27; // [rsp+A4h] [rbp-B4h]
short v28; // [rsp+AAh] [rbp-AEh]
__m128i s1; // [rsp+B8h] [rbp-A0h] BYREF
__m128i v30; // [rsp+C8h] [rbp-90h] BYREF
__m128i v31; // [rsp+D8h] [rbp-80h] BYREF
long v32; // [rsp+E8h] [rbp-70h]
int v33; // [rsp+F0h] [rbp-68h]
int v34; // [rsp+FCh] [rbp-5Ch]
unsigned long v35; // [rsp+118h] [rbp-40h]
[13728, 13729, 13736, 13712, 13716, 13718, 13720, 13722, 13724, 13725] v1 = *a1;
[13739, 13748] v35 = __readfsqword(0x28u);
[13766] v2 = *(_QWORD *)(v1 + 32);
[13770, 13763, 13756, 13758] clear_problem_context(v24);
[13779, 13775] if ( (*((_BYTE *)a1 + 76) & 1) == 0 )
{
[13781] v3 = *(unsigned int *)(v2 + 224);
[13789, 13791] if ( (_DWORD)v3 )
{
[13793, 13826, 13829, 13798, 13803, 13805, 13807, 13815, 13818, 13821] if ( (unsigned int)ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 92))
&& !ext2fs_read_inode(v1, v3, v25) )
{
[13831] v4 = *(_BYTE *)(v2 + 253);
[13954, 13956, 13958, 13928, 13961, 13976, 13966, 13840, 13936, 13842, 13969, 13844, 13846, 13974, 13944, 13949] if ( (!v4 || v4 == 1 && memcmp(&s1, (const void *)(v2 + 268), 0x3CuLL)) && (unsigned int)fix_problem(a1, 45LL) )
{
[13982] v6 = v32;
[13990] v7 = v34;
[13997] *(_BYTE *)(v2 + 253) = 1;
[14010] v8 = _mm_loadu_si128(&s1);
[14019] v9 = _mm_loadu_si128(&v30);
[14028] *(_QWORD *)(v2 + 316) = v6;
[14036] LODWORD(v6) = v33;
[14043] *(_DWORD *)(v2 + 328) = v7;
[14051] v10 = v26;
[14058] v11 = _mm_loadu_si128(&v31);
[14067] *(_DWORD *)(v2 + 324) = v6;
[14075] *(_DWORD *)(v2 + 332) = v10;
[14083] *(__m128i *)(v2 + 268) = v8;
[14092] *(__m128i *)(v2 + 284) = v9;
[14101] *(__m128i *)(v2 + 300) = v11;
[14006, 14110] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v1 + 16));
[14122, 14115] *(_DWORD *)(v1 + 16) &= ~0x200u;
}
[13857, 14145, 13859, 14151, 13868, 14156, 14128, 13874, 14132, 13848, 14137, 14142] if ( *(_DWORD *)(v2 + 224) != 8 && v28 == 1 && !ext2fs_check_if_mounted(a1[2], v23) && (v23[0] & 1) == 0 )
{
[14162, 14167] v12 = journal_names;
[14186, 14179, 14174] v13 = ".journal";
[14195] while ( 1 )
{
[14195] v21 = v13;
[14192, 14199] v14 = strlen(v13);
[14209, 14241, 14212, 14215, 14249, 14219, 14222, 14227, 14232, 14235, 14204, 14237] if ( !ext2fs_lookup(v1, 2LL, v21, v14, 0LL, &v22) && *(_DWORD *)(v2 + 224) == v22 )
break;
[14251] v13 = v12[1];
[14255] ++v12;
[14264, 14259, 14262] if ( !v13 )
[13880, 13897, 13888, 14262] return __readfsqword(0x28u) ^ v35;
}
[14273, 14269] if ( *v12 )
{
[14287, 14290, 14282, 14279] if ( !ext2fs_read_bitmaps(v1) )
{
[14310] v24[12] = (long)*v12;
[14307, 14318, 14323, 14325, 14296, 14299, 14302] if ( (unsigned int)fix_problem(a1, 40LL) )
{
[14338, 14341, 14346, 14349, 14353, 14331, 14334] v15 = ext2fs_unlink(v1, 2LL, *v12, v22, 0LL);
[14361, 14358] if ( v15 )
goto LABEL_27;
[14370, 14378, 14375, 14367] v15 = ext2fs_write_inode(v1, 8LL, v25);
[14386, 14383] if ( v15 )
goto LABEL_27;
[14392] *(_DWORD *)(v2 + 224) = 8;
[14404, 14407] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v1 + 16));
[14412] v16 = v22;
[14422] *(_DWORD *)(v1 + 16) &= ~0x200u;
[14429] v17 = a1[105];
[14436] v28 = 0;
[14446] v27 = v17;
[14416, 14419, 14453] v15 = ext2fs_write_inode(v1, v16, v25);
[14458, 14461] if ( v15 )
{
LABEL_27:
[14544, 14547, 14552] v24[0] = v15;
[14557, 14541] fix_problem(a1, 41LL);
[14569, 14562] *(_WORD *)(*(_QWORD *)(v1 + 32) + 58LL) &= ~1u;
[14579, 14574, 14566] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v1 + 16));
}
else
{
[14463] v18 = v22;
[14471, 14467, 14480, 14463] v19 = ext2fs_group_of_ino_isra_0(*(_QWORD *)(v1 + 32), v22);
[14482, 14476] ext2fs_unmark_inode_bitmap2(*(_QWORD *)(v1 + 80), v18);
[14490, 14487] ext2fs_mark_ib_dirty_isra_0((_DWORD *)(v1 + 16));
[14497, 14500, 14495] v20 = ext2fs_bg_free_inodes_count(v1, v19);
[14505, 14507, 14510, 14513] ext2fs_bg_free_inodes_count_set(v1, v19, (unsigned int)(v20 + 1));
[14520, 14523, 14518] ext2fs_group_desc_csum_set(v1, v19);
[14528, 14532, 14536] ++*(_DWORD *)(*(_QWORD *)(v1 + 32) + 16LL);
}
}
}
}
}
}
}
}
[13888, 13903] return __readfsqword(0x28u) ^ v35;
[13920, 13910, 13911, 13912, 13914, 13916, 13918] }
// 3D00: using guessed type char *journal_names[4];
// 4B88: using guessed type long ext2fs_unmark_inode_bitmap2(_QWORD, _QWORD);
// 4BA0: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 4BB0: using guessed type long ext2fs_unlink(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C18: using guessed type long ext2fs_read_bitmaps(_QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4CD8: using guessed type long ext2fs_write_inode(_QWORD, _QWORD, _QWORD);
// 4D38: using guessed type long ext2fs_check_if_mounted(_QWORD, _QWORD);
// 4D48: using guessed type long ext2fs_lookup(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4D50: using guessed type long ext2fs_bg_free_inodes_count(_QWORD, _QWORD);
// 4D58: using guessed type long ext2fs_bg_free_inodes_count_set(_QWORD, _QWORD, _QWORD);
// 4D60: using guessed type long ext2fs_group_desc_csum_set(_QWORD, _QWORD);
// 3590: using guessed type char var_13C[4];
//----- (0000000000003900) ----------------------------------------------------
long e2fsck_fix_ext3_journal_hint(_QWORD *a1)
[14592] {
long v1; // rbp
const char *devname; // rax
char *v4; // r12
long v5; // rdi
_QWORD v6[14]; // [rsp+0h] [rbp-158h] BYREF
struct stat v7; // [rsp+70h] [rbp-E8h] BYREF
char v8[40]; // [rsp+100h] [rbp-58h] BYREF
unsigned long v9; // [rsp+128h] [rbp-30h]
[14592, 14596, 14598, 14600, 14601, 14602, 14605, 14612, 14621] v9 = __readfsqword(0x28u);
[14634, 14629, 14631] v1 = *(_QWORD *)(*a1 + 32LL);
[14658, 14667, 14638, 14641, 14646, 14648, 14650] if ( (unsigned int)ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v1 + 92)) )
{
[14696, 14703, 14706, 14711, 14713] if ( !(unsigned int)uuid_is_null(v1 + 208) )
{
[14729, 14715, 14723, 14726] uuid_unparse(v1 + 208, v8);
[14744, 14741, 14734, 14751] devname = (const char *)blkid_get_devname(a1[17], "UUID", v8);
[14756] v4 = (char *)devname;
[14762, 14759] if ( devname )
{
[14787, 14795, 14764, 14769, 14772, 14777, 14779, 14781] if ( stat(devname, &v7) >= 0 && v7.st_rdev != *(_DWORD *)(v1 + 228) )
{
[14800, 14803, 14797] clear_problem_context(v6);
[14819, 14827] v6[10] = v7.st_rdev;
[14816, 14832, 14837, 14839, 14808, 14811] if ( (unsigned int)fix_problem(a1, 51LL) )
{
[14864, 14872] v5 = *a1;
[14875] *(_DWORD *)(v1 + 228) = v7.st_rdev;
[14881, 14890, 14885] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v5 + 16));
}
}
[14841, 14844, 14849] free(v4);
}
}
}
[14680, 14673] return 0LL;
[14688, 14682, 14683, 14684, 14686] }
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4C78: using guessed type long uuid_is_null(_QWORD);
// 4CB0: using guessed type long uuid_unparse(_QWORD, _QWORD);
// 4CB8: using guessed type long blkid_get_devname(_QWORD, _QWORD, _QWORD);
// nfuncs=173 queued=98 decompiled=98 lumina nreq=0 worse=0 better=0
// ALL OK, 98 function(s) have been successfully decompiled
|
long brelse(long a1)
[3647] {
long v2; // [rsp+8h] [rbp-8h] BYREF
[3651, 3652, 3655, 3659, 3647] v2 = a1;
[3663, 3667, 3671, 3674, 3676] if ( (*(_BYTE *)(a1 + 24) & 1) != 0 )
[3682, 3685, 3690, 3695, 3700, 3678] ll_rw_block(1, 0LL, 1, &v2);
[3712, 3717, 3718, 3705, 3709] return ext2fs_free_mem(&v2);
[3719] }
// 67C0: using guessed type long ext2fs_free_mem(_QWORD);
//----- (0000000000000E88) ----------------------------------------------------
_BOOL8 buffer_uptodate(long a1)
[3720] {
[3745, 3748, 3720, 3724, 3725, 3728, 3732, 3736, 3740, 3742] return (*(_BYTE *)(a1 + 24) & 2) != 0;
[3749] }
//----- (0000000000000EA6) ----------------------------------------------------
long mark_buffer_uptodate(long a1, char a2)
[3750] {
long result; // rax
[3778, 3781, 3750, 3785, 3754, 3755, 3788, 3758, 3762, 3765, 3768, 3771, 3775] result = (2 * (a2 & 1)) | *(_BYTE *)(a1 + 24) & 0xFDu;
[3778, 3781, 3785, 3788, 3790, 3775] *(_BYTE *)(a1 + 24) = (2 * (a2 & 1)) | *(_BYTE *)(a1 + 24) & 0xFD;
[3793, 3794] return result;
[3795] }
//----- (0000000000000ED4) ----------------------------------------------------
void wait_on_buffer(long a1)
[3796] {
long v1; // [rsp+8h] [rbp-8h] BYREF
[3808, 3796, 3800, 3801, 3804] v1 = a1;
[3812, 3816, 3820, 3823, 3825] if ( (*(_BYTE *)(a1 + 24) & 2) == 0 )
[3844, 3849, 3854, 3827, 3831, 3834, 3839] ll_rw_block(0, 0LL, 1, &v1);
[3856, 3855] }
//----- (0000000000000F11) ----------------------------------------------------
long e2fsck_clear_recover(_QWORD *a1, int a2)
[3857] {
[3873, 3876, 3880, 3883, 3887, 3857, 3890, 3861, 3862, 3865, 3869] ext2fs_clear_feature_journal_needs_recovery(*(_QWORD *)(*a1 + 32LL));
[3899, 3895] if ( a2 )
[3905, 3908, 3912, 3916, 3920, 3923, 3927, 3930, 3901] *(_WORD *)(*(_QWORD *)(*a1 + 32LL) + 58LL) &= ~1u;
[3938, 3941, 3944, 3949, 3950, 3934] return ext2fs_mark_super_dirty(*a1);
[3951] }
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
//----- (0000000000000F70) ----------------------------------------------------
long process_journal_block(
long a1,
unsigned long *a2,
long a3,
long a4,
long a5,
long *a6)
{
unsigned long v8; // [rsp+30h] [rbp-10h]
v8 = *a2;
if ( !*a2 || v8 < *(unsigned int *)(*(_QWORD *)(a1 + 32) + 20LL) || v8 >= ext2fs_blocks_count(*(_QWORD *)(a1 + 32)) )
return 2LL;
if ( a3 >= 0 )
*a6 = a3;
return 0LL;
}
// 67D0: using guessed type long ext2fs_blocks_count(_QWORD);
//----- (0000000000000FF7) ----------------------------------------------------
long ext4_fc_replay_scan(long a1, long a2, int a3, unsigned int a4)
[4087] {
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
int v9; // eax
int v12; // [rsp+28h] [rbp-88h]
short dest[2]; // [rsp+2Ch] [rbp-84h] BYREF
void *src; // [rsp+30h] [rbp-80h]
long v15; // [rsp+38h] [rbp-78h]
void *s; // [rsp+40h] [rbp-70h]
_WORD *v17; // [rsp+48h] [rbp-68h]
unsigned long v18; // [rsp+50h] [rbp-60h]
void *v19; // [rsp+58h] [rbp-58h]
long v20; // [rsp+60h] [rbp-50h] BYREF
int v21[2]; // [rsp+68h] [rbp-48h] BYREF
long v22[4]; // [rsp+70h] [rbp-40h] BYREF
char v23[24]; // [rsp+90h] [rbp-20h] BYREF
unsigned long v24; // [rsp+A8h] [rbp-8h]
[4128, 4102, 4137, 4109, 4116, 4087, 4122, 4091, 4092, 4095] v24 = __readfsqword(0x28u);
[4141, 4143, 4150, 4154, 4157] v15 = **(_QWORD **)(a1 + 112);
[4161] v12 = 1;
[4171] memset(v22, 0, 24);
[4195, 4199, 4205, 4179, 4187] s = (void *)(v15 + 944);
[4216, 4209, 4220] v17 = (_WORD *)(a2 + 40);
[4224, 4231, 4235, 4242, 4245, 4247, 4251, 4254] v18 = a2 + 40 + *(int *)(a1 + 120) - 1LL;
[4265, 4258, 4267, 4262] if ( !*(_DWORD *)(v15 + 996) )
{
[4269, 4273, 4278, 4283, 4286] memset(s, 0, 0x48uLL);
[4298, 4291, 4302, 4295] if ( *v17 != 9 )
[4304, 4309] return 0LL;
}
[4321, 4327, 4329, 4339, 4314, 4318] if ( a3 == *((_DWORD *)s + 13) )
{
[4354, 4358, 4344, 4348, 4351] ++*((_DWORD *)s + 13);
[4994, 4996, 4361, 5003, 4365, 5006, 4369, 5010, 4987] for ( src = v17; ; src = (char *)src + (unsigned short)dest[1] + 4 )
{
[5018, 5022, 5028, 5014] if ( (unsigned long)src >= v18 )
[5029, 5035, 5039, 5048, 5050, 5022] return (unsigned int)v12;
[4385, 4390, 4393, 4396, 4374, 4378] memcpy(dest, src, sizeof(dest));
[4401, 4405, 4409] v19 = (char *)src + 4;
[4426, 4420, 4423] if ( dest[0] == 9 )
{
[4832, 4813, 4817, 4821, 4826, 4829] memcpy(v21, v19, sizeof(v21));
[4840, 4842, 4837] if ( v21[0] )
{
[4844, 4854] v12 = -95;
}
else
{
[4856, 4865, 4859] if ( a4 == v21[1] )
goto LABEL_16;
[4867, 4877] v12 = -22;
}
}
else
{
[4432, 4435, 4420, 4413] if ( (unsigned short)dest[0] > 9u )
goto LABEL_29;
[4441, 4420, 4444] if ( dest[0] != 8 )
{
[4450, 4420, 4453] if ( (unsigned short)dest[0] <= 8u )
{
[4459, 4420, 4462] if ( dest[0] == 1 )
{
[4486, 4490, 4494, 4499, 4502, 4505] memcpy(v23, v19, 0x10uLL);
[4544, 4514, 4518, 4551, 4553, 4522, 4527, 4530, 4563, 4533, 4538, 4510] v12 = ext2fs_decode_extent(v22, &v23[4], 12LL) == 0;
LABEL_16:
[4579, 4582, 4585, 4589, 4575] ++*((_DWORD *)s + 15);
[4592, 4602, 4599] v5 = ext4_fc_tag_len((long)dest);
[4610, 4614, 4617, 4621, 4628, 4631, 4607] v6 = jbd2_chksum(a1, *((_DWORD *)s + 16), (long)src, v5 + 4);
[4640, 4636] *((_DWORD *)s + 16) = v6;
[4643] goto LABEL_33;
}
[4420, 4484, 4464, 4466, 4472, 4475, 4478] if ( dest[0] && (unsigned int)(unsigned short)dest[0] - 2 <= 5 )
goto LABEL_16;
}
LABEL_29:
[4953, 4956, 4949, 4958] if ( *((_DWORD *)s + 12) )
[4960, 4965] v9 = 0;
else
[4967] v9 = -125;
[4972] v12 = v9;
goto LABEL_33;
}
[4648, 4652, 4655, 4658, 4662] ++*((_DWORD *)s + 15);
[4673, 4678, 4681, 4684, 4665, 4669] memcpy(&v20, v19, sizeof(v20));
[4707, 4712, 4715, 4689, 4693, 4696, 4700] v7 = jbd2_chksum(a1, *((_DWORD *)s + 16), (long)src, 8u);
[4720, 4724] *((_DWORD *)s + 16) = v7;
[4736, 4738, 4741, 4745, 4748, 4750, 4727, 4730] if ( v20 == __PAIR64__(*((_DWORD *)s + 16), a4) )
{
[4752, 4756, 4759, 4763, 4766] *((_DWORD *)s + 12) = *((_DWORD *)s + 15);
}
else
{
[4768, 4777, 4772, 4775] if ( *((_DWORD *)s + 12) )
[4784, 4779] v8 = 0;
else
[4786] v8 = -2133571503;
[4791] v12 = v8;
}
[4808, 4801, 4797] *((_DWORD *)s + 16) = 0;
}
LABEL_33:
[4985, 4978] if ( v12 <= 0 )
[4985, 5029] return (unsigned int)v12;
}
}
[5029, 5055] return (unsigned int)-2133571502;
[5056] }
// 67E8: using guessed type long ext2fs_decode_extent(_QWORD, _QWORD, _QWORD);
//----- (00000000000013C1) ----------------------------------------------------
long _errcode_to_errno(long a1, const char *a2, unsigned int a3)
{
const char *v4; // rax
if ( !a1 )
return 0LL;
v4 = (const char *)error_message(a1);
fprintf(stderr, "Error \"%s\" encountered in function %s at line %d\n", v4, a2, a3);
if ( a1 > 256 )
return 4294967282LL;
else
return (unsigned int)-(int)a1;
}
// 67F0: using guessed type long error_message(_QWORD);
//----- (0000000000001439) ----------------------------------------------------
long make_room(long a1, int a2)
[5177] {
long v2; // rax
unsigned int v4; // [rsp+1Ch] [rbp-4h]
[5185, 5189, 5193, 5196, 5200, 5203, 5207, 5177, 5210, 5212, 5181, 5182] if ( *(_DWORD *)(a1 + 16) == *(_DWORD *)(a1 + 20) )
{
[5249, 5218, 5252, 5221, 5223, 5246, 5225, 5257, 5227, 5230, 5235, 5238, 5242, 5214] v2 = ext2fs_resize_mem(0LL, (unsigned int)(24 * *(_DWORD *)(a1 + 20) + 8184), a1 + 8);
[5282, 5262, 5267, 5274, 5277] v4 = _errcode_to_errno(v2, "make_room", 0x198u);
[5289, 5285] if ( v4 )
[5291, 5294] return v4;
[5312, 5316, 5299, 5303, 5306] *(_DWORD *)(a1 + 20) += 341;
}
[5378, 5381, 5385, 5389, 5392, 5394, 5398, 5401, 5404, 5407, 5411, 5414, 5417, 5420, 5423, 5319, 5323, 5326, 5329, 5331, 5333, 5335, 5338, 5341, 5344, 5348, 5351, 5355, 5359, 5362, 5365, 5368, 5371, 5374] memmove(
(void *)(*(_QWORD *)(a1 + 8) + 24 * (a2 + 1LL)),
(const void *)(24LL * a2 + *(_QWORD *)(a1 + 8)),
24LL * (unsigned int)(*(_DWORD *)(a1 + 16) - a2));
[5442, 5445, 5428, 5432, 5435, 5438] ++*(_DWORD *)(a1 + 16);
[5450] return 0LL;
[5451] }
// 6808: using guessed type long ext2fs_resize_mem(_QWORD, _QWORD, _QWORD);
//----- (000000000000154C) ----------------------------------------------------
long ex_compar(_QWORD *a1, _QWORD *a2)
[5452] {
[5472, 5476, 5496, 5480, 5452, 5484, 5456, 5457, 5488, 5460, 5492, 5464, 5468, 5500, 5503] if ( a1[1] < a2[1] )
[5505, 5510] return 0xFFFFFFFFLL;
[5538, 5512, 5516, 5520, 5524, 5528, 5531, 5533] if ( a1[1] <= a2[1] )
[5540, 5544, 5547, 5551, 5554, 5556] return (unsigned int)(*((_DWORD *)a1 + 4) - *((_DWORD *)a2 + 4));
[5558] return 1LL;
[5559] }
//----- (00000000000015B8) ----------------------------------------------------
long ex_len_compar(_DWORD *a1, _DWORD *a2)
[5560] {
[5568, 5603, 5572, 5606, 5592, 5576, 5608, 5580, 5584, 5588, 5560, 5596, 5564, 5565, 5599] if ( a1[4] < a2[4] )
[5610, 5615] return 1LL;
[5633, 5636, 5638, 5643, 5617, 5621, 5625, 5629] if ( *((_QWORD *)a1 + 1) <= *((_QWORD *)a2 + 1) )
[5645] return 0LL;
[5650] return 0xFFFFFFFFLL;
[5651] }
//----- (0000000000001614) ----------------------------------------------------
long ex_sort_and_merge(long a1)
[5652] {
long result; // rax
_QWORD *v2; // rsi
_QWORD *v3; // rcx
long v4; // rdx
unsigned int i; // [rsp+18h] [rbp-8h]
unsigned int v6; // [rsp+18h] [rbp-8h]
unsigned int j; // [rsp+1Ch] [rbp-4h]
[5664, 5668, 5672, 5652, 5656, 5657, 5660] result = *(unsigned int *)(a1 + 16);
[5675, 5678] if ( (unsigned int)result > 1 )
{
[5697, 5701, 5708, 5713, 5684, 5716, 5688, 5691, 5693] qsort(*(void **)(a1 + 8), *(unsigned int *)(a1 + 16), 0x18uLL, (__compar_fn_t)ex_len_compar);
[5728, 5776, 5780, 5784, 5721, 5787, 5790] for ( i = 0; i < *(_DWORD *)(a1 + 16); ++i )
{
[5760, 5730, 5762, 5734, 5738, 5741, 5744, 5747, 5750, 5754, 5757] if ( !*(_DWORD *)(*(_QWORD *)(a1 + 8) + 24LL * i + 16) )
{
[5768, 5771, 5764] *(_DWORD *)(a1 + 16) = i;
[5774] break;
}
}
[5792, 5796] result = *(unsigned int *)(a1 + 16);
[5801, 5799] if ( (_DWORD)result )
{
[5824, 5831, 5836, 5807, 5839, 5811, 5814, 5816, 5820] qsort(*(void **)(a1 + 8), *(unsigned int *)(a1 + 16), 0x18uLL, (__compar_fn_t)ex_compar);
[5851, 5844] v6 = 0;
[6391] while ( 1 )
{
[6384, 6388, 6391] result = (unsigned int)(*(_DWORD *)(a1 + 16) - 1);
[6394, 6403, 6397] if ( v6 >= (unsigned int)result )
break;
[6144, 6146, 5856, 5860, 5864, 5867, 5870, 5873, 5876, 5880, 5883, 5887, 5891, 5895, 5898, 5901, 5904, 5907, 5911, 5914, 5917, 5919, 5923, 5927, 5931, 5934, 5937, 5939, 5942, 5945, 5948, 5952, 5955, 5959, 5962, 5968, 5972, 5976, 5979, 5982, 5985, 5988, 5992, 5995, 5998, 6002, 6006, 6009, 6012, 6015, 6018, 6022, 6025, 6028, 6030, 6034, 6038, 6042, 6045, 6048, 6050, 6053, 6056, 6059, 6063, 6066, 6069, 6072, 6074, 6078, 6082, 6085, 6088, 6091, 6094, 6098, 6101, 6104, 6108, 6112, 6115, 6118, 6120, 6123, 6126, 6129, 6133, 6136, 6139, 6141] if ( *(_QWORD *)(*(_QWORD *)(a1 + 8) + 24LL * v6 + 8) + *(unsigned int *)(*(_QWORD *)(a1 + 8) + 24LL * v6 + 16) == *(_QWORD *)(*(_QWORD *)(a1 + 8) + 24LL * (v6 + 1) + 8)
&& *(_QWORD *)(*(_QWORD *)(a1 + 8) + 24LL * v6) + *(unsigned int *)(*(_QWORD *)(a1 + 8) + 24LL * v6 + 16) == *(_QWORD *)(*(_QWORD *)(a1 + 8) + 24LL * (v6 + 1))
&& (((unsigned char)*(_DWORD *)(*(_QWORD *)(a1 + 8) + 24LL * v6 + 20) ^ (unsigned char)*(_DWORD *)(*(_QWORD *)(a1 + 8) + 24LL * (v6 + 1) + 20)) & 2) == 0 )
{
[6157, 6161, 6165, 6168, 6171, 6174, 6177, 6181, 6184, 6187, 6191, 6195, 6198, 6201, 6203, 6206, 6209, 6212, 6216, 6219, 6222, 6226, 6230, 6233, 6236, 6239, 6242, 6246, 6249, 6252] *(_DWORD *)(*(_QWORD *)(a1 + 8) + 24LL * v6 + 16) += *(_DWORD *)(*(_QWORD *)(a1 + 8) + 24LL * (v6 + 1) + 16);
[6348, 6255, 6352, 6258, 6356, 6261, 6359, 6264, 6362, 6365] for ( j = v6 + 1; j < *(_DWORD *)(a1 + 16) - 1; ++j )
{
[6274, 6277, 6280, 6282, 6285, 6288, 6291, 6295, 6266, 6270] v2 = (_QWORD *)(*(_QWORD *)(a1 + 8) + 24LL * (j + 1));
[6307, 6310, 6313, 6316, 6319, 6323, 6299, 6303] v3 = (_QWORD *)(24LL * j + *(_QWORD *)(a1 + 8));
[6329] v4 = v2[1];
[6333, 6326] *v3 = *v2;
[6336] v3[1] = v4;
[6344, 6340] v3[2] = v2[2];
}
[6371, 6374, 6377, 6381, 6367] --*(_DWORD *)(a1 + 16);
}
else
{
[6152, 6148] ++v6;
}
}
}
}
[6409] return result;
[6410] }
//----- (000000000000190B) ----------------------------------------------------
long ext4_modify_extent_list(_QWORD *a1, long a2, long *a3, int a4)
[6411] {
_QWORD *v5; // rsi
_QWORD *v6; // rcx
long v7; // rdx
int v8; // ecx
_QWORD *v9; // rcx
unsigned int i; // [rsp+24h] [rbp-2Ch]
unsigned int j; // [rsp+24h] [rbp-2Ch]
unsigned int room; // [rsp+28h] [rbp-28h]
int v15; // [rsp+2Ch] [rbp-24h]
int v16; // [rsp+2Ch] [rbp-24h]
long v17; // [rsp+30h] [rbp-20h]
unsigned long v18; // [rsp+38h] [rbp-18h]
long v19; // [rsp+40h] [rbp-10h]
[6464, 6411, 6415, 6416, 6419] v17 = *a3;
[6435, 6468, 6438, 6447, 6451, 6453, 6423, 6457, 6427, 6460, 6431] v18 = a3[1];
[6472, 6476] v19 = a3[2];
[8097, 8100, 8106, 6480, 8086, 6487, 8090, 8094] for ( i = 0; i < *(_DWORD *)(a2 + 16); ++i )
{
[6531, 6534, 6537, 6540, 6543, 6547, 6550, 6553, 6555, 6558, 6562, 6566, 6569, 6492, 6496, 6500, 6503, 6506, 6509, 6512, 6516, 6519, 6523, 6527] if ( *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8)
+ (unsigned long)*(unsigned int *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16)
- 1 >= v18 )
{
[6592, 6625, 6615, 6595, 6599, 6602, 6606, 6575, 6618, 6610, 6579, 6613, 6583, 6586, 6589, 6622] if ( *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8) > (unsigned int)v19 + v18 - 1 )
break;
[6658, 6661, 6665, 6669, 6672, 6675, 6678, 6681, 6685, 6688, 6691, 6695, 6698, 6702, 6704, 6707, 6710, 6631, 6635, 6639, 6642, 6645, 6648, 6651, 6655] ext2fs_unmark_block_bitmap_range2(
*(_QWORD *)(*a1 + 88LL),
*(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i),
*(unsigned int *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16));
[6786, 6790, 6794, 6798, 6801, 6804, 6807, 6810, 6814, 6817, 6820, 6822, 6825, 6829, 6833, 6836, 6838, 6841, 6715, 6845, 6719, 6848, 6723, 6726, 6729, 6732, 6735, 6739, 6742, 6746, 6750, 6753, 6759, 6763, 6767, 6770, 6773, 6776, 6779, 6783] if ( *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8) < v18
&& *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8)
+ (unsigned long)*(unsigned int *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16)
- 1 > (unsigned int)v19 + v18 - 1 )
{
[6854, 6857, 6860, 6862, 6866, 6868, 6871, 6876] room = make_room(a2, i + 1);
[6883, 6879] if ( room )
[6888, 6885] return room;
[6913, 6917, 6893, 6897, 6901, 6904, 6907, 6910] v5 = (_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i);
[6946, 6950, 6921, 6925, 6929, 6932, 6935, 6937, 6940, 6943] v6 = (_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * (i + 1));
[6957] v7 = v5[1];
[6961, 6954] *v6 = *v5;
[6964] v6[1] = v7;
[6968, 6972] v6[2] = v5[2];
[6976, 7008, 6980, 7012, 6982, 7015, 6985, 7019, 6988, 7021, 7023, 6992, 6996, 6999, 7002, 7005] v15 = v18 + v19 - *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8);
[7040, 7042, 7045, 7048, 7051, 7055, 7058, 7062, 7065, 7068, 7072, 7076, 7079, 7082, 7084, 7087, 7090, 7093, 7097, 7100, 7103, 7026, 7030, 7034, 7037] *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * (i + 1) + 8) += v15;
[7170, 7173, 7177, 7180, 7183, 7107, 7111, 7115, 7118, 7121, 7123, 7126, 7129, 7132, 7136, 7139, 7142, 7145, 7148, 7152, 7156, 7159, 7162, 7164, 7167] *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * (i + 1)) += v15;
[7186, 7190, 7194, 7197, 7200, 7202, 7205, 7208, 7211, 7215, 7218, 7221, 7224, 7228, 7232, 7235, 7238, 7240, 7243, 7246, 7249, 7253, 7256, 7258, 7260] *(_DWORD *)(*(_QWORD *)(a2 + 8) + 24LL * (i + 1) + 16) -= v15;
[7296, 7300, 7302, 7306, 7310, 7313, 7316, 7319, 7322, 7326, 7329, 7331, 7333, 7263, 7267, 7269, 7273, 7277, 7280, 7283, 7286, 7289, 7293] *(_DWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16) = v18 - *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8);
[7336] break;
}
[7424, 7427, 7430, 7433, 7436, 7440, 7443, 7446, 7448, 7451, 7455, 7459, 7462, 7464, 7467, 7341, 7471, 7345, 7474, 7349, 7353, 7356, 7359, 7362, 7365, 7369, 7372, 7376, 7379, 7385, 7389, 7393, 7396, 7399, 7402, 7405, 7409, 7412, 7416, 7420] if ( v18 > *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8)
|| *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8)
+ (unsigned long)*(unsigned int *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16)
- 1 > (unsigned int)v19 + v18 - 1 )
{
[7554, 7557, 7560, 7563, 7566, 7570, 7573, 7576, 7578, 7581, 7585, 7589, 7592, 7594, 7597, 7601, 7604, 7515, 7519, 7523, 7526, 7529, 7532, 7535, 7539, 7542, 7546, 7550] if ( *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8)
+ (unsigned long)*(unsigned int *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16)
- 1 > (unsigned int)v19 + v18 - 1 )
{
[7616, 7649, 7619, 7646, 7622, 7653, 7655, 7657, 7626, 7630, 7633, 7642, 7636, 7639, 7610, 7614] v16 = v18 + v19 - *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8);
[7680, 7684, 7687, 7691, 7694, 7697, 7701, 7705, 7708, 7711, 7714, 7717, 7721, 7724, 7728, 7660, 7664, 7668, 7671, 7674, 7677] *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8) += v16;
[7732, 7736, 7740, 7743, 7746, 7749, 7752, 7756, 7759, 7762, 7765, 7768, 7772, 7776, 7779, 7782, 7785, 7788, 7792, 7795, 7799] *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i) += v16;
[7810, 7813, 7816, 7819, 7822, 7826, 7829, 7832, 7835, 7839, 7843, 7846, 7849, 7852, 7855, 7859, 7862, 7864, 7866, 7802, 7806] *(_DWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16) -= v16;
[7869] break;
}
[8000, 7969, 8003, 7973, 7977, 7980, 7983, 7986, 7989, 7960, 7993, 7963, 7996, 7965] if ( v18 <= *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8) )
[8048] v8 = 0;
else
[8035, 8005, 8038, 8009, 8042, 8011, 8044, 8046, 8015, 8019, 8022, 8025, 8028, 8031] v8 = v18 - *(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 8);
[8064, 8067, 8070, 8073, 8077, 8080, 8083, 8053, 8057, 8061] *(_DWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16) = v8;
}
else
{
[7490, 7493, 7496, 7500, 7503, 7476, 7510, 7480, 7484, 7487] *(_DWORD *)(*(_QWORD *)(a2 + 8) + 24LL * i + 16) = 0;
}
}
}
[8109, 8112, 8114, 8116, 8120] if ( (_DWORD)v19 && !a4 )
{
[8129, 8131, 8135, 8137, 8140, 8122, 8126] make_room(a2, *(_DWORD *)(a2 + 16));
[8160, 8163, 8165, 8168, 8171, 8174, 8145, 8178, 8149, 8153, 8157] v9 = (_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * (unsigned int)(*(_DWORD *)(a2 + 16) - 1));
[8186, 8182, 8190] *v9 = v17;
[8193] v9[1] = v18;
[8201, 8197] v9[2] = v19;
}
[8209, 8212, 8205] ex_sort_and_merge(a2);
[8224, 8321, 8324, 8310, 8217, 8314, 8318] for ( j = 0; j < *(_DWORD *)(a2 + 16); ++j )
[8226, 8230, 8234, 8237, 8240, 8243, 8246, 8250, 8253, 8256, 8260, 8264, 8267, 8270, 8273, 8276, 8280, 8283, 8286, 8290, 8293, 8297, 8299, 8302, 8305] ext2fs_mark_block_bitmap_range2(
*(_QWORD *)(*a1 + 88LL),
*(_QWORD *)(*(_QWORD *)(a2 + 8) + 24LL * j),
*(unsigned int *)(*(_QWORD *)(a2 + 8) + 24LL * j + 16));
[8326, 8359, 8361, 8330, 8333, 8336, 8341, 8346, 8350] ext2fs_mark_bb_dirty(*a1);
[8366] return 0LL;
[8367] }
// 6820: using guessed type long ext2fs_unmark_block_bitmap_range2(_QWORD, _QWORD, _QWORD);
// 6828: using guessed type long ext2fs_mark_block_bitmap_range2(_QWORD, _QWORD, _QWORD);
// 6830: using guessed type long ext2fs_mark_bb_dirty(_QWORD);
//----- (00000000000020B0) ----------------------------------------------------
long ext4_add_extent_to_list(_QWORD *a1, long a2, long *a3)
[8368] {
[8384, 8417, 8388, 8392, 8396, 8368, 8400, 8412, 8372, 8373, 8404, 8376, 8409, 8380] return ext4_modify_extent_list(a1, a2, a3, 0);
[8418] }
//----- (00000000000020E3) ----------------------------------------------------
long ext4_del_extent_from_list(_QWORD *a1, long a2, long *a3)
[8419] {
[8419, 8451, 8423, 8424, 8455, 8427, 8460, 8431, 8463, 8435, 8468, 8439, 8443, 8447] return ext4_modify_extent_list(a1, a2, a3, 1);
[8469] }
//----- (0000000000002116) ----------------------------------------------------
long ext4_fc_read_extents(long a1, long a2)
[8470] {
long extents; // rax
[8513, 8517, 8470, 8504, 8474, 8475, 8508, 8478, 8511] if ( a2 == *(_DWORD *)(a1 + 984) )
[8524, 8519] return 0LL;
[8547, 8526, 8530, 8532, 8536, 8539, 8543] *(_DWORD *)(a1 + 984) = a2;
[8482, 8486, 8550, 8553, 8490, 8494, 8500] extents = e2fsck_read_extents(a1, a1 + 944);
[8578, 8558, 8563, 8570, 8573] return _errcode_to_errno(extents, "ext4_fc_read_extents", 0x24Du);
[8579] }
// 6838: using guessed type long e2fsck_read_extents(_QWORD, _QWORD);
//----- (0000000000002184) ----------------------------------------------------
void * ext4_fc_flush_extents(long a1, void *a2)
[8580] {
void *result; // rax
void *s; // [rsp+18h] [rbp-8h]
[8610, 8580, 8584, 8585, 8588, 8592, 8596, 8600, 8604] s = (void *)(a1 + 944);
[8618, 8621, 8614] result = (void *)*(unsigned int *)(a1 + 984);
[8627, 8623] if ( a2 != result )
{
[8633, 8629] result = (void *)*(unsigned int *)(a1 + 984);
[8636, 8638] if ( (_DWORD)result )
{
[8640, 8644, 8648, 8651, 8654] e2fsck_rewrite_extent_tree(a1, s);
[8659, 8670, 8667, 8663] ext2fs_free_mem(a1 + 952);
[8675, 8679, 8684, 8689, 8692, 8697] return memset(s, 0, 0x30uLL);
}
}
[8700] return result;
[8701] }
// 67C0: using guessed type long ext2fs_free_mem(_QWORD);
// 6840: using guessed type long e2fsck_rewrite_extent_tree(_QWORD, _QWORD);
//----- (00000000000021FE) ----------------------------------------------------
long tl_to_darg(long a1, long a2, long a3)
[8702] {
int dest[2]; // [rsp+30h] [rbp-10h] BYREF
unsigned long v6; // [rsp+38h] [rbp-8h]
[8706, 8710, 8714, 8718, 8722, 8731, 8702, 8703] v6 = __readfsqword(0x28u);
[8737, 8769, 8741, 8744, 8747, 8750, 8754, 8758, 8763, 8766, 8735] memcpy(dest, (const void *)a3, sizeof(dest));
[8777, 8779, 8774, 8783] *(_QWORD *)a1 = (unsigned int)dest[0];
[8786, 8795, 8789, 8791] *(_QWORD *)(a1 + 16) = (unsigned int)dest[1];
[8803, 8806, 8811, 8814, 8816, 8820, 8799] *(_DWORD *)(a1 + 8) = ext4_fc_tag_len(a2) - 8;
[8833, 8835, 8838, 8843, 8846, 8850, 8823, 8827, 8830] *(_QWORD *)(a1 + 24) = malloc(*(_DWORD *)(a1 + 8) + 1);
[8865, 8858, 8862, 8854] if ( !*(_QWORD *)(a1 + 24) )
[8872, 8867] return 4294967284LL;
[8896, 8900, 8903, 8874, 8906, 8878, 8881, 8884, 8888, 8892] memcpy(*(void **)(a1 + 24), (const void *)(a3 + 8), *(int *)(a1 + 8));
[8928, 8931, 8934, 8939, 8911, 8943, 8915, 8919, 8952, 8954, 8923, 8926] *(_BYTE *)(*(_QWORD *)(a1 + 24) + *(int *)(a1 + 8)) = 0;
[8959] return 0LL;
[8960] }
//----- (0000000000002301) ----------------------------------------------------
long ext4_fc_handle_unlink(_QWORD *a1, long a2, long a3)
[8961] {
long v4; // rax
unsigned int v5; // [rsp+2Ch] [rbp-34h]
long v6; // [rsp+30h] [rbp-30h] BYREF
void *v7; // [rsp+40h] [rbp-20h]
void *ptr; // [rsp+48h] [rbp-18h]
unsigned long v9; // [rsp+58h] [rbp-8h]
[8961, 8994, 8965, 8966, 8969, 8973, 8977, 8981, 8985] v9 = __readfsqword(0x28u);
[8998, 9000, 9004, 9008, 9012, 9015, 9018, 9023] v5 = tl_to_darg((long)&v6, a2, a3);
[9026, 9030] if ( !v5 )
{
[9037, 9041, 9045, 9048, 9051] ext4_fc_flush_extents((long)a1, v7);
[9056, 9088, 9060, 9062, 9066, 9070, 9072, 9076, 9079, 9085] v4 = ext2fs_unlink(*a1, (unsigned int)v6, ptr, (unsigned int)v7, 0LL);
[9093, 9098, 9105, 9108, 9113] v5 = _errcode_to_errno(v4, "ext4_fc_handle_unlink", 0x28Fu);
[9120, 9123, 9128, 9131, 9135, 9144, 9146, 9116] free(ptr);
}
[9032, 9035, 9151] return v5;
[9152] }
// 6848: using guessed type long ext2fs_unlink(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000023C1) ----------------------------------------------------
long ext4_fc_handle_link_and_create(long *a1, long a2, long a3)
[9153] {
long inode; // rax
long v5; // rax
unsigned int v6; // [rsp+2Ch] [rbp-E4h]
unsigned int v7; // [rsp+2Ch] [rbp-E4h]
unsigned int v8; // [rsp+30h] [rbp-E0h]
long v9; // [rsp+38h] [rbp-D8h]
long v10; // [rsp+40h] [rbp-D0h] BYREF
long v11; // [rsp+50h] [rbp-C0h]
void *ptr; // [rsp+58h] [rbp-B8h]
short v13[84]; // [rsp+60h] [rbp-B0h] BYREF
unsigned long v14; // [rsp+108h] [rbp-8h]
[9153, 9157, 9158, 9189, 9161, 9198, 9168, 9175, 9182] v14 = __readfsqword(0x28u);
[9202, 9211, 9204, 9214] v9 = *a1;
[9248, 9221, 9253, 9228, 9235, 9242, 9245] v6 = tl_to_darg((long)&v10, a2, a3);
[9266, 9259] if ( v6 )
[9274, 9268] return v6;
[9294, 9291, 9286, 9279] ext4_fc_flush_extents((long)a1, 0LL);
[9315, 9322, 9324, 9327, 9299, 9306, 9308] inode = ext2fs_read_inode(v9, (unsigned int)v11, v13);
[9344, 9347, 9352, 9332, 9337] v7 = _errcode_to_errno(inode, "ext4_fc_handle_link_and_create", 0x2A2u);
[9365, 9358] if ( v7 )
goto LABEL_20;
[9378, 9381, 9387, 9403, 9393, 9398, 9371] switch ( v13[0] & 0xF000 )
{
case 32768:
[9405, 9415] v8 = 1;
LABEL_19:
[9632, 9639, 9641, 9657, 9616, 9648, 9654, 9623, 9625] ext2fs_unlink(v9, (unsigned int)v10, ptr, (unsigned int)v11, 1LL);
[9700, 9669, 9671, 9703, 9705, 9708, 9678, 9685, 9687, 9693, 9662] v5 = ext2fs_link(v9, (unsigned int)v10, ptr, (unsigned int)v11, v8);
[9728, 9733, 9739, 9713, 9718, 9725] v7 = _errcode_to_errno(v5, "ext4_fc_handle_link_and_create", 0x2C3u);
goto LABEL_20;
case 16384:
[9436, 9438, 9431] v8 = 2;
[9448] goto LABEL_19;
case 8192:
[9464, 9469, 9471] v8 = 3;
[9481] goto LABEL_19;
case 24576:
[9504, 9497, 9502] v8 = 4;
[9514] goto LABEL_19;
case 40960:
[9539, 9532, 9534, 9527] return 7LL;
case 4096:
[9560, 9562, 9555] v8 = 5;
[9572] goto LABEL_19;
case 49152:
[9592, 9585, 9590] v8 = 6;
[9602] goto LABEL_19;
}
[9604, 9614] v7 = -22;
LABEL_20:
[9752, 9749, 9742] free(ptr);
[9763, 9767, 9776, 9778, 9783, 9757] return v7;
[9784] }
// 6848: using guessed type long ext2fs_unlink(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 6850: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 6858: using guessed type long ext2fs_link(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 23C1: using guessed type short var_B0[84];
//----- (0000000000002639) ----------------------------------------------------
void * ext4_fc_replay_fixup_iblocks(long a1, long a2)
[9785] {
void *result; // rax
_WORD *s; // [rsp+18h] [rbp-8h]
[9793, 9797, 9801, 9805, 9817, 9809, 9812, 9785, 9819, 9789, 9790] if ( (*(_DWORD *)(a1 + 32) & 0x80000) != 0 )
{
[9825, 9829, 9821] s = (_WORD *)(a1 + 40);
[9833, 9837] result = (void *)*(unsigned short *)(a1 + 40);
[9840, 9844] if ( (_WORD)result != 0xF30A )
{
[9860, 9863, 9846, 9850, 9855] memset(s, 0, 0xCuLL);
[9872, 9868] *s = -3318;
[9877] result = (void *)(a1 + 40);
[9881, 9887] *(_WORD *)(a1 + 44) = 4;
}
}
else
{
[9896, 9889, 9893] result = (void *)(*(_DWORD *)(a1 + 32) & 0x10000000);
[9901, 9903] if ( (_DWORD)result )
[9921, 9926, 9929, 9932, 9905, 9909, 9913, 9917] return memcpy((void *)(a1 + 40), (const void *)(a2 + 40), 0x3CuLL);
}
[9937, 9938] return result;
[9939] }
//----- (00000000000026D4) ----------------------------------------------------
long ext4_fc_handle_inode(_QWORD *a1, long a2)
[9940] {
long v2; // rax
long v3; // rbx
long v4; // rax
unsigned int dest; // [rsp+14h] [rbp-4Ch] BYREF
unsigned int v7; // [rsp+18h] [rbp-48h]
unsigned int v8; // [rsp+1Ch] [rbp-44h]
void *v9; // [rsp+20h] [rbp-40h] BYREF
void *v10; // [rsp+28h] [rbp-38h] BYREF
long v11; // [rsp+30h] [rbp-30h] BYREF
long mem; // [rsp+38h] [rbp-28h]
void *v13; // [rsp+40h] [rbp-20h]
unsigned long v14; // [rsp+48h] [rbp-18h]
[9953, 9957, 9961, 9970, 9940, 9944, 9945, 9948, 9949] v14 = __readfsqword(0x28u);
[9976, 9974] v7 = 128;
[9983] v9 = 0LL;
[9991] v10 = 0LL;
[10018, 9999, 10003, 10007, 10012, 10015] memcpy(&dest, (const void *)a2, sizeof(dest));
[10027, 10031, 10023] v13 = (void *)(a2 + 4);
[10035, 10038] v8 = dest;
[10048, 10052, 10055, 10057, 10059, 10063, 10066, 10070, 10041, 10074, 10045, 10078] if ( *(_DWORD *)(*(_QWORD *)(*a1 + 32LL) + 76LL) && *(_WORD *)(*(_QWORD *)(*a1 + 32LL) + 88LL) > 0x80u )
[10080, 10091, 10084, 10094] v7 += *((unsigned short *)v13 + 64);
[10112, 10117, 10097, 10100, 10102, 10106, 10109] mem = ext2fs_get_mem((int)v7, &v9);
[10121, 10126] if ( !mem )
{
[10144, 10147, 10152, 10132, 10135, 10137, 10141] mem = ext2fs_get_mem((int)v7, &v10);
[10161, 10156] if ( !mem )
{
[10177, 10180, 10183, 10167, 10170, 10173] ext4_fc_flush_extents((long)a1, (void *)(int)v8);
[10208, 10213, 10188, 10192, 10195, 10199, 10202, 10205] mem = ext2fs_read_inode_full(*a1, v8, v9, v7);
[10217, 10222] if ( !mem )
{
[10242, 10245, 10248, 10228, 10231, 10234, 10238] memcpy(v10, v13, (int)v7);
[10272, 10253, 10257, 10261, 10266, 10269] memcpy(v9, v10, 0x28uLL);
[10305, 10308, 10277, 10280, 10282, 10286, 10290, 10294, 10298, 10302] memcpy((char *)v9 + 100, (char *)v10 + 100, (int)v7 - 100LL);
[10313, 10317, 10321, 10324, 10327] ext4_fc_replay_fixup_iblocks((long)v9, (long)v10);
[10336, 10339, 10332] v2 = EXT2_INODE((long)v9);
[10370, 10375, 10344, 10347, 10350, 10354, 10357, 10361, 10364, 10367] mem = ext2fs_count_blocks(*a1, v8, v2, &v11);
[10384, 10379] if ( !mem )
{
[10390] v3 = v11;
[10401, 10394, 10398] v4 = EXT2_INODE((long)v9);
[10406, 10409, 10413, 10416, 10419, 10422, 10425] ext2fs_iblk_set(*a1, v4, v3);
[10434, 10437, 10441, 10444, 10446, 10449, 10430] ext2fs_inode_csum_set(*a1, v8, v9);
[10465, 10468, 10471, 10474, 10479, 10454, 10458, 10461] mem = ext2fs_write_inode_full(*a1, v8, v9, v7);
[10488, 10483] if ( !mem )
{
[10490, 10498, 10501, 10494] if ( *((_WORD *)v9 + 13) )
[10503, 10506, 10510, 10513, 10517, 10519, 10522, 10527] ext2fs_mark_inode_bitmap2(*(_QWORD *)(*a1 + 80LL), v8);
else
[10529, 10532, 10536, 10539, 10543, 10545, 10548] ext2fs_unmark_inode_bitmap2(*(_QWORD *)(*a1 + 80LL), v8);
[10560, 10563, 10568, 10553, 10557] ext2fs_mark_ib_dirty(*a1);
}
}
}
}
}
[10587, 10590, 10583] ext2fs_free_mem(&v9);
[10602, 10595, 10599] ext2fs_free_mem(&v10);
[10626, 10631, 10635, 10607, 10611, 10644, 10646, 10616, 10651, 10623] return _errcode_to_errno(mem, "ext4_fc_handle_inode", 0x319u);
[10656, 10657, 10655] }
// 67C0: using guessed type long ext2fs_free_mem(_QWORD);
// 6860: using guessed type long ext2fs_get_mem(_QWORD, _QWORD);
// 6868: using guessed type long ext2fs_read_inode_full(_QWORD, _QWORD, _QWORD, _QWORD);
// 6870: using guessed type long ext2fs_count_blocks(_QWORD, _QWORD, _QWORD, _QWORD);
// 6878: using guessed type long ext2fs_iblk_set(_QWORD, _QWORD, _QWORD);
// 6880: using guessed type long ext2fs_inode_csum_set(_QWORD, _QWORD, _QWORD);
// 6888: using guessed type long ext2fs_write_inode_full(_QWORD, _QWORD, _QWORD, _QWORD);
// 6890: using guessed type long ext2fs_mark_inode_bitmap2(_QWORD, _QWORD);
// 6898: using guessed type long ext2fs_unmark_inode_bitmap2(_QWORD, _QWORD);
// 68A0: using guessed type long ext2fs_mark_ib_dirty(_QWORD);
//----- (00000000000029A2) ----------------------------------------------------
long ext4_fc_handle_add_extent(_QWORD *a1, const void *a2)
[10658] {
long v3; // rax
unsigned int extents; // [rsp+14h] [rbp-4Ch]
unsigned int v5; // [rsp+14h] [rbp-4Ch]
long v6; // [rsp+18h] [rbp-48h]
long s[4]; // [rsp+20h] [rbp-40h] BYREF
int dest[6]; // [rsp+40h] [rbp-20h] BYREF
unsigned long v9; // [rsp+58h] [rbp-8h]
[10658, 10662, 10663, 10666, 10670, 10674, 10678, 10687] v9 = __readfsqword(0x28u);
[10691, 10693, 10700, 10704, 10708, 10713, 10716, 10719] memcpy(dest, a2, 0x10uLL);
[10729, 10724, 10727] v6 = (unsigned int)dest[0];
[10733, 10737, 10741, 10744, 10747] ext4_fc_flush_extents((long)a1, (void *)(unsigned int)dest[0]);
[10752, 10756, 10760, 10763, 10766, 10771] extents = ext4_fc_read_extents((long)a1, v6);
[10778, 10774] if ( extents )
[10780, 10783] return extents;
[10785, 10789, 10794, 10799, 10802] memset(s, 0, 0x18uLL);
[10819, 10824, 10827, 10830, 10807, 10811, 10815] v3 = ext2fs_decode_extent(s, &dest[1], 12LL);
[10850, 10855, 10835, 10840, 10847] v5 = _errcode_to_errno(v3, "ext4_fc_handle_add_extent", 0x32Eu);
[10858, 10862] if ( v5 )
[10864, 10867] return v5;
else
[10880, 10912, 10914, 10884, 10888, 10891, 10894, 10899, 10869, 10903, 10873] return ext4_add_extent_to_list(a1, (long)(a1 + 118), s);
[10920, 10919] }
// 67E8: using guessed type long ext2fs_decode_extent(_QWORD, _QWORD, _QWORD);
// 29A2: using guessed type long s[4];
//----- (0000000000002AA9) ----------------------------------------------------
long ext4_fc_handle_del_range(_QWORD *a1, const void *a2)
[10921] {
int v3; // [rsp+1Ch] [rbp-34h]
unsigned int extents; // [rsp+20h] [rbp-30h]
int dest[3]; // [rsp+24h] [rbp-2Ch] BYREF
long s[4]; // [rsp+30h] [rbp-20h] BYREF
[10950, 10921, 10925, 10926, 10929, 10933, 10937, 10941] s[3] = __readfsqword(0x28u);
[10954, 10956, 10960, 10964, 10969, 10972, 10975] memcpy(dest, a2, sizeof(dest));
[10980, 10983] v3 = dest[0];
[10986, 10989, 10992, 10996, 10999, 11002] ext4_fc_flush_extents((long)a1, (void *)dest[0]);
[11011, 11016, 11021, 11024, 11007] memset(s, 0, 0x18uLL);
[11032, 11034, 11029] s[1] = (unsigned int)dest[1];
[11041, 11038] LODWORD(s[2]) = dest[2];
[11044, 11047, 11050, 11054, 11057, 11060, 11065] extents = ext4_fc_read_extents((long)a1, v3);
[11072, 11068] if ( extents )
[11074, 11077] return extents;
else
[11104, 11109, 11079, 11113, 11083, 11090, 11122, 11124, 11094, 11098, 11101] return ext4_del_extent_from_list(a1, (long)(a1 + 118), s);
[11129, 11130] }
//----- (0000000000002B7B) ----------------------------------------------------
long ext4_fc_replay(long a1, long a2, int a3, int a4, unsigned int a5)
[11131] {
long bitmaps; // rax
int v8; // [rsp+20h] [rbp-40h]
short dest[2]; // [rsp+24h] [rbp-3Ch] BYREF
void *src; // [rsp+28h] [rbp-38h]
long *v11; // [rsp+30h] [rbp-30h]
long *v12; // [rsp+38h] [rbp-28h]
long v13; // [rsp+40h] [rbp-20h]
unsigned long v14; // [rsp+48h] [rbp-18h]
const void *v15; // [rsp+50h] [rbp-10h]
unsigned long v16; // [rsp+58h] [rbp-8h]
[11136, 11170, 11139, 11143, 11147, 11151, 11154, 11157, 11161, 11131, 11135] v16 = __readfsqword(0x28u);
[11174, 11176, 11180, 11184, 11187] v11 = **(long ***)(a1 + 112);
[11201, 11195, 11191] v12 = v11 + 118;
[11205] v8 = 1;
[11216, 11212] if ( !a3 )
{
[11218, 11222] *((_DWORD *)v12 + 14) = 0;
[11232, 11235, 11239, 11243, 11246, 11251, 11229] return ext4_fc_replay_scan(a1, a2, a4, a5);
}
[11256, 11265, 11260, 11263] if ( *((_DWORD *)v12 + 12) )
{
[11281, 11275, 11278, 11271] if ( a3 != *((_DWORD *)v12 + 14) )
{
[11291, 11294, 11287] *((_DWORD *)v12 + 14) = a3;
[11297, 11301, 11304, 11307, 11311, 11314, 11320] *(_DWORD *)(*v11 + 16) |= 0x200000u;
[11330, 11323, 11333, 11327] bitmaps = ext2fs_read_bitmaps(*v11);
[11338, 11343, 11350, 11353, 11358] v8 = _errcode_to_errno(bitmaps, "ext4_fc_replay", 0x369u);
[11361, 11365] if ( v8 )
[11370, 11367] return (unsigned int)v8;
[11394, 11375, 11379, 11382, 11386, 11390] *((_WORD *)v12 + 34) = *(_WORD *)(*(_QWORD *)(*v11 + 32) + 58LL);
[11424, 11427, 11398, 11402, 11405, 11409, 11413, 11417, 11420] *(_WORD *)(*(_QWORD *)(*v11 + 32) + 58LL) |= 2u;
[11457, 11460, 11431, 11435, 11438, 11442, 11446, 11450, 11453] *(_WORD *)(*(_QWORD *)(*v11 + 32) + 58LL) |= 0x20u;
[11464, 11474, 11468, 11471] ext2fs_mark_super_dirty(*v11);
[11489, 11483, 11486, 11479] ext2fs_flush(*v11);
}
[11498, 11502, 11494] v13 = a2 + 40;
[11521, 11523, 11527, 11530, 11506, 11510, 11514, 11518] v14 = a2 + 40 + *(int *)(a1 + 120) - 1LL;
[11843, 11846, 11850, 11534, 11854, 11538, 11858, 11542, 11862, 11868] for ( src = (void *)(a2 + 40); (unsigned long)src < v14; src = (char *)src + (unsigned short)dest[1] + 4 )
{
[11555, 11560, 11563, 11566, 11547, 11551] memcpy(dest, src, sizeof(dest));
[11579, 11571, 11575] v15 = (char *)src + 4;
[11592, 11587, 11590, 11583] if ( !*((_DWORD *)v12 + 12) )
goto LABEL_22;
[11619, 11598, 11602, 11605, 11608, 11612, 11615] --*((_DWORD *)v12 + 12);
[11648, 11651, 11653, 11622, 11625, 11660, 11631, 11663, 11633, 11641] switch ( dest[0] )
{
case 1:
[11744, 11725, 11729, 11733, 11736, 11739] v8 = ext4_fc_handle_add_extent(v11, v15);
[11747] break;
case 2:
[11749, 11753, 11757, 11760, 11763, 11768] v8 = ext4_fc_handle_del_range(v11, v15);
[11771] break;
case 3:
case 4:
[11681, 11684, 11689, 11666, 11670, 11674, 11678] v8 = ext4_fc_handle_link_and_create(v11, (long)dest, (long)v15);
[11692] break;
case 5:
[11712, 11715, 11720, 11697, 11701, 11705, 11709] v8 = ext4_fc_handle_unlink(v11, (long)dest, (long)v15);
[11723] break;
case 6:
[11777, 11781, 11784, 11787, 11792, 11773] v8 = ext4_fc_handle_inode(v11, (long)v15);
[11795] break;
case 7:
case 9:
break;
case 8:
[11801, 11797, 11806, 11809] ext4_fc_flush_extents((long)v11, 0LL);
[11814] break;
default:
[11816, 11823] v8 = -125;
break;
}
[11826, 11830] if ( v8 < 0 )
break;
[11832, 11839] v8 = 1;
}
[11874, 11871] return (unsigned int)v8;
}
else
{
LABEL_22:
[11890, 11883, 11893, 11887] if ( a3 == *((_DWORD *)v12 + 14) )
{
[11906, 11909, 11914, 11917, 11902] ext2fs_calculate_summary_stats(*v11, 0LL);
[11929, 11922, 11932, 11926] ext2fs_write_block_bitmap(*v11);
[11944, 11937, 11947, 11941] ext2fs_write_inode_bitmap(*v11);
[11952, 11962, 11956, 11959] ext2fs_mark_super_dirty(*v11);
[11977, 11971, 11974, 11967] ext2fs_set_gdt_csum(*v11);
[12001, 11982, 11986, 11989, 11993, 11997] *(_WORD *)(*(_QWORD *)(*v11 + 32) + 58LL) = *((_WORD *)v12 + 34);
[12005, 12038, 12040, 12009, 12012, 12015, 12020, 12025, 12029] ext2fs_flush(*v11);
}
[11900, 11895] return 0LL;
}
[12045, 12046] }
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
// 68A8: using guessed type long ext2fs_read_bitmaps(_QWORD);
// 68B0: using guessed type long ext2fs_flush(_QWORD);
// 68B8: using guessed type long ext2fs_calculate_summary_stats(_QWORD, _QWORD);
// 68C0: using guessed type long ext2fs_write_block_bitmap(_QWORD);
// 68C8: using guessed type long ext2fs_write_inode_bitmap(_QWORD);
// 68D0: using guessed type long ext2fs_set_gdt_csum(_QWORD);
//----- (0000000000002F0F) ----------------------------------------------------
long e2fsck_get_journal(const void **a1, _QWORD *a2)
[12047] {
const void *v3; // rax
long v4; // rax
int v5; // eax
int v6; // [rsp+18h] [rbp-A88h]
int v7; // [rsp+1Ch] [rbp-A84h]
unsigned int v8; // [rsp+20h] [rbp-A80h]
int v9; // [rsp+24h] [rbp-A7Ch]
long v10; // [rsp+28h] [rbp-A78h] BYREF
int *v11; // [rsp+30h] [rbp-A70h] BYREF
long v12; // [rsp+38h] [rbp-A68h] BYREF
long v13; // [rsp+40h] [rbp-A60h] BYREF
long memory; // [rsp+48h] [rbp-A58h] BYREF
long v15; // [rsp+50h] [rbp-A50h] BYREF
const void *v16; // [rsp+58h] [rbp-A48h]
long inode; // [rsp+60h] [rbp-A40h]
long v18; // [rsp+68h] [rbp-A38h]
long v19; // [rsp+70h] [rbp-A30h]
_DWORD *v20; // [rsp+78h] [rbp-A28h]
long v21; // [rsp+80h] [rbp-A20h]
unsigned long v22; // [rsp+88h] [rbp-A18h]
char v23[112]; // [rsp+90h] [rbp-A10h] BYREF
long v24[46]; // [rsp+100h] [rbp-9A0h] BYREF
short dest[512]; // [rsp+270h] [rbp-830h] BYREF
char v26[1024]; // [rsp+670h] [rbp-430h] BYREF
char v27[40]; // [rsp+A70h] [rbp-30h] BYREF
unsigned long v28; // [rsp+A98h] [rbp-8h]
[12069, 12076, 12047, 12051, 12052, 12085, 12055, 12062] v28 = __readfsqword(0x28u);
[12098, 12101, 12105, 12089, 12091] v19 = *((_QWORD *)*a1 + 4);
[12112] v12 = 0LL;
[12123] v13 = 0LL;
[12134] v16 = 0LL;
[12145, 12156] inode = 0LL;
[12167] v18 = 0LL;
[12178] v15 = 0LL;
[12189] v6 = 0;
[12199] v7 = 0;
[12216, 12209, 12219] clear_problem_context(v23);
[12224, 12231, 12238, 12243, 12246, 12251] memory = e2fsck_allocate_memory(a1, 208LL, "journal");
[12265, 12258, 12268] if ( !memory )
[12275, 12270] return 2133571398LL;
[12294, 12299, 12302, 12307, 12280, 12287] v13 = e2fsck_allocate_memory(a1, 32LL, "kdev");
[12321, 12314, 12324] if ( v13 )
{
[12353, 12349, 12342] v20 = (_DWORD *)(v13 + 16);
[12360, 12374, 12367] *(_QWORD *)(v13 + 16) = a1;
[12384, 12377, 12394, 12391] *(_QWORD *)v13 = *(_QWORD *)v20;
[12404, 12397] *(_DWORD *)(v13 + 8) = 1;
[12418, 12411] v20[2] = 2;
[12432, 12425, 12439] *(_QWORD *)(memory + 104) = v20;
[12457, 12450, 12443] *(_QWORD *)(memory + 112) = v13;
[12468, 12461] *(_QWORD *)(memory + 136) = 0LL;
[12486, 12489, 12492, 12499, 12479] *(_DWORD *)(memory + 120) = *((_DWORD *)*a1 + 10);
[12515, 12518, 12523, 12525, 12502, 12509] if ( (unsigned int)uuid_is_null(v19 + 208) )
{
[12544, 12538, 12531, 12546] if ( *(_DWORD *)(v19 + 224) )
{
[12578, 12583, 12586, 12591, 12564, 12571] v12 = e2fsck_allocate_memory(a1, 144LL, "journal inode");
[12608, 12605, 12598] if ( v12 )
{
[12640, 12633, 12626] *(_QWORD *)v12 = a1;
[12657, 12650, 12643, 12663] *(_DWORD *)(v12 + 8) = *(_DWORD *)(v19 + 224);
[12673, 12705, 12677, 12710, 12684, 12690, 12697, 12666, 12700, 12702] inode = ext2fs_read_inode(*a1, *(unsigned int *)(v19 + 224), v12 + 12);
[12731, 12717, 12725] if ( !inode )
goto LABEL_14;
[12739, 12746, 12748, 12754, 12761, 12732] while ( *(_BYTE *)(v19 + 253) == 1 && !v7 )
{
[12774, 12778, 12783, 12788, 12791, 12767] memset((void *)(v12 + 12), 0, 0x80uLL);
[12832, 12803, 12810, 12817, 12821, 12826, 12796, 12829] memcpy((void *)(v12 + 52), (const void *)(v19 + 268), 0x3CuLL);
[12857, 12851, 12844, 12837] *(_DWORD *)(v12 + 120) = *(_DWORD *)(v19 + 328);
[12880, 12874, 12867, 12860] *(_DWORD *)(v12 + 16) = *(_DWORD *)(v19 + 332);
[12890, 12883] *(_WORD *)(v12 + 38) = 1;
[12896, 12903] *(_WORD *)(v12 + 12) = -32384;
[12924, 12921, 12916, 12909] e2fsck_use_inode_shortcuts(a1, 1LL);
[12936, 12929, 12946, 12939] *((_DWORD *)a1 + 134) = *(_DWORD *)(v12 + 8);
[12952, 12970, 12963, 12959] a1[68] = (const void *)(v12 + 12);
[12977] v7 = 1;
LABEL_14:
[13024, 12995, 12998, 13000, 13007, 13011, 13014, 12984, 13019, 12991] if ( *(_WORD *)(v12 + 38) && (*(_WORD *)(v12 + 12) & 0xF000) == 0x8000 )
{
[13089, 13092, 13061, 13064, 13097, 13066, 13100, 13070, 13086, 13073, 13042, 13106, 13076, 13049, 13083, 13052, 13054] if ( (((unsigned long)*(unsigned int *)(v12 + 120) << 32) | *(unsigned int *)(v12 + 16))
/ *(int *)(memory + 120) > 0x3FF )
{
[13124] v10 = -1LL;
[13152, 13185, 13155, 13190, 13162, 13177, 13165, 13135, 13172, 13142, 13145, 13182] inode = ext2fs_block_iterate3(*a1, *(unsigned int *)(v12 + 8), 1LL, 0LL, process_journal_block, &v10);
[13218, 13221, 13223, 13227, 13197, 13234, 13204, 13237, 13239, 13208, 13242, 13215] if ( *((unsigned int *)*a1 + 10) * (v10 + 1) >= *(int *)(v12 + 16) )
{
[13317, 13320, 13322, 13325, 13330, 13337, 13345, 13260, 13267, 13269, 13276, 13279, 13282, 13284, 13286, 13293, 13297, 13304, 13310] if ( !v7
|| (*((_DWORD *)a1 + 19) & 1) != 0
|| (inode = ext2fs_write_inode(*a1, *(unsigned int *)(v19 + 224), v12 + 12)) == 0 )
{
[13409, 13379, 13412, 13382, 13351, 13385, 13419, 13358, 13392, 13361, 13363, 13395, 13398, 13401, 13370, 13373, 13406, 13375] *(_DWORD *)(memory + 128) = (((unsigned long)*(unsigned int *)(v12 + 120) << 32) | *(unsigned int *)(v12 + 16))
/ *(int *)(memory + 120);
[13432, 13425, 13439] *(_QWORD *)(memory + 136) = v12;
[13446, 13453, 13456, 13460, 13467] a1[77] = (const void *)*((_QWORD *)*a1 + 1);
[13474, 13481, 13488, 13493, 13496, 13501] v9 = jbd2_journal_bmap(memory, 0LL, &v15);
[13514, 13507] if ( !v9 )
goto LABEL_32;
[13520, 13530, 13526, 13528] inode = -v9;
}
[13537] goto LABEL_70;
}
[13244, 13255] inode = 2133571413LL;
}
else
{
[13108, 13119] inode = 2133571413LL;
}
}
else
{
[13026, 13037] inode = 2133571416LL;
}
}
}
else
{
[12610, 12621] inode = 2133571398LL;
}
}
else
{
[12548] inode = 2133571369LL;
}
[12559] goto LABEL_70;
}
[13542] v6 = 1;
[13552, 13569, 13566, 13559] if ( !a1[78] )
{
[13575, 13582, 13589, 13593, 13596, 13599] uuid_unparse(v19 + 208, v27);
[13632, 13604, 13637, 13611, 13644, 13618, 13622, 13629] a1[78] = (const void *)blkid_get_devname(a1[17], "UUID", v27);
[13665, 13658, 13651, 13668] if ( !a1[78] )
[13700, 13670, 13677, 13683, 13685, 13688, 13693] a1[78] = (const void *)blkid_devno_to_devname(*(unsigned int *)(v19 + 228));
}
[13721, 13714, 13707] v16 = a1[78];
[13728, 13736] if ( v16 )
{
[13788, 13781] v18 = unix_io_manager;
LABEL_32:
[13802, 13795] if ( v6 )
{
[13808] v8 = 1;
[13825, 13828, 13831, 13833, 13835, 13842, 13850, 13845, 13848, 13818] if ( (*((_DWORD *)a1 + 31) & 2) == 0 || (*((_DWORD *)a1 + 31) & 4) == 0 )
[13852] v8 = 3;
[13859, 13891, 13893, 13866, 13869, 13872, 13874, 13876, 13883, 13886] if ( (*((_DWORD *)a1 + 31) & 4) != 0 && (*((_DWORD *)a1 + 19) & 0x100) != 0 )
[13895] v8 &= ~2u;
[13920, 13927, 13933, 13902, 13945, 13940, 13909, 13942, 13913, 13948] inode = (*(long ( **)(const void *, _QWORD, const void **))(v18 + 16))(v16, v8, a1 + 77);
}
[13955, 13963] if ( inode )
goto LABEL_70;
[13987, 14020, 14022, 13991, 14025, 13998, 13969, 14001, 14004, 14006, 13976, 14013, 13983] (*(void ( **)(const void *, _QWORD))(*((_QWORD *)a1[77] + 1) + 32LL))(
a1[77],
*((unsigned int *)*a1 + 10));
[14034, 14027] if ( v6 )
{
[14050, 14053, 14055, 14060, 14063, 14065, 14040, 14047] v15 = (int)(ext2fs_journal_sb_start(*((unsigned int *)*a1 + 10)) - 1);
[14112, 14082, 14085, 14087, 14094, 14104, 14101, 14072, 14107, 14079] v11 = (int *)getblk(v20, v15, *((_DWORD *)*a1 + 10));
[14129, 14126, 14119] if ( !v11 )
{
[14131] inode = 2133571398LL;
[14142] goto LABEL_70;
}
[14147, 14154, 14157, 14162, 14167, 14172] ll_rw_block(0, 0LL, 1, (long *)&v11);
[14184, 14177, 14187, 14189] inode = v11[5];
[14204, 14196] if ( inode )
{
[14216, 14213, 14206] brelse((long)v11);
[14221] goto LABEL_70;
}
[14233, 14226, 14236] if ( v15 )
[14249, 14245, 14238] v3 = v11 + 10;
else
[14258, 14251, 14262] v3 = v11 + 266;
[14275, 14280, 14283, 14286, 14268] memcpy(dest, v3, sizeof(dest));
[14304, 14311, 14314, 14319, 14321, 14291, 14298, 14302] if ( dest[28] != -4269 || !ext2fs_has_feature_journal_dev((long)dest) )
{
[14337, 14342, 14345, 14323, 14330] fix_problem(a1, 18LL, v23);
[14350] inode = 2133571415LL;
[14368, 14361, 14371] brelse((long)v11);
[14376] goto LABEL_70;
}
[14402, 14409, 14381, 14413, 14418, 14388, 14421, 14391, 14424, 14395, 14429, 14431] if ( memcmp(&dest[52], (const void *)(*((_QWORD *)*a1 + 4) + 208LL), 0x10uLL) )
{
[14433, 14440, 14447, 14452, 14455] fix_problem(a1, 19LL, v23);
[14460] inode = 2133571415LL;
[14481, 14478, 14471] brelse((long)v11);
[14486] goto LABEL_70;
}
[14498, 14501, 14506, 14508, 14491] if ( ext2fs_has_feature_metadata_csum((long)dest) )
{
[14533, 14537, 14514, 14550, 14521, 14524, 14526] v4 = (long)(v15 ? v11 + 10 : v11 + 266);
[14556] v21 = v4;
[14563, 14570, 14573, 14580, 14585, 14588, 14591] memcpy(v24, *a1, sizeof(v24));
[14625, 14596, 14628, 14603, 14606, 14610, 14617, 14622] memcpy(v26, *((const void **)*a1 + 4), sizeof(v26));
[14640, 14633] v24[4] = (long)v26;
[14657, 14654, 14647] ext2fs_set_feature_metadata_csum((long)v26);
[14689, 14662, 14669, 14676, 14679, 14682, 14687] if ( !(unsigned int)ext2fs_superblock_csum_verify(v24, v21) )
{
[14720, 14691, 14698, 14705, 14710, 14713, 14718] if ( (unsigned int)fix_problem(a1, 74LL, v23) )
{
[14722, 14729, 14736, 14739, 14742] ext2fs_superblock_csum_set(v24, v21);
[14754, 14747, 14757] mark_buffer_dirty((long)v11);
}
}
}
[14769, 14762, 14772] brelse((long)v11);
[14784, 14777, 14787, 14792] v22 = ext2fs_blocks_count(dest);
[14804, 14799] v5 = -1;
[14816] if ( v22 <= 0xFFFFFFFF )
[14816, 14809] v5 = v22;
[14824, 14834, 14827] *(_DWORD *)(memory + 128) = v5;
[14840, 14851, 14847] ++v15;
}
[14882, 14885, 14888, 14858, 14893, 14865, 14868, 14875] v11 = (int *)getblk(v20, v15, *(_DWORD *)(memory + 120));
[14907, 14900, 14910] if ( v11 )
{
[14928, 14942, 14935] *(_QWORD *)(memory + 16) = v11;
[14960, 14953, 14946, 14964] *(_QWORD *)(memory + 24) = v11 + 10;
[14978, 14982, 14985, 14990, 14992, 14968, 14975] if ( ext2fs_has_feature_fast_commit(*((_QWORD *)*a1 + 4)) )
[15008, 15001, 14994, 15015] *(_QWORD *)(memory + 200) = ext4_fc_replay;
else
[15024, 15017] *(_QWORD *)(memory + 200) = 0LL;
[15049, 15042, 15035] *a2 = memory;
[15064, 15059, 15052, 15067] e2fsck_use_inode_shortcuts(a1, 0LL);
[15072, 15077] return 0LL;
}
[14912, 14923] inode = 2133571398LL;
}
else
{
[13760, 13738, 13745, 13752, 13757] fix_problem(a1, 17LL, v23);
[13776, 13765] inode = 2133571415LL;
}
}
else
{
[12337, 12326] inode = 2133571398LL;
}
LABEL_70:
[15101, 15098, 15093, 15086] e2fsck_use_inode_shortcuts(a1, 0LL);
[15113, 15106, 15116] if ( v13 )
[15128, 15125, 15118] ext2fs_free_mem(&v13);
[15140, 15133, 15143] if ( v12 )
[15152, 15145, 15155] ext2fs_free_mem(&v12);
[15160, 15170, 15167] if ( memory )
[15179, 15172, 15182] ext2fs_free_mem(&memory);
[15207, 15209, 15214, 15187, 15194, 15198] return inode;
[15215] }
// 67A0: using guessed type long e2fsck_allocate_memory(_QWORD, _QWORD, _QWORD);
// 67C0: using guessed type long ext2fs_free_mem(_QWORD);
// 67D0: using guessed type long ext2fs_blocks_count(_QWORD);
// 6850: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68E0: using guessed type long uuid_is_null(_QWORD);
// 68E8: using guessed type long e2fsck_use_inode_shortcuts(_QWORD, _QWORD);
// 68F0: using guessed type long ext2fs_block_iterate3(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 68F8: using guessed type long ext2fs_write_inode(_QWORD, _QWORD, _QWORD);
// 6900: using guessed type long uuid_unparse(_QWORD, _QWORD);
// 6908: using guessed type long blkid_get_devname(_QWORD, _QWORD, _QWORD);
// 6910: using guessed type long blkid_devno_to_devname(_QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// 6928: using guessed type long ext2fs_journal_sb_start(_QWORD);
// 6938: using guessed type long ext2fs_superblock_csum_verify(_QWORD, _QWORD);
// 6940: using guessed type long ext2fs_superblock_csum_set(_QWORD, _QWORD);
//----- (0000000000003B70) ----------------------------------------------------
long e2fsck_journal_fix_bad_inode(_DWORD *a1, long a2)
[15216] {
int v2; // eax
int v3; // edx
_BOOL4 has_feature_journal_needs_recovery; // [rsp+10h] [rbp-10h]
_BOOL4 has_feature_journal; // [rsp+14h] [rbp-Ch]
long v7; // [rsp+18h] [rbp-8h]
[15232, 15236, 15240, 15243, 15247, 15216, 15220, 15221, 15224, 15228] v7 = *(_QWORD *)(*(_QWORD *)a1 + 32LL);
[15265, 15270, 15251, 15255, 15258, 15262] has_feature_journal_needs_recovery = ext2fs_has_feature_journal_needs_recovery(v7);
[15273, 15277, 15280, 15284, 15287, 15292] has_feature_journal = ext2fs_has_feature_journal(*(_QWORD *)(*(_QWORD *)a1 + 32LL));
[15299, 15301, 15305, 15311, 15313, 15295] if ( has_feature_journal || *(_DWORD *)(v7 + 224) )
{
[15329, 15323, 15333, 15319] *(_DWORD *)(a2 + 8) = *(_DWORD *)(v7 + 224);
[15336, 15340, 15344, 15349, 15352, 15357, 15359] if ( (unsigned int)fix_problem(a1, 15LL, a2) )
{
[15369, 15365] if ( has_feature_journal )
{
[15371, 15383, 15381, 15375] if ( *(_DWORD *)(v7 + 224) )
[15392, 15385, 15397] printf("*** journal has been deleted ***\n\n");
}
[15409, 15402, 15406] ext2fs_clear_feature_journal(v7);
[15418, 15414] *(_DWORD *)(v7 + 224) = 0;
[15428, 15432, 15438, 15443, 15448, 15451] memset((void *)(v7 + 268), 0, 0x44uLL);
[15456, 15460] v2 = a1[18];
[15463] LOBYTE(v2) = v2 | 0x80;
[15465, 15467, 15471] a1[18] = v2;
[15481, 15474, 15478] v3 = *(_DWORD *)(*(_QWORD *)a1 + 16LL);
[15491] BYTE1(v3) &= ~2u;
[15488, 15484, 15494] *(_DWORD *)(*(_QWORD *)a1 + 16LL) = v3;
[15497, 15506, 15501, 15509] e2fsck_clear_recover(a1, 1);
[15514, 15519] return 0LL;
}
else
{
[15521, 15526] return 2133571504LL;
}
}
[15528, 15532] else if ( has_feature_journal_needs_recovery )
{
[15555, 15557, 15534, 15538, 15542, 15547, 15550] if ( (unsigned int)fix_problem(a1, 23LL, a2) )
{
[15568, 15563, 15571, 15559] e2fsck_clear_recover(a1, 1);
[15576, 15581] return 0LL;
}
else
{
[15588, 15583] return 2133571395LL;
}
}
else
{
[15590] return 0LL;
}
[15595, 15596] }
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (0000000000003CED) ----------------------------------------------------
unsigned long clear_v2_journal_fields(long a1)
[15597] {
int v1; // eax
_DWORD *v3; // [rsp+18h] [rbp-78h]
char v4[104]; // [rsp+20h] [rbp-70h] BYREF
unsigned long v5; // [rsp+88h] [rbp-8h]
[15619, 15628, 15597, 15601, 15602, 15605, 15612] v5 = __readfsqword(0x28u);
[15648, 15632, 15634, 15641, 15645] v3 = **(_DWORD ***)(a1 + 104);
[15656, 15659, 15652] clear_problem_context(v4);
[15680, 15685, 15687, 15664, 15668, 15672, 15677] if ( (unsigned int)fix_problem(v3, 42LL, v4) )
{
[15689, 15693] v1 = v3[18];
[15696] BYTE1(v1) |= 0x40u;
[15705, 15699, 15701] v3[18] = v1;
[15712, 15746, 15715, 15718, 15721, 15723, 15730, 15734, 15738, 15708, 15743] memset((void *)(*(_QWORD *)(a1 + 24) + 36LL), 0, (unsigned int)(*(_DWORD *)(*(_QWORD *)v3 + 40LL) - 36));
[15751, 15758, 15762, 15765, 15770] mark_buffer_dirty(*(_QWORD *)(a1 + 16));
}
[15777, 15786, 15788, 15793, 15773] return __readfsqword(0x28u) ^ v5;
[15794] }
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (0000000000003DB3) ----------------------------------------------------
long e2fsck_journal_load(long a1)
[15795] {
char *v1; // rax
int v3; // ebx
uint32_t v4; // eax
int v5; // ebx
int v6; // ebx
int v7; // ebx
long v8; // rbx
char *v9; // rax
long v10; // rbx
char *v11; // rax
uint32_t v12; // ebx
long v13; // rbx
char *v14; // rax
long v15; // rbx
long v16; // [rsp+18h] [rbp-98h] BYREF
_DWORD *v17; // [rsp+20h] [rbp-90h]
int *v18; // [rsp+28h] [rbp-88h]
char v19[104]; // [rsp+30h] [rbp-80h] BYREF
unsigned long v20; // [rsp+98h] [rbp-18h]
[15811, 15818, 15795, 15827, 15799, 15800, 15803, 15804] v20 = __readfsqword(0x28u);
[15840, 15844, 15847, 15831, 15833] v17 = **(_DWORD ***)(a1 + 104);
[15865, 15861, 15854] v16 = *(_QWORD *)(a1 + 16);
[15872, 15876, 15879] clear_problem_context(v19);
[15904, 15909, 15884, 15891, 15894, 15899] ll_rw_block(0, 0LL, 1, &v16);
[15921, 15914, 15924, 15926] if ( *(_DWORD *)(v16 + 20) )
{
[15928, 15935] v1 = gettext("reading journal superblock\n");
[15970, 15940, 15943, 15977, 15980, 15950, 15953, 15985, 15956, 15963, 15967] com_err(*((_QWORD *)v17 + 3), *(int *)(v16 + 20), "%s", v1);
[16000, 16002, 15997, 15990] return *(int *)(v16 + 20);
}
[16018, 16014, 16007] v18 = *(int **)(a1 + 24);
[16032, 16025] v3 = *v18;
[16034, 16044, 16046, 16039] if ( v3 != htonl(0xC03B3998) )
[16065, 16070, 16048, 16052, 16059, 16062] return e2fsck_journal_fix_bad_inode(v17, (long)v19);
[16082, 16075, 16085, 16087] v4 = ntohl(v18[1]);
[16092, 16095] if ( v4 == 5 )
[16095] return 2133571504LL;
[16104, 16101] if ( v4 > 5 )
[16403, 16398] return 2133571414LL;
[16113, 16110] if ( v4 == 4 )
{
[16256, 16249] *(_DWORD *)(a1 + 32) = 2;
[16292, 16315, 16263, 16295, 16299, 16270, 16273, 16305, 16275, 16308, 16280, 16313, 16283, 16285] if ( ntohl(v18[16]) > 1 && (unsigned int)uuid_is_null(*(_QWORD *)(*(_QWORD *)v17 + 32LL) + 208LL) )
[16324, 16317, 16327] clear_v2_journal_fields(a1);
[16352, 16332, 16339, 16342, 16344, 16349] if ( ntohl(v18[16]) > 1 )
{
[16354, 16358, 16365, 16370, 16373] fix_problem(v17, 16LL, v19);
[16378, 16383] return 2133571414LL;
}
}
else
{
[16128, 16122, 16131, 16119] if ( v4 <= 2 )
{
[16141, 16133, 16135] if ( !v4 )
[16135] return 2133571414LL;
[16393, 16388] return 2133571504LL;
}
[16146, 16155, 16162, 16149] *(_DWORD *)(a1 + 32) = 1;
[16193, 16195, 16197, 16169, 16204, 16207, 16176, 16209, 16179, 16211, 16181, 16183, 16218, 16221, 16190, 16223] if ( *(_QWORD *)(v18 + 9) || v18[11] || v18[16] )
[16244, 16236, 16229, 16239] clear_v2_journal_fields(a1);
}
[16425, 16419, 16412, 16422] if ( *(int *)(a1 + 32) > 1 )
{
[16434, 16427, 16438] v5 = *(_DWORD *)(*(_QWORD *)(a1 + 24) + 40LL);
[16451, 16453, 16455, 16441, 16446] if ( (v5 & (unsigned int)ext2fs_swab32(4294967232LL)) != 0 )
[16457, 16462] return 2133571395LL;
}
[16480, 16474, 16467, 16477] if ( *(int *)(a1 + 32) > 1 )
{
[16489, 16482, 16493] v6 = *(_DWORD *)(*(_QWORD *)(a1 + 24) + 44LL);
[16496, 16501, 16506, 16508, 16510] if ( (v6 & (unsigned int)ext2fs_swab32(0xFFFFFFFFLL)) != 0 )
[16512, 16517] return 2133571396LL;
}
[16548, 16551, 16522, 16556, 16558, 16529, 16532, 16537, 16539, 16541] if ( jbd2_has_feature_csum2(a1) && jbd2_has_feature_csum3(a1) )
[16560, 16565] return 2133571504LL;
[16577, 16580, 16585, 16587, 16589, 16596, 16599, 16570, 16604, 16606] if ( jbd2_journal_has_csum_v2or3(a1) && jbd2_has_feature_checksum(a1) )
[16608, 16613] return 2133571504LL;
[16672, 16664, 16674, 16643, 16645, 16647, 16618, 16654, 16667, 16625, 16661, 16632, 16635, 16638] if ( !e2fsck_journal_verify_csum_type(a1, (long)v18) || !e2fsck_journal_sb_csum_verify(a1, (long)v18) )
[16681, 16676] return 2133571504LL;
[16686, 16693, 16696, 16701, 16703] if ( jbd2_journal_has_csum_v2or3(a1) )
[16736, 16705, 16741, 16712, 16716, 16748, 16723, 16728, 16733] *(_DWORD *)(a1 + 196) = jbd2_chksum(a1, 0xFFFFFFFF, (long)(v18 + 12), 0x10u);
[16761, 16754] v7 = v18[3];
[16771, 16774, 16776, 16781, 16783, 16764] if ( v7 != htonl(*(_DWORD *)(a1 + 120)) )
{
[16792, 16785] v8 = *((_QWORD *)v17 + 3);
[16803, 16796] v9 = gettext("%s: no valid journal superblock found\n");
[16833, 16838, 16808, 16811, 16818, 16822, 16825, 16830] com_err(*((_QWORD *)v17 + 1), 2133571504LL, v9, v8);
[16848, 16843] return 2133571504LL;
}
[16865, 16870, 16877, 16883, 16853, 16885, 16860, 16863] if ( ntohl(v18[4]) >= *(_DWORD *)(a1 + 128) )
{
[16929, 16931, 16951, 16936, 16943, 16949, 16919, 16926] if ( ntohl(v18[4]) > *(_DWORD *)(a1 + 128) )
{
[16960, 16953] v10 = *((_QWORD *)v17 + 3);
[16971, 16964] v11 = gettext("%s: journal too short\n");
[16993, 16998, 17001, 17006, 16976, 16979, 16986, 16990] com_err(*((_QWORD *)v17 + 1), 2133571504LL, v11, v10);
[17016, 17011] return 2133571504LL;
}
}
else
{
[16897, 16899, 16904, 16911, 16917, 16887, 16894] *(_DWORD *)(a1 + 128) = ntohl(v18[4]);
}
[17028, 17031, 17033, 17038, 17045, 17021] *(_DWORD *)(a1 + 144) = ntohl(v18[6]);
[17064, 17058, 17051, 17071] *(_DWORD *)(a1 + 148) = *(_DWORD *)(a1 + 144);
[17089, 17094, 17096, 17103, 17077, 17084, 17087] *(_QWORD *)(a1 + 48) = ntohl(v18[7]);
[17124, 17126, 17133, 17107, 17114, 17117, 17119] *(_QWORD *)(a1 + 88) = ntohl(v18[5]);
[17152, 17154, 17137, 17144, 17147] if ( jbd2_has_feature_fast_commit(a1) )
{
[17160, 17167, 17170, 17172, 17177] v12 = ntohl(v18[4]);
[17186, 17189, 17194, 17196, 17198, 17203, 17179] if ( v12 - (unsigned int)jbd2_journal_get_num_fc_blks((long)v18) <= 0x3FF )
{
[17212, 17205] v13 = *((_QWORD *)v17 + 3);
[17216, 17223] v14 = gettext("%s: incorrect fast commit blocks\n");
[17250, 17253, 17258, 17228, 17231, 17238, 17242, 17245] com_err(*((_QWORD *)v17 + 1), 2133571504LL, v14, v13);
[17268, 17263] return 2133571504LL;
}
[17280, 17283, 17285, 17290, 17292, 17299, 17273] *(_QWORD *)(a1 + 72) = ntohl(v18[4]);
[17310, 17303] v15 = *(_QWORD *)(a1 + 72);
[17344, 17314, 17321, 17324, 17329, 17331, 17334, 17337] *(_QWORD *)(a1 + 96) = v15 - (int)jbd2_journal_get_num_fc_blks((long)v18);
[17348, 17355, 17359, 17363, 17370, 17374] *(_QWORD *)(a1 + 56) = *(_QWORD *)(a1 + 96) + 1LL;
}
else
{
[17376, 17411, 17383, 17415, 17386, 17388, 17424, 17393, 17426, 17395, 17402, 17406] *(_QWORD *)(a1 + 96) = ntohl(v18[4]);
}
[17431] return 0LL;
[17440, 17438, 17439] }
// 3EFA: conditional instruction was optimized away because eax.4<4u
// 3F15: conditional instruction was optimized away because eax.4==3
// 6770: using guessed type long ext2fs_swab32(_QWORD);
// 67B0: using guessed type long com_err(_QWORD, _QWORD, const char *, ...);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68E0: using guessed type long uuid_is_null(_QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (0000000000004421) ----------------------------------------------------
unsigned long e2fsck_journal_reset_super(long a1, uint32_t *a2, long a3)
[17441] {
int v3; // ebx
uint32_t v4; // ebx
uint32_t hostlong; // [rsp+20h] [rbp-40h]
int i; // [rsp+24h] [rbp-3Ch]
int v9[6]; // [rsp+30h] [rbp-30h] BYREF
unsigned long v10; // [rsp+48h] [rbp-18h]
[17441, 17475, 17445, 17446, 17449, 17450, 17454, 17458, 17462, 17466] v10 = __readfsqword(0x28u);
[17481, 17479] hostlong = 0;
[17488, 17492] v3 = *a2;
[17504, 17506, 17508, 17512, 17515, 17520, 17525, 17494, 17527, 17499] if ( v3 != htonl(0xC03B3998) || (v4 = a2[1], v4 != htonl(3u)) )
{
[17529, 17539, 17534, 17543] *a2 = htonl(0xC03B3998);
[17545, 17555, 17550, 17559] a2[1] = htonl(4u);
}
[17570, 17602, 17574, 17594, 17578, 17581, 17584, 17586, 17590, 17562, 17566, 17599] memset(a2 + 3, 0, *(unsigned int *)(*(_QWORD *)a1 + 40LL) - 12LL);
[17607, 17611, 17614, 17617, 17619, 17624, 17628] a2[3] = htonl(*(_DWORD *)(*(_QWORD *)a1 + 40LL));
[17635, 17641, 17643, 17648, 17652, 17631] a2[4] = htonl(*(_DWORD *)(a3 + 128));
[17665, 17660, 17669, 17655] a2[5] = htonl(1u);
[17672, 17676, 17679] uuid_generate(v9);
[17705, 17709, 17713, 17684, 17691] for ( i = 0; i <= 3; ++i )
[17696, 17698, 17693, 17702] hostlong ^= v9[i];
[17729, 17715, 17718, 17720, 17725] a2[6] = htonl(hostlong);
[17732, 17736, 17740, 17743, 17746] e2fsck_journal_sb_csum_set(a3, (long)a2);
[17762, 17755, 17759, 17751] mark_buffer_dirty(*(_QWORD *)(a3 + 16));
[17793, 17767, 17771, 17775, 17778, 17783, 17788] ll_rw_block(1, 0LL, 1, (long *)(a3 + 16));
[17798, 17799, 17803, 17812, 17814, 17819] return __readfsqword(0x28u) ^ v10;
[17824, 17825, 17823] }
// 6968: using guessed type long uuid_generate(_QWORD);
// 4421: using guessed type int var_30[6];
//----- (00000000000045A2) ----------------------------------------------------
long e2fsck_journal_fix_corrupt_super(_QWORD *a1, long a2, long a3)
[17826] {
int has_feature_journal_needs_recovery; // [rsp+24h] [rbp-Ch]
long v6; // [rsp+28h] [rbp-8h]
[17857, 17826, 17861, 17830, 17831, 17834, 17838, 17842, 17846, 17850, 17854] v6 = *(_QWORD *)(*a1 + 32LL);
[17865, 17869, 17872, 17876, 17879, 17884] has_feature_journal_needs_recovery = ext2fs_has_feature_journal_needs_recovery(v6);
[17891, 17894, 17899, 17901, 17887] if ( ext2fs_has_feature_journal(v6) )
{
[17924, 17926, 17903, 17907, 17911, 17916, 17919] if ( (unsigned int)fix_problem(a1, 21LL, a3) )
{
[17928, 17932, 17936, 17940, 17944, 17947, 17950] e2fsck_journal_reset_super((long)a1, *(uint32_t **)(a2 + 24), a2);
[17955, 17959] *(_DWORD *)(a2 + 148) = 1;
[17969, 17972, 17976, 17978, 17981] e2fsck_clear_recover(a1, has_feature_journal_needs_recovery);
[17986, 17991] return 0LL;
}
else
{
[17993, 17998] return 2133571504LL;
}
}
[18019, 18022, 18000, 18004, 18008, 18011, 18014] else if ( e2fsck_journal_fix_bad_inode(a1, a3) )
{
[18024, 18029] return 2133571504LL;
}
else
{
[18031] return 0LL;
}
[18036, 18037] }
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (0000000000004676) ----------------------------------------------------
long e2fsck_journal_release(long a1, long a2, int a3, int a4)
[18038] {
long v6; // [rsp+10h] [rbp-20h] BYREF
long v7; // [rsp+18h] [rbp-18h]
long v8; // [rsp+28h] [rbp-8h]
[18050, 18038, 18042, 18043, 18046] v7 = a1;
[18054] v6 = a2;
[18064, 18058, 18068, 18061] if ( a4 )
{
[18081, 18086, 18070, 18074, 18078] mark_buffer_clean(*(_QWORD *)(v6 + 16));
}
[18088, 18092, 18095, 18098, 18100] else if ( (*(_DWORD *)(v7 + 76) & 1) == 0 )
{
[18106, 18110, 18102] v8 = *(_QWORD *)(v6 + 24);
[18114, 18118, 18124, 18126, 18131, 18135] *(_DWORD *)(v8 + 24) = htonl(*(_DWORD *)(v6 + 144));
[18138, 18142] if ( a3 )
[18144, 18148] *(_DWORD *)(v8 + 28) = 0;
[18155, 18159, 18163, 18166, 18169] e2fsck_journal_sb_csum_set(v6, v8);
[18185, 18178, 18174, 18182] mark_buffer_dirty(*(_QWORD *)(v6 + 16));
}
[18201, 18194, 18190, 18198] brelse(*(_QWORD *)(v6 + 16));
[18217, 18210, 18220, 18206] if ( *(_QWORD *)(v7 + 616) )
{
[18241, 18245, 18249, 18222, 18256, 18226, 18259, 18229, 18232, 18234, 18238] if ( *(_QWORD *)v7 && *(_QWORD *)(*(_QWORD *)v7 + 8LL) != *(_QWORD *)(v7 + 616) )
[18272, 18276, 18280, 18284, 18291, 18261, 18294, 18265] (*(void ( **)(_QWORD))(*(_QWORD *)(*(_QWORD *)(v7 + 616) + 8LL) + 24LL))(*(_QWORD *)(v7 + 616));
[18296, 18300] *(_QWORD *)(v7 + 616) = 0LL;
}
[18322, 18315, 18325, 18311] if ( *(_QWORD *)(v6 + 136) )
[18337, 18331, 18340, 18327] ext2fs_free_mem(v6 + 136);
[18345, 18353, 18356, 18349] if ( *(_QWORD *)(v6 + 112) )
[18369, 18362, 18366, 18358] ext2fs_free_mem(v6 + 112);
[18374, 18378, 18381, 18386, 18387] return ext2fs_free_mem(&v6);
[18388] }
// 67C0: using guessed type long ext2fs_free_mem(_QWORD);
//----- (00000000000047D5) ----------------------------------------------------
long e2fsck_check_ext3_journal(const void **a1)
[18389] {
unsigned int v2; // eax
_BOOL4 v3; // eax
int v4; // edx
int v5; // eax
unsigned int v6; // [rsp+18h] [rbp-98h]
int v7; // [rsp+1Ch] [rbp-94h]
_BOOL4 has_feature_journal_needs_recovery; // [rsp+20h] [rbp-90h]
_BOOL4 v9; // [rsp+20h] [rbp-90h]
int v10; // [rsp+24h] [rbp-8Ch]
long v11; // [rsp+28h] [rbp-88h] BYREF
long journal; // [rsp+30h] [rbp-80h]
long v13; // [rsp+38h] [rbp-78h]
char v14[80]; // [rsp+40h] [rbp-70h] BYREF
long v15; // [rsp+90h] [rbp-20h]
unsigned long v16; // [rsp+A8h] [rbp-8h]
[18404, 18411, 18420, 18389, 18393, 18394, 18397] v16 = __readfsqword(0x28u);
[18433, 18436, 18440, 18424, 18426] v13 = *((_QWORD *)*a1 + 4);
[18466, 18444, 18451, 18454, 18458, 18461] has_feature_journal_needs_recovery = ext2fs_has_feature_journal_needs_recovery(*((_QWORD *)*a1 + 4));
[18472] v7 = 0;
[18563, 18565, 18482, 18492, 18496, 18499, 18504, 18506, 18508, 18515, 18517, 18521, 18527, 18529, 18531, 18535, 18541, 18543, 18545, 18549, 18555, 18558] if ( __PAIR64__(has_feature_journal_needs_recovery, 0) == ext2fs_has_feature_journal(v13)
&& !*(_DWORD *)(v13 + 224)
&& !*(_DWORD *)(v13 + 228)
&& (unsigned int)uuid_is_null(v13 + 208) )
{
return 0LL;
[18572, 18567] }
clear_problem_context(v14);
[18584, 18577, 18581] v15 = *(unsigned int *)(v13 + 224);
[18593, 18601, 18589, 18599] journal = e2fsck_get_journal(a1, &v11);
[18625, 18630, 18605, 18612, 18619, 18622] if ( journal )
[18634, 18639] {
if ( journal == 2133571369 || journal == 2133571370 || journal == 2133571413 || journal == 2133571416 )
[18659, 18661, 18669, 18671, 18641, 18679, 18649, 18651] return e2fsck_journal_fix_bad_inode(a1, (long)v14);
[18692, 18695, 18698, 18703, 18681, 18685] else
return journal;
[18712, 18708] }
else
{
journal = e2fsck_journal_load(v11);
[18724, 18717, 18732, 18727] if ( journal )
[18736, 18741] {
if ( journal == 2133571504
[18816, 18821, 18824, 18829, 18831, 18833, 18841, 18843, 18847, 18854, 18859, 18862, 18867, 18869, 18747, 18755, 18757, 18765, 18767, 18771, 18778, 18783, 18786, 18791, 18793, 18795, 18803, 18805, 18809] || journal == 2133571395 && !(unsigned int)fix_problem(a1, 38LL, v14)
|| journal == 2133571396 && !(unsigned int)fix_problem(a1, 37LL, v14)
|| journal == 2133571414 && !(unsigned int)fix_problem(a1, 39LL, v14) )
{
journal = e2fsck_journal_fix_corrupt_super(a1, v11, (long)v14);
[18882, 18889, 18892, 18895, 18900, 18871, 18878] }
e2fsck_journal_release((long)a1, v11, 0, 1);
[18918, 18923, 18928, 18931, 18904, 18911] return journal;
[18936, 18940] }
else
{
while ( !ext2fs_has_feature_journal(v13) )
[18946, 18950, 18953, 18958, 18960] {
v9 = ext2fs_has_feature_journal_needs_recovery(v13);
[18970, 18978, 18973, 18966] if ( !(unsigned int)fix_problem(a1, 22LL, v14) )
[19008, 19010, 18984, 18988, 18995, 19000, 19003] {
if ( (*((_DWORD *)a1 + 19) & 1) == 0 )
[19202, 19209, 19212, 19215, 19217] {
ext2fs_set_feature_journal(v13);
[19226, 19219, 19223] v4 = *((_DWORD *)*a1 + 4);
[19241, 19238, 19231] BYTE1(v4) &= ~2u;
[19254] *((_DWORD *)*a1 + 4) = v4;
[19257, 19251, 19244] ext2fs_mark_super_dirty(*a1);
[19273, 19267, 19260, 19270] }
break;
}
if ( !v9 || (unsigned int)fix_problem(a1, 23LL, v14) )
[19041, 19044, 19016, 19049, 19051, 19053, 19023, 19025, 19029, 19036] {
v3 = 1;
[19108, 19103] if ( !v9 )
[19062] {
v2 = *(_DWORD *)(v13 + 76) ? *(_DWORD *)(v13 + 84) : 11;
[19074, 19078, 19081, 19083, 19085, 19089, 19092] if ( v2 <= *(_DWORD *)(v13 + 224) )
[19064, 19099, 19068, 19101] v3 = 0;
[19062, 19055] }
v10 = v3;
[19115] *(_DWORD *)(v13 + 224) = 0;
[19121, 19125] *(_DWORD *)(v13 + 228) = 0;
[19139, 19135] memset((void *)(v13 + 208), 0, 0x10uLL);
[19169, 19172, 19149, 19153, 19159, 19164] e2fsck_clear_recover(a1, v10);
[19177, 19183, 19190, 19192, 19195] break;
[19200] }
}
if ( ext2fs_has_feature_journal(v13)
[19329, 19298, 19332, 19302, 19334, 19305, 19278, 19310, 19312, 19282, 19285, 19318, 19290, 19292, 19325] && !ext2fs_has_feature_journal_needs_recovery(v13)
&& *(_DWORD *)(*(_QWORD *)(v11 + 24) + 28LL) )
{
fix_problem(a1, 24LL, v14);
[19340, 19344, 19351, 19356, 19359] if ( a1[12] )
[19378, 19371, 19364, 19375] v6 = 44;
[19380, 19390] else
v6 = 43;
[19392] if ( (unsigned int)fix_problem(a1, v6, v14) )
[19424, 19429, 19431, 19402, 19406, 19412, 19419, 19421] {
v5 = *((_DWORD *)a1 + 19);
[19440, 19433] BYTE1(v5) |= 1u;
[19443] *((_DWORD *)a1 + 19) = v5;
[19448, 19446, 19455] ext2fs_set_feature_journal_needs_recovery(v13);
[19465, 19458, 19462] ext2fs_mark_super_dirty(*a1);
[19488, 19470, 19477, 19480, 19483] }
else if ( (unsigned int)fix_problem(a1, 25LL, v14) )
[19490, 19494, 19501, 19506, 19509, 19514, 19516] {
v7 = 1;
[19518] *(_WORD *)(v13 + 58) &= ~1u;
[19528, 19532, 19536, 19539, 19541, 19545] ext2fs_mark_super_dirty(*a1);
[19562, 19556, 19549, 19559] }
}
if ( !ext2fs_has_feature_journal_needs_recovery(v13) && *(_DWORD *)(*(_QWORD *)(v11 + 24) + 32LL) )
[19587, 19594, 19598, 19567, 19601, 19571, 19603, 19574, 19579, 19581] {
*(_WORD *)(*((_QWORD *)*a1 + 4) + 58LL) |= 2u;
[19619, 19623, 19630, 19633, 19605, 19637, 19640, 19612, 19615] ext2fs_mark_super_dirty(*a1);
[19657, 19651, 19644, 19654] *(_DWORD *)(*(_QWORD *)(v11 + 24) + 32LL) = 0;
[19673, 19669, 19662] e2fsck_journal_sb_csum_set(v11, *(_QWORD *)(v11 + 24));
[19680, 19687, 19691, 19698, 19701, 19704] mark_buffer_dirty(*(_QWORD *)(v11 + 16));
[19720, 19723, 19716, 19709] }
e2fsck_journal_release((long)a1, v11, v7, 0);
[19748, 19753, 19756, 19728, 19735, 19741] return journal;
[19778, 19780, 19761, 19765, 19769] }
}
}
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68E0: using guessed type long uuid_is_null(_QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (0000000000004D4B) ----------------------------------------------------
long recover_ext3_journal(const void **a1)
[19787] {
int inited; // eax
int v3; // eax
int v4; // eax
int v5; // eax
long v6; // [rsp+10h] [rbp-80h] BYREF
long journal; // [rsp+18h] [rbp-78h]
char v8[8]; // [rsp+20h] [rbp-70h] BYREF
int v9; // [rsp+28h] [rbp-68h]
unsigned long v10; // [rsp+88h] [rbp-8h]
[19809, 19818, 19787, 19791, 19792, 19795, 19802] v10 = __readfsqword(0x28u);
[19824, 19828, 19822, 19831] clear_problem_context(v8);
[19841, 19836] inited = jbd2_journal_init_revoke_record_cache();
[19843] journal = inited;
[19852, 19847] if ( inited )
[19858, 19854] return journal;
[19863] v3 = jbd2_journal_init_revoke_table_cache();
[19868, 19870] journal = v3;
[19874, 19879] if ( v3 )
[19881, 19885] return journal;
[19904, 19907, 19912, 19890, 19894, 19901] journal = e2fsck_get_journal(a1, &v6);
[19921, 19916] if ( journal )
[19923, 19927] return journal;
[19936, 19939, 19932, 19944] journal = e2fsck_journal_load(v6);
[19953, 19948] if ( !journal )
{
[19968, 19963, 19971, 19959] v4 = jbd2_journal_init_revoke(v6, 1024LL);
[19976, 19978] journal = v4;
[19987, 19982] if ( !v4 )
{
[20000, 19993, 19997] v5 = jbd2_journal_recover(v6);
[20009, 20005, 20007] journal = -v5;
[20018, 20013] if ( !v5 )
{
[20024, 20032, 20020, 20030] if ( *(_DWORD *)(v6 + 192) )
{
[20034, 20044, 20038] v9 = *(_DWORD *)(v6 + 192);
[20066, 20047, 20051, 20058, 20063] fix_problem(a1, 58LL, v8);
[20075, 20079, 20071] *(_DWORD *)(*(_QWORD *)(v6 + 24) + 32LL) = -22;
[20097, 20090, 20086, 20094] mark_buffer_dirty(*(_QWORD *)(v6 + 16));
}
[20102, 20106, 20110, 20116, 20122] *(_DWORD *)(v6 + 144) = *(_DWORD *)(v6 + 148);
}
}
}
[20138, 20131, 20135] jbd2_journal_destroy_revoke(v6);
[20143] jbd2_journal_destroy_revoke_record_cache();
[20148] jbd2_journal_destroy_revoke_table_cache();
[20164, 20169, 20174, 20177, 20153, 20157] e2fsck_journal_release((long)a1, v6, 1, 0);
[20199, 20201, 20206, 20182, 20186, 20190] return journal;
[20207] }
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// 6970: using guessed type long jbd2_journal_init_revoke_record_cache(void);
// 6978: using guessed type long jbd2_journal_init_revoke_table_cache(void);
// 6980: using guessed type long jbd2_journal_init_revoke(_QWORD, _QWORD);
// 6988: using guessed type long jbd2_journal_recover(_QWORD);
// 6990: using guessed type long jbd2_journal_destroy_revoke(_QWORD);
// 6998: using guessed type long jbd2_journal_destroy_revoke_record_cache(void);
// 69A0: using guessed type long jbd2_journal_destroy_revoke_table_cache(void);
// 4D4B: using guessed type char var_70[8];
//----- (0000000000004EF0) ----------------------------------------------------
long e2fsck_run_ext3_journal(const void **a1)
[20208] {
const void *v1; // rbx
char *v2; // rax
const void *v3; // rbx
char *v4; // rax
const void *v6; // rbx
char *v7; // rax
int v8; // edx
unsigned int v9; // [rsp+1Ch] [rbp-44h]
long v10; // [rsp+20h] [rbp-40h] BYREF
long v11; // [rsp+28h] [rbp-38h]
long v12; // [rsp+30h] [rbp-30h]
long v13; // [rsp+38h] [rbp-28h]
long v14; // [rsp+40h] [rbp-20h]
unsigned long v15; // [rsp+48h] [rbp-18h]
[20225, 20234, 20208, 20212, 20213, 20216, 20217, 20221] v15 = __readfsqword(0x28u);
[20238, 20240, 20244, 20247, 20251, 20255] v12 = *(_QWORD *)(*((_QWORD *)*a1 + 1) + 8LL);
[20266, 20259, 20269, 20263] v9 = *((_DWORD *)*a1 + 10);
[20272] v10 = 0LL;
[20280] v11 = 0LL;
[20288, 20292] v1 = a1[3];
[20296, 20303] v2 = gettext("%s: recovering journal\n");
[20314, 20308, 20319, 20311] printf(v2, v1);
[20324, 20328, 20331, 20334, 20336] if ( (*((_DWORD *)a1 + 19) & 1) != 0 )
{
[20338, 20342] v3 = a1[3];
[20353, 20346] v4 = gettext("%s: won't do journal recovery while read-only\n");
[20361, 20369, 20364, 20358] printf(v4, v3);
[20379, 20374] return 2133571405LL;
}
else
{
[20384, 20388, 20391, 20394, 20397, 20399] if ( (*((_DWORD *)*a1 + 4) & 4) != 0 )
[20408, 20401, 20411, 20405] ext2fs_flush(*a1);
[20416, 20428, 20420, 20423] v13 = recover_ext3_journal(a1);
[20450, 20453, 20455, 20459, 20462, 20432, 20466, 20436, 20470, 20439, 20474, 20443, 20477] if ( *(_QWORD *)(*((_QWORD *)*a1 + 4) + 376LL) && *(_QWORD *)(*(_QWORD *)(*((_QWORD *)*a1 + 1) + 8LL) + 80LL) )
[20513, 20483, 20516, 20486, 20519, 20490, 20494, 20498, 20502, 20505, 20509, 20479] (*(void ( **)(_QWORD, long *))(*(_QWORD *)(*((_QWORD *)*a1 + 1) + 8LL) + 80LL))(
*((_QWORD *)*a1 + 1),
&v10);
[20521, 20525, 20528, 20530, 20534, 20538, 20541] if ( v10 && *(_QWORD *)(v10 + 16) )
[20555, 20547, 20551, 20543] v11 = *(_QWORD *)(v10 + 16) >> 10;
[20569, 20563, 20566, 20559] ext2fs_mmp_stop(*a1);
[20584, 20578, 20581, 20574] ext2fs_free(*a1);
[20640, 20611, 20643, 20648, 20617, 20589, 20621, 20593, 20625, 20596, 20629, 20637, 20600, 20635, 20604, 20632, 20607] v14 = ext2fs_open(a1[2], *((unsigned int *)a1 + 32), (unsigned int)a1[12], v9, v12, a1);
[20657, 20652] if ( v14 )
{
[20659, 20663] v6 = a1[3];
[20674, 20667] v7 = gettext("while trying to re-open %s");
[20705, 20679, 20682, 20686, 20690, 20694, 20697, 20700] com_err(a1[1], v14, v7, v6);
[20714, 20722, 20710, 20719] fatal_error(a1, 0LL);
}
[20738, 20731, 20734, 20727] *((_QWORD *)*a1 + 28) = a1;
[20745, 20749, 20752, 20756, 20763] *((_QWORD *)*a1 + 23) = a1[105];
[20777, 20770, 20774] v8 = *((_DWORD *)*a1 + 4);
[20787] BYTE1(v8) |= 2u;
[20784, 20780, 20790] *((_DWORD *)*a1 + 4) = v8;
[20800, 20804, 20811, 20815, 20818, 20822, 20793, 20826, 20829, 20797] *(_QWORD *)(*((_QWORD *)*a1 + 4) + 376LL) += v11;
[20836, 20841, 20844, 20847, 20851, 20853, 20856] e2fsck_clear_recover(a1, v13 != 0);
[20865, 20873, 20868, 20861] v14 = e2fsck_check_ext3_journal(a1);
[20882, 20877] if ( v14 )
[20888, 20884] return v14;
else
[20898, 20907, 20909, 20890, 20894] return v13;
}
[20920, 20914, 20918, 20919] }
// 67B0: using guessed type long com_err(_QWORD, _QWORD, const char *, ...);
// 68B0: using guessed type long ext2fs_flush(_QWORD);
// 69A8: using guessed type long ext2fs_mmp_stop(_QWORD);
// 69B0: using guessed type long ext2fs_free(_QWORD);
// 69B8: using guessed type long ext2fs_open(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 69C0: using guessed type long fatal_error(_QWORD, _QWORD);
//----- (00000000000051B9) ----------------------------------------------------
unsigned long e2fsck_move_ext3_journal(long a1)
[20921] {
int v1; // eax
unsigned int v2; // eax
int v3; // eax
int v4; // eax
unsigned int v6; // [rsp+14h] [rbp-12Ch] BYREF
int v7; // [rsp+18h] [rbp-128h] BYREF
unsigned int v8; // [rsp+1Ch] [rbp-124h]
long bitmaps; // [rsp+20h] [rbp-120h]
const char **i; // [rsp+28h] [rbp-118h]
long v11; // [rsp+30h] [rbp-110h]
long v12; // [rsp+38h] [rbp-108h]
long v13[14]; // [rsp+40h] [rbp-100h] BYREF
char v14[4]; // [rsp+B0h] [rbp-90h] BYREF
int v15; // [rsp+B4h] [rbp-8Ch]
int v16; // [rsp+C4h] [rbp-7Ch]
short v17; // [rsp+CAh] [rbp-76h]
_BYTE v18[68]; // [rsp+D8h] [rbp-68h] BYREF
int v19; // [rsp+11Ch] [rbp-24h]
unsigned long v20; // [rsp+138h] [rbp-8h]
[20929, 20936, 20943, 20952, 20921, 20925, 20926] v20 = __readfsqword(0x28u);
[20965, 20968, 20972, 20956, 20958] v11 = *(_QWORD *)(*(_QWORD *)a1 + 32LL);
[20986, 20979, 20989] v12 = *(_QWORD *)a1;
[21003, 20996, 21006] clear_problem_context(v13);
[21011, 21018, 21021, 21024, 21026, 21032, 21039, 21045, 21047, 21053, 21060, 21063, 21068, 21070, 21076, 21083, 21089, 21096, 21103, 21105, 21108, 21113, 21116] if ( (*(_DWORD *)(a1 + 76) & 1) == 0
&& *(_DWORD *)(v11 + 224)
&& ext2fs_has_feature_journal(v11)
&& !ext2fs_read_inode(v12, *(unsigned int *)(v11 + 224), v14) )
{
[21122, 21129, 21136, 21138, 21140, 21147, 21154, 21156, 21162, 21169, 21176, 21183, 21187, 21192, 21195, 21198, 21203, 21205, 21211, 21218, 21225, 21230, 21233, 21238, 21240] if ( (!*(_BYTE *)(v11 + 253) || *(_BYTE *)(v11 + 253) == 1 && memcmp(v18, (const void *)(v11 + 268), 0x3CuLL))
&& (unsigned int)fix_problem(a1, 45LL, v13) )
{
[21281, 21253, 21259, 21278, 21266, 21270, 21275, 21246] memcpy((void *)(v11 + 268), v18, 0x3CuLL);
[21296, 21289, 21286] *(_DWORD *)(v11 + 328) = v19;
[21315, 21308, 21302] *(_DWORD *)(v11 + 332) = v15;
[21328, 21321] *(_BYTE *)(v11 + 253) = 1;
[21345, 21342, 21335] ext2fs_mark_super_dirty(v12);
[21357, 21350] v1 = *(_DWORD *)(v12 + 16);
[21360] BYTE1(v1) &= ~2u;
[21363, 21372, 21365] *(_DWORD *)(v12 + 16) = v1;
}
[21382, 21388, 21391, 21397, 21401, 21405, 21375] if ( *(_DWORD *)(v11 + 224) != 8 && v17 == 1 )
{
[21440, 21411, 21418, 21422, 21429, 21432, 21435] bitmaps = ext2fs_check_if_mounted(*(_QWORD *)(a1 + 16), &v7);
[21472, 21447, 21455, 21461, 21467, 21470] if ( !bitmaps && (v7 & 1) == 0 )
{
[21602, 21478, 21610, 21485, 21617, 21492, 21620, 21623, 21629] for ( i = (const char **)journal_names; *i; ++i )
{
[21504, 21507, 21501, 21494] v2 = strlen(*i);
[21538, 21541, 21512, 21514, 21547, 21549, 21521, 21554, 21524, 21557, 21562, 21531] bitmaps = ext2fs_lookup(v12, 2LL, *i, v2, 0LL, &v6);
[21600, 21569, 21577, 21579, 21586, 21592, 21598] if ( !bitmaps && *(_DWORD *)(v11 + 224) == v6 )
break;
}
[21632, 21642, 21645, 21639] if ( *i )
{
[21666, 21658, 21651, 21661] bitmaps = ext2fs_read_bitmaps(v12);
[21673, 21681] if ( !bitmaps )
{
[21697, 21694, 21687] v13[12] = (long)*i;
[21731, 21733, 21704, 21711, 21718, 21723, 21726] if ( (unsigned int)fix_problem(a1, 40LL, v13) )
{
[21762, 21768, 21739, 21773, 21776, 21745, 21781, 21752, 21755] bitmaps = ext2fs_unlink(v12, 2LL, *i, v6, 0LL);
[21788, 21796] if ( bitmaps )
goto LABEL_26;
[21824, 21829, 21802, 21809, 21816, 21821] bitmaps = ext2fs_write_inode(v12, 8LL, v14);
[21836, 21844] if ( bitmaps )
goto LABEL_26;
[21857, 21850] *(_DWORD *)(v11 + 224) = 8;
[21874, 21867, 21877] ext2fs_mark_super_dirty(v12);
[21889, 21882] v3 = *(_DWORD *)(v12 + 16);
[21892] BYTE1(v3) &= ~2u;
[21904, 21897, 21895] *(_DWORD *)(v12 + 16) = v3;
[21907] v17 = 0;
[21920, 21913, 21927] v16 = *(_QWORD *)(a1 + 840);
[21952, 21955, 21960, 21930, 21936, 21943, 21950] bitmaps = ext2fs_write_inode(v12, v6, v14);
[21975, 21967] if ( bitmaps )
{
LABEL_26:
[22160, 22153] v13[0] = bitmaps;
[22181, 22186, 22189, 22167, 22174] fix_problem(a1, 41LL, v13);
[22209, 22216, 22220, 22223, 22194, 22201, 22205] *(_WORD *)(*(_QWORD *)(v12 + 32) + 58LL) &= ~1u;
[22242, 22234, 22227, 22237] ext2fs_mark_super_dirty(v12);
}
else
{
[21987, 21994, 21996, 21999, 22004, 21981] v8 = ext2fs_group_of_ino(v12, v6);
[22016, 22023, 22027, 22029, 22032, 22010] ext2fs_unmark_inode_bitmap2(*(_QWORD *)(v12 + 80), v6);
[22044, 22037, 22047] ext2fs_mark_ib_dirty(v12);
[22052, 22058, 22065, 22067, 22070] v4 = ext2fs_bg_free_inodes_count(v12, v8);
[22084, 22091, 22093, 22096, 22075, 22078] ext2fs_bg_free_inodes_count_set(v12, v8, (unsigned int)(v4 + 1));
[22114, 22116, 22119, 22101, 22107] ext2fs_group_desc_csum_set(v12, v8);
[22144, 22124, 22131, 22135, 22138, 22141] ++*(_DWORD *)(*(_QWORD *)(v12 + 32) + 16LL);
}
}
}
}
}
}
}
[22279, 22281, 22286, 22266, 22270] return __readfsqword(0x28u) ^ v20;
[22287] }
// 5B80: using guessed type char *journal_names[4];
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
// 6848: using guessed type long ext2fs_unlink(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 6850: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 6898: using guessed type long ext2fs_unmark_inode_bitmap2(_QWORD, _QWORD);
// 68A0: using guessed type long ext2fs_mark_ib_dirty(_QWORD);
// 68A8: using guessed type long ext2fs_read_bitmaps(_QWORD);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68F8: using guessed type long ext2fs_write_inode(_QWORD, _QWORD, _QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// 69C8: using guessed type long ext2fs_check_if_mounted(_QWORD, _QWORD);
// 69D8: using guessed type long ext2fs_lookup(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 69E0: using guessed type long ext2fs_group_of_ino(_QWORD, _QWORD);
// 69E8: using guessed type long ext2fs_bg_free_inodes_count(_QWORD, _QWORD);
// 69F0: using guessed type long ext2fs_bg_free_inodes_count_set(_QWORD, _QWORD, _QWORD);
// 69F8: using guessed type long ext2fs_group_desc_csum_set(_QWORD, _QWORD);
//----- (0000000000005710) ----------------------------------------------------
long e2fsck_fix_ext3_journal_hint(_QWORD *a1)
[22288] {
long v2; // [rsp+10h] [rbp-140h]
char *file; // [rsp+18h] [rbp-138h]
char v4[80]; // [rsp+20h] [rbp-130h] BYREF
__dev_t st_rdev; // [rsp+70h] [rbp-E0h]
struct stat v6; // [rsp+90h] [rbp-C0h] BYREF
char v7[40]; // [rsp+120h] [rbp-30h] BYREF
unsigned long v8; // [rsp+148h] [rbp-8h]
[22310, 22319, 22288, 22292, 22293, 22296, 22303] v8 = __readfsqword(0x28u);
[22339, 22323, 22325, 22332, 22335] v2 = *(_QWORD *)(*a1 + 32LL);
[22372, 22346, 22378, 22381, 22353, 22386, 22356, 22388, 22361, 22363, 22365] if ( !ext2fs_has_feature_journal(v2) || (unsigned int)uuid_is_null(v2 + 208) )
[22395, 22390] return 0LL;
[22400, 22407, 22414, 22418, 22421, 22424] uuid_unparse(v2 + 208, v7);
[22436, 22443, 22447, 22454, 22457, 22429, 22462] file = (char *)blkid_get_devname(a1[17], "UUID", v7);
[22477, 22469] if ( !file )
[22484, 22479] return 0LL;
[22496, 22503, 22506, 22509, 22514, 22516, 22489] if ( stat(file, &v6) >= 0 )
{
[22563, 22565, 22568, 22543, 22550, 22557] if ( v6.st_rdev != *(_DWORD *)(v2 + 228) )
{
[22577, 22570, 22580] clear_problem_context(v4);
[22592, 22585] st_rdev = v6.st_rdev;
[22626, 22628, 22599, 22606, 22613, 22618, 22621] if ( (unsigned int)fix_problem(a1, 51LL, v4) )
{
[22646, 22637, 22630, 22639] *(_DWORD *)(v2 + 228) = v6.st_rdev;
[22665, 22659, 22652, 22662] ext2fs_mark_super_dirty(*a1);
}
}
[22680, 22677, 22670] free(file);
[22690, 22694, 22703, 22705, 22685] return 0LL;
}
else
{
[22528, 22525, 22518] free(file);
[22538, 22533] return 0LL;
}
[22710, 22711] }
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68E0: using guessed type long uuid_is_null(_QWORD);
// 6900: using guessed type long uuid_unparse(_QWORD, _QWORD);
// 6908: using guessed type long blkid_get_devname(_QWORD, _QWORD, _QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// nfuncs=174 queued=93 decompiled=93 lumina nreq=0 worse=0 better=0
// ALL OK, 93 function(s) have been successfully decompiled
|
int strxf_share(unsigned long a0) {
[720] if (a0 == 2) {
[720, 724] g_403fc4 = 0;
[896] str.9935 = 1919251317;
[910, 903] return &str.9935;
[920] } else if (!([D] amd64g_calculate_condition(0x6<64>, 0x5<64>, Conv(8->64, dil<1>), 0x2<64>, cc_ndep<8>))) {
if (a0 == 3) {
[768, 772] g_403fc6 = 0;
[779, 774] *(&g_403fc4) = 25973;
[786, 774] str.9935 = 1902734965;
[800, 793] return &str.9935;
[810] }
__sprintf_chk(&str.9935, 0x1);
[838, 843, 816, 850, 820, 824, 829, 831] return &str.9935;
[866, 855, 862] } else {
if (!a0) {
str.9935 = 7958113;
[872] return &str.9935;
[889, 882] }
*(&str.9935) = 31084746137363827;
[741, 751] return &str.9935;
[765, 758] }
}
|
int strxf_share(unsigned long a0) {
[1135] if (a0 == 3) {
[1152, 1156, 1159, 1135, 1139, 1140, 1143, 1147, 1149] strcpy(&str.9277, "unique");
[1264, 1250, 1257] } else {
if (a0 <= 3) {
[1161, 1164] if (a0 == 2) {
[1169, 1166] strcpy(&str.9277, "user");
[1236, 1243, 1229] goto LABEL_400516;
[1248] } else if (a0 <= 2) {
[1171, 1174] if (!a0) {
strcpy(&str.9277, "any");
[1201, 1187, 1194] goto LABEL_400516;
[1206] }
if (a0 == 1) {
[1180, 1183] strcpy(&str.9277, "session");
[1222, 1208, 1215] goto LABEL_400516;
[1227] }
}
}
sprintf(&str.9277, "%u", a0);
[1284, 1291, 1296, 1271, 1275, 1277] }
LABEL_400516:
return &str.9277;
}
|
long long rijndaelEncrypt(unsigned int a0[4], unsigned long a1, char a2[16], unsigned int a3[4]) {
[2832] int tmp_161; // tmp #161
[2832] int tmp_256; // tmp #256
[2832] int tmp_259; // tmp #259
[2832] unsigned int v0; // [bp-0x8c]
[2832] int tmp_349; // tmp #349
[2832] int tmp_449; // tmp #449
[2832] int tmp_19; // tmp #19
[2832] int tmp_362; // tmp #362
[2832] unsigned int v1; // [bp-0x88]
[2832] unsigned int v2; // [bp-0x84]
[2832] unsigned int v3; // [bp-0x80]
[2832] unsigned int v4; // [bp-0x7c]
[2832] unsigned int v5; // [bp-0x78]
[2832] unsigned int v6; // [bp-0x74]
[2832] unsigned int v7; // [bp-0x70]
[2832] unsigned int v8; // [bp-0x6c]
[2832] unsigned long v9; // [bp-0x68], Other Possible Types: unsigned int
[2832] unsigned int v10; // [bp-0x60]
[2832] unsigned int v11; // [bp-0x5c]
[2832] unsigned int v12[4]; // [bp-0x58]
[2832] unsigned int v13; // [bp-0x48], Other Possible Types: char
[2832] unsigned int v14; // [bp-0x44]
[2832] char v15; // [bp-0x40], Other Possible Types: unsigned int
[2832] unsigned int v16; // [bp-0x3c], Other Possible Types: char
[2832] unsigned long long v19; // rbx
[2832] unsigned long long v20; // rbx
[2832] unsigned int v21; // edx
[2832] unsigned int *v24; // r15
[2832] unsigned long long v25; // r8
[2832] unsigned long long v26; // r9
[2832] unsigned long long v27; // rsi
[2832] unsigned long long v28; // rax
[2832] unsigned long long v29; // rax
[2832]
[2832] *(&v12[0]) = a0;
[2880, 2884, 2887, 2891, 2893, 2898, 2846, 2853, 2855, 2862, 2864, 2871, 2872, 2879] v11 = a1 >> 1;
[2832, 2836, 2838, 2903, 2841, 2906, 2843, 2910, 2914, 2919, 2921, 2925, 2930] v19 = a2[3] ^ a0[0] ^ (a2[0] * 0x1000000) ^ (a2[1] * 0x10000) ^ (a2[2] * 0x100);
[2945, 2947, 2951, 2954, 2891, 2903, 2919, 2935, 2939, 2942] v25 = a2[7] ^ a0[1] ^ (a2[4] * 0x1000000) ^ (a2[5] * 0x10000) ^ (a2[6] * 0x100);
[2956, 2960, 2963, 2966, 2906, 2970, 2973, 2976, 2980, 2983] v26 = a2[11] ^ a0[2] ^ (a2[8] * 0x1000000) ^ (a2[9] * 0x10000) ^ (a2[10] * 0x100);
[3010, 3013, 2986, 2990, 2993, 2996, 2935, 3000, 3003, 3006] v27 = a2[15] ^ a0[3] ^ (a2[12] * 0x1000000) ^ (a2[13] * 0x10000) ^ (a2[14] * 0x100);
[3016, 3020, 3023, 3025, 3029, 3032, 3034, 3038, 3041, 2939] v9 = &a0[2 * (a1 >> 1)];
[3043, 3047, 3051, 3055, 2832, 3058, 2836, 2838, 2841, 2843] while (true) {
[3204] tmp_161 = v19;
[3204, 3206, 3210, 3213] a0 += 2;
[3217, 3220] tmp_256 = *((&Te0 + 4 * (v19 >> 24))) ^ *((&Te3 + 4 * v27)) ^ a0[1] ^ *((&Te1 + 4 * (v25 >> 16))) ^ *((&Te2 + 4 * (v26 >> 8)));
[3210, 3217, 3224, 3228, 3232, 3235, 3238, 3241, 3244, 3249, 3252, 3256, 3259, 3262] tmp_259 = v19;
[3265] v20 = v19 / 0x10000;
[3268] v0 = tmp_256;
[3296, 3271, 3275, 3278, 3283, 3287, 3290, 3293] tmp_349 = *((&Te0 + 4 * (v25 >> 24))) ^ *((&Te3 + 4 * tmp_161)) ^ a0[3] ^ *((&Te1 + 4 * (v26 >> 16))) ^ *((&Te2 + 4 * (v27 >> 8)));
[3328, 3332, 3337, 3340, 3343, 3347, 3351, 3356, 3359, 3364, 3368, 3370, 3372, 3375, 3380, 3383, 3387, 3390, 3393, 3397, 3399, 3402, 3405, 3409, 3412, 3415, 3418, 3422, 3426, 3429, 3434, 3437, 3440, 3443, 3447, 3451, 3455, 3458, 3463, 3466, 3469, 3473, 3477, 3481, 3486, 3490, 3494, 3498, 3502, 3506, 3509, 3513, 3259, 3517, 3520, 3523, 3527, 3530, 3534, 3278, 3539, 3287, 3290, 3301, 3304, 3309, 3311, 3314, 3318, 3321, 3325] a3[0] = *((&Te0 + 4 * (v25 >> 24))) ^ *((&Te3 + 4 * tmp_161)) ^ a0[3] ^ *((&Te1 + 4 * (v26 >> 16))) ^ *((&Te2 + 4 * (v27 >> 8)));
[3328, 3332, 3337, 3340, 3343, 3347, 3351, 3356, 3359, 3364, 3368, 3370, 3372, 3375, 3380, 3383, 3387, 3390, 3393, 3397, 3399, 3402, 3405, 3409, 3412, 3415, 3418, 3422, 3426, 3429, 3434, 3437, 3440, 3443, 3447, 3451, 3455, 3458, 3463, 3466, 3469, 3473, 3477, 3481, 3486, 3490, 3494, 3498, 3502, 3506, 3509, 3513, 3259, 3517, 3520, 3523, 3527, 3530, 3534, 3278, 3539, 3287, 3290, 3301, 3304, 3309, 3311, 3314, 3318, 3321, 3325] tmp_449 = *((&Te0 + 4 * (v27 >> 24))) ^ *((&Te3 + 4 * v26)) ^ a0[1] ^ *((&Te1 + 4 * v20));
[3368, 3340, 3351, 3356, 3359] v21 = *((&Te0 + 4 * (v26 >> 24))) ^ *((&Te3 + 4 * v25)) ^ a0[2] ^ *((&Te1 + 4 * (v27 >> 16))) ^ *((&Te2 + 4 * tmp_259));
[3332, 3372, 3375, 3347, 3383, 3325] v1 = (*((&Te0 + 4 * (v25 >> 24))) ^ *((&Te3 + 4 * tmp_161)) ^ a0[3] ^ *((&Te1 + 4 * (v26 >> 16))) ^ *((&Te2 + 4 * (v27 >> 8)))) >> 24;
[3328, 3332, 3337, 3340, 3343, 3347, 3351, 3356, 3359, 3364, 3368, 3370, 3372, 3375, 3380, 3383, 3387, 3390, 3393, 3397, 3399, 3402, 3405, 3409, 3412, 3415, 3418, 3422, 3426, 3429, 3434, 3437, 3440, 3443, 3447, 3451, 3455, 3458, 3463, 3466, 3469, 3473, 3477, 3481, 3486, 3490, 3494, 3498, 3502, 3506, 3509, 3513, 3259, 3517, 3520, 3523, 3527, 3530, 3278, 3534, 3539, 3287, 3290, 3301, 3304, 3309, 3311, 3314, 3318, 3321, 3325] *(&v27) = (*((&Te0 + 4 * (v26 >> 24))) ^ *((&Te3 + 4 * v25)) ^ a0[2] ^ *((&Te1 + 4 * (v27 >> 16))) ^ *((&Te2 + 4 * tmp_259))) >> 16;
[3332, 3402, 3372, 3375, 3347, 3383, 3325] *(&v20) = tmp_449 ^ *((&Te2 + 4 * (v25 >> 8)));
[3232, 3405] v2 = v27;
[3429] v10 = v9;
[3437, 3440, 3443, 3447] v24 = tmp_349 / 0x10000;
[3451] v4 = v9 >> 24;
[3458, 3443, 3455] v3 = *(&v15);
[3463, 3466, 3469, 3473, 3477] *(&v27) = v0;
[3481] v7 = *(&v15) >> 24;
[3490, 3466, 3486] v5 = *(&v15) >> 16;
[3473, 3494, 3498] v6 = v0 >> 8;
[3506, 3509, 3502] v0 >>= 16;
[3520, 3523, 3513, 3517] v8 = *(&v13);
[3530, 3527] if (a0 == v9)
[3539, 3534] break;
[3539, 3534] v19 = *((&Te2 + 4 * v10)) ^ *((&Te0 + 4 * *(&v16))) ^ *((&Te3 + 4 * *(&v15))) ^ a0[0] ^ *((&Te1 + 0x4 * v24));
[3072, 3076, 3080, 3085, 3088, 3092, 3097, 3101, 3104, 3108] v25 = *((&Te0 + 4 * v1)) ^ *((&Te3 + 4 * v10)) ^ a0[1] ^ *((&Te1 + 4 * v2)) ^ *((&Te2 + 4 * v3));
[3137, 3111, 3115, 3119, 3124, 3128, 3133] v26 = *((&Te0 + 4 * v4)) ^ *((&Te3 + 4 * *(&v13))) ^ a0[2] ^ *((&Te1 + 4 * v5)) ^ *((&Te2 + 4 * v6));
[3172, 3141, 3145, 3149, 3153, 3158, 3163, 3167] v27 = *((&Te0 + 4 * v7)) ^ *((&Te3 + 4 * v9)) ^ a0[3] ^ *((&Te1 + 4 * v0)) ^ *((&Te2 + 4 * v8));
[3328, 3332, 3337, 3340, 3343, 3347, 3351, 3356, 3359, 3364, 3368, 3370, 3372, 3375, 3380, 3383, 3387, 3390, 3393, 3397, 3399, 3402, 3405, 3409, 3412, 3415, 3418, 3422, 3426, 3429, 3176, 3434, 3180, 3184, 3188, 3192, 3195, 3200, 3204, 3206, 3210, 3213, 3217, 3220, 3224, 3228, 3232, 3235, 3238, 3241, 3244, 3249, 3252, 3256, 3259, 3262, 3265, 3268, 3271, 3275, 3278, 3283, 3287, 3290, 3293, 3296, 3301, 3304, 3309, 3311, 3314, 3318, 3321, 3325] }
tmp_19 = v10;
v10 = v27;
v16 = tmp_256 >> 24;
v15 = v20;
v14 = tmp_19;
v13 = a3[0];
v9 = v21;
v28 = __addvsi3(v11, 0xffffffff);
a3[0] = (a0[0] ^ (*((&Te0 + 4 * v14)) & 0xff00 | *(&Te1 + 4 * *(&v15))) ^ (*((&Te2 + 4 * v16)) & -0x1000000 | *((&Te3 + 0x4 * v24)) & 0xff0000)) * 0x1000000 | (a0[0] ^ (*((&Te0 + 4 * v14)) & 0xff00 | *(&Te1 + 4 * *(&v15))) ^ (*((&Te2 + 4 * v16)) & -0x1000000 | *((&Te3 + 0x4 * v24)) & 0xff0000)) * 0x100 & 0xff0000 | (a0[0] ^ (*((&Te0 + 4 * v14)) & 0xff00 | *(&Te1 + 4 * *(&v15))) ^ (*((&Te2 + 4 * v16)) & -0x1000000 | *((&Te3 + 0x4 * v24)) & 0xff0000)) >> 8 & 0xff00 | (a0[0] ^ (*((&Te0 + 4 * v14)) & 0xff00 | *(&Te1 + 4 * *(&v15))) ^ (*((&Te2 + 4 * v16)) & -0x1000000 | *((&Te3 + 0x4 * v24)) & 0xff0000)) >> 24 & 255;
tmp_362 = *((&Te0 + 4 * v6));
a3[1] = ((*((&Te0 + 4 * v3)) & 0xff00 | *(&Te1 + 4 * v10)) ^ v12[2 + 2 * v28 + 1] ^ (*((&Te2 + 4 * v1)) & -0x1000000 | *((&Te3 + 4 * v2)) & 0xff0000)) * 0x1000000 | ((*((&Te0 + 4 * v3)) & 0xff00 | *(&Te1 + 4 * v10)) ^ v12[2 + 2 * v28 + 1] ^ (*((&Te2 + 4 * v1)) & -0x1000000 | *((&Te3 + 4 * v2)) & 0xff0000)) * 0x100 & 0xff0000 | ((*((&Te0 + 4 * v3)) & 0xff00 | *(&Te1 + 4 * v10)) ^ v12[2 + 2 * v28 + 1] ^ (*((&Te2 + 4 * v1)) & -0x1000000 | *((&Te3 + 4 * v2)) & 0xff0000)) >> 8 & 0xff00 | ((*((&Te0 + 4 * v3)) & 0xff00 | *(&Te1 + 4 * v10)) ^ v12[2 + 2 * v28 + 1] ^ (*((&Te2 + 4 * v1)) & -0x1000000 | *((&Te3 + 4 * v2)) & 0xff0000)) >> 24 & 255;
a3[2] = ((*((&Te2 + 4 * v4)) & -0x1000000 | *((&Te3 + 4 * v5)) & 0xff0000) ^ (tmp_362 & 0xff00 | *(&Te1 + 4 * *(&v13))) ^ v12[2 + 2 * v28 + 2]) * 0x1000000 | ((*((&Te2 + 4 * v4)) & -0x1000000 | *((&Te3 + 4 * v5)) & 0xff0000) ^ (tmp_362 & 0xff00 | *(&Te1 + 4 * *(&v13))) ^ v12[2 + 2 * v28 + 2]) * 0x100 & 0xff0000 | ((*((&Te2 + 4 * v4)) & -0x1000000 | *((&Te3 + 4 * v5)) & 0xff0000) ^ (tmp_362 & 0xff00 | *(&Te1 + 4 * *(&v13))) ^ v12[2 + 2 * v28 + 2]) >> 8 & 0xff00 | ((*((&Te2 + 4 * v4)) & -0x1000000 | *((&Te3 + 4 * v5)) & 0xff0000) ^ (tmp_362 & 0xff00 | *(&Te1 + 4 * *(&v13))) ^ v12[2 + 2 * v28 + 2]) >> 24 & 255;
v29 = ((*((&Te3 + 4 * v0)) & 0xff0000 | *((&Te2 + 4 * v7)) & -0x1000000) ^ (*((&Te0 + 4 * v8)) & 0xff00 | *(&Te1 + 4 * v9)) ^ v12[2 + 2 * v28 + 3]) * 0x1000000 | ((*((&Te3 + 4 * v0)) & 0xff0000 | *((&Te2 + 4 * v7)) & -0x1000000) ^ (*((&Te0 + 4 * v8)) & 0xff00 | *(&Te1 + 4 * v9)) ^ v12[2 + 2 * v28 + 3]) * 0x100 & 0xff0000 | ((*((&Te3 + 4 * v0)) & 0xff0000 | *((&Te2 + 4 * v7)) & -0x1000000) ^ (*((&Te0 + 4 * v8)) & 0xff00 | *(&Te1 + 4 * v9)) ^ v12[2 + 2 * v28 + 3]) >> 8 & 0xff00 | ((*((&Te3 + 4 * v0)) & 0xff0000 | *((&Te2 + 4 * v7)) & -0x1000000) ^ (*((&Te0 + 4 * v8)) & 0xff00 | *(&Te1 + 4 * v9)) ^ v12[2 + 2 * v28 + 3]) >> 24 & 255;
a3[3] = v29;
return v29;
}
|
long long rijndaelEncrypt(unsigned long a0, unsigned long a1, char a2[16], char a3[16]) {
[2059] unsigned int v0[8]; // [bp-0x40]
[2059] unsigned int v1; // [bp-0x2c]
[2059] unsigned int v2; // [bp-0x28]
[2059] unsigned int v3; // [bp-0x24]
[2059] unsigned int v4; // [bp-0x20]
[2059] unsigned int v5; // [bp-0x1c]
[2059] unsigned int v6; // [bp-0x18]
[2059] unsigned int v7; // [bp-0x14]
[2059] unsigned int v8; // [bp-0x10]
[2059] unsigned int v9; // [bp-0xc]
[2059]
[2059] *(&v0[0]) = a0;
[2059, 2063, 2064, 2067, 2071] v1 = v0[0] ^ (a2[0] * 0x1000000) ^ (a2[1] * 0x10000) ^ (a2[2] * 0x100) ^ a2[3];
[2075, 2078, 2082, 2086, 2090, 2093, 2096, 2099, 2101, 2105, 2109, 2112, 2115, 2118, 2120, 2124, 2128, 2131, 2134, 2137, 2139, 2143, 2147, 2150, 2153, 2155, 2159, 2161, 2163] v2 = v0[1] ^ (a2[4] * 0x1000000) ^ (a2[5] * 0x10000) ^ (a2[6] * 0x100) ^ a2[7];
[2177, 2180, 2183, 2185, 2189, 2193, 2196, 2199, 2202, 2204, 2208, 2212, 2215, 2218, 2221, 2223, 2227, 2231, 2234, 2237, 2239, 2243, 2247, 2249, 2251, 2166, 2170, 2174] v3 = v0[2] ^ (a2[8] * 0x1000000) ^ (a2[9] * 0x10000) ^ (a2[10] * 0x100) ^ a2[11];
[2306, 2309, 2311, 2315, 2319, 2322, 2325, 2327, 2331, 2335, 2337, 2339, 2254, 2258, 2262, 2265, 2268, 2271, 2273, 2277, 2281, 2284, 2287, 2290, 2292, 2296, 2300, 2303] v4 = v0[3] ^ (a2[12] * 0x1000000) ^ (a2[13] * 0x10000) ^ (a2[14] * 0x100) ^ a2[15];
[2356, 2372, 2375, 2378, 2380, 2384, 2388, 2391, 2394, 2397, 2399, 2403, 2407, 2410, 2413, 2415, 2419, 2423, 2425, 2427] v5 = a1 >> 1;
[2562, 2566, 2568, 2570, 2573, 2576, 2579, 2581, 2589, 2596, 2599, 2602, 2605, 2608, 2610, 2618, 2625, 2628, 2630, 2632, 2635, 2638, 2641, 2643, 2651, 2658, 2661, 2663, 2666, 2669, 2671, 2679, 2686, 2689, 2691, 2693, 2697, 2701, 2703, 2705, 2708, 2711, 2714, 2716, 2724, 2430, 2433, 2435, 2438, 2441, 2444, 2446, 2454, 2461, 2464, 2467, 2470, 2473, 2475, 2483, 2490, 2493, 2495, 2497, 2500, 2503, 2506, 2508, 2516, 2523, 2526, 2528, 2531, 2534, 2536, 2544, 2551, 2554, 2556, 2558] while (true) {
[2438] v6 = v0[4] ^ *((4 * (v1 >> 24) + &Te0)) ^ *((4199776 + 4 * (v2 >> 16))) ^ *((4 * (v3 >> 8) + &Te2)) ^ *((4 * v4 + &Te3));
[2562, 2438, 2566, 2568, 2441, 2570, 2444, 2446, 2454, 2461, 2464, 2467, 2470, 2473, 2475, 2483, 2490, 2493, 2495, 2497, 2500, 2503, 2506, 2508, 2516, 2523, 2526, 2528, 2531, 2534, 2536, 2544, 2551, 2554, 2556, 2558] v7 = v0[5] ^ *((4 * (v2 >> 24) + &Te0)) ^ *((4199776 + 4 * (v3 >> 16))) ^ *((4 * (v4 >> 8) + &Te2)) ^ *((4 * v1 + &Te3));
[2689, 2691, 2693, 2697, 2573, 2701, 2703, 2576, 2705, 2579, 2581, 2589, 2596, 2599, 2602, 2605, 2608, 2610, 2618, 2625, 2628, 2630, 2632, 2635, 2638, 2641, 2643, 2651, 2658, 2661, 2663, 2666, 2669, 2671, 2679, 2686] v8 = v0[6] ^ *((4 * (v3 >> 24) + &Te0)) ^ *((4199776 + 4 * (v4 >> 16))) ^ *((4 * (v1 >> 8) + &Te2)) ^ *((4 * v2 + &Te3));
[2821, 2824, 2826, 2828, 2765, 2832, 2770, 2836, 2838, 2711, 2840, 2796, 2737, 2814] v9 = v0[7] ^ *((4 * (v4 >> 24) + &Te0)) ^ *((4199776 + 4 * (v1 >> 16))) ^ *((4 * (v2 >> 8) + &Te2)) ^ *((4 * v3 + &Te3));
[2949, 2956, 2959, 2961, 2963, 2967, 2971, 2843, 2973, 2846, 2975, 2849, 2851, 2859, 2866, 2869, 2872, 2875, 2878, 2880, 2888, 2895, 2898, 2900, 2902, 2905, 2908, 2911, 2913, 2921, 2928, 2931, 2933, 2936, 2939, 2941] *(&v0[0]) = v0 + 1;
[2978] v5 = __addvsi3(v5, 0xffffffff, *((4 * (v4 >> 24) + &Te0)) ^ *((4199776 + 4 * (v1 >> 16))) ^ *((4 * (v2 >> 8) + &Te2)) ^ *((4 * v3 + &Te3)), *((4 * (v4 >> 24) + &Te0)) ^ *((4199776 + 4 * (v1 >> 16))) ^ *((4 * (v2 >> 8) + &Te2)) ^ *((4 * v3 + &Te3)));
[2983, 2991, 2959, 2931, 2996, 2900, 2872, 2905, 2846] if (!v5)
[3003, 2999] break;
[3003, 2999] if (v5) {
v1 = v0[0] ^ *((4 * (v6 >> 24) + &Te0)) ^ *((4199776 + 4 * (v7 >> 16))) ^ *((4 * (v8 >> 8) + &Te2)) ^ *((4 * v9 + &Te3));
[3074, 3077, 3079, 3087, 3094, 3097, 3099, 3102, 3105, 3107, 3115, 3122, 3125, 3127, 3129, 3133, 3135, 3009, 3137, 3012, 3015, 3017, 3025, 3032, 3035, 3038, 3041, 3044, 3046, 3054, 3061, 3064, 3066, 3068, 3071] v2 = v0[1] ^ *((4 * (v7 >> 24) + &Te0)) ^ *((4199776 + 4 * (v8 >> 16))) ^ *((4 * (v9 >> 8) + &Te2)) ^ *((4 * v6 + &Te3));
[3202, 3205, 3208, 3210, 3218, 3225, 3228, 3230, 3233, 3236, 3238, 3246, 3253, 3256, 3258, 3260, 3264, 3140, 3268, 3270, 3143, 3272, 3146, 3148, 3156, 3163, 3166, 3169, 3172, 3175, 3177, 3185, 3192, 3195, 3197, 3199] }
v3 = v0[2] ^ *((4 * (v8 >> 24) + &Te0)) ^ *((4199776 + 4 * (v9 >> 16))) ^ *((4 * (v6 >> 8) + &Te2)) ^ *((4 * v7 + &Te3));
[3393, 3395, 3332, 3399, 3337, 3403, 3405, 3278, 3407, 3363, 3304, 3388, 3391] v4 = v0[3] ^ *((4 * (v9 >> 24) + &Te0)) ^ *((4199776 + 4 * (v6 >> 16))) ^ *((4 * (v7 >> 8) + &Te2)) ^ *((4 * v8 + &Te3));
[3462, 3465, 3467, 3469, 3472, 3475, 3478, 3480, 3488, 3495, 3498, 3500, 3503, 3506, 3508, 3516, 3523, 3526, 3528, 3530, 3534, 3410, 3538, 3540, 3413, 3542, 3416, 3418, 3426, 3433, 3436, 3439, 3442, 3445, 3447, 3455] }
v1 = v0[0] ^ (*((4 * (v6 >> 24) + &Te2)) & -0x1000000 | *((4 * (v7 >> 16) + &Te3)) & 0xff0000) ^ *((4 * (v8 >> 8) + &Te0)) & 0xff00 ^ *((4199776 + 4 * v9));
a3[0] = v1 >> 24;
a3[1] = v1 >> 16;
a3[2] = v1 >> 8;
a3[3] = v1;
v2 = v0[1] ^ (*((4 * (v7 >> 24) + &Te2)) & -0x1000000 | *((4 * (v8 >> 16) + &Te3)) & 0xff0000) ^ *((4 * (v9 >> 8) + &Te0)) & 0xff00 ^ *((4199776 + 4 * v6));
a3[4] = v2 >> 24;
a3[5] = v2 >> 16;
a3[6] = v2 >> 8;
a3[7] = v2;
v3 = v0[2] ^ (*((4 * (v8 >> 24) + &Te2)) & -0x1000000 | *((4 * (v9 >> 16) + &Te3)) & 0xff0000) ^ *((4 * (v6 >> 8) + &Te0)) & 0xff00 ^ *((4199776 + 4 * v7));
a3[8] = v3 >> 24;
a3[9] = v3 >> 16;
a3[10] = v3 >> 8;
a3[11] = v3;
v4 = v0[3] ^ (*((4 * (v9 >> 24) + &Te2)) & -0x1000000 | *((4 * (v6 >> 16) + &Te3)) & 0xff0000) ^ *((4 * (v7 >> 8) + &Te0)) & 0xff00 ^ *((4199776 + 4 * v8));
a3[12] = v4 >> 24;
a3[13] = v4 >> 16;
a3[14] = v4 >> 8;
a3[15] = v4;
return &a3[15];
}
|
long long channel_input_oclose(unsigned long long a0, unsigned long long a1, void* a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) {
[42288] char v0; // [bp-0x18]
[42288] char v1; // [bp+0x0]
[42288] void* v3; // r12
[42288] unsigned long long v5; // rax
[42288] unsigned long long v6; // rax
[42288]
[42288] v3 = channel_from_packet_id(a2, "channel_input_oclose", "oclose", a3, a4, a5, &v1, *(&v0));
[42337, 42340, 42343, 42297, 42346, 42315, 42329, 42334] if (channel_proxy_upstream(v3, a0, a1, a2, a4, a5))
[42349] return 0;
[42369, 42371, 42358, 42362, 42364, 42365, 42367] v5 = sshpkt_get_end(a2);
[42376, 42379] if (!v5) {
chan_rcvd_oclose(a2, v3);
[42388, 42391, 42394] return 0;
[42403, 42405, 42406, 42408, 42410, 42412, 42399] }
v6 = ssh_err(v5);
sshlog("channels.c", "channel_input_oclose", 0xd15, 0x1, 0x2, v6, "parse data", v6);
ssh_packet_disconnect(a2, "Invalid oclose message", 0xd15);
return channel_input_open_confirmation(a0, "Invalid oclose message", 0xd15, 0x1, 0x2, a5);
}
|
long long channel_input_oclose(unsigned long a0, unsigned long a1, void* a2, unsigned long a3, unsigned long long a4, unsigned long long a5) {
[45875] unsigned int v0; // [bp-0x14]
[45875] void* v1; // [bp-0x10]
[45875]
[45875] v1 = channel_from_packet_id(a2, 0x413b30, "oclose");
[45923, 45901, 45918] if (!channel_proxy_upstream(v1, a0, a1, a2, a4, a5)) {
[45927, 45931, 45934, 45937, 45941, 45944] v0 = sshpkt_get_end(a2);
[45970, 45975] if (v0) {
sshlog("channels.c", "channel_input_oclose", 0xd15, 0x1, 0x2, ssh_err(v0), "parse data");
[46020, 46025, 46032, 46039, 46044, 45989, 45994, 45998, 46005, 46006, 46009, 46015] ssh_packet_disconnect(a2, "Invalid oclose message", 0xd15);
[46049, 46020, 46053, 46057, 46064, 46067, 46072] }
chan_rcvd_oclose(a2, v1, v1);
[46081, 46085, 46088, 46091, 46077] }
return 0;
}
|
int write_permuted_output_reservoir(unsigned long a0, unsigned long a1, void* a2) {
[1488] unsigned long long v0; // [bp-0x28]
[1488] unsigned long v1; // [bp-0x20]
[1488] unsigned long long v2; // [bp-0x18]
[1488] unsigned long long v3; // [bp-0x10]
[1488] unsigned long long v4; // [bp-0x8]
[1488] char v5; // [bp+0x0]
[1488] unsigned long long v7; // r14
[1488] unsigned long long v9; // r13
[1488] unsigned long long v10; // r12
[1488] void* v11; // rbp
[1488] unsigned long long v12; // rbx
[1488] unsigned int v13; // eax
[1488] unsigned long long v14; // rbx
[1488] unsigned long long v15; // r12
[1488] unsigned long long v16; // r13
[1488] unsigned long long v17; // r14
[1488]
[1488] if (!a0)
return 0;
[1589, 1591] v4 = v7;
[1493] v3 = v9;
[1498] v2 = v10;
[1500, 1503] v1 = &v5;
[1505, 1508] v11 = 0;
[1509] v0 = v12;
[1511] while (true) {
a2 = *((a1 + *((a2 + 0x8 * v11)) * 24 + 8));
[1540, 1545, 1549, 1554, 1529, 1533] if (fwrite_unlocked(*((a1 + (*((a2 + 0x8 * v11)) + (*((a2 + 0x8 * v11)) << 1) << 3) + 16)), 0x1, a2, stdout) != *((a1 + (*((a2 + 0x8 * v11)) + (*((a2 + 0x8 * v11)) << 1) << 3) + 8))) {
[1571, 1540, 1545, 1549, 1558, 1562, 1567] v13 = -1;
[1573, 1576, 1577, 1578, 1580, 1582, 1584] v14 = v0;
[1576] v15 = v2;
[1577, 1578] v16 = v3;
[1580] v17 = v4;
[1582] return v13;
[1584] }
v11 += 1;
[1520] if (a0 == v11) {
[1524, 1527] v13 = 0;
[1585] v14 = v0;
[1576] v15 = v2;
[1577, 1578] v16 = v3;
[1580] v17 = v4;
[1582] return v13;
[1584] }
}
}
|
int write_permuted_output_reservoir(unsigned long a0, unsigned long a1, void* a2) {
[2251] void* v0; // [bp-0x18]
[2251] unsigned long long v1[3]; // [bp-0x10]
[2251] unsigned int v3; // eax
[2251]
[2251] v0 = 0;
[2275, 2251, 2255, 2256, 2259, 2263, 2267, 2271] while (true) {
if (v0 < a0) {
[2408, 2404, 2412] v1[0] = a1 + *((a2 + 0x8 * v0)) * 24;
[2304, 2307, 2310, 2313, 2316, 2320, 2323, 2327, 2330, 2267, 2285, 2289, 2297, 2301] if (fwrite_unlocked(v1[2], 0x1, v1[1], stdout) != v1[1]) {
[2387, 2374, 2390, 2379, 2366, 2383] v3 = -1;
[2392] return v3;
[2424, 2423] }
v0 += 1;
[2404, 2408, 2412, 2399] } else {
v3 = 0;
[2418, 2423, 2424] return v3;
[2424, 2423] }
}
}
|
int idname_tree_RB_INSERT(unsigned long long *a0, struct_0 *a1) {
[864] unsigned long v1; // r8
[864] struct_0 *v2; // r9
[864] unsigned long long v3; // rax
[864] unsigned long long v4; // rdx
[864]
[864] v1 = *(a0);
[864] v2 = a1;
[867, 870] if (*(a0)) {
while (true) {
[902] v3 = idname_cmp(a1->field_0, *(v1));
[902, 905, 907] if (v3 >= 0) {
[946, 948] if (!v3)
[888] break;
[888] if (v3)
v4 = *((v1 + 24));
[890] } else {
v4 = *((v1 + 16));
[916] }
if (v3 < 0 || v3) {
[912, 914] if ((v3 < 0 || *((v1 + 24))) && (*((v1 + 16)) || v3 >= 0)) {
[912, 914, 946, 916, 948, 890] v1 = v4;
[899, 902, 905, 907] continue;
[905, 899, 907, 902] }
if ((!*((v1 + 24)) || v3 < 0) && (!*((v1 + 16)) || v3 >= 0)) {
[912, 914, 946, 916, 948, 890] v2->field_20 = v1;
[929, 925] v2->field_28 = 1;
[933] v2->field_10 = 0;
[941] if (v3 >= 0) {
[946, 948] *((v1 + 24)) = v2;
[960, 950, 954, 957] break;
[960, 954, 957, 950] } else {
*((v1 + 16)) = v2;
[976] break;
[980] }
}
}
}
} else {
a1->field_20 = 0;
[986, 982] a1->field_28 = 1;
[994] a1->field_10 = 0;
[1001] *(a0) = a1;
[1005] }
if (!*(a0) || v3 < 0 || v3) {
idname_tree_RB_INSERT_COLOR(a0, a1, v4);
*(&v1) = 0;
}
return v1;
}
|
int idname_tree_RB_INSERT(unsigned long long *a0, struct_0 *a1) {
[3527] unsigned int v0; // [bp-0x1c]
[3527] void* v1; // [bp-0x18]
[3527] void* v2; // [bp-0x10]
[3527] unsigned int v4; // eax
[3527]
[3527] v2 = 0;
[3527, 3531, 3532, 3535, 3539, 3543, 3547] v0 = 0;
[3555] v1 = *(a0);
[3569, 3562, 3566] while (true) {
[3654] if (v1) {
v2 = v1;
[3579, 3575] v0 = idname_cmp(a1, v2);
[3602, 3597] if (v0 < 0) {
[3609, 3605] v1 = v1[16];
[3619, 3611, 3615] } else if (v0 > 0) {
[3625, 3629] v1 = v1[24];
[3635, 3639, 3631] } else {
v4 = v1;
[3645] break;
[3649] }
} else {
a1->field_20 = v2;
[3665, 3669, 3661] a1->field_18 = 0;
[3673, 3677] a1->field_10 = a1->field_18;
[3685, 3689, 3693, 3697] a1->field_28 = 1;
[3705, 3701] if (!v2) {
*(a0) = a1;
[3778, 3753, 3757, 3761, 3764, 3768, 3772, 3775] } else if (v0 < 0) {
[3609, 3605] *(&v2[16]) = a1;
[3729, 3733, 3725] } else {
*(&v2[24]) = a1;
[3747, 3739, 3743] }
idname_tree_RB_INSERT_COLOR(a0, a1);
[3778, 3764, 3768, 3772, 3775] v4 = 0;
[3783, 3788, 3789] break;
[3788, 3789, 3783] }
}
return v4;
}
|
long rl_vi_start_inserting(int a1, int a2, int a3)
[7168] {
[7168, 7172, 7173, 7175] rl_vi_set_last(a1, a2, a3);
[7180] rl_begin_undo_group();
[7192, 7185, 7187, 7193] return rl_vi_insertion_mode(1LL, a1);
}
// 4B20: using guessed type long rl_begin_undo_group(void);
//----- (0000000000001C20) ----------------------------------------------------
long vi_change_dispatch(_DWORD *a1)
[7200] {
int v1; // r12d
const unsigned short **v2; // rbp
bool v3; // al
long v4; // rsi
char *v5; // rdi
int v7; // edi
[7200, 7202, 7204, 7205, 7206, 7209, 7213] int next_mbchar; // eax
[7232, 7235, 7525, 7531, 7217, 7510, 7224, 7513, 7227, 7519]
v1 = a1[8];
[7552, 7554, 7560, 7562, 7537, 7548] if ( !strchr(" l|hwW^0bBFT`", v1) && a1[5] <= rl_point && rl_mark < rl_end )
{
[7564, 7567] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
[7577, 7571] {
v1 = a1[8];
++rl_mark;
}
[7632, 7542, 7639, 7641, 7646] else
[7651] {
[7661, 7655] next_mbchar = rl_find_next_mbchar(rl_line_buffer, rl_mark, 1LL, 0LL);
v1 = a1[8];
rl_mark = next_mbchar;
[7241, 7250] }
[7256, 7262, 7253, 7246] }
[7264, 7269, 7272, 7277, 7246] v2 = _ctype_b_loc();
if ( ((*v2)[(unsigned char)v1] & 0x200) != 0 )
[7384, 7388, 7391] v3 = (*_ctype_toupper_loc())[(unsigned char)v1] == 87;
[7280, 7282, 7284, 7287, 7293] else
v3 = v1 == 87;
[7400, 7284] if ( v3 && a1[5] > rl_point )
[7412, 7406, 7414] {
rl_point = a1[5];
if ( rl_vi_redoing )
[7305, 7312, 7315, 7317, 7320] {
[7584, 7589] LABEL_7:
[7338, 7332, 7326] if ( vi_insert_buffer && *vi_insert_buffer )
[7353, 7355, 7358, 7350] rl_begin_undo_group();
[7368] v4 = rl_mark;
[7600, 7343] rl_delete_text(rl_point, rl_mark);
[7605] v5 = vi_insert_buffer;
[7376] if ( !vi_insert_buffer || !*vi_insert_buffer )
return 0LL;
rl_insert_text(vi_insert_buffer);
[7303, 7301, 7295] rl_end_undo_group(v5, v4);
return 0LL;
}
}
[7416] else if ( rl_vi_redoing )
[7433, 7427, 7421] {
[7438] goto LABEL_7;
[7441, 7445, 7449, 7454] }
[7456] rl_begin_undo_group();
[7472, 7466, 7478] rl_kill_text(rl_point, rl_mark);
[7364] v7 = a1[7];
[7616, 7489, 7490, 7491, 7617, 7493, 7618, 7495, 7620, 7622, 7370, 7371, 7372, 7374, 7610, 7483, 7614, 7487] if ( ((*v2)[(unsigned char)v7] & 0x100) == 0 )
rl_vi_doing_insert = 1;
rl_vi_start_inserting(v7, rl_numeric_arg, rl_arg_sign);
return 0LL;
}
// 3B40: using guessed type int rl_vi_doing_insert;
// 4B00: using guessed type int rl_vi_redoing;
// 4B20: using guessed type long rl_begin_undo_group(void);
// 4B30: using guessed type long rl_end_undo_group(_QWORD, _QWORD);
// 4B50: using guessed type long rl_insert_text(_QWORD);
// 4B98: using guessed type long rl_kill_text(_QWORD, _QWORD);
// 4C60: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 4D30: using guessed type long rl_delete_text(_QWORD, _QWORD);
//----- (0000000000001E00) ----------------------------------------------------
long vidomove_dispatch(unsigned int *a1)
[7680] {
long v1; // rsi
long result; // rax
[7680, 7684] v1 = *a1;
[7689, 7686] if ( (_DWORD)v1 == 2 )
{
[7744] result = vi_change_dispatch(a1);
[7749] rl_readline_state &= ~0x100000uLL;
}
[7691, 7694] else if ( (_DWORD)v1 == 4 )
{
[7800, 7803, 7807] result = vi_yank_dispatch_isra_0(a1 + 5, a1[8]);
[7812] rl_readline_state &= ~0x100000uLL;
}
else
{
[7696, 7699] if ( (_DWORD)v1 == 1 )
{
[7768, 7771, 7774, 7779] result = vi_delete_dispatch_isra_0(a1[5], a1[8]);
}
else
{
[7701, 7710, 7703] rl_errmsg("vidomove_dispatch: unknown operator %d", v1);
[7715] result = 1LL;
}
[7720] rl_readline_state &= ~0x100000uLL;
}
[7731] return result;
[7790, 7823, 7760, 7794, 7827, 7764, 7735] }
// 4D38: using guessed type long rl_errmsg(const char *, ...);
//----- (0000000000001EA0) ----------------------------------------------------
long rl_vi_start_inserting_constprop_0(int a1, int a2)
{
rl_vi_set_last(a1, 1, a2);
rl_begin_undo_group();
return rl_vi_insertion_mode(1LL, a1);
}
// 4B20: using guessed type long rl_begin_undo_group(void);
//----- (0000000000001ED0) ----------------------------------------------------
long rl_vi_complete(long a1, int a2)
[7888] {
char v2; // dl
char v3; // al
[7905, 7906, 7908, 7888, 7899] if ( rl_point < rl_end )
{
[7892, 7917, 7910] v2 = *(_BYTE *)(rl_line_buffer + rl_point);
[7921, 7924, 7929, 7926] if ( v2 != 32 && v2 != 9 )
{
[7931, 7892] v3 = *(_BYTE *)(rl_line_buffer + rl_point + 1LL);
[7936, 7938, 7940, 7942] if ( v3 != 32 && v3 != 9 )
[7944, 7954, 7949] rl_vi_end_word(1LL, 69LL);
[7959] rl_vi_advance_point();
}
}
[7964, 7967] if ( a2 == 42 )
{
[8032, 8042, 8037] rl_complete_internal(42LL);
LABEL_13:
[8016, 8010, 8018, 8023] rl_vi_start_inserting_constprop_0(a2, rl_arg_sign);
[8026] return 0LL;
}
[7969, 7972] if ( a2 != 61 )
{
[7977, 7974] if ( a2 != 92 )
{
[7979, 7981, 7983] rl_complete(0LL, (unsigned int)a2);
[7991] return 0LL;
}
[8000, 8005] rl_complete_internal(9LL);
goto LABEL_13;
}
[8048, 8058, 8053] rl_complete_internal(63LL);
[7988, 7990] return 0LL;
[8025, 8060, 8061] }
// 4D40: using guessed type long rl_complete(_QWORD, _QWORD);
// 4D48: using guessed type long rl_complete_internal(_QWORD);
//----- (0000000000001F80) ----------------------------------------------------
long rl_vi_tilde_expand(long a1, int a2)
[8064] {
[8064, 8068, 8069, 8071, 8073] rl_tilde_expand(0LL);
[8086, 8084, 8078] rl_vi_start_inserting_constprop_0(a2, rl_arg_sign);
[8091, 8093] return 0LL;
[8094] }
// 4D50: using guessed type long rl_tilde_expand(_QWORD);
//----- (0000000000001FA0) ----------------------------------------------------
long rl_vi_append_mode(long a1, int a2)
[8096] {
[8096, 8100, 8101, 8103] rl_vi_append_forward_isra_0(a1);
[8114, 8116, 8108] rl_vi_start_inserting_constprop_0(a2, rl_arg_sign);
[8121, 8123] return 0LL;
[8124] }
// A10: using guessed type long rl_vi_append_forward_isra_0(_QWORD);
//----- (0000000000001FC0) ----------------------------------------------------
long rl_vi_append_eol(long a1, long a2)
[8128] {
[8128, 8132, 8133, 8138, 8140] rl_end_of_line(1LL, a2);
[8152, 8145, 8147] rl_vi_append_mode(1LL, a2);
[8157, 8159] return 0LL;
[8160] }
// 4CC0: using guessed type long rl_end_of_line(_QWORD, _QWORD);
//----- (0000000000001FF0) ----------------------------------------------------
long rl_vi_insert_mode(long a1, int a2)
[8176] {
[8192, 8176, 8180, 8184, 8186] rl_vi_start_inserting_constprop_0(a2, rl_arg_sign);
[8197, 8199] return 0LL;
[8203] }
//----- (0000000000002010) ----------------------------------------------------
long rl_vi_insert_beg(long a1, long a2)
[8208] {
[8208, 8212, 8213, 8218, 8220] rl_beg_of_line(1LL, a2);
[8232, 8225, 8227] rl_vi_insert_mode(1LL, a2);
[8237, 8239] return 0LL;
[8240] }
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000002040) ----------------------------------------------------
long rl_vi_done_inserting(long a1, long a2)
{
long result; // rax
if ( rl_vi_doing_insert )
{
rl_end_undo_group(a1, a2);
rl_vi_doing_insert = 0;
if ( rl_vi_last_key_before_insert == 82 )
{
rl_vi_save_replace();
}
else
{
a1 = *rl_undo_list;
rl_vi_save_insert((int *)*rl_undo_list);
}
}
else
{
a1 = rl_undo_list;
if ( rl_undo_list && (rl_vi_last_key_before_insert & 0xFFFFFFD7) == 65 )
{
rl_vi_save_insert(rl_undo_list);
}
else if ( rl_vi_last_key_before_insert == 67 )
{
goto LABEL_5;
}
}
while ( 1 )
{
result = rl_undo_group_level;
if ( rl_undo_group_level <= 0 )
break;
LABEL_5:
rl_end_undo_group(a1, a2);
}
return result;
}
// 3AE8: using guessed type int rl_vi_last_key_before_insert;
// 3B40: using guessed type int rl_vi_doing_insert;
// 4B30: using guessed type long rl_end_undo_group(_QWORD, _QWORD);
//----- (00000000000020E0) ----------------------------------------------------
long rl_vi_movement_mode(long a1, long a2)
[8416] {
[8416, 8420, 8424, 8430, 8432] if ( rl_point > 0 )
[8434, 8439] {
[8451, 8444] a1 = 1LL;
[8458] rl_backward_char(1LL, a2);
[8470, 8463] }
rl_keymap = &vi_movement_keymap;
[8504] rl_vi_done_inserting(a1, a2);
[8515, 8517, 8509] if ( (*((_BYTE *)&rl_readline_state + 2) & 0x40) == 0 )
{
rl_free_undo_list();
[8519] if ( !rl_show_mode_in_prompt )
[8524] goto LABEL_5;
LABEL_7:
[8472, 8480, 8478] rl_reset_prompt(a1);
goto LABEL_5;
}
[8482] if ( rl_show_mode_in_prompt )
[8493, 8495] goto LABEL_7;
[8499] LABEL_5:
rl_readline_state |= 0x400000uLL;
return 0LL;
}
// 4BB0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 4D20: using guessed type long rl_reset_prompt(_QWORD);
// 4D60: using guessed type long rl_free_undo_list(void);
//----- (0000000000002150) ----------------------------------------------------
long rl_vi_arg_digit(long a1, long a2)
[8528] {
[8544, 8546, 8552, 8554, 8528, 8532, 8535, 8537] if ( (_DWORD)a2 == 48 && rl_numeric_arg == 1 && !rl_explicit_arg )
[8568, 8573] return rl_beg_of_line(1LL, a2);
else
[8556] return rl_digit_argument(a1);
}
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
// 4D68: using guessed type long rl_digit_argument(_QWORD);
//----- (0000000000002190) ----------------------------------------------------
long rl_vi_put(int a1, unsigned int a2)
[8592] {
int v2; // ebx
[8610, 8614, 8617, 8636, 8622, 8592, 8596, 8598, 8630, 8601, 8602, 8604, 8605] if ( ((*_ctype_b_loc())[(unsigned char)a2] & 0x100) == 0 && rl_point < rl_end )
[8704, 8711, 8716, 8624, 8721, 8726, 8732] rl_point = rl_find_next_mbchar(rl_line_buffer, rl_point, 1LL, 1LL);
[8638] v2 = a1 - 1;
[8648, 8643, 8646] if ( a1 )
{
do
{
[8658, 8663] --v2;
[8656, 8666] rl_yank(1LL, a2);
}
[8674, 8671] while ( v2 != -1 );
}
[8683, 8676, 8678] rl_backward_char(1LL, a2);
[8688, 8689] return 0LL;
[8691, 8692, 8694] }
// 4B88: using guessed type long rl_yank(_QWORD, _QWORD);
// 4BB0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 4C60: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002220) ----------------------------------------------------
long rl_vi_check()
[8736] {
[8736, 8740, 8746, 8748, 8750, 8756] if ( !rl_point || rl_point != rl_end )
[8758] return 0LL;
[8768, 8777, 8779, 8772] rl_vi_backup();
[8760] return 0LL;
[8783] }
//----- (0000000000002250) ----------------------------------------------------
long rl_vi_change_mbchar_case(int a1)
{
int v1; // ebx
long v2; // r12
long i; // rbx
wint_t v4; // edi
int v5; // eax
wint_t v6; // edi
wint_t v7; // eax
long v8; // rsi
int v9; // r15d
int v10; // eax
long v11; // rax
size_t v12; // rax
int v13; // eax
wint_t v14; // eax
wint_t wc; // [rsp+4h] [rbp-64h] BYREF
mbstate_t ps; // [rsp+8h] [rbp-60h] BYREF
char s[24]; // [rsp+10h] [rbp-58h] BYREF
unsigned long v19; // [rsp+28h] [rbp-40h]
v1 = a1;
v2 = (unsigned int)(a1 - 1);
v19 = __readfsqword(0x28u);
ps = 0LL;
if ( (int)rl_adjust_point(rl_line_buffer, rl_point, &ps) > 0 )
{
v1 = a1 - 1;
v2 = (unsigned int)(a1 - 2);
}
if ( v1 )
{
for ( i = 0LL; ; i = v11 )
{
if ( rl_point >= rl_end )
return 0LL;
v12 = mbrtowc((wchar_t *)&wc, (const char *)(rl_line_buffer + rl_point), rl_end - rl_point, &ps);
if ( v12 > 0xFFFFFFFFFFFFFFFDLL )
break;
if ( !v12 )
{
wc = 0;
v4 = 0;
LABEL_6:
v5 = iswupper(v4);
v6 = wc;
if ( v5 )
goto LABEL_7;
goto LABEL_18;
}
v13 = iswupper(wc);
v6 = wc;
if ( v13 )
{
LABEL_7:
v7 = towlower(v6);
v8 = v7;
wc = v7;
if ( !v7 )
goto LABEL_20;
goto LABEL_8;
}
LABEL_18:
if ( !iswlower(v6) || (v14 = towupper(wc), v8 = v14, (wc = v14) == 0) )
{
LABEL_20:
rl_forward_char(1LL, 0LL);
v11 = i + 1;
if ( i == v2 )
return 0LL;
continue;
}
LABEL_8:
v9 = rl_point;
v10 = wcrtomb(s, v8, &ps);
if ( v10 >= 0 )
s[v10] = 0;
rl_begin_undo_group();
rl_vi_delete_constprop_0(0LL, v8);
if ( rl_point < v9 )
rl_vi_advance_point();
rl_insert_text(s);
rl_end_undo_group(s, v8);
rl_vi_check();
v11 = i + 1;
if ( i == v2 )
return 0LL;
}
v4 = *(char *)(rl_line_buffer + rl_point);
wc = v4;
goto LABEL_6;
}
return 0LL;
}
// 4B20: using guessed type long rl_begin_undo_group(void);
// 4B30: using guessed type long rl_end_undo_group(_QWORD, _QWORD);
// 4B50: using guessed type long rl_insert_text(_QWORD);
// 4D70: using guessed type long rl_adjust_point(_QWORD, _QWORD, _QWORD);
// 4DA8: using guessed type long rl_forward_char(_QWORD, _QWORD);
// 2250: using guessed type char s[24];
//----- (0000000000002420) ----------------------------------------------------
long rl_vi_change_case(int a1, long a2)
[9248] {
int v3; // ebx
unsigned int v4; // r12d
int v5; // ebp
const unsigned short **v6; // rax
long v7; // r13
unsigned short v8; // ax
[9248, 9258, 9252, 9264] if ( rl_point >= rl_end )
[9266, 9268] return 0LL;
[9272, 9274, 9276, 9277, 9278] v3 = a1;
[9280, 9284, 9289, 9293, 9295, 9301, 9303] if ( _ctype_get_mb_cur_max() > 1 && !rl_byte_oriented )
[9544, 9548, 9550, 9551, 9552, 9554, 9556] return rl_vi_change_mbchar_case(a1);
[9309, 9311] if ( a1 )
{
[9320, 9317] v4 = 0;
do
{
[9409] while ( 1 )
{
[9409] v5 = rl_point;
[9421, 9415] if ( rl_point >= rl_end )
[9421] return 0LL;
[9423] v6 = _ctype_b_loc();
[9441, 9435, 9428, 9438] v7 = *(unsigned char *)(rl_line_buffer + v5);
[9449, 9446] v8 = (*v6)[v7];
[9457, 9454] if ( (v8 & 0x100) == 0 )
break;
[9328, 9336, 9333] v4 = (*_ctype_tolower_loc())[v7];
[9340, 9343] if ( v4 )
goto LABEL_8;
LABEL_16:
[9496, 9489, 9491] a2 = 0LL;
[9504, 9506, 9510, 9512, 9513, 9514, 9516, 9501] rl_forward_char(1LL, 0LL);
[9504] if ( !--v3 )
return 0LL;
[9466, 9463] }
if ( (v8 & 0x200) != 0 )
[9473, 9468, 9476] {
[9480, 9483] v4 = (*_ctype_toupper_loc())[v7];
if ( !v4 )
goto LABEL_16;
[9349] LABEL_8:
[9354, 9357] rl_begin_undo_group();
[9368, 9362, 9370] rl_vi_delete_constprop_0(v4, a2);
[9372, 9375] if ( rl_point < v5 )
[9384, 9381, 9389] ++rl_point;
[9394] a2 = v4;
[9399] rl_insert_char(1LL, v4);
rl_end_undo_group(1LL, v4);
rl_vi_check();
[9520, 9528, 9523, 9533] goto LABEL_11;
}
[9404] a2 = v4;
rl_forward_char(1LL, v4);
[9457, 9407] LABEL_11:
--v3;
[9268] }
[9518] while ( v3 );
}
return 0LL;
}
// 4B20: using guessed type long rl_begin_undo_group(void);
// 4B30: using guessed type long rl_end_undo_group(_QWORD, _QWORD);
// 4C98: using guessed type long rl_insert_char(_QWORD, _QWORD);
// 4DA8: using guessed type long rl_forward_char(_QWORD, _QWORD);
//----- (0000000000002560) ----------------------------------------------------
long rl_vi_column(int a1, long a2)
[9568] {
[9568, 9582, 9572, 9576] if ( rl_end >= a1 )
{
[9608] rl_point = 0;
[9632, 9618, 9621, 9626] rl_point = rl_forward_char_internal((unsigned int)(a1 - 1));
}
else
{
[9584, 9589] rl_end_of_line(1LL, a2);
}
[9594, 9596] return 0LL;
[9600, 9634, 9638] }
// 4B48: using guessed type long rl_forward_char_internal(_QWORD);
// 4CC0: using guessed type long rl_end_of_line(_QWORD, _QWORD);
//----- (00000000000025B0) ----------------------------------------------------
long rl_vi_domove_motion_cleanup(int c, unsigned int *a2)
{
int v3; // r13d
int v4; // ebx
const unsigned short **v5; // rax
short v6; // r14
bool v7; // al
unsigned int v8; // edx
unsigned int v10; // edx
bool v11; // al
bool v12; // al
long v13; // rax
char v14; // dl
int v15; // ecx
long v16; // rsi
char v17; // al
char v18; // al
rl_end = a2[6];
*(_BYTE *)(rl_line_buffer + rl_end) = 0;
rl_fix_point(0LL);
v3 = rl_mark;
v4 = rl_point;
v5 = _ctype_b_loc();
if ( v3 != v4 )
{
v6 = (*v5)[(unsigned char)c] & 0x200;
if ( v6 )
v7 = (*_ctype_toupper_loc())[(unsigned char)c] == 87;
else
v7 = c == 87;
v8 = a2[7];
if ( v7 && v4 < rl_end && v3 < v4 )
{
v18 = *(_BYTE *)(rl_line_buffer + v4);
if ( v18 == 32 || v18 == 9 )
{
if ( v8 != 99 )
{
LABEL_9:
rl_point = v3;
rl_mark = v4;
goto LABEL_10;
}
goto LABEL_20;
}
rl_point = --v4;
}
if ( v8 != 99 )
goto LABEL_8;
if ( v3 > v4 )
{
LABEL_10:
if ( (*((_BYTE *)&rl_readline_state + 2) & 8) != 0 )
rl_redisplay_function();
return vidomove_dispatch(a2);
}
LABEL_20:
if ( v6 )
v12 = (*_ctype_toupper_loc())[(unsigned char)c] == 87;
else
v12 = c == 87;
if ( v12 )
{
if ( v3 >= v4 )
{
LABEL_41:
v16 = v4;
}
else
{
v13 = v4;
while ( 1 )
{
v14 = *(_BYTE *)(rl_line_buffer + v13);
v15 = v13;
v16 = (int)v13;
if ( v14 != 32 && v14 != 9 )
break;
v4 = --v13;
rl_point = v15 - 1;
if ( v3 >= (int)v13 )
goto LABEL_41;
}
}
if ( v3 == (_DWORD)v16
|| (int)v16 >= 0 && rl_end - 1 > (int)v16 && (v17 = *(_BYTE *)(rl_line_buffer + v16), v17 != 32) && v17 != 9 )
{
rl_vi_advance_point();
v3 = rl_mark;
v4 = rl_point;
}
}
LABEL_8:
if ( v3 >= v4 )
goto LABEL_10;
goto LABEL_9;
}
v10 = a2[7];
if ( ((*v5)[(unsigned char)v10] & 0x200) != 0 )
v11 = (*_ctype_toupper_loc())[(unsigned char)v10] == 67;
else
v11 = v10 == 67;
if ( v11 && (unsigned int)rl_vi_motion_command(c) )
return vidomove_dispatch(a2);
rl_readline_state &= ~0x100000uLL;
return 0xFFFFFFFFLL;
}
// 4C48: using guessed type long rl_fix_point(_QWORD);
// 4DB8: using guessed type long (*rl_redisplay_function)(void);
//----- (0000000000002810) ----------------------------------------------------
long rl_domove_motion_callback(unsigned int *a1)
[10256] {
unsigned int v1; // r12d
long v2; // rax
[10272, 10279, 10256, 10258, 10259, 10262] rl_vi_last_motion = a1[8];
[10272, 10266] v1 = rl_vi_last_motion;
[10276, 10286] rl_extend_line_buffer((unsigned int)(rl_end + 1));
[10291] v2 = rl_end;
[10304, 10301] ++rl_end;
[10317, 10310] *(_BYTE *)(rl_line_buffer + v2) = 32;
[10328, 10321, 10335] *(_BYTE *)(rl_line_buffer + rl_end) = 0;
[10298, 10339, 10346] rl_dispatch(v1, rl_keymap);
[10370, 10351, 10358, 10363, 10365] if ( (rl_readline_state & 0x80000) != 0 && (rl_readline_state & 0x800000) != 0 )
[10376] return 0LL;
else
[10388, 10397, 10391] return rl_vi_domove_motion_cleanup(v1, a1);
[10372, 10378, 10379, 10381, 10384, 10394, 10395] }
// 3B20: using guessed type int rl_vi_last_motion;
// 4CB0: using guessed type long rl_dispatch(_QWORD, _QWORD);
// 4DC0: using guessed type long rl_extend_line_buffer(_QWORD);
//----- (00000000000028B0) ----------------------------------------------------
long rl_domove_read_callback(const char *a1)
[10416] {
unsigned int *v1; // rbp
unsigned int v2; // r12d
long v3; // rax
unsigned int v5; // ecx
long v6; // rax
long v7; // rdx
int v8; // r12d
int v9; // eax
[10416, 10418, 10419, 10422, 10426]
[10433, 10430] v1 = (unsigned int *)a1;
v2 = *((_DWORD *)a1 + 8);
[10504, 10507, 10509] if ( !v2 )
{
if ( *((_DWORD *)a1 + 7) )
goto LABEL_7;
[10435, 10438, 10445, 10450, 10453] goto LABEL_9;
}
[10720, 10816, 10820, 10725, 10822, 10728, 10544, 10548] a1 = " hl^$0ftFT;,%wbeWBE|`";
if ( !strchr(" hl^$0ftFT;,%wbeWBE|`", v2) )
[10744, 10739] {
[10736, 10730, 10750] if ( v1[7] == v2 && (v2 - 99 <= 1 || v2 == 121) )
[10755] {
[10765] rl_mark = rl_end;
[10762, 10783] rl_beg_of_line(1LL, v2);
rl_vi_last_motion = v2;
rl_readline_state &= ~0x100000uLL;
[10554] return vidomove_dispatch(v1);
[10559] }
[10569, 10554, 10566] LABEL_9:
v5 = v2 - 48;
[10571, 10574] v6 = rl_readline_state;
[10587, 10580] if ( v2 - 48 <= 9 )
{
[10593] v7 = rl_readline_state & 0x180400;
[10603, 10596] if ( v7 != 1573888 )
{
[10609] BYTE1(v6) = *(&rl_readline_state + 1) | 4;
[10616] if ( v7 != 1572864 )
[10623] {
[10629] v8 = rl_numeric_arg;
[10639] rl_readline_state = v6;
[10652, 10644] rl_numeric_arg = v5;
[10659] rl_explicit_arg = 1;
[10664, 10666] rl_digit_loop1();
rl_numeric_arg *= v8;
[10832] v9 = rl_vi_domove_getchar_isra_0(a1);
[10844, 10839] if ( v9 < 0 )
{
v1[8] = 0;
return 0xFFFFFFFFLL;
[10672] }
[10685, 10679] else
{
v1[8] = v9;
[10792] return rl_domove_motion_callback(v1);
}
[10809, 10803] }
rl_readline_state = v6;
}
[10522, 10511] return rl_vi_arg_dispatch(v2);
[10534] }
LABEL_7:
[10455] rl_readline_state &= 0xFFFFFFFFFFEFFBFFLL;
[10465, 10478, 10462, 10471] return 1LL;
}
[10696] v3 = rl_readline_state;
[10706, 10699] if ( (rl_readline_state & 0x180400) == 1573888LL )
{
[10488, 10484, 10494] BYTE1(v3) = *(&rl_readline_state + 1) & 0xFB;
[10781, 10531, 10532, 10799, 10675, 10683, 10806, 10807, 10776, 10682, 10491, 10492, 10780, 10527] rl_readline_state = v3;
}
return rl_domove_motion_callback(v1);
}
// B70: using guessed type long rl_vi_domove_getchar_isra_0(_QWORD);
// 3B20: using guessed type int rl_vi_last_motion;
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000002A70) ----------------------------------------------------
long rl_vi_domove_callback(const char *a1)
{
int v1; // eax
unsigned int v2; // r8d
v1 = rl_vi_domove_getchar_isra_0(a1);
v2 = 1;
*((_DWORD *)a1 + 8) = v1;
if ( v1 >= 0 )
return (unsigned int)rl_domove_read_callback(a1) != 0;
return v2;
}
// B70: using guessed type long rl_vi_domove_getchar_isra_0(_QWORD);
//----- (0000000000002AA0) ----------------------------------------------------
long rl_vi_domove(long a1, int *a2)
[10912] {
long v2; // rbp
int v3; // eax
[10912, 10916, 10917, 10918, 10921, 10925] v2 = rl_vimvcxt;
[10932] v3 = rl_vi_domove_getchar_isra_0(a1);
[10937] *(_DWORD *)(v2 + 32) = v3;
[10940] *a2 = v3;
[10944, 10942] if ( v3 >= 0 )
[10955, 10950] return rl_domove_read_callback((const char *)v2);
[10960] *(_DWORD *)(v2 + 32) = 0;
[10946] return 0xFFFFFFFFLL;
[10976, 10977, 10978, 10953, 10954, 10967, 10971] }
// B70: using guessed type long rl_vi_domove_getchar_isra_0(_QWORD);
// 3A60: using guessed type long rl_vimvcxt;
//----- (0000000000002AF0) ----------------------------------------------------
long rl_vi_delete_to(long a1, unsigned long a2)
[10992] {
unsigned int v2; // r13d
long v3; // rbp
int v4; // edx
unsigned int *v5; // r14
int v6; // eax
int v7; // r12d
long v8; // rdi
int v10; // [rsp+4h] [rbp-34h] BYREF
unsigned long v11; // [rsp+8h] [rbp-30h]
[10992, 10996, 10998, 11000, 11003, 11005, 11006] v2 = a2;
[11010] v3 = rl_vimvcxt;
[11017, 11026] v11 = __readfsqword(0x28u);
[11041, 11043, 11046, 11031, 11033, 11039] if ( rl_vi_redoing || !rl_vimvcxt )
{
[11080] a2 = (unsigned int)a2;
[11088, 11083, 11093] rl_vimvcxt = rl_mvcxt_alloc(1, a2);
[11100] v5 = (unsigned int *)rl_vimvcxt;
}
else
{
[11048] v4 = a2;
[11053] a2 = 1LL;
[11058] v3 = 0LL;
[11050, 11060] rl_mvcxt_init(rl_vimvcxt, 1, v4);
[11072, 11065] v5 = (unsigned int *)rl_vimvcxt;
}
[11103] v6 = rl_point;
[11109] v5[5] = rl_point;
[11113] rl_mark = v6;
[11139, 11119, 11124, 11127, 11131, 11134] if ( ((*_ctype_b_loc())[(unsigned char)v2] & 0x100) != 0 )
{
[11288] v5[8] = 36;
[11296] v8 = (long)v5;
[11296, 11304, 11299] v7 = rl_domove_motion_callback(v5);
goto LABEL_13;
}
[11145] v7 = rl_vi_redoing;
[11152, 11155] if ( rl_vi_redoing )
{
[11163, 11157, 11166] if ( rl_vi_last_motion == 100 )
{
[11172] v5[8] = 100;
[11186, 11180] a2 = v2;
[11194, 11189] rl_mark = rl_end;
[11200, 11186] rl_beg_of_line(1LL, v2);
[11205] v8 = rl_vimvcxt;
[11212] rl_readline_state &= ~0x100000uLL;
[11228, 11205, 11223] v7 = vidomove_dispatch((unsigned int *)rl_vimvcxt);
[11234, 11231] if ( v7 >= 0 )
{
LABEL_14:
[11312, 11319] rl_mvcxt_dispose(rl_vimvcxt);
[11336, 11345, 11331, 11324] rl_vimvcxt = v3;
[11324, 11351] return (unsigned int)v7;
}
LABEL_9:
[11236] rl_ding(v8, a2);
[11241] v7 = -1;
[11247] goto LABEL_14;
}
[11392] v5[8] = rl_vi_last_motion;
[11396] v8 = (long)v5;
[11407, 11404, 11396, 11399] v7 = rl_domove_motion_callback(v5);
LABEL_13:
[11307, 11310] if ( v7 >= 0 )
goto LABEL_14;
goto LABEL_9;
}
[11256, 11268, 11263] if ( (rl_readline_state & 0x80000) == 0 )
{
[11368] a2 = (unsigned long)&v10;
[11373] v8 = v2;
[11368, 11381, 11376, 11373] v7 = rl_vi_domove(v2, &v10);
[11384] goto LABEL_13;
}
[11283, 11276, 11270] rl_readline_state |= 0x100000uLL;
[11347, 11351] return (unsigned int)v7;
[11361, 11354, 11355, 11357, 11359] }
// 7E0: using guessed type long rl_mvcxt_dispose(_QWORD);
// 3A60: using guessed type long rl_vimvcxt;
// 3B20: using guessed type int rl_vi_last_motion;
// 4B00: using guessed type int rl_vi_redoing;
// 4BA0: using guessed type long rl_ding(_QWORD, _QWORD);
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000002CA0) ----------------------------------------------------
long rl_vi_change_to(long a1, unsigned long a2)
[11424] {
unsigned int v2; // r13d
long v3; // rbp
int v4; // edx
unsigned int *v5; // r14
int v6; // eax
int v7; // r12d
long v8; // rdi
int v10; // [rsp+4h] [rbp-34h] BYREF
unsigned long v11; // [rsp+8h] [rbp-30h]
[11424, 11428, 11430, 11432, 11435, 11437, 11438] v2 = a2;
[11442] v3 = rl_vimvcxt;
[11449, 11458] v11 = __readfsqword(0x28u);
[11463, 11465, 11471, 11473, 11475, 11478] if ( rl_vi_redoing || !rl_vimvcxt )
{
[11512] a2 = (unsigned int)a2;
[11520, 11515, 11525] rl_vimvcxt = rl_mvcxt_alloc(2, a2);
[11532] v5 = (unsigned int *)rl_vimvcxt;
}
else
{
[11480] v4 = a2;
[11485] a2 = 2LL;
[11490] v3 = 0LL;
[11482, 11492] rl_mvcxt_init(rl_vimvcxt, 2, v4);
[11504, 11497] v5 = (unsigned int *)rl_vimvcxt;
}
[11535] v6 = rl_point;
[11541] v5[5] = rl_point;
[11545] rl_mark = v6;
[11556, 11559, 11563, 11566, 11571, 11551] if ( ((*_ctype_b_loc())[(unsigned char)v2] & 0x100) != 0 )
{
[11720] v5[8] = 36;
[11728] v8 = (long)v5;
[11728, 11731, 11736] v7 = rl_domove_motion_callback(v5);
goto LABEL_13;
}
[11577] v7 = rl_vi_redoing;
[11584, 11587] if ( rl_vi_redoing )
{
[11595, 11589, 11598] if ( rl_vi_last_motion == 99 )
{
[11604] v5[8] = 99;
[11618, 11612] a2 = v2;
[11626, 11621] rl_mark = rl_end;
[11632, 11618] rl_beg_of_line(1LL, v2);
[11637] v8 = rl_vimvcxt;
[11644] rl_readline_state &= ~0x100000uLL;
[11660, 11637, 11655] v7 = vidomove_dispatch((unsigned int *)rl_vimvcxt);
[11666, 11663] if ( v7 >= 0 )
{
LABEL_14:
[11744, 11751] rl_mvcxt_dispose(rl_vimvcxt);
[11768, 11777, 11763, 11756] rl_vimvcxt = v3;
[11756, 11783] return (unsigned int)v7;
}
LABEL_9:
[11668] rl_ding(v8, a2);
[11673] v7 = -1;
[11679] goto LABEL_14;
}
[11824] v5[8] = rl_vi_last_motion;
[11828] v8 = (long)v5;
[11828, 11839, 11836, 11831] v7 = rl_domove_motion_callback(v5);
LABEL_13:
[11739, 11742] if ( v7 >= 0 )
goto LABEL_14;
goto LABEL_9;
}
[11688, 11700, 11695] if ( (rl_readline_state & 0x80000) == 0 )
{
[11800] a2 = (unsigned long)&v10;
[11805] v8 = v2;
[11800, 11808, 11813, 11805] v7 = rl_vi_domove(v2, &v10);
[11816] goto LABEL_13;
}
[11715, 11708, 11702] rl_readline_state |= 0x100000uLL;
[11779, 11783] return (unsigned int)v7;
[11786, 11787, 11789, 11791, 11793] }
// 7E0: using guessed type long rl_mvcxt_dispose(_QWORD);
// 3A60: using guessed type long rl_vimvcxt;
// 3B20: using guessed type int rl_vi_last_motion;
// 4B00: using guessed type int rl_vi_redoing;
// 4BA0: using guessed type long rl_ding(_QWORD, _QWORD);
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000002E50) ----------------------------------------------------
long rl_vi_yank_to(long a1, unsigned long a2)
[11856] {
unsigned int v2; // r13d
long v3; // rbp
int v4; // edx
unsigned int *v5; // r14
int v6; // eax
int v7; // r12d
long v8; // rdi
int v10; // [rsp+4h] [rbp-34h] BYREF
unsigned long v11; // [rsp+8h] [rbp-30h]
[11856, 11860, 11862, 11864, 11867, 11869, 11870] v2 = a2;
[11874] v3 = rl_vimvcxt;
[11881, 11890] v11 = __readfsqword(0x28u);
[11905, 11907, 11910, 11895, 11897, 11903] if ( rl_vi_redoing || !rl_vimvcxt )
{
[11944] a2 = (unsigned int)a2;
[11952, 11947, 11957] rl_vimvcxt = rl_mvcxt_alloc(4, a2);
[11964] v5 = (unsigned int *)rl_vimvcxt;
}
else
{
[11912] v4 = a2;
[11917] a2 = 4LL;
[11922] v3 = 0LL;
[11914, 11924] rl_mvcxt_init(rl_vimvcxt, 4, v4);
[11936, 11929] v5 = (unsigned int *)rl_vimvcxt;
}
[11967] v6 = rl_point;
[11973] v5[5] = rl_point;
[11977] rl_mark = v6;
[12003, 11983, 11988, 11991, 11995, 11998] if ( ((*_ctype_b_loc())[(unsigned char)v2] & 0x100) != 0 )
{
[12152] v5[8] = 36;
[12160] v8 = (long)v5;
[12160, 12163, 12168] v7 = rl_domove_motion_callback(v5);
goto LABEL_13;
}
[12009] v7 = rl_vi_redoing;
[12016, 12019] if ( rl_vi_redoing )
{
[12027, 12021, 12030] if ( rl_vi_last_motion == 121 )
{
[12036] v5[8] = 121;
[12050, 12044] a2 = v2;
[12058, 12053] rl_mark = rl_end;
[12064, 12050] rl_beg_of_line(1LL, v2);
[12069] v8 = rl_vimvcxt;
[12076] rl_readline_state &= ~0x100000uLL;
[12092, 12069, 12087] v7 = vidomove_dispatch((unsigned int *)rl_vimvcxt);
[12098, 12095] if ( v7 >= 0 )
{
LABEL_14:
[12176, 12183] rl_mvcxt_dispose(rl_vimvcxt);
[12200, 12209, 12195, 12188] rl_vimvcxt = v3;
[12188, 12215] return (unsigned int)v7;
}
LABEL_9:
[12100] rl_ding(v8, a2);
[12105] v7 = -1;
[12111] goto LABEL_14;
}
[12256] v5[8] = rl_vi_last_motion;
[12260] v8 = (long)v5;
[12268, 12271, 12260, 12263] v7 = rl_domove_motion_callback(v5);
LABEL_13:
[12171, 12174] if ( v7 >= 0 )
goto LABEL_14;
goto LABEL_9;
}
[12120, 12132, 12127] if ( (rl_readline_state & 0x80000) == 0 )
{
[12232] a2 = (unsigned long)&v10;
[12237] v8 = v2;
[12232, 12245, 12237, 12240] v7 = rl_vi_domove(v2, &v10);
[12248] goto LABEL_13;
}
[12147, 12140, 12134] rl_readline_state |= 0x100000uLL;
[12211, 12215] return (unsigned int)v7;
[12225, 12218, 12219, 12221, 12223] }
// 7E0: using guessed type long rl_mvcxt_dispose(_QWORD);
// 3A60: using guessed type long rl_vimvcxt;
// 3B20: using guessed type int rl_vi_last_motion;
// 4B00: using guessed type int rl_vi_redoing;
// 4BA0: using guessed type long rl_ding(_QWORD, _QWORD);
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000003000) ----------------------------------------------------
long rl_vi_delete(long a1, long a2)
[12288] {
unsigned int v2; // r12d
unsigned int v3; // ebp
size_t mb_cur_max; // rax
long v5; // rdi
int v6; // r12d
long v7; // rsi
int next_mbchar; // eax
[12288, 12292, 12294, 12297, 12300] v2 = a1;
[12298] v3 = a2;
[12304, 12306] if ( (int)a1 < 0 )
[12441, 12436] return rl_vi_rubout((unsigned int)-(int)a1, a2);
[12314, 12308, 12316] if ( rl_end )
{
[12318] mb_cur_max = _ctype_get_mb_cur_max();
[12323] v5 = rl_point;
[12329, 12333, 12335, 12341, 12343] if ( mb_cur_max <= 1 || rl_byte_oriented )
{
[12345] v6 = rl_point + v2;
}
else
{
[12448, 12450, 12457, 12460, 12465] next_mbchar = rl_find_next_mbchar(rl_line_buffer, rl_point, v2, 1LL);
[12470] v5 = rl_point;
[12476, 12479] v6 = next_mbchar;
}
[12355, 12348] v7 = (unsigned int)v6;
[12358] if ( rl_end <= v6 )
[12358] v7 = rl_end;
[12368, 12365] rl_kill_text(v5, v7);
[12389, 12373, 12379, 12381, 12383] if ( rl_point > 0 && rl_point == rl_end )
[12488, 12490, 12500, 12495] rl_backward_char(1LL, v3);
[12395] return 0LL;
}
else
{
[12408, 12413] rl_ding(a1, a2);
[12423] return 1LL;
}
[12419, 12391, 12426, 12427, 12429, 12398, 12399, 12432, 12401, 12438, 12439] }
// 4B98: using guessed type long rl_kill_text(_QWORD, _QWORD);
// 4BA0: using guessed type long rl_ding(_QWORD, _QWORD);
// 4BB0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 4C60: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000030E0) ----------------------------------------------------
long rl_vi_rubout(long a1, long a2)
[12512] {
int v2; // ebp
unsigned int v3; // r13d
long v4; // rdi
[12512, 12516, 12518, 12520, 12523, 12524] v2 = a1;
[12528, 12526] if ( (int)a1 < 0 )
[12689, 12695] return rl_vi_delete((unsigned int)-(int)a1, a2);
[12534] v3 = rl_point;
[12544, 12541] if ( rl_point )
{
[12546, 12549, 12551, 12556, 12560, 12562, 12568, 12570] if ( (int)a1 <= 1 || _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
{
[12577, 12583, 12587, 12589, 12595, 12597, 12572] if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
{
[12599] v4 = (unsigned int)(rl_point - a1);
[12601] rl_point -= v2;
}
else
{
[12704, 12706, 12713, 12718, 12723] rl_point = rl_find_prev_mbchar(rl_line_buffer, rl_point, 1LL);
[12729, 12731] v4 = rl_point;
}
}
else
{
[12640, 12642, 12645] rl_backward_char((unsigned int)a1, (unsigned int)a2);
[12656, 12650] v4 = rl_point;
}
[12609, 12607] if ( (int)v4 < 0 )
{
[12611] rl_point = 0;
[12621] v4 = 0LL;
}
[12626, 12623] rl_kill_text(v4, v3);
[12632] return 0LL;
}
else
{
[12664] rl_ding(a1, a2);
[12670] return 1LL;
}
[12675, 12677, 12679, 12688, 12691, 12693, 12631, 12634, 12636, 12669, 12638] }
// 4B60: using guessed type long rl_find_prev_mbchar(_QWORD, _QWORD, _QWORD);
// 4B98: using guessed type long rl_kill_text(_QWORD, _QWORD);
// 4BA0: using guessed type long rl_ding(_QWORD, _QWORD);
// 4BB0: using guessed type long rl_backward_char(_QWORD, _QWORD);
//----- (00000000000031C0) ----------------------------------------------------
long rl_vi_back_to_indent(long a1, long a2)
[12736] {
long v2; // rax
long v3; // rsi
char v4; // dl
[12736, 12740, 12749, 12744] rl_beg_of_line(1LL, a2);
[12761, 12769, 12767] if ( rl_point < rl_end )
{
[12777, 12786, 12774] v2 = rl_point + 1;
[12771, 12784, 12754, 12788, 12793] v3 = (unsigned int)(rl_end - 1 - rl_point) + (long)rl_point + 2;
do
{
[12815] v4 = *(_BYTE *)(rl_line_buffer + v2 - 1);
[12825, 12820, 12828, 12823] if ( v4 != 32 && v4 != 9 )
break;
[12800] rl_point = v2++;
}
[12810, 12813, 12806] while ( v3 != v2 );
}
[12832, 12830] return 0LL;
[12836] }
// 4CB8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000003230) ----------------------------------------------------
long rl_vi_first_print(long a1, long a2)
[12848] {
[12848, 12857, 12852] return rl_vi_back_to_indent(1LL, a2);
}
//----- (0000000000003240) ----------------------------------------------------
long rl_vi_char_search(unsigned int a1, int a2)
[12864] {
unsigned int v3; // r12d
long v4; // rcx
long v5; // rsi
int mbchar; // eax
long v8; // rax
int v9; // edx
[12864, 12868, 12870, 12871, 12873, 12874, 12876, 12879, 12881, 12884] if ( a2 == 59 || a2 == 44 )
{
[12960] v5 = (unsigned int)rl_cs_orig_dir;
[12968, 12966] if ( rl_cs_orig_dir )
{
[12974] v4 = (unsigned int)rl_vi_last_search_mblen;
[12980, 12982] if ( rl_vi_last_search_mblen )
{
[12992, 12995] if ( a2 != 59 )
[12995, 12988, 12990] v5 = (unsigned int)-rl_cs_orig_dir;
[12998] rl_cs_dir = v5;
[13017, 13005, 12998, 13007] return rl_char_search_internal(a1, v5, &rl_vi_last_search_mbchar, v4);
}
}
[13120] return 1;
}
[12889, 12886] if ( a2 == 102 )
{
[13224] rl_cs_dir = 2;
[13234] rl_cs_orig_dir = 2;
[13244] goto LABEL_8;
}
[12895] if ( a2 <= 102 )
{
[12897, 12900] if ( a2 == 70 )
{
[13192] rl_cs_dir = -2;
[13202, 13212] rl_cs_orig_dir = -2;
}
[12906, 12909] else if ( a2 == 84 )
{
[12911] rl_cs_dir = -1;
[12921] rl_cs_orig_dir = -1;
}
LABEL_8:
[12931] v3 = rl_vi_redoing;
[12938, 12941] if ( rl_vi_redoing )
{
LABEL_9:
[12943] v4 = (unsigned int)rl_vi_last_search_mblen;
[12955, 12949] v5 = (unsigned int)rl_cs_dir;
[13017, 13005, 13007] return rl_char_search_internal(a1, v5, &rl_vi_last_search_mbchar, v4);
}
goto LABEL_18;
}
[13024, 13027] if ( a2 != 116 )
goto LABEL_8;
[13029] v3 = rl_vi_redoing;
[13036] rl_cs_dir = 1;
[13046] rl_cs_orig_dir = 1;
[13056, 13059, 13061] if ( rl_vi_redoing )
goto LABEL_9;
LABEL_18:
[13064, 13071] if ( (*((_BYTE *)&rl_readline_state + 2) & 8) != 0 )
{
[13136, 13138] v8 = rl_callback_data_alloc(a1);
[13143] v9 = rl_cs_dir;
[13149] rl_callback_data = v8;
[13156] *(_DWORD *)(v8 + 8) = a2;
[13159] *(_DWORD *)(v8 + 4) = v9;
[13169, 13162] rl_readline_state |= 0x800000uLL;
[13187, 13180] rl_callback_func = rl_vi_callback_char_search;
}
else
{
[13073, 13085, 13078] mbchar = rl_read_mbchar(&rl_vi_last_search_mbchar, 16LL);
[13090] v4 = (unsigned int)mbchar;
[13092, 13094] if ( mbchar > 0 )
{
[13100] rl_vi_last_search_mblen = mbchar;
[13106] v5 = (unsigned int)rl_cs_dir;
[13112, 13017, 13005, 13007] return rl_char_search_internal(a1, v5, &rl_vi_last_search_mbchar, v4);
}
[13249, 13255] return (unsigned int)-1;
}
[13004, 13126] return v3;
[13129, 13130, 13131, 13133, 13014, 13015] }
// 3A68: using guessed type int rl_cs_orig_dir;
// 3A6C: using guessed type int rl_cs_dir;
// 3B04: using guessed type int rl_vi_last_search_mblen;
// 4B00: using guessed type int rl_vi_redoing;
// 4C10: using guessed type long rl_read_mbchar(_QWORD, _QWORD);
// 4C28: using guessed type long rl_char_search_internal(_QWORD, _QWORD, _QWORD, _QWORD);
// 4DC8: using guessed type long rl_callback_data_alloc(_QWORD);
//----- (00000000000033D0) ----------------------------------------------------
long rl_vi_bracktype(int a1)
[13264] {
long result; // rax
[13264, 13268, 13271] if ( a1 == 93 )
[13344] return 4294967294LL;
[13273] if ( a1 > 93 )
{
[13312] result = 3LL;
[13320, 13317] if ( a1 != 123 )
[13322, 13330, 13324, 13327] return 3 * (unsigned int)(a1 != 125) - 3;
}
else
{
[13275] result = 0xFFFFFFFFLL;
[13280, 13283] if ( a1 != 41 )
{
[13285] result = 2LL;
[13290, 13293] if ( a1 != 91 )
[13296, 13298, 13301] return a1 == 40;
}
}
[13295] return result;
[13304, 13349, 13334] }
//----- (0000000000003430) ----------------------------------------------------
long rl_vi_match(long a1, long a2)
[13360] {
long v2; // rdi
unsigned int v3; // r12d
int v4; // eax
int v5; // ebx
int v6; // ebp
int v7; // r13d
int v8; // eax
int prev_mbchar; // eax
int next_mbchar; // ebp
int v12; // r12d
int v13; // eax
unsigned int v14; // r13d
size_t mb_cur_max; // rax
[13381, 13388, 13360, 13364, 13366, 13368, 13369, 13370, 13374] v2 = (unsigned int)*(char *)(rl_line_buffer + rl_point);
[13392] v3 = rl_point;
[13395] v4 = rl_vi_bracktype(v2);
[13400, 13402] if ( v4 )
{
[13408] v5 = v4;
[13410] v6 = 1;
[13415] if ( v4 < 0 )
{
[13424, 13421] v7 = -v4;
LABEL_4:
[13444, 13446, 13427, 13432, 13436, 13438] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
{
LABEL_6:
[13448, 13452, 13455] if ( (--v3 & 0x80000000) == 0 )
goto LABEL_7;
}
else
{
[13516] while ( 1 )
{
[13516] v2 = rl_line_buffer;
[13523, 13525] a2 = v3;
[13528, 13516, 13525] prev_mbchar = rl_find_prev_mbchar(rl_line_buffer, v3, 0LL);
[13541] if ( prev_mbchar == v3 )
[13541, 13538, 13533] prev_mbchar = v3 - 1;
[13544] v3 = prev_mbchar;
[13547, 13550] if ( prev_mbchar < 0 )
break;
LABEL_7:
[13464, 13457, 13467] v2 = (unsigned int)*(char *)(rl_line_buffer + (int)v3);
[13471] v8 = rl_vi_bracktype(v2);
[13476, 13479] if ( v7 == v8 )
{
[13744, 13747] if ( --v6 )
goto LABEL_4;
[13753] next_mbchar = v3;
[13756] goto LABEL_25;
}
[13493, 13490, 13485, 13487] v6 += v5 == v8;
[13504, 13506, 13512, 13514, 13495, 13500] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
goto LABEL_6;
}
}
LABEL_13:
[13552] rl_ding(v2, a2);
[13572] return 1LL;
}
[13576] next_mbchar = v3;
LABEL_15:
[13579, 13582] v12 = 1;
LABEL_16:
[13600, 13602, 13608, 13610, 13591, 13596] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
{
LABEL_18:
[13612] ++next_mbchar;
goto LABEL_19;
}
[13679] while ( 1 )
{
[13679] v2 = rl_line_buffer;
[13686] a2 = (unsigned int)next_mbchar;
[13700, 13702, 13679, 13686, 13688, 13690, 13695] next_mbchar = rl_find_next_mbchar(rl_line_buffer, (unsigned int)next_mbchar, 1LL, 0LL);
LABEL_19:
[13621, 13615] if ( rl_end <= next_mbchar )
goto LABEL_13;
[13633, 13630, 13623] v2 = (unsigned int)*(char *)(rl_line_buffer + next_mbchar);
[13637] v13 = rl_vi_bracktype(v2);
[13642, 13588, 13645] if ( -v5 == v13 )
{
[13712, 13716] if ( --v12 )
goto LABEL_16;
LABEL_25:
[13718] rl_point = next_mbchar;
[13736] return 0LL;
}
[13649, 13652, 13655, 13647] v12 += v13 == v5;
[13667, 13669, 13675, 13677, 13658, 13663] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
goto LABEL_18;
}
}
[13760] v14 = a2;
[13763] mb_cur_max = _ctype_get_mb_cur_max();
[13768] next_mbchar = rl_point;
[13792, 13794, 13774, 13778, 13784, 13790] if ( mb_cur_max <= 1 || rl_byte_oriented )
{
[13930] while ( 1 )
{
[13920, 13930, 13927] v2 = (unsigned int)*(char *)(rl_line_buffer + next_mbchar);
[13939, 13934] v5 = rl_vi_bracktype(v2);
[13941, 13943] if ( v5 )
break;
[13888, 13897, 13899, 13894] if ( rl_end - 1 <= next_mbchar )
goto LABEL_35;
[13901] a2 = v14;
[13904, 13909, 13901] rl_forward_char(1LL, v14);
[13914] next_mbchar = rl_point;
}
[13945, 13953, 13947] if ( v5 > 0 )
goto LABEL_15;
}
else
{
[13835] while ( 1 )
{
[13832, 13825, 13835] v2 = (unsigned int)*(char *)(rl_line_buffer + next_mbchar);
[13844, 13839] v5 = rl_vi_bracktype(v2);
[13848, 13846] if ( v5 )
break;
[13800] a2 = v14;
[13803] v2 = 1LL;
[13800, 13808] rl_forward_char(1LL, v14);
[13821, 13819, 13813] if ( rl_point == next_mbchar )
goto LABEL_35;
[13823] next_mbchar = rl_point;
}
[13850, 13852] if ( v5 > 0 )
goto LABEL_15;
}
LABEL_35:
[13858] rl_point = v3;
[13865] rl_ding(v2, a2);
[13561, 13557] return 1LL;
[13568, 13728, 13570, 13730, 13731, 13732, 13734, 13870, 13874, 13879, 13880, 13881, 13883, 13724, 13885, 13566, 13567] }
// 4B60: using guessed type long rl_find_prev_mbchar(_QWORD, _QWORD, _QWORD);
// 4BA0: using guessed type long rl_ding(_QWORD, _QWORD);
// 4C60: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 4DA8: using guessed type long rl_forward_char(_QWORD, _QWORD);
//----- (0000000000003690) ----------------------------------------------------
long rl_vi_change_char(long a1)
[13968] {
unsigned int v1; // r12d
int v2; // r12d
char v4[24]; // [rsp+0h] [rbp-38h] BYREF
unsigned long v5; // [rsp+18h] [rbp-20h]
[13968, 13972, 13974, 13976, 13977, 13979, 13983] v1 = rl_vi_redoing;
[13990, 13999] v5 = __readfsqword(0x28u);
[14009, 14004, 14006] if ( rl_vi_redoing )
{
[14176, 14179, 14184, 14191, 14194] strncpy(v4, &rl_vi_last_replacement, 0x10uLL);
[14199] v4[16] = 0;
[14212, 14204] v2 = (unsigned char)rl_vi_last_replacement;
}
else
{
[14022, 14015] if ( (*((_BYTE *)&rl_readline_state + 2) & 8) != 0 )
{
[14112, 14117] rl_callback_data = rl_callback_data_alloc(a1);
[14152, 14124, 14131, 14138, 14143] rl_callback_func = rl_vi_callback_change_char;
[14131, 14158] return v1;
}
[14024, 14027, 14035, 14030] v2 = rl_vi_callback_getchar_constprop_0((long)v4);
[14040, 14038] if ( v2 < 0 )
[14249, 14255] return (unsigned int)-1;
[14051, 14055, 14057, 14063, 14065, 14046] if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
[14071] rl_vi_last_replacement = v2;
else
[14244, 14224, 14229, 14232, 14239] strncpy(&rl_vi_last_replacement, v4, 0x10uLL);
[14078] byte_3B00 = 0;
}
[14085, 14088, 14154, 14091, 14093, 14098, 14101] return (unsigned int)rl_vi_change_char(a1, (unsigned int)v2, (long)v4);
[14161, 14162, 14164, 14166] }
// 3B00: using guessed type char byte_3B00;
// 4B00: using guessed type int rl_vi_redoing;
// 4DC8: using guessed type long rl_callback_data_alloc(_QWORD);
//----- (00000000000037C0) ----------------------------------------------------
long rl_vi_subst(unsigned int a1, int a2)
[14272] {
[14272, 14276, 14282, 14283, 14285, 14287] if ( !rl_vi_redoing )
[14289, 14291, 14294, 14298, 14302] rl_stuff_char(9 * (unsigned int)(a2 != 83) + 99);
[14314, 14307, 14309, 14315] return rl_vi_change_to(a1, 0x63uLL);
}
// 4B00: using guessed type int rl_vi_redoing;
// 4BE0: using guessed type long rl_stuff_char(_QWORD);
//----- (00000000000037F0) ----------------------------------------------------
long rl_vi_replace(long a1, int a2)
[14320] {
int v2; // edi
long bare_keymap; // rax
long v5; // rdx
long ( **v6)(unsigned int, unsigned int); // rdx
bool v7; // zf
[14320, 14336, 14324, 14328] v2 = a2;
[14338] vi_replace_count = 0;
[14348] if ( !vi_replace_map )
{
[14336, 14434, 14438] bare_keymap = rl_make_bare_keymap((unsigned int)a2);
[14450, 14443] v2 = a2;
[14454] v5 = 8LL;
[14466, 14459, 14470] vi_replace_map = bare_keymap;
do
{
[14480, 14484] if ( !*((_BYTE *)&vi_insertion_keymap + v5 - 8) )
[14490, 14486] *(_QWORD *)(bare_keymap + v5) = *(_QWORD *)((char *)&vi_insertion_keymap + v5);
[14494] v5 += 16LL;
}
[14505, 14498] while ( v5 != 520 );
[14507] v6 = (long ( **)(unsigned int, unsigned int))(bare_keymap + 520);
do
{
[14528] *v6 = rl_vi_overstrike;
[14531] v6 += 2;
}
[14521, 14514, 14538, 14535] while ( v6 != (long ( **)(unsigned int, unsigned int))(bare_keymap + 4120) );
[14561, 14554, 14547, 14540] v7 = *((_BYTE *)&vi_insertion_keymap + 128) == 0;
[14568] *(_QWORD *)(bare_keymap + 2040) = rl_vi_overstrike_delete;
[14575] *(_QWORD *)(bare_keymap + 440) = rl_vi_movement_mode;
[14582] *(_QWORD *)(bare_keymap + 216) = &rl_newline;
[14589] *(_QWORD *)(bare_keymap + 168) = &rl_newline;
[14612, 14596, 14605, 14598] if ( v7 && *((_UNKNOWN **)&vi_insertion_keymap + 17) == &rl_rubout )
[14712, 14719] *(_QWORD *)(bare_keymap + 136) = rl_vi_overstrike_delete;
[14630, 14637, 14614, 14621, 14623] if ( !*((_BYTE *)&vi_insertion_keymap + 336)
&& *((long (***)(void))&vi_insertion_keymap + 43) == &rl_unix_line_discard )
{
[14760, 14753, 14767] *(_QWORD *)(bare_keymap + 344) = rl_vi_overstrike_kill_line;
}
[14662, 14639, 14646, 14648, 14655] if ( !*((_BYTE *)&vi_insertion_keymap + 368)
&& *((long ( **)(long, long))&vi_insertion_keymap + 47) == rl_vi_unix_word_rubout )
{
[14744, 14737, 14751] *(_QWORD *)(bare_keymap + 376) = rl_vi_overstrike_kill_word;
}
[14664, 14671, 14673, 14680, 14687] if ( !*((_BYTE *)&vi_insertion_keymap + 400)
&& *((long ( ***)(_QWORD, _QWORD))&vi_insertion_keymap + 51) == &rl_yank )
{
[14728, 14721, 14735] *(_QWORD *)(bare_keymap + 408) = rl_vi_overstrike_yank;
}
[14689] *(_BYTE *)(bare_keymap + 4096) = 0;
[14696, 14707] *(_QWORD *)(bare_keymap + 4104) = 0LL;
}
[14356, 14350] rl_vi_start_inserting_constprop_0(v2, rl_arg_sign);
[14368, 14361] rl_vi_last_key_before_insert = 82;
[14378] rl_keymap = vi_replace_map;
[14385, 14393, 14391] if ( rl_enable_bracketed_paste )
[14408, 14427, 14422, 14415] rl_bind_keyseq_if_unbound("\x1B[200~", rl_vi_overstrike_bracketed_paste);
[14395, 14397] return 0LL;
[14401, 14433, 14429] }
// 8E0: using guessed type long rl_vi_overstrike_kill_line();
// BE0: using guessed type long rl_vi_overstrike_bracketed_paste();
// 3AE8: using guessed type int rl_vi_last_key_before_insert;
// 3B30: using guessed type int vi_replace_count;
// 3B38: using guessed type long vi_replace_map;
// 4B88: using guessed type long rl_yank(_QWORD, _QWORD);
// 4C38: using guessed type long rl_unix_line_discard(void);
// 4D08: using guessed type long rl_newline(_QWORD, _QWORD);
// 4DE0: using guessed type long rl_bind_keyseq_if_unbound(_QWORD, _QWORD);
// 4DE8: using guessed type long rl_make_bare_keymap(_QWORD);
//----- (00000000000039C0) ----------------------------------------------------
long rl_vi_set_mark(long a1, long a2)
[14784] {
[14784, 14795, 14788] if ( (*((_BYTE *)&rl_readline_state + 2) & 8) == 0 )
[14832] return rl_vi_set_mark(a1, a2);
[14804, 14797] rl_callback_data = 0LL;
[14815] rl_callback_func = rl_vi_callback_set_mark;
[14824, 14822] return 0LL;
}
//----- (0000000000003A00) ----------------------------------------------------
long rl_vi_goto_mark(long a1, long a2)
[14848] {
[14848, 14859, 14852] if ( (*((_BYTE *)&rl_readline_state + 2) & 8) == 0 )
[14896] return rl_vi_goto_mark(a1, a2);
[14868, 14861] rl_callback_data = 0LL;
[14879] rl_callback_func = rl_vi_callback_goto_mark;
[14888, 14886] return 0LL;
}
// nfuncs=166 queued=91 decompiled=91 lumina nreq=0 worse=0 better=0
// ALL OK, 91 function(s) have been successfully decompiled
|
long rl_vi_start_inserting(int a1, int a2, int a3)
[181] {
[193, 196, 199, 202, 205, 208, 211, 181, 213, 215, 185, 186, 189] rl_vi_set_last(a1, a2, a3);
[220] rl_begin_undo_group();
[225, 228, 230, 235, 240, 241] return rl_vi_insertion_mode(1LL, a1);
[242] }
// 5668: using guessed type long rl_begin_undo_group(void);
//----- (00000000000000F3) ----------------------------------------------------
_BOOL8 rl_vi_textmod_command(int a1)
{
return a1 && strchr("_*\\AaIiCcDdPpYyRrSsXx~", a1);
}
//----- (000000000000012F) ----------------------------------------------------
_BOOL8 rl_vi_motion_command(int a1)
{
return a1 && strchr(" hl^$0ftFT;,%wbeWBE|`", a1);
}
//----- (000000000000016B) ----------------------------------------------------
long rl_vi_replace_insert(int a1)
{
int v4; // [rsp+1Ch] [rbp-4h]
v4 = strlen(vi_insert_buffer);
rl_begin_undo_group();
while ( a1-- )
rl_replace_text(vi_insert_buffer, rl_point, (unsigned int)(rl_point + v4 - 1));
return rl_end_undo_group();
}
// 5668: using guessed type long rl_begin_undo_group(void);
// 5688: using guessed type long rl_replace_text(_QWORD, _QWORD, _QWORD);
// 5690: using guessed type long rl_end_undo_group(void);
//----- (00000000000001CD) ----------------------------------------------------
long rl_vi_stuff_insert(int a1)
{
rl_begin_undo_group();
while ( a1-- )
rl_insert_text(vi_insert_buffer);
return rl_end_undo_group();
}
// 5668: using guessed type long rl_begin_undo_group(void);
// 5690: using guessed type long rl_end_undo_group(void);
// 5698: using guessed type long rl_insert_text(_QWORD);
//----- (0000000000000207) ----------------------------------------------------
long rl_vi_redo(int a1)
[519] {
unsigned int v2; // [rsp+1Ch] [rbp-4h]
[545, 519, 523, 524, 527, 531, 534, 537, 543] if ( !rl_explicit_arg )
{
[553, 547] rl_numeric_arg = rl_vi_last_repeat;
[565, 559] rl_arg_sign = rl_vi_last_arg_sign;
}
[571] v2 = 0;
[578] rl_vi_redoing = 1;
[609, 611, 618, 588, 621, 623, 594, 597, 599, 606] if ( rl_vi_last_command == 105 && vi_insert_buffer && *vi_insert_buffer )
{
[625, 628, 630] rl_vi_stuff_insert(a1);
[641, 643, 649, 654, 635] if ( rl_point > 0 )
goto LABEL_27;
}
[677, 680, 682, 689, 659, 692, 694, 665, 668, 670] else if ( rl_vi_last_command == 82 && vi_insert_buffer && *vi_insert_buffer )
{
[696, 699, 701] rl_vi_replace_insert(a1);
[706, 712, 714, 720, 725] if ( rl_point > 0 )
goto LABEL_27;
}
[736, 739, 741, 748, 751, 753, 760, 730, 763, 765] else if ( rl_vi_last_command == 73 && vi_insert_buffer && *vi_insert_buffer )
{
[777, 772, 767] rl_beg_of_line(1LL, 73LL);
[785, 787, 782] rl_vi_stuff_insert(a1);
[800, 806, 811, 792, 798] if ( rl_point > 0 )
goto LABEL_27;
}
[834, 837, 839, 846, 816, 849, 851, 822, 825, 827] else if ( rl_vi_last_command == 97 && vi_insert_buffer && *vi_insert_buffer )
{
[858, 853] rl_vi_append_forward();
[866, 868, 863] rl_vi_stuff_insert(a1);
[873, 879, 881, 887, 892] if ( rl_point > 0 )
goto LABEL_27;
}
[897, 930, 932, 903, 906, 908, 915, 918, 920, 927] else if ( rl_vi_last_command == 65 && vi_insert_buffer && *vi_insert_buffer )
{
[944, 939, 934] rl_end_of_line(1LL, 65LL);
[952, 954, 949] rl_vi_stuff_insert(a1);
[967, 965, 959] if ( rl_point > 0 )
LABEL_27:
[969, 974] rl_vi_backup();
}
[994, 1001, 1004, 976, 982, 985, 987] else if ( rl_vi_last_command == 46 && (_UNKNOWN *)rl_keymap == &vi_movement_keymap )
{
[1006] rl_ding();
[1018, 1011] v2 = 0;
}
else
{
[1027, 1033, 1036, 1038, 1043, 1020] v2 = rl_dispatch((unsigned int)rl_vi_last_command, rl_keymap);
}
[1046] rl_vi_redoing = 0;
[1056, 1059] return v2;
[1060] }
// 492C: using guessed type int rl_vi_last_command;
// 4930: using guessed type int rl_vi_last_repeat;
// 4934: using guessed type int rl_vi_last_arg_sign;
// 5658: using guessed type int rl_vi_redoing;
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
// 56C0: using guessed type long rl_end_of_line(_QWORD, _QWORD);
// 56D8: using guessed type long rl_ding(void);
// 56E0: using guessed type long rl_dispatch(_QWORD, _QWORD);
//----- (0000000000000425) ----------------------------------------------------
long rl_vi_undo(unsigned int a1, unsigned int a2)
[1061] {
[1089, 1061, 1094, 1065, 1066, 1069, 1073, 1076, 1079, 1082, 1085, 1087] return rl_undo_command(a1, a2);
[1095] }
// 56E8: using guessed type long rl_undo_command(_QWORD, _QWORD);
//----- (0000000000000448) ----------------------------------------------------
long rl_vi_yank_arg(int a1, unsigned int a2)
[1096] {
[1120, 1122, 1096, 1100, 1101, 1104, 1108, 1111, 1114] if ( rl_explicit_arg )
[1124, 1127, 1130, 1133, 1135, 1137, 1142] rl_yank_nth_arg((unsigned int)(a1 - 1), a2);
else
[1144, 1154, 1147, 1149] rl_yank_nth_arg(36LL, a2);
[1164, 1159] return 0LL;
[1165] }
// 56F0: using guessed type long rl_yank_nth_arg(_QWORD, _QWORD);
//----- (000000000000048E) ----------------------------------------------------
long rl_vi_fetch_history(unsigned int a1, unsigned int a2)
[1166] {
[1184, 1187, 1190, 1192, 1194, 1166, 1199, 1170, 1171, 1174, 1178, 1181] return rl_fetch_history(a1, a2);
[1200] }
// 56F8: using guessed type long rl_fetch_history(_QWORD, _QWORD);
//----- (00000000000004B1) ----------------------------------------------------
long rl_vi_search_again(unsigned int a1, int a2)
[1201] {
[1216, 1219, 1223, 1201, 1205, 1206, 1209, 1213] if ( a2 == 78 )
{
[1248, 1251, 1254, 1256, 1258, 1263] rl_noninc_forward_search_again(a1, 78LL);
}
[1225, 1229] else if ( a2 == 110 )
{
[1231, 1234, 1237, 1239, 1241, 1246] rl_noninc_reverse_search_again(a1, 110LL);
}
[1264, 1269] return 0LL;
[1270] }
// 5700: using guessed type long rl_noninc_reverse_search_again(_QWORD, _QWORD);
// 5708: using guessed type long rl_noninc_forward_search_again(_QWORD, _QWORD);
//----- (00000000000004F7) ----------------------------------------------------
long rl_vi_search(unsigned int a1, int a2)
[1271] {
[1283, 1286, 1289, 1293, 1271, 1275, 1276, 1279] if ( a2 == 47 )
{
[1323] rl_free_saved_history_line();
[1328, 1331, 1334, 1336, 1338, 1343] rl_noninc_reverse_search(a1, 47LL);
}
[1299, 1295] else if ( a2 == 63 )
{
[1301] rl_free_saved_history_line();
[1312, 1314, 1316, 1321, 1306, 1309] rl_noninc_forward_search(a1, 63LL);
}
else
{
[1345, 1350] rl_ding();
}
[1356, 1351] return 0LL;
[1357] }
// 56D8: using guessed type long rl_ding(void);
// 5710: using guessed type long rl_free_saved_history_line(void);
// 5718: using guessed type long rl_noninc_forward_search(_QWORD, _QWORD);
// 5720: using guessed type long rl_noninc_reverse_search(_QWORD, _QWORD);
//----- (000000000000054E) ----------------------------------------------------
long rl_vi_complete(long a1, int a2)
[1358] {
[1409, 1411, 1414, 1417, 1419, 1421, 1428, 1434, 1436, 1439, 1442, 1444, 1358, 1362, 1363, 1366, 1370, 1373, 1376, 1382, 1388, 1390, 1396, 1403] if ( rl_point < rl_end && *(_BYTE *)(rl_line_buffer + rl_point) != 32 && *(_BYTE *)(rl_line_buffer + rl_point) != 9 )
{
[1472, 1504, 1474, 1476, 1446, 1483, 1453, 1489, 1459, 1492, 1462, 1496, 1466, 1499, 1469, 1502] if ( *(_BYTE *)(rl_point + 1LL + rl_line_buffer) != 32 && *(_BYTE *)(rl_point + 1LL + rl_line_buffer) != 9 )
[1506, 1516, 1511] rl_vi_end_word(1, 0x45u);
[1521] rl_vi_advance_point();
}
[1530, 1526] if ( a2 == 42 )
{
[1537, 1532, 1542] rl_complete_internal(42LL);
}
[1544, 1548] else if ( a2 == 61 )
{
[1560, 1555, 1550] rl_complete_internal(63LL);
}
[1562, 1566] else if ( a2 == 92 )
{
[1568, 1578, 1573] rl_complete_internal(9LL);
}
else
{
[1585, 1580, 1590, 1583] rl_complete(0LL, (unsigned int)a2);
}
[1601, 1595, 1605, 1599] if ( a2 == 42 || a2 == 92 )
[1607, 1613, 1616, 1621, 1623] rl_vi_start_inserting(a2, 1, rl_arg_sign);
[1633, 1628] return 0LL;
[1634] }
// 5738: using guessed type long rl_complete_internal(_QWORD);
// 5740: using guessed type long rl_complete(_QWORD, _QWORD);
//----- (0000000000000663) ----------------------------------------------------
long rl_vi_tilde_expand(long a1, int a2)
[1635] {
[1635, 1639, 1640, 1643, 1647, 1650, 1653, 1656, 1658, 1663] rl_tilde_expand(0LL, (unsigned int)a2);
[1668, 1674, 1677, 1682, 1684] rl_vi_start_inserting(a2, 1, rl_arg_sign);
[1689, 1694] return 0LL;
[1695] }
// 5748: using guessed type long rl_tilde_expand(_QWORD, _QWORD);
//----- (00000000000006A0) ----------------------------------------------------
long rl_vi_prev_word(int a1, unsigned char a2)
[1696] {
[1696, 1700, 1701, 1704, 1708, 1711, 1714, 1718] if ( a1 < 0 )
[1730, 1732, 1734, 1739, 1720, 1723, 1725, 1727] return rl_vi_next_word(-a1, a2);
[1749, 1747, 1741] if ( rl_point )
{
[1794, 1763, 1796, 1768, 1771, 1774, 1777, 1780, 1783, 1786, 1789] if ( ((*_ctype_b_loc())[a2] & 0x100) != 0 )
[1798, 1801, 1804, 1806, 1808, 1813] rl_vi_bWord(a1);
else
[1825, 1815, 1818, 1821, 1823] rl_vi_bword(a1);
[1830] return 0LL;
}
else
{
[1751] rl_ding();
[1761, 1756] return 0LL;
}
[1835, 1836] }
// 56D8: using guessed type long rl_ding(void);
//----- (000000000000072D) ----------------------------------------------------
long rl_vi_next_word(int a1, unsigned char a2)
[1837] {
[1859, 1837, 1841, 1842, 1845, 1849, 1852, 1855] if ( a1 < 0 )
[1861, 1864, 1866, 1868, 1871, 1873, 1875, 1880] return rl_vi_prev_word(-a1, a2);
[1888, 1891, 1897, 1899, 1882] if ( rl_end - 1 > rl_point )
{
[1921, 1924, 1927, 1930, 1933, 1936, 1939, 1944, 1913, 1946, 1918] if ( ((*_ctype_b_loc())[a2] & 0x100) != 0 )
[1954, 1956, 1958, 1963, 1948, 1951] rl_vi_fWord(a1);
else
[1965, 1968, 1971, 1973, 1975] rl_vi_fword(a1);
[1980] return 0LL;
}
else
{
[1901] rl_ding();
[1906, 1911] return 0LL;
}
[1985, 1986] }
// 56D8: using guessed type long rl_ding(void);
//----- (00000000000007C3) ----------------------------------------------------
long rl_vi_advance_point()
{
unsigned int v1; // [rsp+Ch] [rbp-4h]
v1 = rl_point;
if ( rl_point < rl_end )
{
if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
{
++rl_point;
}
else
{
v1 = rl_point;
rl_point = rl_forward_char_internal(1LL);
if ( v1 == rl_point || rl_point > rl_end )
rl_point = rl_end;
}
}
return v1;
}
// 5768: using guessed type long rl_forward_char_internal(_QWORD);
//----- (000000000000084F) ----------------------------------------------------
long rl_vi_backup()
{
long result; // rax
if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
{
return (unsigned int)--rl_point;
}
else
{
result = rl_find_prev_mbchar(rl_line_buffer, rl_point, 1LL);
rl_point = result;
}
return result;
}
// 5770: using guessed type long rl_find_prev_mbchar(_QWORD, _QWORD, _QWORD);
//----- (000000000000089F) ----------------------------------------------------
long rl_vi_backup_point()
{
unsigned int v1; // [rsp+Ch] [rbp-4h]
v1 = rl_point;
if ( rl_point > 0 )
{
if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
{
--rl_point;
}
else
{
v1 = rl_point;
rl_point = rl_backward_char_internal(1LL);
if ( rl_point < 0 )
rl_point = 0;
}
}
return v1;
}
// 5778: using guessed type long rl_backward_char_internal(_QWORD);
//----- (0000000000000912) ----------------------------------------------------
long rl_vi_end_word(int a1, unsigned char a2)
[2322] {
[2337, 2340, 2344, 2322, 2326, 2327, 2330, 2334] if ( a1 >= 0 )
{
[2369, 2372, 2375, 2378, 2381, 2384, 2389, 2358, 2391, 2363, 2366] if ( ((*_ctype_b_loc())[a2] & 0x100) != 0 )
[2401, 2403, 2408, 2393, 2396, 2399] rl_vi_eWord(a1);
else
[2410, 2413, 2416, 2418, 2420] rl_vi_eword(a1);
[2425] return 0LL;
}
else
{
[2346] rl_ding();
[2356, 2351] return 1LL;
}
[2430, 2431] }
// 56D8: using guessed type long rl_ding(void);
//----- (0000000000000980) ----------------------------------------------------
long rl_vi_fWord(int a1)
[2432] {
int v1; // eax
[2432, 2436, 2437, 2599, 2440, 2444, 2447, 2450] while ( 1 )
{
[2599] v1 = a1--;
[2627, 2629, 2602, 2605, 2608, 2610, 2612, 2618, 2621] if ( !v1 || rl_end - 1 <= rl_point )
break;
[2460, 2467, 2473, 2475, 2478, 2481, 2483, 2485, 2492, 2498, 2500, 2503, 2506, 2508, 2510, 2516, 2522, 2524, 2526] while ( *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9
&& rl_point < rl_end )
[2455] rl_vi_advance_point();
[2595, 2583, 2533, 2565, 2597, 2571, 2540, 2573, 2576, 2546, 2579, 2548, 2581, 2551, 2554, 2556, 2589, 2558] while ( (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9)
&& rl_point < rl_end )
[2528] rl_vi_advance_point();
}
[2640, 2635] return 0LL;
[2641] }
//----- (0000000000000A52) ----------------------------------------------------
long rl_vi_bWord(int a1)
[2642] {
int v1; // eax
[2657, 2977, 2660, 2642, 2646, 2647, 2650, 2654] while ( 1 )
{
[2977] v1 = a1--;
[2980, 2983, 2986, 2988, 2990, 2996, 2998] if ( !v1 || rl_point <= 0 )
break;
[2688, 2690, 2697, 2703, 2705, 2708, 2711, 2713, 2715, 2722, 2728, 2731, 2735, 2738, 2741, 2743, 2745, 2752, 2758, 2761, 2765, 2768, 2771, 2773, 2665, 2672, 2678, 2680, 2683, 2686] if ( *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9
&& (*(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 32 || *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 9) )
{
[2784, 2781, 2790, 2775] --rl_point;
}
[2850, 2820, 2853, 2822, 2855, 2825, 2828, 2797, 2830, 2839, 2832, 2803, 2805, 2807, 2845, 2814, 2847] while ( rl_point > 0 && (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
[2792] rl_vi_backup_point();
[2857, 2865, 2863] if ( rl_point > 0 )
{
do
[2867] rl_vi_backup_point();
[2880, 2882, 2914, 2920, 2889, 2922, 2925, 2895, 2928, 2897, 2930, 2900, 2903, 2872, 2905, 2907, 2878] while ( rl_point > 0 && *(_BYTE *)(rl_line_buffer + rl_point) != 32 && *(_BYTE *)(rl_line_buffer + rl_point) != 9 );
[2940, 2938, 2932] if ( rl_point > 0 )
[2948, 2942, 2951] ++rl_point;
[2963, 2957, 2965] if ( rl_point < 0 )
[2967] rl_point = 0;
}
}
[3009, 3004] return 0LL;
[3010] }
//----- (0000000000000BC3) ----------------------------------------------------
long rl_vi_eWord(int a1)
[3011] {
int v2; // eax
int v5; // [rsp+1Ch] [rbp-4h]
[3011, 3015, 3016, 3019, 3023, 3026, 3029, 3382] while ( 1 )
{
[3382] v2 = a1--;
[3393, 3395, 3401, 3404, 3410, 3412, 3385, 3388, 3391] if ( !v2 || rl_end - 1 <= rl_point )
[3418, 3423] return 0LL;
[3072, 3041, 3066, 3074, 3077, 3047, 3080, 3049, 3082, 3052, 3084, 3055, 3057, 3089, 3059, 3034] if ( *(_BYTE *)(rl_line_buffer + rl_point) != 32 && *(_BYTE *)(rl_line_buffer + rl_point) != 9 )
LABEL_7:
[3107] rl_vi_advance_point();
[3168, 3171, 3141, 3174, 3143, 3112, 3176, 3146, 3149, 3118, 3151, 3153, 3124, 3126, 3128, 3160, 3166, 3135] if ( rl_point < rl_end
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
{
goto LABEL_7;
}
[3204, 3206, 3178, 3184, 3186, 3192, 3198] if ( rl_point && rl_point < rl_end )
{
[3218, 3212, 3221] v5 = rl_point;
[3231, 3237, 3243, 3245, 3247, 3254, 3260, 3262, 3265, 3268, 3270, 3272, 3279, 3285, 3287, 3290, 3293, 3295, 3297] while ( rl_point < rl_end
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
[3228, 3223] v5 = rl_vi_advance_point();
[3361, 3330, 3363, 3366, 3336, 3369, 3338, 3307, 3371, 3341, 3344, 3313, 3346, 3355, 3348, 3319, 3321, 3323] while ( rl_point < rl_end
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9 )
[3304, 3299] v5 = rl_vi_advance_point();
[3376, 3373] rl_point = v5;
}
}
[3424] }
//----- (0000000000000D61) ----------------------------------------------------
long rl_vi_fword(int a1)
[3425] {
int v1; // eax
[3425, 3874, 3429, 3430, 3433, 3437, 3440, 3443] while ( 1 )
{
[3874] v1 = a1--;
[3904, 3877, 3880, 3883, 3885, 3887, 3893, 3896, 3902] if ( !v1 || rl_end - 1 <= rl_point )
break;
[3456, 3463, 3469, 3472, 3475, 3478, 3481, 3484, 3487, 3490, 3493, 3496, 3498, 3500, 3507, 3513, 3515, 3518, 3521, 3523, 3525, 3448, 3453] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95 )
{
[3584, 3591, 3597, 3599, 3602, 3605, 3607, 3613, 3619, 3625, 3627, 3629, 3532, 3537, 3540, 3547, 3553, 3556, 3559, 3562, 3565, 3568, 3571, 3574, 3577, 3580, 3582] while ( (((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95)
&& rl_point < rl_end )
[3527] rl_vi_advance_point();
}
else
{
[3712, 3714, 3716, 3723, 3729, 3731, 3734, 3737, 3739, 3741, 3748, 3754, 3756, 3759, 3762, 3764, 3766, 3639, 3644, 3772, 3647, 3778, 3780, 3654, 3786, 3660, 3663, 3666, 3669, 3672, 3675, 3678, 3681, 3684, 3687, 3689, 3691, 3698, 3704, 3706, 3709] while ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) == 0
&& *(_BYTE *)(rl_line_buffer + rl_point) != 95
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9
&& rl_point < rl_end )
[3634] rl_vi_advance_point();
}
[3808, 3840, 3872, 3846, 3815, 3848, 3851, 3821, 3854, 3823, 3856, 3826, 3858, 3829, 3831, 3864, 3833, 3870] while ( (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9)
&& rl_point < rl_end )
[3800, 3805] rl_vi_advance_point();
}
[3915, 3910] return 0LL;
[3916] }
//----- (0000000000000F4D) ----------------------------------------------------
long rl_vi_bword(int a1)
[3917] {
_BOOL4 v1; // eax
_BOOL4 v2; // eax
int v3; // eax
int v6; // [rsp+14h] [rbp-Ch]
int v7; // [rsp+14h] [rbp-Ch]
_BOOL4 v8; // [rsp+18h] [rbp-8h]
[4770, 3917, 3921, 3922, 3925, 3929, 3932, 3935] while ( 1 )
{
[4770] v3 = a1--;
[4773, 4776, 4779, 4781, 4783, 4789, 4791, 4797] if ( !v3 || rl_point <= 0 )
break;
[3972, 3978, 3980, 3983, 3986, 3988, 3990, 3997, 4003, 4006, 4010, 4013, 4016, 4018, 4020, 4027, 4033, 4036, 4040, 4043, 4046, 4048, 4050, 4056, 4059, 4065, 3940, 4071, 4073, 3947, 3953, 3955, 3958, 3961, 3963, 3965] if ( *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9
&& (*(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 32 || *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 9)
&& !--rl_point )
{
break;
}
[4100, 4103, 4106, 4109, 4112, 4115, 4118, 4121, 4124, 4127, 4129, 4131, 4138, 4144, 4146, 4149, 4152, 4154, 4156, 4161, 4079, 4084, 4087, 4094] v1 = ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95;
[4168] v8 = v1;
[4176, 4171] v6 = rl_vi_backup_point();
[4224, 4227, 4229, 4231, 4238, 4244, 4246, 4249, 4252, 4254, 4256, 4261, 4179, 4184, 4187, 4194, 4200, 4203, 4206, 4209, 4212, 4215, 4218, 4221] v2 = ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95;
[4289, 4293, 4268, 4271, 4275, 4277, 4281, 4283, 4287] if ( (!v8 || v2) && (v8 || !v2) )
[4304, 4298, 4295] rl_point = v6;
[4321, 4353, 4359, 4328, 4361, 4364, 4334, 4367, 4336, 4369, 4339, 4342, 4311, 4344, 4346, 4317, 4319] while ( rl_point > 0 && (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
[4306] rl_vi_backup_point();
[4379, 4377, 4371] if ( rl_point > 0 )
{
[4385, 4391, 4394, 4399, 4402, 4409, 4415, 4418, 4421, 4424, 4427, 4430, 4433, 4436, 4439, 4442, 4444, 4446, 4453, 4459, 4461, 4464, 4467, 4469] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95 )
{
do
[4476, 4471] v7 = rl_vi_backup_point();
[4485, 4487, 4493, 4498, 4501, 4508, 4514, 4517, 4520, 4523, 4526, 4529, 4532, 4535, 4538, 4541, 4543, 4545, 4552, 4558, 4560, 4563, 4566, 4568, 4570, 4479] while ( rl_point > 0
&& (((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95) );
}
else
{
do
[4580, 4575] v7 = rl_vi_backup_point();
[4612, 4618, 4621, 4624, 4627, 4630, 4633, 4636, 4639, 4642, 4645, 4647, 4649, 4656, 4662, 4664, 4667, 4670, 4672, 4674, 4681, 4687, 4689, 4692, 4695, 4697, 4699, 4706, 4583, 4712, 4714, 4589, 4717, 4591, 4720, 4722, 4597, 4728, 4602, 4605] while ( rl_point > 0
&& ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) == 0
&& *(_BYTE *)(rl_line_buffer + rl_point) != 95
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9 );
}
[4737, 4731, 4739] if ( rl_point > 0 )
[4744, 4741] rl_point = v7;
[4758, 4756, 4750] if ( rl_point < 0 )
[4760] rl_point = 0;
}
}
[4800, 4805] return 0LL;
[4806] }
//----- (00000000000012C7) ----------------------------------------------------
long rl_vi_eword(int a1)
[4807] {
int v2; // eax
int v5; // [rsp+1Ch] [rbp-4h]
[4807, 4811, 4812, 4815, 5361, 4819, 4822, 4825] while ( 1 )
{
[5361] v2 = a1--;
[5380, 5383, 5389, 5391, 5364, 5367, 5370, 5372, 5374] if ( !v2 || rl_end - 1 <= rl_point )
[5402, 5397] return 0LL;
[4868, 4837, 4870, 4873, 4843, 4876, 4845, 4862, 4878, 4848, 4880, 4851, 4853, 4885, 4855, 4830] if ( *(_BYTE *)(rl_line_buffer + rl_point) != 32 && *(_BYTE *)(rl_line_buffer + rl_point) != 9 )
LABEL_7:
[4903] rl_vi_advance_point();
[4962, 4931, 4964, 4956, 4967, 4937, 4970, 4939, 4908, 4972, 4942, 4945, 4914, 4947, 4949, 4920, 4922, 4924] if ( rl_point < rl_end
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
{
goto LABEL_7;
}
[4980, 4974] v5 = rl_point;
[4995, 4989, 4997, 4983] if ( rl_point < rl_end )
{
[5003, 5008, 5011, 5018, 5024, 5027, 5030, 5033, 5036, 5039, 5042, 5045, 5048, 5051, 5053, 5055, 5062, 5068, 5070, 5073, 5076, 5078] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95 )
{
do
[5080, 5085] v5 = rl_vi_advance_point();
[5123, 5129, 5132, 5135, 5138, 5141, 5144, 5147, 5150, 5153, 5156, 5158, 5160, 5167, 5173, 5175, 5178, 5181, 5183, 5185, 5088, 5094, 5100, 5102, 5108, 5113, 5116] while ( rl_point < rl_end
&& (((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) != 0
|| *(_BYTE *)(rl_line_buffer + rl_point) == 95) );
}
else
{
do
[5195, 5190] v5 = rl_vi_advance_point();
[5248, 5251, 5254, 5257, 5260, 5263, 5266, 5268, 5270, 5277, 5283, 5285, 5288, 5291, 5293, 5295, 5302, 5308, 5310, 5313, 5316, 5318, 5320, 5198, 5327, 5204, 5333, 5335, 5210, 5338, 5212, 5341, 5343, 5218, 5349, 5223, 5226, 5233, 5239, 5242, 5245] while ( rl_point < rl_end
&& ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 8) == 0
&& *(_BYTE *)(rl_line_buffer + rl_point) != 95
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9 );
}
}
[5352, 5355] rl_point = v5;
}
[5403] }
//----- (000000000000151C) ----------------------------------------------------
long rl_vi_insert_beg(long a1, int a2)
[5404] {
[5408, 5409, 5412, 5416, 5419, 5422, 5425, 5427, 5432, 5404] rl_beg_of_line(1LL, (unsigned int)a2);
[5440, 5442, 5437, 5447] rl_vi_insert_mode(1LL, a2);
[5457, 5452] return 0LL;
[5458] }
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000001553) ----------------------------------------------------
long rl_vi_append_forward()
{
return rl_vi_advance_point();
}
//----- (000000000000156A) ----------------------------------------------------
long rl_vi_append_mode(long a1, int a2)
[5482] {
[5505, 5482, 5486, 5487, 5490, 5494, 5497, 5500, 5503] rl_vi_append_forward();
[5510, 5516, 5519, 5524, 5526] rl_vi_start_inserting(a2, 1, rl_arg_sign);
[5536, 5531] return 0LL;
[5537] }
//----- (00000000000015A2) ----------------------------------------------------
long rl_vi_append_eol(long a1, int a2)
[5538] {
[5538, 5542, 5543, 5546, 5550, 5553, 5556, 5559, 5561, 5566] rl_end_of_line(1LL, (unsigned int)a2);
[5576, 5571, 5581, 5574] rl_vi_append_mode(1LL, a2);
[5586, 5591] return 0LL;
[5592] }
// 56C0: using guessed type long rl_end_of_line(_QWORD, _QWORD);
//----- (00000000000015D9) ----------------------------------------------------
long rl_vi_eof_maybe()
[5593] {
[5601, 5605, 5608, 5611, 5616, 5621, 5593, 5626, 5597, 5598] return rl_newline(1LL, 10LL);
[5627] }
// 15D9: using guessed type long rl_vi_eof_maybe();
// 5780: using guessed type long rl_newline(_QWORD, _QWORD);
//----- (00000000000015FC) ----------------------------------------------------
long rl_vi_insertion_mode(long a1, int a2)
[5628] {
[5632, 5633, 5636, 5640, 5643, 5646, 5653, 5628] rl_keymap = &vi_insertion_keymap;
[5660, 5663] rl_vi_last_key_before_insert = a2;
[5677, 5675, 5669] if ( rl_show_mode_in_prompt )
[5679] rl_reset_prompt();
[5689, 5684] return 0LL;
[5690] }
// 49A4: using guessed type int rl_vi_last_key_before_insert;
// 5798: using guessed type long rl_reset_prompt(void);
//----- (000000000000163B) ----------------------------------------------------
long rl_vi_insert_mode(long a1, int a2)
[5691] {
[5696, 5699, 5703, 5706, 5709, 5715, 5718, 5723, 5691, 5725, 5695] rl_vi_start_inserting(a2, 1, rl_arg_sign);
[5730, 5735] return 0LL;
[5736] }
//----- (0000000000001669) ----------------------------------------------------
char * vi_save_insert_buffer(int a1, int a2)
[5737] {
char *result; // rax
[5761, 5764, 5737, 5741, 5742, 5745, 5749, 5752, 5755] if ( a2 >= vi_insert_buffer_size )
{
[5796, 5766, 5798, 5769, 5772, 5775, 5776, 5779, 5781, 5784, 5786, 5788, 5790] vi_insert_buffer_size += a2 + 32 - a2 % 32;
[5826, 5831, 5804, 5810, 5813, 5820, 5823] vi_insert_buffer = (char *)xrealloc(vi_insert_buffer, vi_insert_buffer_size);
}
[5857, 5859, 5862, 5869, 5838, 5872, 5841, 5875, 5844, 5847, 5854] strncpy(vi_insert_buffer, (const char *)(a1 + rl_line_buffer), a2 - 1);
[5890, 5893, 5897, 5880, 5887] result = &vi_insert_buffer[a2 - 1];
[5900] *result = 0;
[5904, 5903] return result;
[5905] }
// 4968: using guessed type int vi_insert_buffer_size;
// 57A0: using guessed type long xrealloc(_QWORD, _QWORD);
//----- (0000000000001712) ----------------------------------------------------
char *rl_vi_save_replace()
{
char *result; // rax
int v1; // [rsp+Ch] [rbp-14h]
int v2; // [rsp+10h] [rbp-10h]
if ( rl_undo_list && *(_DWORD *)(rl_undo_list + 24LL) == 3 && vi_replace_count > 0 )
{
v2 = rl_point - vi_replace_count + 1;
v1 = vi_replace_count + 1;
if ( v2 < 0 )
{
v1 = rl_point + 1;
v2 = 0;
}
return vi_save_insert_buffer(v2, v1);
}
else
{
result = (char *)(unsigned int)vi_insert_buffer_size;
if ( vi_insert_buffer_size > 0 )
{
result = vi_insert_buffer;
*vi_insert_buffer = 0;
}
}
return result;
}
// 4958: using guessed type int vi_replace_count;
// 4968: using guessed type int vi_insert_buffer_size;
//----- (00000000000017AE) ----------------------------------------------------
char * rl_vi_save_insert(int *a1)
{
char *result; // rax
if ( a1 && a1[6] == 1 )
return vi_save_insert_buffer(a1[2], a1[3] - a1[2] + 1);
result = (char *)(unsigned int)vi_insert_buffer_size;
if ( vi_insert_buffer_size > 0 )
{
result = vi_insert_buffer;
*vi_insert_buffer = 0;
}
return result;
}
// 4968: using guessed type int vi_insert_buffer_size;
//----- (000000000000181B) ----------------------------------------------------
long rl_vi_done_inserting()
{
long result; // rax
if ( rl_vi_doing_insert )
{
rl_end_undo_group();
rl_vi_doing_insert = 0;
if ( rl_vi_last_key_before_insert == 82 )
rl_vi_save_replace();
else
rl_vi_save_insert((int *)*rl_undo_list);
if ( rl_undo_group_level <= 0 )
goto LABEL_15;
}
else
{
if ( rl_undo_list
&& (rl_vi_last_key_before_insert == 105
|| rl_vi_last_key_before_insert == 97
|| rl_vi_last_key_before_insert == 73
|| rl_vi_last_key_before_insert == 65) )
{
rl_vi_save_insert(rl_undo_list);
goto LABEL_15;
}
if ( rl_vi_last_key_before_insert != 67 )
goto LABEL_15;
}
do
{
rl_end_undo_group();
LABEL_15:
result = rl_undo_group_level;
}
while ( rl_undo_group_level > 0 );
return result;
}
// 4948: using guessed type int rl_vi_doing_insert;
// 49A4: using guessed type int rl_vi_last_key_before_insert;
// 5690: using guessed type long rl_end_undo_group(void);
//----- (00000000000018DF) ----------------------------------------------------
long rl_vi_movement_mode(long a1, unsigned int a2)
[6367] {
[6371, 6372, 6375, 6379, 6382, 6385, 6391, 6393, 6367] if ( rl_point > 0 )
[6400, 6395, 6405, 6398] rl_backward_char(1LL, a2);
[6417, 6410] rl_keymap = &vi_movement_keymap;
[6424] rl_vi_done_inserting();
[6441, 6436, 6429, 6444] if ( (rl_readline_state & 0x400000) == 0 )
[6446] rl_free_undo_list();
[6457, 6451, 6459] if ( rl_show_mode_in_prompt )
[6461] rl_reset_prompt();
[6473, 6466, 6479] rl_readline_state |= 0x400000uLL;
[6491, 6486] return 0LL;
[6492] }
// 5798: using guessed type long rl_reset_prompt(void);
// 57C0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 57C8: using guessed type long rl_free_undo_list(void);
//----- (000000000000195D) ----------------------------------------------------
long rl_vi_arg_digit(unsigned int a1, unsigned int a2)
[6493] {
[6528, 6497, 6498, 6501, 6534, 6536, 6505, 6508, 6511, 6515, 6517, 6523, 6493, 6526] if ( a2 == 48 && rl_numeric_arg == 1 && !rl_explicit_arg )
[6538, 6541, 6543, 6548, 6553] return rl_beg_of_line(1LL, 48LL);
else
[6561, 6563, 6565, 6555, 6558] return rl_digit_argument(a1, a2);
[6570, 6571] }
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
// 57D0: using guessed type long rl_digit_argument(_QWORD, _QWORD);
//----- (00000000000019AC) ----------------------------------------------------
long rl_vi_change_mbchar_case(int a1)
{
int v1; // eax
int v3; // [rsp+Ch] [rbp-44h]
wchar_t pwc; // [rsp+14h] [rbp-3Ch] BYREF
int v5; // [rsp+18h] [rbp-38h]
int v6; // [rsp+1Ch] [rbp-34h]
size_t v7; // [rsp+20h] [rbp-30h]
mbstate_t s; // [rsp+28h] [rbp-28h] BYREF
char v9[24]; // [rsp+30h] [rbp-20h] BYREF
unsigned long v10; // [rsp+48h] [rbp-8h]
v3 = a1;
v10 = __readfsqword(0x28u);
memset(&s, 0, sizeof(s));
if ( (int)rl_adjust_point(rl_line_buffer, rl_point, &s) > 0 )
v3 = a1 - 1;
while ( 1 )
{
v1 = v3--;
if ( !v1 || rl_point >= rl_end )
return 0LL;
v7 = mbrtowc(&pwc, (const char *)(rl_line_buffer + rl_point), rl_end - rl_point, &s);
if ( v7 < 0xFFFFFFFFFFFFFFFELL )
{
if ( !v7 )
pwc = 0;
}
else
{
pwc = *(char *)(rl_line_buffer + rl_point);
}
if ( iswupper(pwc) )
{
pwc = towlower(pwc);
goto LABEL_12;
}
if ( iswlower(pwc) )
{
pwc = towupper(pwc);
LABEL_12:
if ( !pwc )
goto LABEL_18;
v5 = rl_point;
v6 = wcrtomb(v9, pwc, &s);
if ( v6 >= 0 )
v9[v6] = 0;
rl_begin_undo_group();
rl_vi_delete(1u, 0);
if ( v5 > rl_point )
rl_vi_advance_point();
rl_insert_text(v9);
rl_end_undo_group();
rl_vi_check();
}
else
{
LABEL_18:
rl_forward_char(1LL, 0LL);
}
}
}
// 5668: using guessed type long rl_begin_undo_group(void);
// 5690: using guessed type long rl_end_undo_group(void);
// 5698: using guessed type long rl_insert_text(_QWORD);
// 57E0: using guessed type long rl_adjust_point(_QWORD, _QWORD, _QWORD);
// 5810: using guessed type long rl_forward_char(_QWORD, _QWORD);
// 19AC: using guessed type char var_20[24];
//----- (0000000000001B8C) ----------------------------------------------------
long rl_vi_change_case(int a1)
[7052] {
int v2; // eax
int v3; // eax
int v4; // eax
int v5; // [rsp+Ch] [rbp-14h]
unsigned int v6; // [rsp+18h] [rbp-8h]
int v7; // [rsp+1Ch] [rbp-4h]
[7052, 7056, 7057, 7060, 7064] v5 = a1;
[7076, 7082, 7084, 7067, 7070] if ( rl_point >= rl_end )
[7091, 7086] return 0LL;
[7096] v6 = 0;
[7108, 7112, 7118, 7124, 7126, 7103] if ( _ctype_get_mb_cur_max() > 1 && !rl_byte_oriented )
[7137, 7132, 7142, 7135] return rl_vi_change_mbchar_case(a1);
[7610] while ( 1 )
{
[7610] v4 = v5--;
[7616, 7619, 7621, 7623, 7629, 7635, 7637, 7643, 7613] if ( !v4 || rl_point >= rl_end )
[7648] return 0LL;
[7168, 7171, 7174, 7177, 7147, 7180, 7183, 7152, 7186, 7155, 7189, 7192, 7162, 7197, 7199] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 0x100) != 0 )
{
[7201, 7234, 7237, 7206, 7240, 7209, 7243, 7246, 7216, 7251, 7253, 7222, 7225, 7228, 7231] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 0x100) != 0 )
[7268, 7270, 7273, 7276, 7279, 7281, 7286, 7255, 7262] v2 = tolower(*(unsigned char *)(rl_line_buffer + rl_point));
else
[7301, 7303, 7306, 7309, 7288, 7295] v2 = *(char *)(rl_line_buffer + rl_point);
[7312] v6 = v2;
[7315] goto LABEL_17;
}
[7328, 7362, 7365, 7335, 7370, 7372, 7341, 7344, 7347, 7350, 7320, 7353, 7356, 7325, 7359] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 0x200) != 0 )
{
[7424, 7426, 7395, 7398, 7401, 7404, 7374, 7407, 7410, 7379, 7413, 7382, 7416, 7419, 7389] if ( ((*_ctype_b_loc())[*(unsigned char *)(rl_line_buffer + rl_point)] & 0x200) != 0 )
[7459, 7428, 7435, 7441, 7443, 7446, 7449, 7452, 7454] v3 = toupper(*(unsigned char *)(rl_line_buffer + rl_point));
else
[7461, 7468, 7474, 7476, 7479, 7482] v3 = *(char *)(rl_line_buffer + rl_point);
[7488, 7485] v6 = v3;
LABEL_17:
[7507, 7511] if ( v6 )
{
[7513, 7519] v7 = rl_point;
[7522] rl_begin_undo_group();
[7537, 7530, 7532, 7527] rl_vi_delete(1u, v6);
[7548, 7542, 7551] if ( v7 > rl_point )
[7553, 7562, 7559] ++rl_point;
[7568, 7578, 7571, 7573] rl_insert_char(1LL, v6);
[7583] rl_end_undo_group();
[7593, 7588] rl_vi_check();
}
else
{
[7600, 7595, 7605, 7598] rl_forward_char(1LL, 0LL);
}
}
else
{
[7490, 7493, 7495, 7500, 7505] rl_forward_char(1LL, v6);
}
}
[7649] }
// 5668: using guessed type long rl_begin_undo_group(void);
// 5690: using guessed type long rl_end_undo_group(void);
// 5810: using guessed type long rl_forward_char(_QWORD, _QWORD);
// 5838: using guessed type long rl_insert_char(_QWORD, _QWORD);
//----- (0000000000001DE2) ----------------------------------------------------
long rl_vi_put(int a1, unsigned int a2)
[7650] {
[7682, 7685, 7688, 7691, 7694, 7699, 7701, 7703, 7709, 7715, 7717, 7650, 7654, 7655, 7658, 7662, 7665, 7668, 7673, 7676, 7679] if ( ((*_ctype_b_loc())[(unsigned char)a2] & 0x100) == 0 && rl_point < rl_end )
[7745, 7750, 7719, 7756, 7725, 7732, 7737, 7742] rl_point = rl_find_next_mbchar(rl_line_buffer, rl_point, 1LL, 1LL);
[7776, 7779, 7782, 7784, 7773] while ( a1-- )
[7768, 7761, 7763, 7758] rl_yank(1LL, a2);
[7786, 7796, 7789, 7791] rl_backward_char(1LL, a2);
[7801, 7806] return 0LL;
[7807] }
// 57C0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 5840: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 5848: using guessed type long rl_yank(_QWORD, _QWORD);
//----- (0000000000001E80) ----------------------------------------------------
long rl_vi_check()
[7808] {
[7808, 7840, 7812, 7813, 7816, 7822, 7824, 7826, 7832, 7838] if ( rl_point && rl_point == rl_end )
[7842] rl_vi_backup();
[7852, 7847] return 0LL;
[7853] }
//----- (0000000000001EAE) ----------------------------------------------------
long rl_vi_column(int a1, unsigned int a2)
[7854] {
[7872, 7878, 7881, 7854, 7858, 7859, 7862, 7866, 7869] if ( a1 <= rl_end )
{
[7900] rl_point = 0;
[7910, 7913, 7916, 7918, 7923] rl_point = rl_forward_char_internal((unsigned int)(a1 - 1));
}
else
{
[7883, 7886, 7888, 7893, 7898] rl_end_of_line(1LL, a2);
}
[7929, 7934] return 0LL;
[7935] }
// 56C0: using guessed type long rl_end_of_line(_QWORD, _QWORD);
// 5768: using guessed type long rl_forward_char_internal(_QWORD);
//----- (0000000000001F00) ----------------------------------------------------
long rl_vi_arg_dispatch(unsigned int a1)
{
signed int v2; // [rsp+Ch] [rbp-14h]
if ( (a1 & 0x80000000) != 0
|| *(_BYTE *)(16LL * (int)a1 + rl_keymap)
|| *(_UNKNOWN **)(16LL * (int)a1 + rl_keymap + 8) != &rl_universal_argument )
{
v2 = a1 & 0xFFFFFF7F;
if ( (int)(a1 & 0xFFFFFF7F) <= 47 || v2 > 57 )
{
rl_clear_message();
rl_stuff_char(a1);
return 0LL;
}
else
{
if ( rl_explicit_arg )
rl_numeric_arg = 10 * rl_numeric_arg + v2 - 48;
else
rl_numeric_arg = v2 - 48;
rl_explicit_arg = 1;
return 1LL;
}
}
else
{
rl_numeric_arg *= 4;
return 1LL;
}
}
// 5858: using guessed type long rl_clear_message(void);
// 5860: using guessed type long rl_stuff_char(_QWORD);
//----- (0000000000001FE1) ----------------------------------------------------
long rl_digit_loop1()
[8161] {
long v1; // rax
unsigned int v2; // [rsp+8h] [rbp-8h]
do
{
[8178, 8180, 8173] if ( (unsigned int)rl_arg_overflow() )
[8187, 8182] return 1LL;
[8194, 8189] v2 = rl_arg_getchar();
}
[8197, 8200, 8202, 8207, 8210, 8214, 8216] while ( (int)rl_vi_arg_dispatch(v2) > 0 );
[8218, 8219] v1 = rl_readline_state;
[8226] BYTE1(v1) = *(&rl_readline_state + 1) & 0xFB;
[8236, 8229] rl_readline_state = v1;
[8241] return 0LL;
[8161, 8165, 8166, 8169, 8242] }
// 5868: using guessed type long rl_arg_overflow(void);
// 5870: using guessed type long rl_arg_getchar(void);
//----- (0000000000002033) ----------------------------------------------------
_DWORD * rl_mvcxt_init(_DWORD *a1, int a2, int a3)
{
_DWORD *result; // rax
*a1 = a2;
a1[2] = 0;
a1[1] = a1[2];
a1[3] = 0;
a1[4] = -1;
a1[5] = rl_point;
a1[6] = rl_end;
a1[7] = a3;
result = a1;
a1[8] = -1;
return result;
}
//----- (00000000000020AF) ----------------------------------------------------
_DWORD * rl_mvcxt_alloc(int a1, int a2)
{
_DWORD *v3; // [rsp+18h] [rbp-8h]
v3 = (_DWORD *)xmalloc(36LL);
rl_mvcxt_init(v3, a1, a2);
return v3;
}
// 5878: using guessed type long xmalloc(_QWORD);
//----- (00000000000020E9) ----------------------------------------------------
long rl_mvcxt_dispose(long a1)
{
return xfree(a1);
}
// 5880: using guessed type long xfree(_QWORD);
//----- (0000000000002108) ----------------------------------------------------
long rl_domove_motion_callback(unsigned int *a1)
[8456] {
int v1; // eax
unsigned int v3; // [rsp+1Ch] [rbp-4h]
[8485, 8456, 8460, 8461, 8464, 8468, 8472, 8476] rl_vi_last_motion = a1[8];
[8482, 8479] v3 = rl_vi_last_motion;
[8497, 8491, 8500, 8502] rl_extend_line_buffer((unsigned int)(rl_end + 1));
[8514, 8507] v1 = rl_end++;
[8520, 8523, 8529, 8531, 8534] *(_BYTE *)(rl_line_buffer + v1) = 32;
[8544, 8550, 8552, 8555, 8537] *(_BYTE *)(rl_line_buffer + rl_end) = 0;
[8558, 8565, 8568, 8571, 8573] rl_dispatch(v3, rl_keymap);
[8578, 8610, 8585, 8590, 8593, 8595, 8602, 8607] if ( (rl_readline_state & 0x80000) != 0 && (rl_readline_state & 0x800000) != 0 )
[8617, 8612] return 0LL;
else
[8642, 8645, 8648, 8650, 8638] return rl_vi_domove_motion_cleanup(v3, a1);
[8656, 8655] }
// 496C: using guessed type int rl_vi_last_motion;
// 56E0: using guessed type long rl_dispatch(_QWORD, _QWORD);
// 5888: using guessed type long rl_extend_line_buffer(_QWORD);
//----- (00000000000021D1) ----------------------------------------------------
long rl_vi_domove_motion_cleanup(int a1, unsigned int *a2)
{
bool v2; // al
bool v4; // al
int v6; // [rsp+18h] [rbp-8h]
rl_end = a2[6];
*(_BYTE *)(rl_line_buffer + rl_end) = 0;
rl_fix_point(0LL);
if ( rl_mark == rl_point )
{
if ( ((*_ctype_b_loc())[(unsigned char)a2[7]] & 0x200) != 0 )
v2 = toupper((unsigned char)a2[7]) == 67;
else
v2 = a2[7] == 67;
if ( v2 && rl_vi_motion_command(a1) )
{
return vidomove_dispatch(a2);
}
else
{
rl_readline_state &= ~0x100000uLL;
return 0xFFFFFFFFLL;
}
}
else
{
if ( ((*_ctype_b_loc())[(unsigned char)a1] & 0x200) != 0 )
v4 = toupper((unsigned char)a1) == 87;
else
v4 = a1 == 87;
if ( v4
&& rl_point < rl_end
&& rl_point > rl_mark
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9 )
{
--rl_point;
}
if ( a2[7] == 99
&& rl_point >= rl_mark
&& (((*_ctype_b_loc())[(unsigned char)a1] & 0x200) != 0 ? toupper((unsigned char)a1) == 87 : a1 == 87) )
{
while ( rl_point > rl_mark
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
--rl_point;
if ( rl_point == rl_mark
|| rl_point >= 0
&& rl_end - 1 > rl_point
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9 )
{
rl_vi_advance_point();
}
}
if ( rl_mark < rl_point )
{
v6 = rl_point;
rl_point = rl_mark;
rl_mark = v6;
}
if ( (rl_readline_state & 0x80000) != 0 )
rl_redisplay_function();
return (unsigned int)vidomove_dispatch(a2);
}
}
// 5890: using guessed type long rl_fix_point(_QWORD);
// 58A0: using guessed type long (*rl_redisplay_function)(void);
//----- (00000000000024DB) ----------------------------------------------------
long rl_domove_read_callback(unsigned int *a1)
[9435] {
long v1; // rax
long v3; // rax
long v4; // rax
long v5; // rax
int c; // [rsp+18h] [rbp-8h]
int ca; // [rsp+18h] [rbp-8h]
int v8; // [rsp+1Ch] [rbp-4h]
[9440, 9443, 9447, 9451, 9455, 9458, 9435, 9439] c = a1[8];
[9474, 9477, 9479, 9482, 9487, 9490, 9461, 9465, 9467] if ( c && strchr(" hl^$0ftFT;,%wbeWBE|`", c) )
{
[9504, 9538, 9507, 9509, 9541, 9516, 9521, 9492, 9524, 9526, 9499, 9533] if ( (rl_readline_state & 0x80000) != 0 && (rl_readline_state & 0x100000) != 0 && (rl_readline_state & 0x400) != 0 )
{
[9543] v1 = rl_readline_state;
[9550] BYTE1(v1) = *(&rl_readline_state + 1) & 0xFB;
[9553] rl_readline_state = v1;
}
[9560, 9572, 9564, 9567] return rl_domove_motion_callback(a1);
}
[9601, 9605, 9608, 9577, 9611, 9581, 9613, 9584, 9617, 9587, 9620, 9589, 9623, 9593, 9596, 9599] else if ( c == a1[7] && (a1[7] == 100 || a1[7] == 121 || a1[7] == 99) )
{
rl_mark = rl_end;
[9625, 9631] rl_beg_of_line(1LL, (unsigned int)c);
[9640, 9642, 9637, 9647] rl_vi_last_motion = c;
[9652, 9655] rl_readline_state &= ~0x100000uLL;
[9674, 9668, 9661] return vidomove_dispatch(a1);
[9688, 9681, 9693, 9685] }
else if ( c > 47
[9698, 9702, 9734, 9704, 9739, 9708, 9759, 9710, 9742, 9744, 9717, 9751, 9722, 9756, 9725, 9727] && c <= 57
&& (rl_readline_state & 0x80000) != 0
&& (rl_readline_state & 0x100000) != 0
&& (rl_readline_state & 0x400) != 0 )
{
return rl_vi_arg_dispatch(c);
[9761, 9771, 9764, 9766] }
else if ( c > 47
[9795, 9829, 9800, 9834, 9803, 9805, 9837, 9776, 9780, 9812, 9782, 9817, 9786, 9788, 9822, 9820] && c <= 57
&& (rl_readline_state & 0x80000) != 0
&& (rl_readline_state & 0x100000) != 0
&& (rl_readline_state & 0x400) == 0 )
{
v3 = rl_readline_state;
[9839] BYTE1(v3) = *(&rl_readline_state + 1) | 4;
[9846] rl_readline_state = v3;
[9849] return rl_vi_arg_dispatch(c);
[9856, 9866, 9859, 9861] }
else if ( c <= 47 || c > 57 )
[9881, 9875, 9885, 9871] {
rl_readline_state &= ~0x100000uLL;
[10036, 10030, 10023] v5 = rl_readline_state;
[10043] BYTE1(v5) = *(&rl_readline_state + 1) & 0xFB;
[10050] rl_readline_state = v5;
[10053] return 1LL;
[10060] }
else
{
v8 = rl_numeric_arg;
[9897, 9891] rl_numeric_arg = c - 48;
[9906, 9900, 9903] rl_explicit_arg = 1;
[9912] v4 = rl_readline_state;
[9922] BYTE1(v4) = *(&rl_readline_state + 1) | 4;
[9929] rl_readline_state = v4;
[9932] rl_digit_loop1();
[9939] rl_numeric_arg *= v8;
[9944, 9954, 9950] ca = rl_vi_domove_getchar();
[9960, 9964, 9972, 9967] if ( ca >= 0 )
[9979, 9975] {
a1[8] = ca;
[10003, 10006, 9999] return rl_domove_motion_callback(a1);
[10016, 10009, 10021, 10013] }
else
{
a1[8] = 0;
[9985, 9981] return 0xFFFFFFFFLL;
[9992, 9997] }
}
}
// 496C: using guessed type int rl_vi_last_motion;
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000002753) ----------------------------------------------------
long rl_vi_domove_getchar()
[10067] {
[10083, 10088, 10067, 10071, 10072, 10075, 10079] return rl_bracketed_read_key();
[10089] }
// 58A8: using guessed type long rl_bracketed_read_key(void);
//----- (000000000000276A) ----------------------------------------------------
_BOOL8 rl_vi_domove_callback(unsigned int *a1)
{
int v2; // [rsp+18h] [rbp-8h]
v2 = rl_vi_domove_getchar();
a1[8] = v2;
return v2 < 0 || (unsigned int)rl_domove_read_callback(a1) != 0;
}
//----- (00000000000027BB) ----------------------------------------------------
long rl_vi_domove(long a1, _DWORD *a2)
[10171] {
unsigned int *v3; // [rsp+18h] [rbp-8h]
[10176, 10179, 10183, 10186, 10190, 10197, 10171, 10175] v3 = (unsigned int *)rl_vimvcxt;
[10208, 10213, 10217, 10201, 10205] v3[8] = rl_vi_domove_getchar();
[10224, 10227, 10220, 10231] *a2 = v3[8];
[10240, 10233, 10242, 10237] if ( (v3[8] & 0x80000000) == 0 )
[10266, 10269, 10262] return rl_domove_read_callback(v3);
[10248, 10244, 10260, 10255] v3[8] = 0;
[10274] return 0xFFFFFFFFLL;
[10275] }
// 4940: using guessed type long rl_vimvcxt;
//----- (0000000000002824) ----------------------------------------------------
long vi_delete_dispatch(long a1)
[10276] {
[10276, 10280, 10281, 10284, 10288, 10292, 10296, 10299, 10301, 10308, 10313, 10316, 10318, 10322, 10325, 10331, 10333, 10335, 10341, 10347, 10349] if ( !strchr(" l|h^0bBFT`", *(_DWORD *)(a1 + 32)) && *(_DWORD *)(a1 + 20) <= rl_point && rl_mark < rl_end )
{
[10368, 10370, 10351, 10356, 10360, 10362] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
[10378, 10387, 10372, 10381] ++rl_mark;
else
[10402, 10407, 10412, 10415, 10420, 10389, 10395] rl_mark = rl_find_next_mbchar(rl_line_buffer, rl_mark, 1LL, 0LL);
}
[10432, 10438, 10440, 10442, 10426] rl_kill_text(rl_point, rl_mark);
[10452, 10447] return 0LL;
[10453] }
// 5840: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 58B0: using guessed type long rl_kill_text(_QWORD, _QWORD);
//----- (00000000000028D6) ----------------------------------------------------
long rl_vi_delete_to(long a1, unsigned int a2)
[10454] {
int v3; // [rsp+18h] [rbp-18h] BYREF
unsigned int v4; // [rsp+1Ch] [rbp-14h]
long v5; // [rsp+20h] [rbp-10h]
unsigned long v6; // [rsp+28h] [rbp-8h]
[10466, 10469, 10472, 10481, 10454, 10458, 10459, 10462] v6 = __readfsqword(0x28u);
[10485, 10487] v5 = 0LL;
[10503, 10501, 10495] if ( rl_vi_redoing )
{
[10512, 10505] v5 = rl_vimvcxt;
[10531, 10538, 10516, 10519, 10521, 10526] rl_vimvcxt = (long)rl_mvcxt_alloc(1, a2);
}
[10547, 10540, 10550] else if ( rl_vimvcxt )
{
[10562, 10567, 10570, 10575, 10552, 10559] rl_mvcxt_init((_DWORD *)rl_vimvcxt, 1, a2);
}
else
{
[10592, 10577, 10580, 10582, 10587] rl_vimvcxt = (long)rl_mvcxt_alloc(1, a2);
}
[10612, 10606, 10599] *(_DWORD *)(rl_vimvcxt + 20) = rl_point;
[10621, 10615] rl_mark = rl_point;
[10658, 10627, 10660, 10632, 10635, 10638, 10641, 10644, 10647, 10650, 10653] if ( ((*_ctype_b_loc())[(unsigned char)a2] & 0x100) != 0 )
{
[10669, 10662] *(_DWORD *)(rl_vimvcxt + 32) = 36;
[10691, 10694, 10676, 10683, 10686] v4 = rl_domove_motion_callback((unsigned int *)rl_vimvcxt);
}
[10699, 10705, 10707, 10709, 10715, 10718] else if ( !rl_vi_redoing || rl_vi_last_motion == 100 )
{
[10767, 10765, 10759] if ( rl_vi_redoing )
{
[10776, 10769, 10782] *(_DWORD *)(rl_vimvcxt + 32) = rl_vi_last_motion;
[10785, 10791] rl_mark = rl_end;
[10800, 10802, 10797, 10807] rl_beg_of_line(1LL, a2);
[10825, 10819, 10812] rl_readline_state &= ~0x100000uLL;
[10850, 10832, 10839, 10842, 10847] v4 = vidomove_dispatch((unsigned int *)rl_vimvcxt);
}
else
{
[10864, 10867, 10859, 10852] if ( (rl_readline_state & 0x80000) != 0 )
{
[10882, 10876, 10869] rl_readline_state |= 0x100000uLL;
[10889, 10894] return 0LL;
}
[10913, 10896, 10900, 10903, 10906, 10908] v4 = rl_vi_domove(a2, &v3);
}
}
else
{
[10720, 10733, 10727] *(_DWORD *)(rl_vimvcxt + 32) = rl_vi_last_motion;
[10754, 10736, 10743, 10746, 10751] v4 = rl_domove_motion_callback((unsigned int *)rl_vimvcxt);
}
[10920, 10916] if ( (v4 & 0x80000000) != 0 )
{
[10922] rl_ding();
[10927] v4 = -1;
}
[10944, 10941, 10934] rl_mvcxt_dispose(rl_vimvcxt);
[10953, 10949] rl_vimvcxt = v5;
[10976, 10978, 10983, 10960, 10963, 10967] return v4;
[10984] }
// 4940: using guessed type long rl_vimvcxt;
// 496C: using guessed type int rl_vi_last_motion;
// 5658: using guessed type int rl_vi_redoing;
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
// 56D8: using guessed type long rl_ding(void);
//----- (0000000000002AE9) ----------------------------------------------------
long vi_change_dispatch(_DWORD *a1)
[10985] {
bool v1; // al
[11008, 11010, 11017, 11022, 11025, 11027, 11031, 11034, 11040, 11042, 11044, 11050, 11056, 11058, 10985, 10989, 10990, 10993, 10997, 11001, 11005] if ( !strchr(" l|hwW^0bBFT`", a1[8]) && a1[5] <= rl_point && rl_mark < rl_end )
{
[11077, 11079, 11060, 11065, 11069, 11071] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
[11096, 11081, 11090, 11087] ++rl_mark;
else
[11104, 11111, 11116, 11121, 11124, 11129, 11098] rl_mark = rl_find_next_mbchar(rl_line_buffer, rl_mark, 1LL, 0LL);
}
[11170, 11140, 11172, 11143, 11147, 11150, 11153, 11156, 11159, 11162, 11165, 11135] if ( ((*_ctype_b_loc())[(unsigned char)a1[8]] & 0x200) != 0 )
[11174, 11178, 11181, 11184, 11186, 11191, 11194, 11197] v1 = toupper((unsigned char)a1[8]) == 87;
else
[11209, 11203, 11206, 11199] v1 = a1[8] == 87;
[11212, 11214, 11216, 11220, 11223, 11229, 11231] if ( v1 && a1[5] > rl_point )
[11240, 11233, 11237] rl_point = a1[5];
[11254, 11252, 11246] if ( rl_vi_redoing )
{
[11266, 11268, 11275, 11278, 11280, 11256, 11263] if ( vi_insert_buffer && *vi_insert_buffer )
[11282] rl_begin_undo_group();
[11299, 11301, 11303, 11287, 11293] rl_delete_text(rl_point, rl_mark);
[11331, 11334, 11336, 11308, 11315, 11318, 11324] if ( vi_insert_buffer && *vi_insert_buffer )
{
[11345, 11338, 11348] rl_insert_text(vi_insert_buffer);
[11353, 11358] rl_end_undo_group();
}
}
else
{
[11360] rl_begin_undo_group();
[11365, 11371, 11377, 11379, 11381] rl_kill_text(rl_point, rl_mark);
[11423, 11394, 11398, 11401, 11404, 11407, 11410, 11413, 11416, 11386, 11421, 11391] if ( ((*_ctype_b_loc())[(unsigned char)a1[7]] & 0x100) == 0 )
[11425] rl_vi_doing_insert = 1;
[11456, 11458, 11435, 11441, 11447, 11451, 11454] rl_vi_start_inserting(a1[7], rl_numeric_arg, rl_arg_sign);
}
[11468, 11463] return 0LL;
[11469] }
// 4948: using guessed type int rl_vi_doing_insert;
// 5658: using guessed type int rl_vi_redoing;
// 5668: using guessed type long rl_begin_undo_group(void);
// 5690: using guessed type long rl_end_undo_group(void);
// 5698: using guessed type long rl_insert_text(_QWORD);
// 5840: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 58B0: using guessed type long rl_kill_text(_QWORD, _QWORD);
// 58B8: using guessed type long rl_delete_text(_QWORD, _QWORD);
//----- (0000000000002CCE) ----------------------------------------------------
long rl_vi_change_to(long a1, unsigned int a2)
[11470] {
int v3; // [rsp+18h] [rbp-18h] BYREF
unsigned int v4; // [rsp+1Ch] [rbp-14h]
long v5; // [rsp+20h] [rbp-10h]
unsigned long v6; // [rsp+28h] [rbp-8h]
[11488, 11497, 11470, 11474, 11475, 11478, 11482, 11485] v6 = __readfsqword(0x28u);
[11501, 11503] v5 = 0LL;
[11519, 11517, 11511] if ( rl_vi_redoing )
{
[11528, 11521] v5 = rl_vimvcxt;
[11554, 11532, 11535, 11537, 11542, 11547] rl_vimvcxt = (long)rl_mvcxt_alloc(2, a2);
}
[11563, 11556, 11566] else if ( rl_vimvcxt )
{
[11586, 11591, 11568, 11575, 11578, 11583] rl_mvcxt_init((_DWORD *)rl_vimvcxt, 2, a2);
}
else
{
[11593, 11596, 11598, 11603, 11608] rl_vimvcxt = (long)rl_mvcxt_alloc(2, a2);
}
[11628, 11622, 11615] *(_DWORD *)(rl_vimvcxt + 20) = rl_point;
[11637, 11631] rl_mark = rl_point;
[11648, 11651, 11654, 11657, 11660, 11663, 11666, 11669, 11674, 11643, 11676] if ( ((*_ctype_b_loc())[(unsigned char)a2] & 0x100) != 0 )
{
[11685, 11678] *(_DWORD *)(rl_vimvcxt + 32) = 36;
[11692, 11699, 11702, 11707, 11710] v4 = rl_domove_motion_callback((unsigned int *)rl_vimvcxt);
}
[11715, 11721, 11723, 11725, 11731, 11734] else if ( !rl_vi_redoing || rl_vi_last_motion == 99 )
{
[11783, 11781, 11775] if ( rl_vi_redoing )
{
[11792, 11785, 11798] *(_DWORD *)(rl_vimvcxt + 32) = rl_vi_last_motion;
[11801, 11807] rl_mark = rl_end;
[11816, 11818, 11813, 11823] rl_beg_of_line(1LL, a2);
[11841, 11835, 11828] rl_readline_state &= ~0x100000uLL;
[11848, 11855, 11858, 11863, 11866] v4 = vidomove_dispatch((unsigned int *)rl_vimvcxt);
}
else
{
[11880, 11883, 11875, 11868] if ( (rl_readline_state & 0x80000) != 0 )
{
[11898, 11892, 11885] rl_readline_state |= 0x100000uLL;
[11905, 11910] return 0LL;
}
[11912, 11916, 11919, 11922, 11924, 11929] v4 = rl_vi_domove(a2, &v3);
}
}
else
{
[11736, 11749, 11743] *(_DWORD *)(rl_vimvcxt + 32) = rl_vi_last_motion;
[11752, 11759, 11762, 11767, 11770] v4 = rl_domove_motion_callback((unsigned int *)rl_vimvcxt);
}
[11936, 11932] if ( (v4 & 0x80000000) != 0 )
{
[11938] rl_ding();
[11943] v4 = -1;
}
[11960, 11957, 11950] rl_mvcxt_dispose(rl_vimvcxt);
[11969, 11965] rl_vimvcxt = v5;
[11976, 11979, 11983, 11992, 11994, 11999] return v4;
[12000] }
// 4940: using guessed type long rl_vimvcxt;
// 496C: using guessed type int rl_vi_last_motion;
// 5658: using guessed type int rl_vi_redoing;
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
// 56D8: using guessed type long rl_ding(void);
//----- (0000000000002EE1) ----------------------------------------------------
long vi_yank_dispatch(long a1)
[12001] {
[12033, 12038, 12041, 12043, 12047, 12050, 12056, 12058, 12060, 12066, 12072, 12074, 12001, 12005, 12006, 12009, 12013, 12017, 12021, 12024, 12026] if ( !strchr(" l|h^0%bBFT`", *(_DWORD *)(a1 + 32)) && *(_DWORD *)(a1 + 20) <= rl_point && rl_mark < rl_end )
{
[12076, 12081, 12085, 12087, 12093, 12095] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
[12112, 12097, 12106, 12103] ++rl_mark;
else
[12132, 12137, 12140, 12145, 12114, 12120, 12127] rl_mark = rl_find_next_mbchar(rl_line_buffer, rl_mark, 1LL, 0LL);
}
[12151] rl_begin_undo_group();
[12162, 12168, 12170, 12172, 12156] rl_kill_text(rl_point, rl_mark);
[12177] rl_end_undo_group();
[12182] rl_do_undo();
[12194, 12187, 12191] rl_point = *(_DWORD *)(a1 + 20);
[12200, 12205] rl_fix_point(1LL);
[12210, 12215] return 0LL;
[12216] }
// 5668: using guessed type long rl_begin_undo_group(void);
// 5690: using guessed type long rl_end_undo_group(void);
// 5840: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 5890: using guessed type long rl_fix_point(_QWORD);
// 58B0: using guessed type long rl_kill_text(_QWORD, _QWORD);
// 58C0: using guessed type long rl_do_undo(void);
//----- (0000000000002FB9) ----------------------------------------------------
long rl_vi_yank_to(long a1, unsigned int a2)
[12217] {
int v3; // [rsp+18h] [rbp-18h] BYREF
unsigned int v4; // [rsp+1Ch] [rbp-14h]
long v5; // [rsp+20h] [rbp-10h]
unsigned long v6; // [rsp+28h] [rbp-8h]
[12225, 12229, 12232, 12235, 12244, 12217, 12221, 12222] v6 = __readfsqword(0x28u);
[12248, 12250] v5 = 0LL;
[12264, 12258, 12266] if ( rl_vi_redoing )
{
[12275, 12268] v5 = rl_vimvcxt;
[12289, 12294, 12301, 12279, 12282, 12284] rl_vimvcxt = (long)rl_mvcxt_alloc(4, a2);
}
[12313, 12310, 12303] else if ( rl_vimvcxt )
{
[12322, 12325, 12330, 12333, 12338, 12315] rl_mvcxt_init((_DWORD *)rl_vimvcxt, 4, a2);
}
else
{
[12355, 12340, 12343, 12345, 12350] rl_vimvcxt = (long)rl_mvcxt_alloc(4, a2);
}
[12369, 12362, 12375] *(_DWORD *)(rl_vimvcxt + 20) = rl_point;
[12384, 12378] rl_mark = rl_point;
[12416, 12421, 12390, 12423, 12395, 12398, 12401, 12404, 12407, 12410, 12413] if ( ((*_ctype_b_loc())[(unsigned char)a2] & 0x100) != 0 )
{
[12432, 12425] *(_DWORD *)(rl_vimvcxt + 32) = 36;
[12449, 12454, 12457, 12439, 12446] v4 = rl_domove_motion_callback((unsigned int *)rl_vimvcxt);
}
[12481, 12462, 12468, 12470, 12472, 12478] else if ( !rl_vi_redoing || rl_vi_last_motion == 121 )
{
[12528, 12522, 12530] if ( rl_vi_redoing )
{
[12545, 12539, 12532] *(_DWORD *)(rl_vimvcxt + 32) = rl_vi_last_motion;
[12554, 12548] rl_mark = rl_end;
[12560, 12570, 12563, 12565] rl_beg_of_line(1LL, a2);
[12588, 12582, 12575] rl_readline_state &= ~0x100000uLL;
[12610, 12613, 12595, 12602, 12605] v4 = vidomove_dispatch((unsigned int *)rl_vimvcxt);
}
else
{
[12630, 12627, 12622, 12615] if ( (rl_readline_state & 0x80000) != 0 )
{
[12632, 12645, 12639] rl_readline_state |= 0x100000uLL;
[12657, 12652] return 0LL;
}
[12676, 12659, 12663, 12666, 12669, 12671] v4 = rl_vi_domove(a2, &v3);
}
}
else
{
[12496, 12490, 12483] *(_DWORD *)(rl_vimvcxt + 32) = rl_vi_last_motion;
[12514, 12517, 12499, 12506, 12509] v4 = rl_domove_motion_callback((unsigned int *)rl_vimvcxt);
}
[12683, 12679] if ( (v4 & 0x80000000) != 0 )
{
[12685] rl_ding();
[12690] v4 = -1;
}
[12704, 12697, 12707] rl_mvcxt_dispose(rl_vimvcxt);
[12712, 12716] rl_vimvcxt = v5;
[12739, 12741, 12746, 12723, 12726, 12730] return v4;
[12747] }
// 4940: using guessed type long rl_vimvcxt;
// 496C: using guessed type int rl_vi_last_motion;
// 5658: using guessed type int rl_vi_redoing;
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
// 56D8: using guessed type long rl_ding(void);
//----- (00000000000031CC) ----------------------------------------------------
long vidomove_dispatch(unsigned int *a1)
[12748] {
int v1; // eax
unsigned int v3; // [rsp+1Ch] [rbp-4h]
[12768, 12748, 12752, 12753, 12756, 12760, 12764] v1 = *a1;
[12768, 12770, 12773] if ( *a1 == 4 )
{
[12833, 12838, 12841, 12826, 12830] v3 = vi_yank_dispatch((long)a1);
}
else
{
[12778, 12775] if ( v1 > 4 )
{
LABEL_9:
[12843, 12847, 12849, 12851, 12858, 12863] rl_errmsg("vidomove_dispatch: unknown operator %d", *a1);
[12875, 12868] v3 = 1;
goto LABEL_10;
}
[12780, 12783] if ( v1 == 1 )
{
[12804, 12807, 12792, 12796, 12799] v3 = vi_delete_dispatch((long)a1);
}
else
{
[12785, 12788, 12790] if ( v1 != 2 )
goto LABEL_9;
[12809, 12813, 12816, 12821, 12824] v3 = vi_change_dispatch(a1);
}
}
LABEL_10:
[12889, 12883, 12876] rl_readline_state &= ~0x100000uLL;
[12896, 12899] return v3;
[12900] }
// 58C8: using guessed type long rl_errmsg(const char *, ...);
//----- (0000000000003265) ----------------------------------------------------
long rl_vi_rubout(int a1, unsigned int a2)
[12901] {
unsigned int v3; // [rsp+1Ch] [rbp-4h]
[12901, 12905, 12906, 12909, 12913, 12916, 12919, 12923] if ( a1 < 0 )
[12928, 12930, 12932, 12935, 12937, 12939, 12944, 12925] return rl_vi_delete(-a1, a2);
[12955, 12949, 12957] if ( rl_point )
{
[12980, 12974] v3 = rl_point;
[12994, 12998, 13000, 13006, 13008, 12983, 12987, 12989] if ( a1 <= 1 || _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
{
[13027, 13032, 13036, 13038, 13044, 13046] if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
[13090, 13084, 13093] rl_point -= a1;
else
[13061, 13066, 13068, 13071, 13076, 13048, 13082, 13054] rl_point = rl_find_prev_mbchar(rl_line_buffer, rl_point, 1LL);
}
else
{
[13025, 13010, 13013, 13016, 13018, 13020] rl_backward_char((unsigned int)a1, a2);
}
[13105, 13107, 13099] if ( rl_point < 0 )
[13109] rl_point = 0;
[13125, 13128, 13130, 13132, 13119] rl_kill_text(rl_point, v3);
[13137] return 0LL;
}
else
{
[12959] rl_ding();
[12969, 12964] return 1LL;
}
[13142, 13143] }
// 56D8: using guessed type long rl_ding(void);
// 5770: using guessed type long rl_find_prev_mbchar(_QWORD, _QWORD, _QWORD);
// 57C0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 58B0: using guessed type long rl_kill_text(_QWORD, _QWORD);
//----- (0000000000003358) ----------------------------------------------------
long rl_vi_delete(unsigned int a1, unsigned int a2)
[13144] {
int next_mbchar; // [rsp+1Ch] [rbp-4h]
[13152, 13156, 13159, 13162, 13166, 13144, 13148, 13149] if ( (a1 & 0x80000000) != 0 )
[13187, 13168, 13171, 13173, 13175, 13178, 13180, 13182] return rl_vi_rubout(-a1, a2);
[13192, 13200, 13198] if ( rl_end )
{
[13217, 13222, 13226, 13228, 13234, 13236] if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
[13272, 13281, 13283, 13278] next_mbchar = rl_point + a1;
else
[13251, 13254, 13259, 13262, 13267, 13238, 13270, 13244] next_mbchar = rl_find_next_mbchar(rl_line_buffer, rl_point, a1, 1LL);
[13292, 13286, 13295] if ( next_mbchar >= rl_end )
[13297, 13303] next_mbchar = rl_end;
[13312, 13315, 13317, 13319, 13306] rl_kill_text(rl_point, (unsigned int)next_mbchar);
[13346, 13348, 13324, 13330, 13332, 13334, 13340] if ( rl_point > 0 && rl_point == rl_end )
[13360, 13353, 13355, 13350] rl_backward_char(1LL, a2);
[13365] return 0LL;
}
else
{
[13202] rl_ding();
[13212, 13207] return 1LL;
}
[13370, 13371] }
// 56D8: using guessed type long rl_ding(void);
// 57C0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 5840: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
// 58B0: using guessed type long rl_kill_text(_QWORD, _QWORD);
//----- (000000000000343C) ----------------------------------------------------
long rl_vi_unix_word_rubout(int a1)
[13372] {
_BOOL4 v1; // eax
int v6; // [rsp+Ch] [rbp-14h]
unsigned int v7; // [rsp+1Ch] [rbp-4h]
[13376, 13377, 13380, 13384, 13372] v6 = a1;
[13398, 13387, 13396, 13390] if ( rl_point )
{
[13416, 13410] v7 = rl_point;
[13419, 13423] if ( a1 <= 0 )
[13436, 13429] v6 = 1;
[14465, 14468, 14471, 14473, 14462] while ( v6-- )
{
[13441, 13447, 13449, 13455, 13462, 13468, 13470, 13473, 13476, 13478, 13484, 13491, 13497, 13500, 13504, 13507, 13510, 13512, 13514, 13521, 13527, 13530, 13534, 13537, 13540, 13542, 13544] if ( rl_point > 0
&& !*(_BYTE *)(rl_line_buffer + rl_point)
&& (*(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 32 || *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 9) )
{
do
[13545, 13554, 13551] --rl_point;
[13568, 13570, 13602, 13608, 13577, 13610, 13613, 13583, 13616, 13585, 13618, 13588, 13591, 13560, 13593, 13595, 13566] while ( rl_point > 0
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) );
}
[13626, 13620, 13628] if ( rl_point > 0 )
{
[13699, 13705, 13708, 13711, 13714, 13718, 13721, 13724, 13727, 13730, 13733, 13735, 13737, 13742, 13634, 13641, 13647, 13649, 13652, 13655, 13657, 13659, 13666, 13672, 13674, 13677, 13680, 13682, 13684, 13689, 13692] v1 = *(_BYTE *)(rl_line_buffer + rl_point) == 32
|| *(_BYTE *)(rl_line_buffer + rl_point) == 9
|| ((*_ctype_b_loc())[*(char *)(rl_line_buffer + rl_point)] & 4) != 0;
[13825, 13832, 13838, 13841, 13845, 13848, 13851, 13855, 13858, 13861, 13864, 13867, 13870, 13872, 13749, 13751, 13757, 13764, 13770, 13773, 13777, 13780, 13783, 13785, 13787, 13794, 13800, 13803, 13807, 13810, 13813, 13815, 13817, 13822] if ( !v1
&& (*(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 32
|| *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 9
|| ((*_ctype_b_loc())[*(char *)(rl_point - 1LL + rl_line_buffer)] & 4) != 0) )
{
[13880, 13874, 13883] --rl_point;
}
}
[13953, 13958, 13961, 13968, 13974, 13977, 13980, 13983, 13987, 13990, 13993, 13996, 13999, 14002, 14004, 14010, 13889, 13895, 13897, 13903, 13910, 13916, 13918, 13921, 13924, 13926, 13928, 13935, 13941, 13943, 13946, 13949, 13951] if ( rl_point > 0
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32
|| *(_BYTE *)(rl_line_buffer + rl_point) == 9
|| ((*_ctype_b_loc())[*(char *)(rl_line_buffer + rl_point)] & 4) != 0) )
{
[14084, 14087, 14091, 14094, 14097, 14099, 14101, 14106, 14109, 14116, 14122, 14125, 14129, 14132, 14135, 14139, 14142, 14145, 14148, 14151, 14154, 14027, 14156, 14033, 14162, 14035, 14041, 14048, 14054, 14057, 14061, 14064, 14067, 14069, 14071, 14078] while ( rl_point
&& (*(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 32
|| *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 9
|| ((*_ctype_b_loc())[*(char *)(rl_point - 1LL + rl_line_buffer)] & 4) != 0) )
[14018, 14012, 14021] --rl_point;
}
[14213, 14219, 14221, 14224, 14227, 14229, 14231, 14236, 14239, 14246, 14252, 14255, 14258, 14261, 14265, 14268, 14271, 14274, 14277, 14280, 14282, 14284, 14289, 14167, 14173, 14175, 14181, 14188, 14194, 14196, 14199, 14202, 14204, 14206] else if ( rl_point > 0
&& *(_BYTE *)(rl_line_buffer + rl_point) != 32
&& *(_BYTE *)(rl_line_buffer + rl_point) != 9
&& ((*_ctype_b_loc())[*(char *)(rl_line_buffer + rl_point)] & 4) == 0 )
{
[14319, 14317, 14311] while ( rl_point > 0 )
{
[14338, 14341, 14345, 14348, 14351, 14353, 14355, 14362, 14368, 14371, 14375, 14378, 14381, 14383, 14385, 14390, 14393, 14400, 14406, 14409, 14413, 14416, 14419, 14423, 14426, 14429, 14432, 14435, 14438, 14440, 14442, 14447, 14325, 14332] if ( *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 32
|| *(_BYTE *)(rl_point - 1LL + rl_line_buffer) == 9
|| ((*_ctype_b_loc())[*(char *)(rl_point - 1LL + rl_line_buffer)] & 4) != 0 )
{
break;
}
[14306] rl_vi_backup_point();
}
}
}
[14479, 14485, 14488, 14490, 14492] rl_kill_text(v7, rl_point);
}
else
{
[13400, 13405] rl_ding();
}
[14497, 14502] return 0LL;
[14503] }
// 56D8: using guessed type long rl_ding(void);
// 58B0: using guessed type long rl_kill_text(_QWORD, _QWORD);
//----- (00000000000038A8) ----------------------------------------------------
long rl_vi_back_to_indent(long a1, unsigned int a2)
[14504] {
[14532, 14504, 14537, 14508, 14509, 14512, 14516, 14519, 14522, 14525, 14527] rl_beg_of_line(1LL, a2);
[14560, 14593, 14595, 14566, 14568, 14570, 14602, 14618, 14608, 14577, 14610, 14613, 14583, 14616, 14585, 14554, 14588, 14591] while ( rl_point < rl_end
&& (*(_BYTE *)(rl_line_buffer + rl_point) == 32 || *(_BYTE *)(rl_line_buffer + rl_point) == 9) )
[14545, 14539, 14548] ++rl_point;
[14625, 14620] return 0LL;
[14626] }
// 56B8: using guessed type long rl_beg_of_line(_QWORD, _QWORD);
//----- (0000000000003923) ----------------------------------------------------
long rl_vi_first_print(long a1, unsigned int a2)
[14627] {
[14627, 14660, 14631, 14632, 14635, 14639, 14642, 14645, 14648, 14650, 14655] return rl_vi_back_to_indent(1LL, a2);
[14661] }
//----- (0000000000003946) ----------------------------------------------------
long rl_vi_callback_char_search(unsigned int *a1)
{
rl_vi_last_search_mblen = rl_read_mbchar(&rl_vi_last_search_mbchar, 16LL);
if ( rl_vi_last_search_mblen > 0 )
{
rl_callback_func = 0LL;
rl_want_redisplay = 1;
rl_readline_state &= ~0x800000uLL;
return rl_char_search_internal(
*a1,
(unsigned int)rl_cs_dir,
&rl_vi_last_search_mbchar,
(unsigned int)rl_vi_last_search_mblen);
}
else
{
rl_readline_state &= ~0x800000uLL;
return 0xFFFFFFFFLL;
}
}
// 4980: using guessed type int rl_vi_last_search_mblen;
// 4A28: using guessed type int rl_cs_dir;
// 58D0: using guessed type long rl_read_mbchar(_QWORD, _QWORD);
// 58E8: using guessed type long rl_char_search_internal(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000039E4) ----------------------------------------------------
long rl_vi_char_search(unsigned int a1, int a2)
[14820] {
int v3; // eax
int mbchar; // [rsp+1Ch] [rbp-4h]
[14848, 14820, 14824, 14825, 14828, 14832, 14835, 14838, 14842, 14844] if ( a2 == 59 || a2 == 44 )
{
[14856, 14850, 14858] if ( !rl_cs_orig_dir )
[14865, 14860] return 1LL;
[14876, 14870, 14878] if ( !rl_vi_last_search_mblen )
[14880, 14885] return 1LL;
[14890, 14894] if ( a2 == 59 )
[14906] v3 = rl_cs_orig_dir;
else
[14896, 14904, 14902] v3 = -rl_cs_orig_dir;
[14912, 14918] rl_cs_dir = v3;
}
else
{
[14923, 14927] if ( a2 == 116 )
{
[14961] rl_cs_dir = 1;
[14977, 14971, 14983] rl_cs_orig_dir = 1;
}
[14929, 14933] else if ( a2 <= 116 )
{
[14939, 14935] if ( a2 == 102 )
{
[15009] rl_cs_dir = 2;
[15025, 15019, 15031] rl_cs_orig_dir = 2;
}
[14945, 14941] else if ( a2 <= 102 )
{
[14947, 14951] if ( a2 == 70 )
{
[15033] rl_cs_dir = -2;
[15049, 15043, 15055] rl_cs_orig_dir = -2;
}
[14953, 14957, 14959] else if ( a2 == 84 )
{
[14985] rl_cs_dir = -1;
[15001, 14995, 15007] rl_cs_orig_dir = -1;
}
}
}
[15056, 15062, 15064] if ( !rl_vi_redoing )
{
[15085, 15082, 15077, 15070] if ( (rl_readline_state & 0x80000) != 0 )
{
[15097, 15090, 15092, 15087] rl_callback_data = rl_callback_data_alloc(a1);
[15104, 15117, 15111] *(_DWORD *)(rl_callback_data + 4LL) = rl_cs_dir;
[15120, 15130, 15127] *(_DWORD *)(rl_callback_data + 8LL) = a2;
[15140, 15133] rl_callback_func = rl_vi_callback_char_search;
[15160, 15154, 15147] rl_readline_state |= 0x800000uLL;
[15172, 15167] return 0LL;
}
[15186, 15179, 15174, 15191] mbchar = rl_read_mbchar(&rl_vi_last_search_mbchar, 16LL);
[15194, 15198] if ( mbchar <= 0 )
[15200, 15205] return 0xFFFFFFFFLL;
[15210, 15207] rl_vi_last_search_mblen = mbchar;
}
}
[15216, 15223] target_6558 = (long)&rl_vi_last_search_mbchar;
[15236, 15230] tlen_6559 = rl_vi_last_search_mblen;
[15264, 15266, 15271, 15242, 15248, 15255, 15261] return rl_char_search_internal(
a1,
(unsigned int)rl_cs_dir,
&rl_vi_last_search_mbchar,
(unsigned int)rl_vi_last_search_mblen);
[15272] }
// 4980: using guessed type int rl_vi_last_search_mblen;
// 4A28: using guessed type int rl_cs_dir;
// 4A2C: using guessed type int rl_cs_orig_dir;
// 4A30: using guessed type long target_6558;
// 4A38: using guessed type int tlen_6559;
// 5658: using guessed type int rl_vi_redoing;
// 58D0: using guessed type long rl_read_mbchar(_QWORD, _QWORD);
// 58E8: using guessed type long rl_char_search_internal(_QWORD, _QWORD, _QWORD, _QWORD);
// 58F0: using guessed type long rl_callback_data_alloc(_QWORD);
//----- (0000000000003BA9) ----------------------------------------------------
long rl_vi_match(long a1, unsigned int a2)
[15273] {
int v3; // [rsp+14h] [rbp-1Ch]
int v4; // [rsp+18h] [rbp-18h]
int v5; // [rsp+1Ch] [rbp-14h]
int next_mbchar; // [rsp+1Ch] [rbp-14h]
int v7; // [rsp+20h] [rbp-10h]
int v8; // [rsp+24h] [rbp-Ch]
int v9; // [rsp+28h] [rbp-8h]
int v10; // [rsp+2Ch] [rbp-4h]
[15273, 15277, 15278, 15281, 15285, 15288, 15291] v3 = 1;
[15304, 15298] v5 = rl_point;
[15328, 15331, 15333, 15338, 15307, 15314, 15320, 15322, 15325] v4 = rl_vi_bracktype(*(char *)(rl_line_buffer + rl_point));
[15345, 15341] if ( v4 )
goto LABEL_14;
[15360, 15362, 15368, 15370, 15372, 15351, 15356] if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
{
[15500] while ( 1 )
{
[15490, 15493, 15495, 15500, 15469, 15476, 15482, 15484, 15487] v4 = rl_vi_bracktype(*(char *)(rl_line_buffer + rl_point));
[15524, 15526, 15503, 15507, 15509, 15515, 15518] if ( v4 || rl_end - 1 <= rl_point )
break;
[15464, 15457, 15459, 15454] rl_forward_char(1LL, a2);
}
}
else
{
do
{
[15424, 15427, 15430, 15433, 15435, 15440, 15409, 15416, 15422] v4 = rl_vi_bracktype(*(char *)(rl_line_buffer + rl_point));
[15449, 15443, 15447] if ( v4 )
break;
[15380, 15374] v7 = rl_point;
[15393, 15386, 15388, 15383] rl_forward_char(1LL, a2);
}
[15404, 15398, 15407] while ( v7 != rl_point );
}
[15528, 15532] if ( v4 > 0 )
{
LABEL_14:
[15564, 15558] next_mbchar = rl_point;
[15577, 15571, 15567] if ( v4 >= 0 )
{
[15898, 15894] while ( v3 )
{
[15752, 15757, 15761, 15763, 15769, 15771] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
[15777, 15773] ++next_mbchar;
else
[15779, 15786, 15789, 15794, 15799, 15802, 15807] next_mbchar = rl_find_next_mbchar(rl_line_buffer, (unsigned int)next_mbchar, 1LL, 0LL);
[15816, 15810, 15819] if ( next_mbchar >= rl_end )
{
LABEL_26:
[15722] rl_ding();
[15732, 15727] return 1LL;
}
[15842, 15844, 15849, 15821, 15828, 15831, 15833, 15836, 15839] v8 = rl_vi_bracktype(*(char *)(rl_line_buffer + next_mbchar));
[15857, 15852, 15860, 15855] if ( v8 == -v4 )
{
[15866, 15862] --v3;
}
[15874, 15868, 15871] else if ( v8 == v4 )
{
[15880, 15876] ++v3;
}
}
}
else
{
[15737, 15747, 15741] while ( v3 )
{
[15585, 15582] v9 = next_mbchar;
[15588, 15593, 15597, 15599, 15605, 15607] if ( _ctype_get_mb_cur_max() == 1 || rl_byte_oriented )
{
[15609, 15613] --next_mbchar;
}
else
{
[15622, 15625, 15630, 15632, 15635, 15640, 15615] next_mbchar = rl_find_prev_mbchar(rl_line_buffer, (unsigned int)next_mbchar, 0LL);
[15649, 15643, 15646] if ( v9 == next_mbchar )
[15651] --next_mbchar;
}
[15659, 15655] if ( next_mbchar < 0 )
goto LABEL_26;
[15682, 15684, 15689, 15661, 15668, 15671, 15673, 15676, 15679] v10 = rl_vi_bracktype(*(char *)(rl_line_buffer + next_mbchar));
[15697, 15700, 15692, 15695] if ( v10 == -v4 )
{
[15706, 15702] --v3;
}
[15714, 15708, 15711] else if ( v10 == v4 )
{
[15720, 15716] ++v3;
}
}
}
[15904, 15907] rl_point = next_mbchar;
[15913] return 0LL;
}
else
{
[15537, 15534] rl_point = v5;
[15543] rl_ding();
[15553, 15548] return 1LL;
}
[15918, 15919] }
// 56D8: using guessed type long rl_ding(void);
// 5770: using guessed type long rl_find_prev_mbchar(_QWORD, _QWORD, _QWORD);
// 5810: using guessed type long rl_forward_char(_QWORD, _QWORD);
// 5840: using guessed type long rl_find_next_mbchar(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000003E30) ----------------------------------------------------
long rl_vi_bracktype(int a1)
[15920] {
[15920, 15924, 15925, 15928, 15931, 15935] if ( a1 == 125 )
[16033, 16028] return 4294967293LL;
[15937, 15941] if ( a1 <= 125 )
{
[15947, 15943] if ( a1 == 123 )
[16026, 16021] return 3LL;
[15953, 15949] if ( a1 <= 123 )
{
[15955, 15959] if ( a1 == 93 )
[16019, 16014] return 4294967294LL;
[15961, 15965] if ( a1 <= 93 )
{
[15971, 15967] if ( a1 == 91 )
[16012, 16007] return 2LL;
[15977, 15973] if ( a1 <= 91 )
{
[15979, 15983] if ( a1 == 40 )
[15993, 15998] return 1LL;
[15985, 15989, 15991] if ( a1 == 41 )
[16000, 16005] return 0xFFFFFFFFLL;
}
}
}
}
[16040] return 0LL;
[16041] }
//----- (0000000000003EAA) ----------------------------------------------------
long rl_vi_change_char(int a1, unsigned int a2, long a3)
{
int v4; // eax
int v7; // [rsp+1Ch] [rbp-4h]
if ( a2 == 27 || a2 == 3 )
return 0xFFFFFFFFLL;
rl_begin_undo_group();
while ( 1 )
{
v4 = a1--;
if ( !v4 || rl_point >= rl_end )
break;
v7 = rl_point;
rl_vi_delete(1u, a2);
if ( v7 > rl_point )
rl_vi_append_forward();
if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
rl_insert_char(1LL, a2);
else
rl_insert_text(a3);
}
rl_backward_char(1LL, a2);
rl_end_undo_group();
return 0LL;
}
// 5668: using guessed type long rl_begin_undo_group(void);
// 5690: using guessed type long rl_end_undo_group(void);
// 5698: using guessed type long rl_insert_text(_QWORD);
// 57C0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 5838: using guessed type long rl_insert_char(_QWORD, _QWORD);
//----- (0000000000003F74) ----------------------------------------------------
long rl_vi_callback_getchar(long a1, unsigned int a2)
{
return rl_bracketed_read_mbstring(a1, a2);
}
// 5900: using guessed type long rl_bracketed_read_mbstring(_QWORD, _QWORD);
//----- (0000000000003F9A) ----------------------------------------------------
long rl_vi_callback_change_char(int *a1)
{
signed int v2; // [rsp+1Ch] [rbp-24h]
char src[24]; // [rsp+20h] [rbp-20h] BYREF
unsigned long v4; // [rsp+38h] [rbp-8h]
v4 = __readfsqword(0x28u);
v2 = rl_vi_callback_getchar((long)src, 0x10u);
if ( v2 < 0 )
return 0xFFFFFFFFLL;
if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
rl_vi_last_replacement = v2;
else
strncpy(&rl_vi_last_replacement, src, 0x10uLL);
byte_49A0 = 0;
rl_callback_func = 0LL;
rl_want_redisplay = 1;
return rl_vi_change_char(*a1, v2, (long)src);
}
// 49A0: using guessed type char byte_49A0;
//----- (000000000000405A) ----------------------------------------------------
long rl_vi_change_char(int a1)
[16474] {
signed int v2; // [rsp+1Ch] [rbp-24h]
char dest[24]; // [rsp+20h] [rbp-20h] BYREF
unsigned long v4; // [rsp+38h] [rbp-8h]
[16482, 16486, 16489, 16492, 16501, 16474, 16478, 16479] v4 = __readfsqword(0x28u);
[16505, 16513, 16507, 16515] if ( rl_vi_redoing )
{
[16517, 16521, 16526, 16533, 16536] strncpy(dest, &rl_vi_last_replacement, 0x10uLL);
[16554] dest[16] = 0;
[16548, 16742, 16551, 16717, 16558, 16721, 16723, 16728, 16730, 16541] return rl_vi_change_char(a1, (unsigned char)rl_vi_last_replacement, (long)dest);
}
[16578, 16570, 16563, 16575] else if ( (rl_readline_state & 0x80000) != 0 )
{
[16585, 16580, 16590, 16583] rl_callback_data = rl_callback_data_alloc((unsigned int)a1);
[16604, 16597] rl_callback_func = rl_vi_callback_change_char;
[16616, 16611] return 0LL;
}
else
{
[16621, 16625, 16630, 16633, 16638] v2 = rl_vi_callback_getchar((long)dest, 0x10u);
[16641, 16645] if ( v2 >= 0 )
{
[16673, 16654, 16659, 16663, 16665, 16671] if ( _ctype_get_mb_cur_max() <= 1 || rl_byte_oriented )
[16704, 16701] rl_vi_last_replacement = v2;
else
[16675, 16679, 16684, 16687, 16694, 16699] strncpy(&rl_vi_last_replacement, dest, 0x10uLL);
[16710] byte_49A0 = 0;
[16737, 16740, 16742, 16744, 16749, 16762, 16753, 16730, 16764, 16734] return rl_vi_change_char(a1, v2, (long)dest);
}
else
{
[16652, 16647] return 0xFFFFFFFFLL;
}
}
[16769, 16770] }
// 4151: conditional instruction was optimized away because %var_24.4>=0
// 49A0: using guessed type char byte_49A0;
// 5658: using guessed type int rl_vi_redoing;
// 58F0: using guessed type long rl_callback_data_alloc(_QWORD);
//----- (0000000000004183) ----------------------------------------------------
long rl_vi_subst(unsigned int a1, int a2)
[16771] {
unsigned int v2; // eax
[16771, 16775, 16776, 16779, 16783, 16786, 16789, 16795, 16797] if ( !rl_vi_redoing )
{
[16803, 16799] if ( a2 == 83 )
[16810, 16805] v2 = 99;
else
[16812] v2 = 108;
[16817, 16819] rl_stuff_char(v2);
}
[16832, 16834, 16839, 16824, 16827] return rl_vi_change_to(a1, 0x63u);
[16840] }
// 5658: using guessed type int rl_vi_redoing;
// 5860: using guessed type long rl_stuff_char(_QWORD);
//----- (00000000000041C9) ----------------------------------------------------
long rl_vi_overstrike(unsigned int a1, unsigned int a2)
[16841] {
[16865, 16867, 16841, 16845, 16846, 16849, 16853, 16856, 16859] if ( !rl_vi_doing_insert )
{
[16869] rl_vi_doing_insert = 1;
[16879] rl_begin_undo_group();
}
[16888, 16884] if ( (int)a1 > 0 )
{
[16896, 16898, 16900, 16905, 16907, 16890, 16893] if ( (unsigned int)rl_overwrite_char(a1, a2) )
[16914, 16909] return 1LL;
[16933, 16916, 16922, 16925, 16927] vi_replace_count += a1;
}
[16938] return 0LL;
[16939] }
// 4948: using guessed type int rl_vi_doing_insert;
// 4958: using guessed type int vi_replace_count;
// 5668: using guessed type long rl_begin_undo_group(void);
// 5908: using guessed type long rl_overwrite_char(_QWORD, _QWORD);
//----- (000000000000422C) ----------------------------------------------------
long rl_vi_overstrike_delete(int a1, unsigned int a2)
[16940] {
int i; // [rsp+18h] [rbp-8h]
int v4; // [rsp+1Ch] [rbp-4h]
[16965, 16940, 16944, 16945, 17043, 16948, 17047, 16952, 17050, 16955, 17053, 16958] for ( i = 0; i < a1; ++i )
{
[16973, 16975, 16967] if ( !vi_replace_count )
{
[16977] rl_ding();
[16982] break;
}
[16984, 16990] v4 = rl_point;
[17000, 16993, 16998] if ( (unsigned int)rl_do_undo() )
[17008, 17002, 17011] --vi_replace_count;
[17017, 17026, 17023] if ( v4 == rl_point )
[17033, 17028, 17038, 17031] rl_backward_char(1LL, a2);
}
[17061, 17063, 17065, 17071, 17073, 17055] if ( !vi_replace_count && rl_vi_doing_insert )
{
[17075] rl_end_undo_group();
[17080] rl_do_undo();
[17085] rl_vi_doing_insert = 0;
}
[17100, 17095] return 0LL;
[17101] }
// 4948: using guessed type int rl_vi_doing_insert;
// 4958: using guessed type int vi_replace_count;
// 5690: using guessed type long rl_end_undo_group(void);
// 56D8: using guessed type long rl_ding(void);
// 57C0: using guessed type long rl_backward_char(_QWORD, _QWORD);
// 58C0: using guessed type long rl_do_undo(void);
//----- (00000000000042CE) ----------------------------------------------------
long rl_vi_overstrike_kill_line(unsigned int a1, unsigned int a2)
[17102] {
int v3; // [rsp+18h] [rbp-8h]
unsigned int v4; // [rsp+1Ch] [rbp-4h]
[17120, 17126, 17102, 17106, 17107, 17110, 17114, 17117] v3 = rl_end;
[17129, 17132, 17135, 17137, 17139, 17144] v4 = rl_unix_line_discard(a1, a2);
[17153, 17159, 17162, 17164, 17166, 17168, 17147] vi_replace_count -= v3 - rl_end;
[17177, 17174] return v4;
[17178] }
// 4958: using guessed type int vi_replace_count;
// 5910: using guessed type long rl_unix_line_discard(_QWORD, _QWORD);
//----- (000000000000431B) ----------------------------------------------------
long rl_vi_overstrike_kill_word(int a1)
[17179] {
int v2; // [rsp+18h] [rbp-8h]
unsigned int v3; // [rsp+1Ch] [rbp-4h]
[17184, 17187, 17191, 17194, 17197, 17203, 17179, 17183] v2 = rl_end;
[17216, 17221, 17206, 17209, 17212, 17214] v3 = rl_vi_unix_word_rubout(a1);
[17224, 17230, 17236, 17239, 17241, 17243, 17245] vi_replace_count -= v2 - rl_end;
[17251, 17254] return v3;
[17255] }
// 4958: using guessed type int vi_replace_count;
//----- (0000000000004368) ----------------------------------------------------
long rl_vi_overstrike_yank(unsigned int a1, unsigned int a2)
[17256] {
int v3; // [rsp+18h] [rbp-8h]
unsigned int v4; // [rsp+1Ch] [rbp-4h]
[17280, 17256, 17260, 17261, 17264, 17268, 17271, 17274] v3 = rl_end;
[17283, 17286, 17289, 17291, 17293, 17298] v4 = rl_yank(a1, a2);
[17312, 17318, 17320, 17301, 17307, 17310] vi_replace_count += rl_end - v3;
[17329, 17326] return v4;
[17330] }
// 4958: using guessed type int vi_replace_count;
// 5848: using guessed type long rl_yank(_QWORD, _QWORD);
//----- (00000000000043B3) ----------------------------------------------------
long rl_vi_overstrike_bracketed_paste()
[17331] {
unsigned int key; // [rsp+8h] [rbp-28h]
unsigned int i; // [rsp+14h] [rbp-1Ch]
long v3; // [rsp+18h] [rbp-18h] BYREF
long v4; // [rsp+20h] [rbp-10h]
unsigned long v5; // [rsp+28h] [rbp-8h]
[17346, 17349, 17358, 17331, 17335, 17336, 17339, 17343] v5 = __readfsqword(0x28u);
[17376, 17362, 17364, 17368, 17371] v4 = rl_bracketed_text(&v3);
[17384, 17387, 17380] if ( v3 )
{
[17408, 17443, 17412, 17415, 17447, 17451, 17420, 17423, 17427, 17430, 17433, 17436, 17438] for ( i = v3; (--i & 0x80000000) == 0; rl_unget_char(*(unsigned char *)((int)i + v4)) )
;
[17457, 17460, 17453, 17465] xfree(v4);
[17498, 17500, 17493] while ( (unsigned int)rl_pushed_input_available() )
{
[17472, 17467] key = rl_read_key();
[17475, 17478, 17480, 17485, 17490] i = rl_vi_overstrike(1u, key);
}
[17505, 17509, 17518, 17520, 17502] return i;
}
else
{
[17393, 17396, 17389] xfree(v4);
[17401, 17406] return 0LL;
}
[17525, 17526] }
// 43B3: using guessed type long rl_vi_overstrike_bracketed_paste();
// 5880: using guessed type long xfree(_QWORD);
// 5918: using guessed type long rl_bracketed_text(_QWORD);
// 5920: using guessed type long rl_unget_char(_QWORD);
// 5928: using guessed type long rl_read_key(void);
// 5930: using guessed type long rl_pushed_input_available(void);
//----- (0000000000004477) ----------------------------------------------------
long rl_vi_replace(long a1, int a2)
[17527] {
int i; // [rsp+1Ch] [rbp-4h]
int j; // [rsp+1Ch] [rbp-4h]
[17539, 17542, 17545, 17527, 17531, 17532, 17535] vi_replace_count = 0;
[17562, 17555, 17565] if ( !vi_replace_map )
{
[17576, 17571] vi_replace_map = rl_make_bare_keymap();
[17666, 17670, 17674, 17583, 17590] for ( i = 0; i <= 31; ++i )
{
[17601, 17604, 17611, 17615, 17617, 17592, 17595, 17597] if ( !*((_BYTE *)&vi_insertion_keymap + 16 * i) )
[17632, 17636, 17639, 17642, 17658, 17644, 17648, 17619, 17651, 17626, 17629, 17662] *(_QWORD *)(vi_replace_map + 16LL * i + 8) = *((_QWORD *)&vi_insertion_keymap + 2 * i + 1);
}
[17676, 17683, 17716, 17720, 17727] for ( j = 32; j <= 256; ++j )
[17698, 17702, 17705, 17712, 17685, 17692, 17695] *(_QWORD *)(16LL * j + vi_replace_map + 8) = rl_vi_overstrike;
[17736, 17729, 17749, 17742] *(_QWORD *)(vi_replace_map + 2040) = rl_vi_overstrike_delete;
[17760, 17753, 17773, 17766] *(_QWORD *)(vi_replace_map + 440) = rl_vi_movement_mode;
[17784, 17777, 17797, 17790] *(_QWORD *)(vi_replace_map + 216) = &rl_newline;
[17808, 17801, 17821, 17814] *(_QWORD *)(vi_replace_map + 168) = &rl_newline;
[17825, 17832, 17834, 17836, 17843, 17850, 17853] if ( !*((_BYTE *)&vi_insertion_keymap + 128) && *((_UNKNOWN **)&vi_insertion_keymap + 17) == &rl_rubout )
[17873, 17866, 17862, 17855] *(_QWORD *)(vi_replace_map + 136) = rl_vi_overstrike_delete;
[17888, 17895, 17902, 17905, 17877, 17884, 17886] if ( !*((_BYTE *)&vi_insertion_keymap + 336)
&& *((long ( ***)(_QWORD, _QWORD))&vi_insertion_keymap + 43) == &rl_unix_line_discard )
{
[17920, 17914, 17907, 17927] *(_QWORD *)(vi_replace_map + 344) = rl_vi_overstrike_kill_line;
}
[17956, 17959, 17931, 17938, 17940, 17942, 17949] if ( !*((_BYTE *)&vi_insertion_keymap + 368)
&& *((long ( **)(int))&vi_insertion_keymap + 47) == rl_vi_unix_word_rubout )
{
[17968, 17961, 17981, 17974] *(_QWORD *)(vi_replace_map + 376) = rl_vi_overstrike_kill_word;
}
[17985, 17992, 17994, 17996, 18003, 18010, 18013] if ( !*((_BYTE *)&vi_insertion_keymap + 400)
&& *((long ( ***)(_QWORD, _QWORD))&vi_insertion_keymap + 51) == &rl_yank )
{
[18035, 18028, 18022, 18015] *(_QWORD *)(vi_replace_map + 408) = rl_vi_overstrike_yank;
}
[18052, 18046, 18039] *(_BYTE *)(vi_replace_map + 4096) = 0;
[18068, 18062, 18055] *(_QWORD *)(vi_replace_map + 4104) = 0LL;
}
[18082, 18085, 18090, 18092, 18076] rl_vi_start_inserting(a2, 1, rl_arg_sign);
[18097] rl_vi_last_key_before_insert = 82;
[18114, 18107] rl_keymap = vi_replace_map;
[18121, 18129, 18127] if ( rl_enable_bracketed_paste )
[18145, 18138, 18131] rl_bind_keyseq_if_unbound("\x1B[200~", rl_vi_overstrike_bracketed_paste);
[18155, 18150] return 0LL;
[18156] }
// 43B3: using guessed type long rl_vi_overstrike_bracketed_paste();
// 4950: using guessed type long vi_replace_map;
// 4958: using guessed type int vi_replace_count;
// 49A4: using guessed type int rl_vi_last_key_before_insert;
// 5780: using guessed type long rl_newline(_QWORD, _QWORD);
// 5848: using guessed type long rl_yank(_QWORD, _QWORD);
// 5910: using guessed type long rl_unix_line_discard(_QWORD, _QWORD);
// 5938: using guessed type long rl_make_bare_keymap(void);
// 5950: using guessed type long rl_bind_keyseq_if_unbound(_QWORD, _QWORD);
//----- (00000000000046ED) ----------------------------------------------------
long rl_vi_set_mark()
{
int key; // [rsp+Ch] [rbp-4h]
rl_readline_state |= 0x40uLL;
key = rl_read_key();
rl_readline_state &= ~0x40uLL;
if ( key >= 97 && key <= 122 )
{
vi_mark_chars[key - 97] = rl_point;
return 0LL;
}
else
{
rl_ding();
return 1LL;
}
}
// 49C0: using guessed type _DWORD vi_mark_chars[26];
// 56D8: using guessed type long rl_ding(void);
// 5928: using guessed type long rl_read_key(void);
//----- (000000000000476C) ----------------------------------------------------
long rl_vi_callback_set_mark()
{
rl_callback_func = 0LL;
rl_want_redisplay = 1;
return rl_vi_set_mark();
}
// 476C: using guessed type long rl_vi_callback_set_mark();
//----- (0000000000004798) ----------------------------------------------------
long rl_vi_set_mark()
[18328] {
[18336, 18340, 18343, 18346, 18353, 18358, 18328, 18361, 18332, 18333] if ( (rl_readline_state & 0x80000) == 0 )
[18395] return rl_vi_set_mark();
[18363] rl_callback_data = 0LL;
[18393, 18388, 18381, 18374] rl_callback_func = rl_vi_callback_set_mark;
[18400] return 0LL;
[18401] }
// 476C: using guessed type long rl_vi_callback_set_mark();
// 4798: using guessed type long rl_vi_set_mark();
//----- (00000000000047E2) ----------------------------------------------------
long rl_vi_goto_mark()
{
int key; // [rsp+Ch] [rbp-4h]
int v2; // [rsp+Ch] [rbp-4h]
rl_readline_state |= 0x40uLL;
key = rl_read_key();
rl_readline_state &= ~0x40uLL;
if ( key == 96 )
{
rl_point = rl_mark;
rl_fix_point(1LL);
return 0LL;
}
else if ( key < 97 || key > 122 || (v2 = key - 97, vi_mark_chars[v2] == -1) )
{
rl_ding();
return 1LL;
}
else
{
rl_point = vi_mark_chars[v2];
rl_fix_point(1LL);
return 0LL;
}
}
// 49C0: using guessed type _DWORD vi_mark_chars[26];
// 56D8: using guessed type long rl_ding(void);
// 5890: using guessed type long rl_fix_point(_QWORD);
// 5928: using guessed type long rl_read_key(void);
//----- (00000000000048B5) ----------------------------------------------------
long rl_vi_callback_goto_mark()
{
rl_callback_func = 0LL;
rl_want_redisplay = 1;
return rl_vi_goto_mark();
}
// 48B5: using guessed type long rl_vi_callback_goto_mark();
//----- (00000000000048E1) ----------------------------------------------------
long rl_vi_goto_mark()
[18657] {
[18657, 18690, 18661, 18662, 18665, 18669, 18672, 18675, 18682, 18687] if ( (rl_readline_state & 0x80000) == 0 )
[18724] return rl_vi_goto_mark();
[18692] rl_callback_data = 0LL;
[18722, 18717, 18710, 18703] rl_callback_func = rl_vi_callback_goto_mark;
[18729] return 0LL;
[18730] }
// 48B5: using guessed type long rl_vi_callback_goto_mark();
// 48E1: using guessed type long rl_vi_goto_mark();
// nfuncs=164 queued=91 decompiled=91 lumina nreq=0 worse=0 better=0
// ALL OK, 91 function(s) have been successfully decompiled
|
long long sshlogdie(char *a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long a4) {
[2944] unsigned int v0; // [bp-0xd8]
[2944] unsigned int v1; // [bp-0xd4]
[2944] unsigned long v2; // [bp-0xd0]
[2944] unsigned long v3; // [bp-0xc8]
[2944] unsigned long v4; // [bp-0xc0]
[2944] char v5; // [bp-0xb8]
[2944] int v6; // [bp-0x88]
[2944] int v7; // [bp-0x78]
[2944] int v8; // [bp-0x68]
[2944] int v9; // [bp-0x58]
[2944] int v10; // [bp-0x48]
[2944] int v11; // [bp-0x38]
[2944] int v12; // [bp-0x28]
[2944] int v13; // [bp-0x18]
[2944] unsigned long long v14; // [bp+0x8]
[2944] char v15; // [bp+0x10]
[2944] unsigned long long v16; // r8
[2944] char v17; // al
[2944] int v18; // xmm0
[2944] int v19; // xmm1
[2944] int v20; // xmm2
[2944] int v21; // xmm3
[2944] int v22; // xmm4
[2944] int v23; // xmm5
[2944] int v24; // xmm6
[2944] int v25; // xmm7
[2944] unsigned long long *v26; // fs
[2944] unsigned long long v27; // r9
[2944]
[2944] v16 = v14;
[2944, 2948, 2949, 2950, 2957] if (v17) {
v6 = v18;
[2969] v7 = v19;
[2974] v8 = v20;
[2979] v9 = v21;
[2984] v10 = v22;
[2992] v11 = v23;
[3000] v12 = v24;
[3008] v13 = v25;
[3073, 3016, 3081, 3082, 3084, 3024, 3090, 3033, 3038, 3040, 3048, 3055, 3060, 3065, 3070] }
v4 = v26[5];
v0 = 48;
v2 = &v15;
v3 = &v5;
v1 = 48;
sshlogv(a0, a1, a2, a3, 0x3, v27, v16, &v0);
cleanup_exit(0xff);
sshsigdie(0xff, a1, a2, a3, 0x3); /* do not return */
}
|
long long sshlogdie(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long long a5, unsigned long long v16) {
[2847] unsigned long long v0; // [bp-0x108]
[2847] unsigned int v1; // [bp-0xf4]
[2847] unsigned int v2; // [bp-0xd8]
[2847] unsigned int v3; // [bp-0xd4]
[2847] unsigned long v4; // [bp-0xd0]
[2847] unsigned long v5; // [bp-0xc8]
[2847] unsigned long v6; // [bp-0xc0]
[2847] char v7; // [bp-0xb8]
[2847] int v8; // [bp-0x88]
[2847] int v9; // [bp-0x78]
[2847] int v10; // [bp-0x68]
[2847] int v11; // [bp-0x58]
[2847] int v12; // [bp-0x48]
[2847] int v13; // [bp-0x38]
[2847] int v14; // [bp-0x28]
[2847] int v15; // [bp-0x18]
[2847] char v17; // [bp+0x10]
[2847] char v18; // al
[2847] int v19; // xmm0
[2847] int v20; // xmm1
[2847] int v21; // xmm2
[2847] int v22; // xmm3
[2847] int v23; // xmm4
[2847] int v24; // xmm5
[2847] int v25; // xmm6
[2847] int v26; // xmm7
[2847] unsigned long long *v27; // fs
[2847]
[2847] v1 = a4;
[2882, 2851, 2852, 2855, 2888, 2862, 2869, 2876, 2847] if (v18) {
v8 = v19;
[2906] v9 = v20;
[2910] v10 = v21;
[2914] v11 = v22;
[2918] v12 = v23;
[2922] v13 = v24;
[2926] v14 = v25;
[2930] v15 = v26;
[2949, 2958, 2965, 2967, 2977, 2987, 2991, 2998, 3005, 3012, 3019, 3025, 3031, 3038, 3045, 3052, 3053, 3059, 2934, 3062, 2938, 3068, 2942, 3071] }
v0 = v16;
v6 = v27[5];
v2 = 48;
v3 = 48;
v4 = &v17;
v5 = &v7;
sshlogv(a0, a1, a2, a3, 0x3, a5, v0, &v2);
cleanup_exit(0xff);
}
|
int rta_getattr_u32(struct_0 *a0) {
[0] return a0->field_4;
[0, 3] }
|
int rta_getattr_u32(struct_0 *a0) {
[0] return a0->field_4;
[0, 1, 4, 8, 12, 15, 16] }
|
long long usage(unsigned long long a0) {
[26192] unsigned long v0; // [bp-0x8]
[26192] unsigned long v2; // r12
[26192] unsigned int v4; // rdx
[26192] unsigned long long v5; // rsi
[26192] unsigned long long v6; // rcx
[26192] unsigned long long v7; // r8
[26192] unsigned long long v8; // r9
[26192] unsigned long long v9; // rdi
[26192]
[26192] v0 = v2;
[26192, 26196] if (a0) {
__fprintf_chk(stderr, 0x1, dcgettext(NULL, "Try '%s --help' for more information.\n", 0x5));
[26242, 26245, 26250, 26253, 26221, 26255, 26228, 26230, 26235] } else {
v4 = program_name;
[26281] __printf_chk(0x1, dcgettext(NULL, "Usage: %s [OPTION]... [FILE]...\n", 0x5));
[26276, 26284, 26289, 26292, 26294, 26267, 26269] v4 = 5;
[26299] fputs_unlocked(dcgettext(NULL, "List information about the FILEs (the current directory by default).\nSort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n", 0x5), stdout);
[26304, 26313, 26320, 26325, 26328, 26331] emit_mandatory_arg_note(a0, v5, v4, v6, v7, v8);
[26336] fputs_unlocked(dcgettext(NULL, " -a, --all do not ignore entries starting with .\n -A, --almost-all do not list implied . and ..\n --author with -l, print the author of each file\n -b, --escape print C-style escapes for nongraphic characters\n", 0x5), stdout);
[26370, 26373, 26348, 26355, 26362, 26367] fputs_unlocked(dcgettext(NULL, " --block-size=SIZE with -l, scale sizes by SIZE when printing them;\n e.g., '--block-size=M'; see SIZE format below\n\n", 0x5), stdout);
[26404, 26407, 26410, 26385, 26392, 26399] fputs_unlocked(dcgettext(NULL, " -B, --ignore-backups do not list implied entries ending with ~\n", 0x5), stdout);
[26436, 26441, 26444, 26447, 26422, 26429] fputs_unlocked(dcgettext(NULL, " -c with -lt: sort by, and show, ctime (time of last\n modification of file status information);\n with -l: show ctime and sort by name;\n otherwise: sort by ctime, newest first\n\n", 0x5), stdout);
[26466, 26473, 26478, 26481, 26484, 26459] fputs_unlocked(dcgettext(NULL, " -C list entries by columns\n --color[=WHEN] color the output WHEN; more info below\n -d, --directory list directories themselves, not their contents\n -D, --dired generate output designed for Emacs' dired mode\n", 0x5), stdout);
[26496, 26503, 26510, 26515, 26518, 26521] fputs_unlocked(dcgettext(NULL, " -f list all entries in directory order\n -F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN\n --file-type likewise, except do not append '*'\n", 0x5), stdout);
[26533, 26540, 26547, 26552, 26555, 26558] fputs_unlocked(dcgettext(NULL, " --format=WORD across -x, commas -m, horizontal -x, long -l,\n single-column -1, verbose -l, vertical -C\n\n", 0x5), stdout);
[26592, 26595, 26570, 26577, 26584, 26589] fputs_unlocked(dcgettext(NULL, " --full-time like -l --time-style=full-iso\n", 0x5), stdout);
[26626, 26629, 26632, 26607, 26614, 26621] fputs_unlocked(dcgettext(NULL, " -g like -l, but do not list owner\n", 0x5), stdout);
[26658, 26663, 26666, 26637, 26669, 26651] fputs_unlocked(dcgettext(NULL, " --group-directories-first\n group directories before files;\n can be augmented with a --sort option, but any\n use of --sort=none (-U) disables grouping\n\n", 0x5), stdout);
[26688, 26695, 26700, 26703, 26706, 26681] fputs_unlocked(dcgettext(NULL, " -G, --no-group in a long listing, don't print group names\n", 0x5), stdout);
[26725, 26732, 26737, 26740, 26743, 26718] fputs_unlocked(dcgettext(NULL, " -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.\n --si likewise, but use powers of 1000 not 1024\n", 0x5), stdout);
[26755, 26762, 26769, 26774, 26777, 26780] fputs_unlocked(dcgettext(NULL, " -H, --dereference-command-line\n follow symbolic links listed on the command line\n", 0x5), stdout);
[26817, 26792, 26799, 26806, 26811, 26814] fputs_unlocked(dcgettext(NULL, " --dereference-command-line-symlink-to-dir\n follow each command line symbolic link\n that points to a directory\n\n", 0x5), stdout);
[26848, 26851, 26854, 26829, 26836, 26843] fputs_unlocked(dcgettext(NULL, " --hide=PATTERN do not list implied entries matching shell PATTERN\n (overridden by -a or -A)\n\n", 0x5), stdout);
[26880, 26885, 26888, 26891, 26866, 26873] fputs_unlocked(dcgettext(NULL, " --hyperlink[=WHEN] hyperlink file names WHEN\n", 0x5), stdout);
[26917, 26922, 26925, 26928, 26903, 26910] fputs_unlocked(dcgettext(NULL, " --indicator-style=WORD\n append indicator with style WORD to entry names:\n none (default), slash (-p),\n file-type (--file-type), classify (-F)\n\n", 0x5), stdout);
[26947, 26954, 26959, 26962, 26965, 26940] fputs_unlocked(dcgettext(NULL, " -i, --inode print the index number of each file\n -I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n", 0x5), stdout);
[26977, 26984, 26991, 26996, 26999, 27002] fputs_unlocked(dcgettext(NULL, " -k, --kibibytes default to 1024-byte blocks for file system usage;\n used only with -s and per directory totals\n\n", 0x5), stdout);
[27014, 27021, 27028, 27033, 27036, 27039] fputs_unlocked(dcgettext(NULL, " -l use a long listing format\n", 0x5), stdout);
[27073, 27076, 27051, 27058, 27065, 27070] fputs_unlocked(dcgettext(NULL, " -L, --dereference when showing file information for a symbolic\n link, show information for the file the link\n references rather than for the link itself\n\n", 0x5), stdout);
[27107, 27110, 27113, 27088, 27095, 27102] fputs_unlocked(dcgettext(NULL, " -m fill width with a comma separated list of entries\n", 0x5), stdout);
[27139, 27144, 27147, 27150, 27125, 27132] fputs_unlocked(dcgettext(NULL, " -n, --numeric-uid-gid like -l, but list numeric user and group IDs\n -N, --literal print entry names without quoting\n -o like -l, but do not list group information\n -p, --indicator-style=slash\n append / indicator to directories\n", 0x5), stdout);
[27169, 27176, 27181, 27184, 27187, 27162] fputs_unlocked(dcgettext(NULL, " -q, --hide-control-chars print ? instead of nongraphic characters\n", 0x5), stdout);
[27206, 27213, 27218, 27221, 27224, 27199] fputs_unlocked(dcgettext(NULL, " --show-control-chars show nongraphic characters as-is (the default,\n unless program is 'ls' and output is a terminal)\n\n", 0x5), stdout);
[27236, 27243, 27250, 27255, 27258, 27261] fputs_unlocked(dcgettext(NULL, " -Q, --quote-name enclose entry names in double quotes\n", 0x5), stdout);
[27298, 27273, 27280, 27287, 27292, 27295] fputs_unlocked(dcgettext(NULL, " --quoting-style=WORD use quoting style WORD for entry names:\n literal, locale, shell, shell-always,\n shell-escape, shell-escape-always, c, escape\n (overrides QUOTING_STYLE environment variable)\n\n", 0x5), stdout);
[27329, 27332, 27335, 27310, 27317, 27324] fputs_unlocked(dcgettext(NULL, " -r, --reverse reverse order while sorting\n -R, --recursive list subdirectories recursively\n -s, --size print the allocated size of each file, in blocks\n", 0x5), stdout);
[27361, 27366, 27369, 27372, 27347, 27354] fputs_unlocked(dcgettext(NULL, " -S sort by file size, largest first\n", 0x5), stdout);
[27398, 27403, 27406, 27409, 27384, 27391] fputs_unlocked(dcgettext(NULL, " --sort=WORD sort by WORD instead of name: none (-U), size (-S),\n time (-t), version (-v), extension (-X), width\n\n", 0x5), stdout);
[27426, 27428, 27435, 27440, 27443, 27446] fputs_unlocked(dcgettext(NULL, " --time=WORD change the default of using modification times;\n access time (-u): atime, access, use;\n change time (-c): ctime, status;\n birth time: birth, creation;\n with -l, WORD determines which time to show;\n with --sort=time, sort by WORD (newest first)\n\n", 0x5), stdout);
[27458, 27465, 27472, 27477, 27480, 27483] fputs_unlocked(dcgettext(NULL, " --time-style=TIME_STYLE\n time/date format with -l; see TIME_STYLE below\n", 0x5), stdout);
[27520, 27495, 27502, 27509, 27514, 27517] fputs_unlocked(dcgettext(NULL, " -t sort by time, newest first; see --time\n -T, --tabsize=COLS assume tab stops at each COLS instead of 8\n", 0x5), stdout);
[27554, 27557, 27532, 27539, 27546, 27551] fputs_unlocked(dcgettext(NULL, " -u with -lt: sort by, and show, access time;\n with -l: show access time and sort by name;\n otherwise: sort by access time, newest first\n\n", 0x5), stdout);
[27588, 27591, 27594, 27569, 27576, 27583] fputs_unlocked(dcgettext(NULL, " -U do not sort; list entries in directory order\n", 0x5), stdout);
[27620, 27625, 27628, 27631, 27606, 27613] fputs_unlocked(dcgettext(NULL, " -v natural sort of (version) numbers within text\n", 0x5), stdout);
[27650, 27657, 27662, 27665, 27668, 27643] fputs_unlocked(dcgettext(NULL, " -w, --width=COLS set output width to COLS. 0 means no limit\n -x list entries by lines instead of by columns\n -X sort alphabetically by entry extension\n -Z, --context print any security context of each file\n --zero end each output line with NUL, not newline\n -1 list one file per line\n", 0x5), stdout);
[27680, 27687, 27694, 27699, 27702, 27705] fputs_unlocked(dcgettext(NULL, " --help display this help and exit\n", 0x5), stdout);
[27717, 27724, 27731, 27736, 27739, 27742] v4 = 5;
[27747] fputs_unlocked(dcgettext(NULL, " --version output version information and exit\n", 0x5), stdout);
[27776, 27779, 27752, 27761, 27768, 27773] emit_size_note(a0, v5, v4, v6, v7, v8);
[27784] fputs_unlocked(dcgettext(NULL, "\nThe TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT.\nFORMAT is interpreted like in date(1). If FORMAT is FORMAT1<newline>FORMAT2,\nthen FORMAT1 applies to non-recent files and FORMAT2 to recent files.\nTIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale.\nAlso the TIME_STYLE environment variable sets the default style to use.\n", 0x5), stdout);
[27810, 27815, 27818, 27821, 27796, 27803] fputs_unlocked(dcgettext(NULL, "\nThe WHEN argument defaults to 'always' and can also be 'auto' or 'never'.\n", 0x5), stdout);
[27840, 27847, 27852, 27855, 27858, 27838] fputs_unlocked(dcgettext(NULL, "\nUsing color to distinguish file types is disabled both by default and\nwith --color=never. With --color=auto, ls emits color codes only when\nstandard output is connected to a terminal. The LS_COLORS environment\nvariable can change the settings. Use the dircolors(1) command to set it.\n", 0x5), stdout);
[27875, 27877, 27884, 27889, 27892, 27895] fputs_unlocked(dcgettext(NULL, "\nExit status:\n 0 if OK,\n 1 if minor problems (e.g., cannot access subdirectory),\n 2 if serious trouble (e.g., cannot access command-line argument).\n", 0x5), stdout);
[27912, 27914, 27921, 27926, 27929, 27932] v9 = "ls";
[27937, 27943] if (ls_mode != 1) {
[27953, 27950] if (ls_mode != 2)
[27955, 27972, 27973, 27974, 27958, 27976, 27965] v9 = "vdir";
[27972, 27973, 27974, 27976, 27955, 27958, 27965] else
v9 = "dir";
[27972, 27973, 27974, 27976, 27955, 27958, 27965] }
emit_ancillary_info(v9);
[27976] }
exit(a0); /* do not return */
}
|
void usage(unsigned long a0) {
[41278] unsigned long v0; // [bp-0x10]
[41278] unsigned long v2; // rbx
[41278] unsigned long long v3; // rax
[41278]
[41278] v0 = v2;
[41282, 41283, 41286, 41278] if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
[41314, 41319, 41322, 41329, 41332, 41335, 41338, 41307, 41343] } else {
printf(gettext("Usage: %s [OPTION]... [FILE]...\n"));
[41378, 41383, 41360, 41367, 41372, 41375] fputs_unlocked(gettext("List information about the FILEs (the current directory by default).\nSort entries alphabetically if none of -cftuvSUX nor --sort is specified.\n"), stdout);
[41410, 41413, 41395, 41402, 41407] emit_mandatory_arg_note();
[41418] fputs_unlocked(gettext(" -a, --all do not ignore entries starting with .\n -A, --almost-all do not list implied . and ..\n --author with -l, print the author of each file\n -b, --escape print C-style escapes for nongraphic characters\n"), stdout);
[41442, 41445, 41448, 41430, 41437] fputs_unlocked(gettext(" --block-size=SIZE with -l, scale sizes by SIZE when printing them;\n e.g., '--block-size=M'; see SIZE format below\n\n"), stdout);
[41472, 41475, 41478, 41460, 41467] fputs_unlocked(gettext(" -B, --ignore-backups do not list implied entries ending with ~\n"), stdout);
[41505, 41508, 41490, 41497, 41502] fputs_unlocked(gettext(" -c with -lt: sort by, and show, ctime (time of last\n modification of file status information);\n with -l: show ctime and sort by name;\n otherwise: sort by ctime, newest first\n\n"), stdout);
[41538, 41520, 41527, 41532, 41535] fputs_unlocked(gettext(" -C list entries by columns\n --color[=WHEN] color the output WHEN; more info below\n -d, --directory list directories themselves, not their contents\n -D, --dired generate output designed for Emacs' dired mode\n"), stdout);
[41568, 41550, 41557, 41562, 41565] fputs_unlocked(gettext(" -f list all entries in directory order\n -F, --classify[=WHEN] append indicator (one of */=>@|) to entries WHEN\n --file-type likewise, except do not append '*'\n"), stdout);
[41580, 41587, 41592, 41595, 41598] fputs_unlocked(gettext(" --format=WORD across -x, commas -m, horizontal -x, long -l,\n single-column -1, verbose -l, vertical -C\n\n"), stdout);
[41610, 41617, 41622, 41625, 41628] fputs_unlocked(gettext(" --full-time like -l --time-style=full-iso\n"), stdout);
[41640, 41647, 41652, 41655, 41658] fputs_unlocked(gettext(" -g like -l, but do not list owner\n"), stdout);
[41670, 41677, 41682, 41685, 41688] fputs_unlocked(gettext(" --group-directories-first\n group directories before files;\n can be augmented with a --sort option, but any\n use of --sort=none (-U) disables grouping\n\n"), stdout);
[41700, 41707, 41712, 41715, 41718] fputs_unlocked(gettext(" -G, --no-group in a long listing, don't print group names\n"), stdout);
[41730, 41737, 41742, 41745, 41748] fputs_unlocked(gettext(" -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc.\n --si likewise, but use powers of 1000 not 1024\n"), stdout);
[41760, 41767, 41772, 41775, 41778] fputs_unlocked(gettext(" -H, --dereference-command-line\n follow symbolic links listed on the command line\n"), stdout);
[41797, 41802, 41805, 41808, 41790] fputs_unlocked(gettext(" --dereference-command-line-symlink-to-dir\n follow each command line symbolic link\n that points to a directory\n\n"), stdout);
[41827, 41832, 41835, 41838, 41820] fputs_unlocked(gettext(" --hide=PATTERN do not list implied entries matching shell PATTERN\n (overridden by -a or -A)\n\n"), stdout);
[41857, 41862, 41865, 41868, 41850] fputs_unlocked(gettext(" --hyperlink[=WHEN] hyperlink file names WHEN\n"), stdout);
[41892, 41895, 41898, 41880, 41887] fputs_unlocked(gettext(" --indicator-style=WORD\n append indicator with style WORD to entry names:\n none (default), slash (-p),\n file-type (--file-type), classify (-F)\n\n"), stdout);
[41922, 41925, 41928, 41910, 41917] fputs_unlocked(gettext(" -i, --inode print the index number of each file\n -I, --ignore=PATTERN do not list implied entries matching shell PATTERN\n"), stdout);
[41952, 41955, 41958, 41940, 41947] fputs_unlocked(gettext(" -k, --kibibytes default to 1024-byte blocks for file system usage;\n used only with -s and per directory totals\n\n"), stdout);
[41985, 41988, 41970, 41977, 41982] fputs_unlocked(gettext(" -l use a long listing format\n"), stdout);
[42018, 42000, 42007, 42012, 42015] fputs_unlocked(gettext(" -L, --dereference when showing file information for a symbolic\n link, show information for the file the link\n references rather than for the link itself\n\n"), stdout);
[42048, 42030, 42037, 42042, 42045] fputs_unlocked(gettext(" -m fill width with a comma separated list of entries\n"), stdout);
[42060, 42067, 42072, 42075, 42078] fputs_unlocked(gettext(" -n, --numeric-uid-gid like -l, but list numeric user and group IDs\n -N, --literal print entry names without quoting\n -o like -l, but do not list group information\n -p, --indicator-style=slash\n append / indicator to directories\n"), stdout);
[42090, 42097, 42102, 42105, 42108] fputs_unlocked(gettext(" -q, --hide-control-chars print ? instead of nongraphic characters\n"), stdout);
[42120, 42127, 42132, 42135, 42138] fputs_unlocked(gettext(" --show-control-chars show nongraphic characters as-is (the default,\n unless program is 'ls' and output is a terminal)\n\n"), stdout);
[42150, 42157, 42162, 42165, 42168] fputs_unlocked(gettext(" -Q, --quote-name enclose entry names in double quotes\n"), stdout);
[42180, 42187, 42192, 42195, 42198] fputs_unlocked(gettext(" --quoting-style=WORD use quoting style WORD for entry names:\n literal, locale, shell, shell-always,\n shell-escape, shell-escape-always, c, escape\n (overrides QUOTING_STYLE environment variable)\n\n"), stdout);
[42210, 42217, 42222, 42225, 42228] fputs_unlocked(gettext(" -r, --reverse reverse order while sorting\n -R, --recursive list subdirectories recursively\n -s, --size print the allocated size of each file, in blocks\n"), stdout);
[42240, 42247, 42252, 42255, 42258] fputs_unlocked(gettext(" -S sort by file size, largest first\n"), stdout);
[42277, 42282, 42285, 42288, 42270] fputs_unlocked(gettext(" --sort=WORD sort by WORD instead of name: none (-U), size (-S),\n time (-t), version (-v), extension (-X), width\n\n"), stdout);
[42307, 42312, 42315, 42318, 42300] fputs_unlocked(gettext(" --time=WORD change the default of using modification times;\n access time (-u): atime, access, use;\n change time (-c): ctime, status;\n birth time: birth, creation;\n with -l, WORD determines which time to show;\n with --sort=time, sort by WORD (newest first)\n\n"), stdout);
[42337, 42342, 42345, 42348, 42330] fputs_unlocked(gettext(" --time-style=TIME_STYLE\n time/date format with -l; see TIME_STYLE below\n"), stdout);
[42372, 42375, 42378, 42360, 42367] fputs_unlocked(gettext(" -t sort by time, newest first; see --time\n -T, --tabsize=COLS assume tab stops at each COLS instead of 8\n"), stdout);
[42402, 42405, 42408, 42390, 42397] fputs_unlocked(gettext(" -u with -lt: sort by, and show, access time;\n with -l: show access time and sort by name;\n otherwise: sort by access time, newest first\n\n"), stdout);
[42432, 42435, 42438, 42420, 42427] fputs_unlocked(gettext(" -U do not sort; list entries in directory order\n"), stdout);
[42465, 42468, 42450, 42457, 42462] fputs_unlocked(gettext(" -v natural sort of (version) numbers within text\n"), stdout);
[42498, 42480, 42487, 42492, 42495] fputs_unlocked(gettext(" -w, --width=COLS set output width to COLS. 0 means no limit\n -x list entries by lines instead of by columns\n -X sort alphabetically by entry extension\n -Z, --context print any security context of each file\n --zero end each output line with NUL, not newline\n -1 list one file per line\n"), stdout);
[42528, 42510, 42517, 42522, 42525] fputs_unlocked(gettext(" --help display this help and exit\n"), stdout);
[42540, 42547, 42552, 42555, 42558] fputs_unlocked(gettext(" --version output version information and exit\n"), stdout);
[42570, 42577, 42582, 42585, 42588] emit_size_note();
[42593] fputs_unlocked(gettext("\nThe TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT.\nFORMAT is interpreted like in date(1). If FORMAT is FORMAT1<newline>FORMAT2,\nthen FORMAT1 applies to non-recent files and FORMAT2 to recent files.\nTIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale.\nAlso the TIME_STYLE environment variable sets the default style to use.\n"), stdout);
[42605, 42612, 42617, 42620, 42623] fputs_unlocked(gettext("\nThe WHEN argument defaults to 'always' and can also be 'auto' or 'never'.\n"), stdout);
[42635, 42642, 42647, 42650, 42653] fputs_unlocked(gettext("\nUsing color to distinguish file types is disabled both by default and\nwith --color=never. With --color=auto, ls emits color codes only when\nstandard output is connected to a terminal. The LS_COLORS environment\nvariable can change the settings. Use the dircolors(1) command to set it.\n"), stdout);
[42665, 42672, 42677, 42680, 42683] fputs_unlocked(gettext("\nExit status:\n 0 if OK,\n 1 if minor problems (e.g., cannot access subdirectory),\n 2 if serious trouble (e.g., cannot access command-line argument).\n"), stdout);
[42695, 42702, 42707, 42710, 42713] if (ls_mode == 1) {
[42724, 42718, 42727] v3 = "ls";
[42768, 42758, 42765] } else if (ls_mode == 2) {
[42729, 42738, 42735] v3 = "dir";
[42740] } else {
v3 = "vdir";
[42749] }
emit_ancillary_info(v3);
[42768, 42765] }
exit(a0); /* do not return */
}
|
void input_avail(unsigned long long a0) {
[0] uint128_t v0; // [bp-0x138]
[0] uint128_t v1; // [bp-0x128]
[0] uint128_t v2; // [bp-0x118]
[0] uint128_t v3; // [bp-0x108]
[0] uint128_t v4; // [bp-0xf8]
[0] uint128_t v5; // [bp-0xe8]
[0] uint128_t v6; // [bp-0xd8]
[0] uint128_t v7; // [bp-0xc8]
[0] uint128_t v8; // [bp-0xb8]
[0] uint128_t v9; // [bp-0xa8]
[0] uint128_t v10; // [bp-0x98]
[0] uint128_t v11; // [bp-0x88]
[0] uint128_t v12; // [bp-0x78]
[0] uint128_t v13; // [bp-0x68]
[0] uint128_t v14; // [bp-0x58]
[0] uint128_t v15; // [bp-0x48]
[0] uint128_t v16; // [bp-0x38]
[0] unsigned long long v18; // rax
[0] unsigned long v21; // rax
[0]
[0] v18 = 4294967295;
[0, 32, 34, 4, 6, 7, 8, 15, 24] if (a0 >= 0) {
[41, 39] v1 = 0;
[64, 47, 50, 54, 56, 61] v2 = 0;
[69] v3 = 0;
[74] v4 = 0;
[79] v5 = 0;
[84] v6 = 0;
[89] v7 = 0;
[94] v8 = 0;
[99] v9 = 0;
[107] v10 = 0;
[115] v11 = 0;
[123] v12 = 0;
[131] v13 = 0;
[139] v14 = 0;
[147] v15 = 0;
[155] v16 = 0;
[163] *((&v1 + 8 * __fdelt_chk(a0))) = *((&v1 + 8 * __fdelt_chk(a0))) | 1 << (a0 & 63);
[171, 176, 178, 181, 184, 56] *((&v9 + 8 * __fdelt_chk(a0))) = *((&v9 + 8 * __fdelt_chk(a0))) | 1 << (a0 & 63);
[194, 198, 200, 205, 213, 181, 216, 56, 219, 189] v0 = 0;
[227] v21 = select(a0 + 1, &v1, NULL, &v9, &v0) > 0;
[261, 198, 213, 231, 236, 238, 241, 244, 252] }
return;
}
|
void input_avail(unsigned long a0) {
[0] unsigned int v0; // [bp-0x148]
[0] unsigned int v1; // [bp-0x144]
[0] unsigned int v2; // [bp-0x140]
[0] unsigned int v3; // [bp-0x13c]
[0] unsigned long long *v4; // [bp-0x138]
[0] unsigned long long *v5; // [bp-0x130]
[0] void* v6; // [bp-0x128]
[0] void* v7; // [bp-0x120]
[0] char v8; // [bp-0x118]
[0] char v9; // [bp-0x98]
[0] unsigned long long v11; // rax
[0] unsigned long v12; // rax
[0]
[0] if (a0 < 0) {
[0, 34, 4, 5, 36, 8, 43, 15, 21, 30] v11 = 4294967295;
[45] } else {
v0 = 0;
[55] v4 = &v8;
[72, 65] for (v1 = 0; v1 <= 15; v1 += 1) {
[112, 119, 126, 79] v4[v1] = 0;
[98, 104, 91] }
v5 = &v9;
[128, 135] for (v2 = 0; v2 <= 15; v2 += 1) {
[182, 189, 142, 175] v5[v2] = 0;
[161, 167, 154] }
*(&(&v8)[8 * ((a0 < 0 ? a0 + 63 : a0) >> 6)]) = *(&(&v8)[8 * ((a0 < 0 ? a0 + 63 : a0) >> 6)]) | 1 << (((a0 + (a0 >> 31 >> 26) & 63) - (a0 >> 31 >> 26)) & 63);
[0, 257, 4, 5, 260, 8, 15, 21, 30, 34, 36, 43, 191, 197, 200, 202, 205, 208, 210, 213, 221, 227, 228, 231, 233, 236, 238, 243, 245, 248, 251, 254] *(&(&v9)[8 * ((a0 < 0 ? a0 + 63 : a0) >> 6)]) = *(&(&v9)[8 * ((a0 < 0 ? a0 + 63 : a0) >> 6)]) | 1 << (((a0 + (a0 >> 31 >> 26) & 63) - (a0 >> 31 >> 26)) & 63);
[0, 4, 5, 8, 268, 15, 274, 21, 277, 279, 282, 285, 30, 287, 34, 290, 36, 298, 43, 304, 305, 308, 310, 313, 315, 320, 322, 325, 328, 331, 334, 337, 227, 228, 231, 233, 236] v6 = 0;
[345] v7 = 0;
[356] v3 = select(a0 + 1, &v8, NULL, &v9, &v6);
[416, 403, 373, 411] v12 = 0 < v3;
[448, 422, 429, 432, 435, 439] }
return;
}
|
long long set_cloexec_flag(unsigned long a0, unsigned long a1) {
[0] unsigned long long v2; // rax
[0] unsigned long long v3; // r8
[0] unsigned int v4; // edx
[0]
[0] v2 = rpl_fcntl();
[19, 23, 14] if (v2 >= 0) {
[28, 30] v4 = v2 & -2;
[32, 34, 36, 39] if (a1)
v4 = v2 | 1;
[36, 42, 44, 45, 46, 49, 52] v3 = 0;
[47] if (v4 != v2)
[50, 52] v3 = -(rpl_fcntl() == -1);
[68, 71, 74, 78, 81, 85, 88, 89, 90, 63] } else {
v3 = 4294967295;
[96] }
return v3;
}
|
long long set_cloexec_flag(unsigned long a0, unsigned long a1) {
[0] unsigned int v0; // [bp-0x10]
[0] unsigned int v1; // [bp-0xc]
[0] unsigned int v3; // eax
[0] unsigned long long v4; // rax
[0] unsigned long long v5; // rax
[0]
[0] v0 = rpl_fcntl(a0, 0x1, 0x0);
[23, 40, 28, 45] if (v0 >= 0) {
[48, 52] if (a1)
v3 = v0 | 1;
[60, 63] else
v3 = v0 & -2;
[68, 71, 74, 77, 80, 83] v1 = v3;
[74] if (v0 != v1)
[80, 83, 77] v4 = rpl_fcntl(a0, 0x2, v1);
[96, 98, 103, 85, 88, 91] if (v0 == v1 || v4 != -1)
[80, 83, 108, 77, 111] v5 = 0;
[113] }
if (v0 < 0 || v4 == -1 && v0 != v1)
v5 = 4294967295;
return v5;
}
|
long long _rl_restore_tty_signals() {
[2624] unsigned long long v1; // rax
[2624]
[2624] if (!tty_sigs_disabled)
return tty_sigs_disabled;
[2638] v1 = _set_tty_settings(fileno(rl_instream), &sigstty);
[2656, 2663, 2665, 2651] if (!v1) {
tty_sigs_disabled = 0;
[2688, 2674, 2684] return v1;
[2688, 2684] }
return v1;
}
|
long long _rl_restore_tty_signals() {
[3474] unsigned int v0; // [bp-0xc]
[3474] void* v2; // rax
[3474]
[3474] if (!tty_sigs_disabled) {
v2 = 0;
[3496] return v2;
[3554, 3555] }
v0 = _set_tty_settings(fileno(rl_instream), &sigstty);
if (!v0)
tty_sigs_disabled = 0;
v2 = v0;
return v2;
}
|
long long getenv(char *a0) {
[0] struct_1 *v1; // rbx
[0] unsigned long long *v2; // r12
[0] struct_0 *v3; // rax
[0] unsigned int v5; // r15d
[0] unsigned long long *v6; // r12, Other Possible Types: unsigned long long
[0] void* v7; // rbx
[0] void* v8; // r15
[0] unsigned long long v9; // rax
[0] void* v10; // r12
[0]
[0] if (*(a0)) {
v1 = find_tempenv_variable();
[35, 30] if (v1) {
if (last_tempenv_value)
sh_xfree(last_tempenv_value, "getenv.c", 0x3d);
[67, 55, 60] v10 = v1->field_8;
[72] if (v1->field_8)
v10 = strcpy(sh_xmalloc(strlen(v1->field_8) + 1, "getenv.c", 0x3f), v1->field_8);
[131, 135, 138, 139, 140, 142, 144, 146, 148, 84, 89, 94, 101, 105, 116, 121, 124] last_tempenv_value = v10;
[131, 135, 138, 139, 140, 142, 144, 146, 148, 124] } else if (shell_variables) {
v3 = find_variable(a0);
[162, 165] if (v3 && (v3->field_28 & 1))
[170, 173, 175] v10 = v3->field_8;
[181] } else {
v2 = environ;
[200] if (environ) {
v7 = *(v2);
[220] if (*(v2)) {
v6 = v2 + 1;
[232] if (v5) {
do {
[269] if (*(v7) == *(a0)) {
[272, 269] v8 = strlen(a0);
[274, 277, 215, 280, 283] v9 = strncmp(v7, a0, v8);
[286] if (!v9) {
if (*((v7 + v8)) == 61)
[300, 295] break;
[300, 295] }
}
v7 = *(v6);
[256] v6 += 1;
[260] } while (v7);
[269] } else {
while (true) {
[317] if (*(v7) != 61) {
[320, 317] v7 = *(v6);
[304] v6 += 1;
[308] if (!v7)
[312, 315] break;
[312, 315] } else {
v8 = 0;
[322, 325, 330] break;
[322, 325, 330] }
}
}
}
}
}
}
if (!v1 && !v5 && !shell_variables && environ && *(v2) && *(a0) && *(v7) == 61 || !v1 && !shell_variables && v5 && environ && *(v2) && *(a0) && (!(!v7) || !(v9) && !(*(v7) != *(a0)) && !(*((v7 + v8)) != 61)))
v10 = v7 + v8 + 1;
if (!v1 && !v5 && !shell_variables && environ && *(v2) && *(a0) && *(v7) != 61 || !v1 && !shell_variables && v5 && environ && *(v2) && *(a0) && !v7 && (v9 || *(v7) != *(a0) || *((v7 + v8)) != 61) || !v1 && !shell_variables && environ && *(a0) && !*(v2) || !v1 && *(a0) && shell_variables && v3 && !(v3->field_28 & 1) || !v1 && *(a0) && shell_variables && !v3 || !v1 && !shell_variables && *(a0) && !environ || !*(a0))
v10 = 0;
return v10;
}
|
void getenv(char *a0) {
[0] struct_1 *v0; // [bp-0x20], Other Possible Types: struct_0 *
[0] void* v2; // rax
[0] void* v3; // rbx
[0] char *v4; // r12
[0] unsigned long long v5; // rax
[0] unsigned long long v6; // rax
[0] void* v7; // rax
[0] unsigned long long v8; // rax
[0] void* v9; // rax
[0] unsigned long long *v10; // rax
[0]
[0] if (a0 && *(a0)) {
[0, 4, 5, 8, 10, 11, 15, 19, 24] v0 = find_tempenv_variable(a0);
[59, 54] if (v0) {
if (last_tempenv_value)
sh_xfree(last_tempenv_value, "getenv.c", 0x3d);
[98, 105, 108, 86, 93] if (v0->field_8)
v9 = strcpy(sh_xmalloc(strlen(v0->field_8) + 1, "getenv.c", 0x3f), v0->field_8);
[169, 174, 177, 145, 180, 150, 154, 159] else
v9 = 0;
[192, 199, 206, 187] last_tempenv_value = v9;
[192] v10 = last_tempenv_value;
[199] } else {
if (shell_variables) {
v0 = find_variable(a0);
[235, 230] if (v0 && (v0->field_28 & 1))
[244, 239] v6 = v0->field_8;
[272, 268] } else if (environ) {
v3 = 0;
[297] for (v4 = strlen(a0); *((environ + (v3 << 3))); v3 = v3 + 1) {
[481, 485, 488, 491, 494, 468, 309, 471, 314, 478] if (v4 && *(*((environ + (v3 << 3)))) == *(a0))
[322, 354, 325, 357, 359, 327, 334, 337, 341, 344, 347, 350] v5 = strncmp(*((environ + v3 * 8)), a0, v4);
[384, 388, 391, 394, 361, 364, 371, 374, 378, 381] if (v4[*((environ + (v3 << 3)))] == 61 && (*(*((environ + (v3 << 3)))) == *(a0) || !v4) && (!v4 || !v5)) {
[327, 334, 337, 403, 341, 344, 410, 347, 413, 350, 417, 354, 420, 357, 423, 359, 426, 429, 432, 434] v8 = &v4[1 + *((environ + v3 * 8))];
[450, 453, 456, 459, 463, 436, 443, 446] break;
[466] }
}
}
if (!shell_variables && environ && (!(v4[*((environ + (v3 << 3)))] == 61) || !(*(*((environ + (v3 << 3)))) == *(a0)) && !(!v4) || !(!v4) && !(!v5)) || v0 && shell_variables && !(v0->field_28 & 1) || shell_variables && !v0 || !shell_variables && !environ)
[322, 325, 327, 334, 399, 337, 401, 403, 341, 344, 410, 347, 413, 350, 417, 354, 420, 357, 423, 359, 426, 429, 432, 434] v7 = 0;
[512, 513, 500, 505, 509, 510] }
}
if (!a0 || !*(a0))
v2 = 0;
return;
}
|
long array_patsub(long a1, long a2, long a3, int a4)
[4272] {
_QWORD *v6; // rax
_QWORD *v7; // r14
_QWORD *v8; // rbx
long v9; // rax
long *v10; // rdx
long *v11; // rdx
long v12; // r12
long v14; // [rsp+8h] [rbp-40h]
[4290, 4293, 4272, 4276, 4278, 4280, 4282, 4284, 4285, 4286] if ( !a1 )
[4293] return 0LL;
[4304, 4299] if ( !*(_QWORD *)(a1 + 16) )
[4299] return 0LL;
[4315, 4310] if ( !*(_QWORD *)(a1 + 8) )
[4310] return 0LL;
[4321, 4324, 4329, 4327] v6 = array_to_word_list(a1);
[4334] v7 = v6;
[4337, 4340] if ( !v6 )
[4528, 4531] return 0LL;
[4346, 4356, 4349] v8 = v6;
do
{
[4375] while ( 1 )
{
[4360, 4364, 4367, 4369, 4372, 4375] v9 = pat_subst(*(_QWORD *)v8[1], a2, a3, (unsigned int)a4);
[4380] v10 = (long *)v8[1];
[4384, 4387, 4390] if ( !*v10 )
break;
[4400] v14 = v9;
[4384, 4392, 4405, 4397] sh_xfree(*v10, "array.c", 461LL);
[4410] v11 = (long *)v8[1];
[4419, 4414] v8 = (_QWORD *)*v8;
[4422] *v11 = v14;
[4425, 4428] if ( !v8 )
goto LABEL_8;
}
[4504] v8 = (_QWORD *)*v8;
[4507] *v10 = v9;
}
[4513, 4510, 4519] while ( v8 );
LABEL_8:
[4449, 4452, 4455, 4458, 4461, 4430, 4432, 4464, 4434, 4467, 4436, 4439, 4475, 4444, 4447] v12 = string_list_pos_params((a4 & 0x80) == 0 ? 64 : 42, v7, (a4 >> 5) & 1, (a4 >> 3) & 8);
[4472, 4478] dispose_words(v7);
[4483, 4487] return v12;
[4490, 4491, 4492, 4494, 4496, 4498, 4500] }
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2890: using guessed type long string_list_pos_params(_QWORD, _QWORD, _QWORD, _QWORD);
// 2898: using guessed type long dispose_words(_QWORD);
// 28A0: using guessed type long pat_subst(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000011C0) ----------------------------------------------------
long array_modcase(long a1, long a2, unsigned int a3, int a4)
[4544] {
_QWORD *v5; // rax
_QWORD *v6; // r14
_QWORD *v7; // rbx
long v8; // rax
long *v9; // rdx
long v10; // r13
long *v11; // rdx
long v12; // r12
[4544, 4548, 4550, 4552, 4554, 4556, 4557, 4558, 4562, 4566, 4569] if ( !a1 )
[4569] return 0LL;
[4580, 4575] if ( !*(_QWORD *)(a1 + 16) )
[4575] return 0LL;
[4586, 4591] if ( !*(_QWORD *)(a1 + 8) )
[4586] return 0LL;
[4600, 4603, 4597] v5 = array_to_word_list(a1);
[4608] v6 = v5;
[4611, 4614] if ( !v5 )
[4808, 4811] return 0LL;
[4620, 4630, 4623] v7 = v5;
do
{
[4653] while ( 1 )
{
[4640, 4644, 4647, 4650, 4653] v8 = sh_modcase(*(_QWORD *)v7[1], a2, a3);
[4658] v9 = (long *)v7[1];
[4662] v10 = v8;
[4665, 4668, 4671] if ( !*v9 )
break;
[4673, 4665, 4681, 4678] sh_xfree(*v9, "array.c", 495LL);
[4686] v11 = (long *)v7[1];
[4690] v7 = (_QWORD *)*v7;
[4693] *v11 = v10;
[4696, 4699] if ( !v7 )
goto LABEL_8;
}
[4784] v7 = (_QWORD *)*v7;
[4787] *v9 = v8;
}
[4793, 4790, 4799] while ( v7 );
LABEL_8:
[4736, 4705, 4739, 4708, 4733, 4710, 4742, 4715, 4718, 4750, 4720, 4722, 4725, 4727, 4730, 4701] v12 = string_list_pos_params((a4 & 0x80) == 0 ? 64 : 42, v6, (a4 >> 5) & 1, (a4 >> 3) & 8);
[4753, 4747] dispose_words(v6);
[4762, 4758] return v12;
[4769, 4771, 4773, 4775, 4765, 4766, 4767] }
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2890: using guessed type long string_list_pos_params(_QWORD, _QWORD, _QWORD, _QWORD);
// 2898: using guessed type long dispose_words(_QWORD);
// 28A8: using guessed type long sh_modcase(_QWORD, _QWORD, _QWORD);
//----- (00000000000012D0) ----------------------------------------------------
_QWORD * array_keys_to_word_list(long a1)
[4816] {
_QWORD *v1; // rax
_QWORD *v2; // rbx
_QWORD *word_list; // r12
long v4; // rbp
long bare_word; // rax
[4816, 4820, 4822, 4824, 4826, 4827, 4828, 4831] if ( !a1 )
[4831] return 0LL;
[4845, 4842, 4837] if ( !*(_QWORD *)(a1 + 8) )
[4837] return 0LL;
[4851] v1 = *(_QWORD **)(a1 + 16);
[4855] v2 = (_QWORD *)v1[2];
[4859, 4862] if ( v1 == v2 )
[4862] return 0LL;
[4864, 4874, 4867] word_list = 0LL;
do
{
[4880, 4883, 4891] v4 = itos(*v2);
[4888, 4894] bare_word = make_bare_word(v4);
[4905, 4899, 4902, 4921] word_list = (_QWORD *)make_word_list(bare_word, word_list);
[4918, 4915, 4924, 4910] sh_xfree(v4, "array.c", 791LL);
[4929] v2 = (_QWORD *)v2[2];
}
[4937, 4933] while ( *(_QWORD **)(a1 + 16) != v2 );
[4939, 4942] if ( !word_list )
[4976] return 0LL;
[4944, 4949] if ( *word_list )
[4952, 4964] return (_QWORD *)list_reverse(word_list);
[4980, 4951] return word_list;
[4960, 4962, 4988, 4990, 4979, 4983, 4984, 4986, 4955, 4956, 4958] }
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2878: using guessed type long make_bare_word(_QWORD);
// 2880: using guessed type long make_word_list(_QWORD, _QWORD);
// 2888: using guessed type long list_reverse(_QWORD);
// 28B0: using guessed type long itos(_QWORD);
//----- (0000000000001380) ----------------------------------------------------
_QWORD * array_to_kvpair_list(long a1)
[4992] {
_QWORD *v1; // rax
_QWORD *v2; // rbx
_QWORD *v3; // r12
long v4; // rax
long v5; // r15
long v6; // rbp
long bare_word; // rax
long word_list; // r12
long v9; // rax
[4992, 4996, 4998, 5000, 5002, 5004, 5005, 5006, 5010, 5013] if ( !a1 )
[5013] return 0LL;
[5024, 5019, 5027] if ( !*(_QWORD *)(a1 + 8) )
[5019] return 0LL;
[5033] v1 = *(_QWORD **)(a1 + 16);
[5037] v2 = (_QWORD *)v1[2];
[5041, 5044] if ( v1 == v2 )
[5044] return 0LL;
[5050, 5060, 5053] v3 = 0LL;
do
{
[5064, 5067] v4 = itos(*v2);
[5072] v5 = v2[1];
[5079] v6 = v4;
[5082, 5076] bare_word = make_bare_word(v4);
[5101, 5090, 5093, 5087] word_list = make_word_list(bare_word, v3);
[5104, 5098] v9 = make_bare_word(v5);
[5112, 5115, 5109, 5131] v3 = (_QWORD *)make_word_list(v9, word_list);
[5120, 5128, 5125, 5134] sh_xfree(v6, "array.c", 812LL);
[5139] v2 = (_QWORD *)v2[2];
}
[5147, 5143] while ( *(_QWORD **)(a1 + 16) != v2 );
[5152, 5149] if ( !v3 )
[5192] return 0LL;
[5154, 5159] if ( *v3 )
[5168, 5180, 5165] return (_QWORD *)list_reverse(v3);
[5161, 5199] return v3;
[5210, 5195, 5208, 5170, 5171, 5172, 5202, 5174, 5203, 5176, 5204, 5178, 5206, 5212] }
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2878: using guessed type long make_bare_word(_QWORD);
// 2880: using guessed type long make_word_list(_QWORD, _QWORD);
// 2888: using guessed type long list_reverse(_QWORD);
// 28B0: using guessed type long itos(_QWORD);
//----- (0000000000001460) ----------------------------------------------------
long * array_assign_list(long *a1, long **a2)
[5216] {
long **v2; // rbx
long v3; // rbp
long v4; // rsi
[5216, 5220, 5222, 5225, 5226, 5227, 5230] if ( a2 )
{
[5232] v2 = a2;
[5235, 5237] v3 = 0LL;
do
{
[5244] v4 = v3++;
[5250, 5254, 5257, 5240, 5247] array_insert(a1, v4, (char *)*v2[1]);
[5262] v2 = (long **)*v2;
}
[5265, 5268] while ( v2 );
}
[5273, 5270] return a1;
[5274, 5275, 5277] }
//----- (00000000000014A0) ----------------------------------------------------
long * array_from_word_list(long **a1)
[5280] {
long *v1; // rax
[5280, 5284, 5287] if ( !a1 )
[5312] return 0LL;
[5289, 5290, 5293] v1 = (long *)array_create();
[5314, 5298, 5301, 5302, 5305] return array_assign_list(v1, a1);
}
//----- (00000000000014D0) ----------------------------------------------------
long array_to_argv(long a1, _DWORD *a2)
[5328] {
long v3; // rdi
long v4; // r14
long v5; // rax
long v6; // rbx
int v7; // r12d
long v8; // rdx
const char *v9; // rbp
_QWORD *v10; // r15
size_t v11; // rax
char *v12; // rax
char *v13; // rax
long v15; // [rsp+0h] [rbp-48h]
[5346, 5351, 5354, 5370, 5328, 5360, 5363, 5332, 5334, 5367, 5336, 5338, 5340, 5341, 5342] if ( a1 && (v3 = *(_QWORD *)(a1 + 8)) != 0 )
{
[5376, 5384, 5379] v4 = strvec_create((unsigned int)(v3 + 1));
[5387] v5 = *(_QWORD *)(a1 + 16);
[5391] v6 = *(_QWORD *)(v5 + 16);
[5395, 5398] if ( v5 == v6 )
{
[5592] v10 = (_QWORD *)v4;
[5595, 5598] v7 = 0;
}
else
{
[5404] v7 = 0;
[5409, 5407] v8 = 0LL;
do
{
[5416] while ( 1 )
{
[5416] v9 = *(const char **)(v6 + 8);
[5428] v15 = 8 * v8;
[5432, 5420] v10 = (_QWORD *)(v4 + 8 * v8);
[5436, 5439] if ( !v9 )
break;
[5444] ++v7;
[5448, 5441] v11 = strlen(v9);
[5465, 5458, 5469, 5453] v12 = (char *)sh_xmalloc(v11 + 1, "array.c", 849LL);
[5480, 5474, 5477] v13 = strcpy(v12, v9);
[5489, 5485] v6 = *(_QWORD *)(v6 + 16);
[5493] *v10 = v13;
[5496] v5 = *(_QWORD *)(a1 + 16);
[5500] v10 = (_QWORD *)(v4 + v15 + 8);
[5505, 5508] if ( v6 == v5 )
goto LABEL_9;
[5513, 5510] v8 = v7;
}
[5520] v6 = *(_QWORD *)(v6 + 16);
}
[5524, 5527] while ( v6 != v5 );
}
LABEL_9:
[5529, 5534] *v10 = 0LL;
[5544, 5541] if ( a2 )
[5546] *a2 = v7;
}
else
{
[5568, 5573] v4 = 0LL;
[5576, 5579] if ( a2 )
[5587, 5581] *a2 = 0;
}
[5553, 5549] return v4;
[5556, 5557, 5558, 5560, 5562, 5564, 5566] }
// 2838: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 28B8: using guessed type long strvec_create(_QWORD);
//----- (00000000000015E0) ----------------------------------------------------
__m128i * array_from_argv(__m128i *a1, const char **a2, int a3)
[5600] {
long v3; // r13
long v4; // rax
long v6; // rbp
long v7; // rbx
size_t v8; // rax
char *v9; // rax
char *v10; // rdx
long v11; // rsi
long v13; // rbx
long v14; // rsi
long v15; // rbx
const char *v16; // rbp
size_t v17; // rax
char *v18; // rax
long i; // rbx
char *v20; // rdx
long v21; // rsi
char *src; // [rsp+8h] [rbp-40h]
char *srca; // [rsp+8h] [rbp-40h]
[5600, 5604, 5606, 5608, 5610, 5613, 5615, 5618, 5619, 5620] v3 = a3;
[5633, 5637, 5640, 5624, 5627] if ( a1 && (v4 = a1->m128i_i64[1]) != 0 )
{
[5649, 5610, 5652, 5646] if ( v4 == a3 )
{
[5888] v6 = a1[1].m128i_i64[0];
[5892, 5895] if ( a3 == 1 )
{
[5901] v15 = *(_QWORD *)(v6 + 16);
[5905, 5908, 5911] v16 = *a2;
[5905] if ( *a2 )
{
[5913, 5916] v17 = strlen(*a2);
[5921, 5933, 5926, 5937] v18 = (char *)sh_xmalloc(v17 + 1, "array.c", 878LL);
[5953, 5945, 5948, 5942] v16 = strcpy(v18, v16);
}
[5960, 5956, 5965, 5972] sh_xfree(*(_QWORD *)(v15 + 8), "array.c", 879LL);
[5977] *(_QWORD *)(v15 + 8) = v16;
[5828, 5981] return a1;
}
}
else
{
[5610, 5658] if ( v4 > a3 )
{
[5992] array_flush(a1);
[6000, 5997] if ( v3 > 0 )
{
[6026, 6035, 6040, 6038, 6006, 6008] for ( i = 0LL; i != v3; ++i )
{
[6016] v20 = (char *)a2[i];
[6020] v21 = i;
[6030, 6023] array_insert(a1->m128i_i64, v21, v20);
}
}
[5828, 6038] return a1;
}
[5664] v6 = a1[1].m128i_i64[0];
}
[5668] v7 = 0LL;
[5673, 5682, 5675, 5670] if ( v4 > 0 )
{
do
{
[5698, 5691, 5695] while ( 1 )
{
[5691] v6 = *(_QWORD *)(v6 + 16);
[5688] if ( !*a2 )
break;
[5707] src = (char *)*a2;
[5712] ++v7;
[5704, 5716] v8 = strlen(*a2);
[5721, 5729, 5733, 5726] v9 = (char *)sh_xmalloc(v8 + 1, "array.c", 888LL);
[5766, 5738, 5743, 5746, 5749] srca = strcpy(v9, src);
[5754, 5763, 5771, 5758] sh_xfree(*(_QWORD *)(v6 + 8), "array.c", 889LL);
[5776, 5781] *(_QWORD *)(v6 + 8) = srca;
[5785, 5790] if ( v7 >= a1->m128i_i64[1] )
goto LABEL_9;
}
[6060] ++v7;
[6048, 6057, 6052, 6064] sh_xfree(*(_QWORD *)(v6 + 8), "array.c", 889LL);
[6069] *(_QWORD *)(v6 + 8) = 0LL;
}
[6088, 6082, 6077] while ( a1->m128i_i64[1] > v7 );
}
LABEL_9:
[5792, 5795, 5797] if ( v7 < v3 )
{
do
{
[5800] v10 = (char *)a2[v7];
[5804] v11 = v7++;
[5810, 5814, 5807] array_insert(a1->m128i_i64, v11, v10);
}
[5819, 5822] while ( v7 != v3 );
}
}
else
{
[5848] v13 = 0LL;
[5850, 5610, 5853, 5855] if ( a3 > 0LL )
{
do
{
[5856] v14 = v13++;
[5864, 5859, 5868, 5861] array_insert(a1->m128i_i64, v14, 0LL);
}
[5873, 5876, 5878] while ( v13 != v3 );
}
}
[5824, 5828] return a1;
[5831, 5832, 5833, 5835, 5837, 5839, 5841] }
// 2838: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
//----- (00000000000017D0) ----------------------------------------------------
long array_to_kvpair(long a1, int a2)
[6096] {
long v2; // r13
_BYTE *v3; // rax
_QWORD *v4; // rax
_QWORD *v5; // r12
int v6; // ebx
int v7; // ebp
const char *v8; // rax
long v9; // r14
const char *v10; // r15
int v11; // eax
long v12; // rdi
int v13; // edx
int v14; // eax
int v15; // eax
int v16; // eax
int v17; // eax
int v18; // ebx
char *v19; // rdi
int v20; // eax
long v21; // r9
long v22; // r9
int v23; // ebx
long v24; // rax
_BYTE *v25; // r9
long v27; // rbx
long v29; // [rsp+0h] [rbp-78h]
long v30; // [rsp+10h] [rbp-68h]
char v31[24]; // [rsp+20h] [rbp-58h] BYREF
unsigned long v32; // [rsp+38h] [rbp-40h]
[6114, 6118, 6122, 6096, 6131, 6100, 6102, 6104, 6106, 6108, 6109, 6110] v32 = __readfsqword(0x28u);
[6136, 6138, 6141] if ( !a1 )
[7034, 7031] return 0LL;
[6147] v2 = 0LL;
[6155, 6150, 6158] if ( *(_QWORD *)(a1 + 8) )
{
[6176, 6169, 6164, 6181] v3 = (_BYTE *)sh_xmalloc(128LL, "array.c", 964LL);
[6186] *v3 = 0;
[6189] v2 = (long)v3;
[6192] v4 = *(_QWORD **)(a1 + 16);
[6196] v5 = (_QWORD *)v4[2];
[6200, 6203] if ( v4 == v5 )
{
[7039] v25 = (_BYTE *)v2;
[7042] goto LABEL_33;
}
[6209, 6214] v6 = 0;
[6216, 6226, 6221] v7 = 128;
[6241, 6246] while ( 1 )
{
[6232, 6237, 6246] v8 = (const char *)inttostr(*v5, v31, 22LL);
[6251] v9 = v5[1];
[6256] v10 = v8;
[6259, 6262] if ( !v9 )
break;
[6251, 6268, 6271] v11 = ansic_shouldquote(v5[1]);
[6276] v12 = v5[1];
[6281, 6283] if ( v11 )
[6289, 6298, 6291, 6293] v9 = ansic_quote(v12, 0LL, 0LL);
else
[6896, 6901, 6904] v9 = sh_double_quote(v12);
[6301] v13 = 8;
[6306, 6309] if ( v10 )
{
[6315, 6311] if ( *v10 )
{
[6322, 6327] v13 = 9;
[6317] if ( v10[1] )
goto LABEL_41;
}
}
LABEL_11:
[6336, 6333] if ( !v9 )
goto LABEL_47;
[6346, 6349] v14 = v13 + 1;
[6342] if ( *(_BYTE *)v9 )
{
[6356, 6359] v14 = v13 + 2;
[6351] if ( *(_BYTE *)(v9 + 1) )
{
[6369, 6366, 6375] v14 = v13 + 3;
[6361] if ( *(_BYTE *)(v9 + 2) )
[6976, 6980, 6960, 6963, 6967, 6972] v14 = v13 + strlen((const char *)v9) + 1;
}
}
LABEL_16:
[6384] v15 = v6 + v14;
[6386, 6388] if ( v15 >= v7 )
{
do
[6728] v7 *= 2;
[6730, 6732] while ( v15 >= v7 );
[6752, 6757, 6760, 6734, 6737, 6740, 6745] v2 = sh_xrealloc(v2, v7, "array.c", 975LL);
}
[6400, 6394, 6403, 6397] strcpy((char *)(v2 + v6), v10);
[6408] v16 = 0;
[6410, 6414] if ( *v10 )
{
[6426, 6421] v16 = 1;
[6416] if ( v10[1] )
{
[6433, 6438] v16 = 2;
[6428] if ( v10[2] )
[6440, 6443] v16 = strlen(v10);
}
}
[6448] v17 = v6 + v16;
[6450] v18 = v17 + 1;
[6456, 6459, 6453] *(_BYTE *)(v2 + v17) = 32;
[6465, 6450] v19 = (char *)(v2 + v17 + 1);
[6468, 6471] if ( v9 )
{
[6480, 6477] strcpy(v19, (const char *)v9);
[6485] v20 = 0;
[6491, 6487] if ( *(_BYTE *)v9 )
{
[6498, 6503] v20 = 1;
[6493] if ( *(_BYTE *)(v9 + 1) )
{
[6521, 6515, 6510] v20 = 2;
[6505] if ( *(_BYTE *)(v9 + 2) )
[6944, 6952, 6947] v20 = strlen((const char *)v9);
}
}
[6528] v6 = v20 + v18;
[6530, 6534] v21 = v6;
[6537, 6546, 6541] if ( v5[2] != *(_QWORD *)(a1 + 16) )
{
[6548] ++v6;
[6551] *(_BYTE *)(v2 + v21) = 32;
[6557] v21 = v6;
}
[6575] v30 = v21;
[6560, 6580, 6572, 6565] sh_xfree(v9, "array.c", 991LL);
[6585] v22 = v30;
}
else
{
[6841, 6844] v6 = v17 + 3;
[6832, 6836, 6848] strcpy(v19, "\"\"");
[6841, 6851] v22 = v17 + 3;
[6858, 6854, 6863] if ( v5[2] == *(_QWORD *)(a1 + 16) )
{
LABEL_30:
[6616] v23 = v6 + 1;
[6619, 6621] if ( v23 >= v7 )
{
[6633, 6628] v29 = v22;
[6625, 6637, 6640, 6647, 6651, 6654, 6623] v24 = sh_xrealloc(v2, (int)(v7 + ((v23 - v7) & 0xFFFFFFF8) + 8), "array.c", 993LL);
[6659] v22 = v29;
[6663] v2 = v24;
}
[6666] v25 = (_BYTE *)(v2 + v22);
LABEL_33:
[6673, 6669] *v25 = 0;
[6690, 6699, 6677, 6679, 6685] if ( a2 )
{
[6992, 6995, 7015] v27 = sh_single_quote(v2);
[7000, 7018, 7003, 7008] sh_xfree(v2, "array.c", 999LL);
[7026, 7023] return v27;
}
[6709, 7023] return v2;
}
[6869] v6 = v17 + 4;
[6872] *(_BYTE *)(v2 + v22) = 32;
[6881, 6869, 6878] v22 = v17 + 4;
}
[6594, 6590] v5 = (_QWORD *)v5[2];
[6609, 6603, 6599] if ( *(_QWORD **)(a1 + 16) == v5 )
goto LABEL_30;
}
[6768, 6771] if ( !v8 )
{
[6928] v9 = 0LL;
[6931] v14 = 9;
[6936] goto LABEL_16;
}
[6777, 6780] if ( !*v8 )
{
[6912] v13 = 8;
LABEL_47:
[6917] v14 = v13 + 1;
[6920] v9 = 0LL;
[6923] goto LABEL_16;
}
[6786, 6790] if ( !v8[1] )
{
[7052] v13 = 9;
[7057] goto LABEL_47;
}
LABEL_41:
[6801, 6796, 6806] v13 = 10;
[6796] if ( v10[2] )
[6820, 6812, 6815] v13 = strlen(v10) + 8;
[6823] goto LABEL_11;
}
[6705, 6709] return v2;
[6720, 6722, 6712, 6713, 6714, 6716, 6718] }
// 2838: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2840: using guessed type long sh_xrealloc(_QWORD, _QWORD, _QWORD, _QWORD);
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 28C0: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// 28C8: using guessed type long ansic_shouldquote(_QWORD);
// 28D0: using guessed type long ansic_quote(_QWORD, _QWORD, _QWORD);
// 28D8: using guessed type long sh_double_quote(_QWORD);
// 28E0: using guessed type long sh_single_quote(_QWORD);
// 17D0: using guessed type char var_58[24];
//----- (0000000000001BA0) ----------------------------------------------------
long array_to_assign(long a1, int a2)
[7072] {
long v2; // rbp
_BYTE *v3; // rax
_QWORD *v4; // rax
_QWORD *v5; // r12
int v6; // r15d
int v7; // ebx
const char *v8; // rax
long v9; // r13
const char *v10; // r14
int v11; // eax
long v12; // rdi
int v13; // edx
int v14; // eax
int v15; // eax
int v16; // eax
int v17; // edx
int v18; // eax
long v19; // r10
int v20; // eax
long v21; // r12
long v22; // rax
long v24; // rbx
long v26; // [rsp+0h] [rbp-78h]
char v27[24]; // [rsp+20h] [rbp-58h] BYREF
unsigned long v28; // [rsp+38h] [rbp-40h]
[7072, 7107, 7076, 7078, 7080, 7082, 7084, 7085, 7086, 7090, 7094, 7098] v28 = __readfsqword(0x28u);
[7112, 7114, 7117] if ( !a1 )
[8073, 8071] return 0LL;
[7123] v2 = 0LL;
[7133, 7130, 7125] if ( *(_QWORD *)(a1 + 8) )
{
[7144, 7139, 7156, 7151] v3 = (_BYTE *)sh_xmalloc(128LL, "array.c", 1018LL);
[7161] *v3 = 40;
[7164] v2 = (long)v3;
[7167] v4 = *(_QWORD **)(a1 + 16);
[7171] v5 = (_QWORD *)v4[2];
[7178, 7175] if ( v4 == v5 )
{
[8078] v21 = 2LL;
[8084] v19 = 1LL;
[8090] goto LABEL_32;
}
[7184, 7189] v6 = 1;
[7200, 7195, 7205] v7 = 128;
[7217, 7222] while ( 1 )
{
[7208, 7213, 7222] v8 = (const char *)inttostr(*v5, v27, 22LL);
[7227] v9 = v5[1];
[7232] v10 = v8;
[7235, 7238] if ( !v9 )
break;
[7227, 7244, 7247] v11 = ansic_shouldquote(v5[1]);
[7252] v12 = v5[1];
[7257, 7259] if ( v11 )
[7265, 7274, 7267, 7269] v9 = ansic_quote(v12, 0LL, 0LL);
else
[7912, 7920, 7917] v9 = sh_double_quote(v12);
[7277] v13 = 8;
[7282, 7285] if ( v10 )
{
[7291, 7287] if ( *v10 )
{
[7298, 7303] v13 = 9;
[7293] if ( v10[1] )
goto LABEL_42;
}
}
LABEL_11:
[7312, 7309] if ( !v9 )
goto LABEL_46;
[7323, 7326] v14 = v13 + 1;
[7318] if ( *(_BYTE *)v9 )
{
[7336, 7333] v14 = v13 + 2;
[7328] if ( *(_BYTE *)(v9 + 1) )
{
[7352, 7346, 7343] v14 = v13 + 3;
[7338] if ( *(_BYTE *)(v9 + 2) )
[8000, 8004, 7984, 7987, 7991, 7996] v14 = v13 + strlen((const char *)v9) + 1;
}
}
LABEL_16:
[7360] v15 = v6 + v14;
[7363, 7365] if ( v15 >= v7 )
{
do
[7776] v7 *= 2;
[7778, 7780] while ( v15 >= v7 );
[7808, 7782, 7785, 7788, 7793, 7800, 7805] v2 = sh_xrealloc(v2, v7, "array.c", 1030LL);
}
[7371, 7381, 7387] *(_BYTE *)(v2 + v6) = 91;
[7393, 7397, 7374, 7378, 7390] strcpy((char *)(v2 + v6 + 1), v10);
[7402] v16 = 0;
[7408, 7412] v17 = v6 + 1;
[7404] if ( *v10 )
{
[7424, 7419] v16 = 1;
[7414] if ( v10[1] )
{
[7436, 7431] v16 = 2;
[7426] if ( v10[2] )
{
[7441, 7438] v16 = strlen(v10);
[7450, 7446] v17 = v6 + 1;
}
}
}
[7456] v18 = v17 + v16;
[7461] v6 = v18 + 2;
[7465, 7458] *(_BYTE *)(v2 + v18) = 93;
[7473, 7476, 7461] v19 = v18 + 2;
[7470, 7479] *(_BYTE *)(v2 + v18 + 1) = 61;
[7484, 7487] if ( v9 )
{
[7473, 7498, 7501, 7493] strcpy((char *)(v2 + v6), (const char *)v9);
[7506] v20 = 0;
[7513, 7508] if ( *(_BYTE *)v9 )
{
[7520, 7525] v20 = 1;
[7515] if ( *(_BYTE *)(v9 + 1) )
{
[7537, 7532, 7543] v20 = 2;
[7527] if ( *(_BYTE *)(v9 + 2) )
[8016, 8019, 8024] v20 = strlen((const char *)v9);
}
}
[7552, 7556] v6 += v20;
[7562, 7571, 7566] if ( v5[2] != *(_QWORD *)(a1 + 16) )
[7577, 7586, 7582, 7559] *(_BYTE *)(v2 + v6++) = 32;
[7589, 7594, 7601, 7604, 7609] sh_xfree(v9, "array.c", 1045LL);
[7614] v19 = v6;
}
else
{
[7816, 7820, 7824, 7829] if ( v5[2] == *(_QWORD *)(a1 + 16) )
{
LABEL_30:
[7648, 7652] v21 = v6 + 1;
[7648, 7658, 7655] if ( v6 + 1 >= v7 )
{
[7666, 7671] v26 = v19;
[7648, 7686, 7691, 7660, 7694, 7663, 7675, 7679] v22 = sh_xrealloc(v2, (int)(v7 + ((v6 + 1 - v7) & 0xFFFFFFF8) + 8), "array.c", 1047LL);
[7699] v19 = v26;
[7703] v2 = v22;
}
LABEL_32:
[7706, 7710] *(_BYTE *)(v2 + v19) = 41;
[7716] *(_BYTE *)(v2 + v21) = 0;
[7744, 7722, 7724, 7730, 7735] if ( a2 )
{
[8032, 8035, 8055] v24 = sh_single_quote(v2);
[8040, 8058, 8043, 8048] sh_xfree(v2, "array.c", 1053LL);
[8066, 8063] return v24;
}
[7754, 8063] return v2;
}
[7835] v6 = v18 + 3;
[7839] *(_BYTE *)(v2 + v19) = 32;
[7848, 7835, 7845] v19 = v18 + 3;
}
[7619, 7623] v5 = (_QWORD *)v5[2];
[7632, 7628, 7638] if ( *(_QWORD **)(a1 + 16) == v5 )
goto LABEL_30;
}
[7856, 7859] if ( !v8 )
{
[7968] v9 = 0LL;
[7971] v14 = 9;
[7976] goto LABEL_16;
}
[7864, 7861] if ( !*v8 )
{
[7928] v13 = 8;
LABEL_46:
[7933] v14 = v13 + 1;
[7936] v9 = 0LL;
[7939] goto LABEL_16;
}
[7866, 7870] if ( !v8[1] )
{
[8095] v13 = 9;
[8100] goto LABEL_46;
}
LABEL_42:
[7881, 7876, 7886] v13 = 10;
[7876] if ( v10[2] )
[7900, 7892, 7895] v13 = strlen(v10) + 8;
[7903] goto LABEL_11;
}
[7754, 7750] return v2;
[7757, 7758, 7759, 7761, 7763, 7765, 7767] }
// 2838: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2840: using guessed type long sh_xrealloc(_QWORD, _QWORD, _QWORD, _QWORD);
// 2848: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 28C0: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// 28C8: using guessed type long ansic_shouldquote(_QWORD);
// 28D0: using guessed type long ansic_quote(_QWORD, _QWORD, _QWORD);
// 28D8: using guessed type long sh_double_quote(_QWORD);
// 28E0: using guessed type long sh_single_quote(_QWORD);
// 1BA0: using guessed type char var_58[24];
//----- (0000000000001FB0) ----------------------------------------------------
_BYTE * array_to_string(long a1, const char *a2, int a3)
[8112] {
_BYTE *result; // rax
size_t v4; // rax
[8112, 8116, 8119] if ( !a1 )
[8200] return 0LL;
[8121, 8126] if ( *(_QWORD *)(a1 + 8) )
[8128, 8132, 8134, 8137, 8141, 8144] return (_BYTE *)array_to_string_internal(*(_QWORD *)(*(_QWORD *)(a1 + 16) + 16LL), *(_QWORD *)(a1 + 16), a2, a3);
[8152, 8163, 8156] v4 = strlen(&LC2);
[8168, 8184, 8180, 8173] result = (_BYTE *)sh_xmalloc(v4 + 1, "array.c", 1068LL);
[8189] *result = 0;
[8192, 8196] return result;
[8202] }
// 2838: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// nfuncs=60 queued=35 decompiled=35 lumina nreq=0 worse=0 better=0
// ALL OK, 35 function(s) have been successfully decompiled
|
long array_patsub(long a1, long a2, long a3, int a4)
[3025] {
unsigned int v5; // eax
_QWORD *v8; // [rsp+38h] [rbp-18h]
_QWORD *v9; // [rsp+40h] [rbp-10h]
long v10; // [rsp+48h] [rbp-8h]
long v11; // [rsp+48h] [rbp-8h]
[3072, 3041, 3076, 3045, 3080, 3049, 3083, 3052, 3025, 3057, 3059, 3029, 3030, 3063, 3033, 3067, 3037, 3070] if ( !a1 || !*(_QWORD *)(a1 + 16) || !*(_QWORD *)(a1 + 8) )
[3090, 3085] return 0LL;
[3107, 3099, 3102, 3095] v8 = array_to_word_list(a1);
[3116, 3111] if ( !v8 )
[3123, 3118] return 0LL;
[3128, 3136, 3132] v9 = v8;
[3250, 3245] while ( v8 )
{
[3168, 3138, 3142, 3146, 3149, 3152, 3156, 3160, 3163] v10 = pat_subst(*(_QWORD *)v8[1], a2, a3, (unsigned int)a4);
[3172, 3176, 3180, 3183, 3186] if ( *(_QWORD *)v8[1] )
[3204, 3211, 3214, 3188, 3192, 3196, 3199] sh_xfree(*(_QWORD *)v8[1], "array.c", 461LL);
[3231, 3219, 3227, 3223] *(_QWORD *)v8[1] = v10;
[3241, 3234, 3238] v8 = (_QWORD *)*v8;
}
[3260, 3252, 3262, 3255] if ( (a4 & 0x80) != 0 )
[3264, 3269] v5 = 42;
else
[3271] v5 = 64;
[3297, 3300, 3303, 3306, 3276, 3309, 3279, 3323, 3313, 3282, 3316, 3285, 3318, 3288, 3291, 3294] v11 = string_list_pos_params(v5, v9, (a4 >> 5) & 1, (a4 >> 3) & 8);
[3331, 3334, 3327] dispose_words(v9);
[3339, 3343] return v11;
[3344] }
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2BB8: using guessed type long string_list_pos_params(_QWORD, _QWORD, _QWORD, _QWORD);
// 2BC0: using guessed type long dispose_words(_QWORD);
// 2BC8: using guessed type long pat_subst(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000000D11) ----------------------------------------------------
long array_modcase(long a1, long a2, unsigned int a3, int a4)
[3345] {
unsigned int v5; // eax
_QWORD *v8; // [rsp+38h] [rbp-18h]
_QWORD *v9; // [rsp+40h] [rbp-10h]
long v10; // [rsp+48h] [rbp-8h]
long v11; // [rsp+48h] [rbp-8h]
[3361, 3395, 3365, 3399, 3368, 3402, 3371, 3376, 3345, 3378, 3349, 3350, 3382, 3353, 3386, 3389, 3357, 3391] if ( !a1 || !*(_QWORD *)(a1 + 16) || !*(_QWORD *)(a1 + 8) )
[3409, 3404] return 0LL;
[3418, 3426, 3421, 3414] v8 = array_to_word_list(a1);
[3435, 3430] if ( !v8 )
[3442, 3437] return 0LL;
[3451, 3455, 3447] v9 = v8;
[3568, 3563] while ( v8 )
{
[3457, 3461, 3465, 3468, 3471, 3475, 3478, 3481, 3486] v10 = sh_modcase(*(_QWORD *)v8[1], a2, a3);
[3490, 3494, 3498, 3501, 3504] if ( *(_QWORD *)v8[1] )
[3522, 3529, 3532, 3506, 3510, 3514, 3517] sh_xfree(*(_QWORD *)v8[1], "array.c", 495LL);
[3549, 3537, 3545, 3541] *(_QWORD *)v8[1] = v10;
[3552, 3556, 3559] v8 = (_QWORD *)*v8;
}
[3570, 3580, 3573, 3578] if ( (a4 & 0x80) != 0 )
[3587, 3582] v5 = 42;
else
[3589] v5 = 64;
[3618, 3621, 3624, 3594, 3627, 3597, 3631, 3600, 3641, 3634, 3603, 3636, 3606, 3609, 3612, 3615] v11 = string_list_pos_params(v5, v9, (a4 >> 5) & 1, (a4 >> 3) & 8);
[3649, 3652, 3645] dispose_words(v9);
[3657, 3661] return v11;
[3662] }
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2BB8: using guessed type long string_list_pos_params(_QWORD, _QWORD, _QWORD, _QWORD);
// 2BC0: using guessed type long dispose_words(_QWORD);
// 2BD0: using guessed type long sh_modcase(_QWORD, _QWORD, _QWORD);
//----- (0000000000000E4F) ----------------------------------------------------
_QWORD * array_create_element(long a1, const char *a2)
[3663] {
size_t v2; // rax
char *v3; // rax
char *v4; // rax
_QWORD *v6; // [rsp+18h] [rbp-8h]
[3683, 3688, 3663, 3695, 3667, 3668, 3700, 3671, 3705, 3675, 3679] v6 = (_QWORD *)sh_xmalloc(32LL, "array.c", 520LL);
[3713, 3709, 3717] *v6 = a1;
[3720, 3725] if ( a2 )
{
[3731, 3734, 3727] v2 = strlen(a2);
[3748, 3755, 3758, 3739, 3743] v3 = (char *)sh_xmalloc(v2 + 1, "array.c", 522LL);
[3776, 3781, 3763, 3766, 3770, 3773] v4 = strcpy(v3, a2);
}
else
{
[3783] v4 = 0LL;
}
[3792, 3788] v6[1] = v4;
[3800, 3796] v6[3] = 0LL;
[3808, 3820, 3812, 3816] v6[2] = v6[3];
[3824, 3828] return v6;
[3829] }
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
//----- (0000000000000EF6) ----------------------------------------------------
long array_dispose_element(long a1)
[3830] {
long result; // rax
[3842, 3846, 3851, 3830, 3834, 3835, 3838] if ( a1 )
{
[3864, 3857, 3861, 3853] if ( *(_QWORD *)(a1 + 8) )
[3874, 3879, 3886, 3889, 3866, 3870] sh_xfree(*(_QWORD *)(a1 + 8), "array.c", 542LL);
[3910, 3913, 3894, 3898, 3903] return sh_xfree(a1, "array.c", 543LL);
}
[3918, 3919] return result;
[3920] }
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
//----- (0000000000000F51) ----------------------------------------------------
long array_insert(long *a1, long a2, const char *a3)
[3921] {
_QWORD *element; // rbx
_QWORD *v5; // rax
_QWORD *v6; // r12
_QWORD *v7; // rax
int v8; // [rsp+24h] [rbp-1Ch]
[3936, 3940, 3944, 3948, 3921, 3953, 3925, 3926, 3929, 3931, 3932] if ( !a1 )
[3960, 3955] return 0xFFFFFFFFLL;
[3969, 3973, 3976, 3979, 3984, 3965] element = array_create_element(a2, a3);
[3994, 3987, 3998, 3991] if ( a2 <= *a1 )
{
[4105, 4109, 4113, 4117, 4120, 4124] if ( a2 >= **(_QWORD **)(a1[2] + 16) )
{
[4224, 4228, 4220, 4231] if ( a1[3] )
[4233, 4241, 4237] v5 = (_QWORD *)a1[3];
else
[4243, 4251, 4247] v5 = *(_QWORD **)(a1[2] + 16);
[4258, 4255] v6 = v5;
[4262, 4266, 4270, 4273, 4277, 4280, 4283, 4287] if ( a2 >= *v5 / 2LL )
{
[4321, 4325, 4262, 4329] if ( a2 < *v5 )
[4350, 4343] v8 = -1;
else
[4338, 4331] v8 = 1;
}
else
{
[4289, 4297, 4293] v6 = *(_QWORD **)(a1[2] + 16);
[4309, 4305, 4316, 4301] v8 = 1;
}
[4624, 4617, 4621, 4613] while ( v6 != (_QWORD *)a1[2] )
{
[4363, 4355, 4359] if ( a2 == *v6 )
{
[4385, 4365, 4370, 4375, 4382] sh_xfree(v6[1], "array.c", 610LL);
[4394, 4390] v6[1] = element[1];
[4399] element[1] = 0LL;
[4410, 4407] array_dispose_element((long)element);
[4419, 4415] a1[3] = (long)v6;
[4428, 4423] return 0LL;
}
[4433, 4437, 4439, 4443, 4447] if ( v8 == 1 && a2 < *v6 )
{
[4449, 4454] *(_QWORD *)(v6[3] + 16LL) = element;
[4458, 4463] element[3] = v6[3];
[4467] v6[3] = element;
[4472] element[2] = v6;
[4480, 4484, 4488, 4492, 4476] ++a1[1];
[4496, 4500] a1[3] = (long)element;
[4504, 4509] return 0LL;
}
[4514, 4518, 4520, 4524, 4528] if ( v8 == -1 && a2 > *v6 )
{
[4530, 4535] *(_QWORD *)(v6[2] + 24LL) = element;
[4544, 4539] element[2] = v6[2];
[4548] element[3] = v6;
[4552] v6[2] = element;
[4557, 4561, 4565, 4569, 4573] ++a1[1];
[4577, 4581] a1[3] = (long)element;
[4585, 4590] return 0LL;
}
[4592, 4596] if ( v8 == 1 )
[4603, 4598] v7 = (_QWORD *)v6[2];
else
[4605] v7 = (_QWORD *)v6[3];
[4610] v6 = v7;
}
[4633, 4630] array_dispose_element((long)element);
[4642, 4638] a1[3] = 0LL;
[4650] return 0xFFFFFFFFLL;
}
else
{
[4134, 4130, 4138, 4126] *(_QWORD *)(*(_QWORD *)(a1[2] + 16) + 24LL) = element;
[4150, 4146, 4154, 4142] element[2] = *(_QWORD *)(a1[2] + 16);
[4166, 4162, 4158] element[3] = a1[2];
[4170, 4178, 4174] *(_QWORD *)(a1[2] + 16) = element;
[4194, 4198, 4182, 4186, 4190] ++a1[1];
[4202, 4206] a1[3] = (long)element;
[4210, 4215] return 0LL;
}
}
else
{
[4000, 4012, 4004, 4008] *(_QWORD *)(*(_QWORD *)(a1[2] + 24) + 16LL) = element;
[4016, 4028, 4020, 4024] element[3] = *(_QWORD *)(a1[2] + 24);
[4032, 4036, 4040] *(_QWORD *)(a1[2] + 24) = element;
[4048, 4052, 4044] element[2] = a1[2];
[4056, 4060, 4064] *a1 = a2;
[4067, 4071, 4075, 4079, 4083] ++a1[1];
[4091, 4087] a1[3] = (long)element;
[4100, 4095] return 0LL;
}
[4655, 4659, 4660, 4662, 4663] }
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
//----- (0000000000001238) ----------------------------------------------------
long * array_remove(long *a1, long a2)
[4664] {
_QWORD *v3; // rax
_QWORD *v4; // rbx
_QWORD *v5; // rax
int v6; // [rsp+14h] [rbp-14h]
[4672, 4673, 4677, 4681, 4696, 4686, 4688, 4692, 4664, 4699, 4668, 4669] if ( !a1 || !a1[1] )
[4706, 4701] return 0LL;
[4736, 4739, 4711, 4743, 4715, 4718, 4722, 4724, 4728, 4732] if ( a2 > *a1 || a2 < **(_QWORD **)(a1[2] + 16) )
[4745, 4750] return 0LL;
[4755, 4763, 4766, 4759] if ( a1[3] )
[4768, 4772, 4776] v3 = (_QWORD *)a1[3];
else
[4786, 4778, 4782] v3 = *(_QWORD **)(a1[2] + 16);
[4793, 4790] v4 = v3;
[4800, 4804, 4807, 4811, 4814, 4817, 4821, 4796] if ( a2 >= *v3 / 2LL )
{
[4858, 4862, 4796, 4854] if ( a2 < *v3 )
[4883, 4876] v6 = -1;
else
[4864, 4871] v6 = 1;
}
else
{
[4831, 4827, 4823] v4 = *(_QWORD **)(a1[2] + 16);
[4849, 4842, 4835, 4838] v6 = 1;
}
[5100] while ( 1 )
{
[5104, 5108, 5117, 5111] if ( v4 == (_QWORD *)a1[2] )
[5120] return 0LL;
[4888, 4891, 4895] if ( a2 == *v4 )
break;
[5051, 5055] if ( v6 == 1 )
[5057, 5061] v5 = (_QWORD *)v4[2];
else
[5063] v5 = (_QWORD *)v4[3];
[5067] v4 = v5;
[5089, 5091, 5098, 5070, 5074, 5076, 5079, 5083, 5085] if ( v6 == 1 && a2 < *v5 || v6 == -1 && a2 > *v5 )
[5098, 5094] return 0LL;
}
[4905, 4909, 4901] *(_QWORD *)(v4[2] + 24LL) = v4[3];
[4913, 4917, 4921] *(_QWORD *)(v4[3] + 16LL) = v4[2];
[4929, 4933, 4937, 4941, 4925] --a1[1];
[4952, 4945, 4956, 4949] if ( a2 == *a1 )
[4969, 4962, 4965, 4958] *a1 = *(_QWORD *)v4[3];
[4972, 4976, 4980, 4984, 4987] if ( v4[2] == a1[2] )
{
[5003, 5007, 5011, 5015, 5018] if ( v4[3] == a1[2] )
[5034, 5038] a1[3] = 0LL;
else
[5024, 5028, 5020, 5032] a1[3] = v4[3];
}
else
{
[4993, 5001, 4989, 4997] a1[3] = v4[2];
}
[5049, 5125, 5046] return v4;
[5126, 5127] }
//----- (0000000000001408) ----------------------------------------------------
long array_reference(long *a1, long a2)
[5128] {
_QWORD *v3; // rax
long v4; // r12
_QWORD *v5; // rbx
_QWORD *v6; // rax
int v7; // [rsp+14h] [rbp-1Ch]
[5152, 5154, 5158, 5128, 5162, 5132, 5133, 5165, 5136, 5138, 5139, 5143, 5147] if ( !a1 || !a1[1] )
[5172, 5167] return 0LL;
[5184, 5209, 5188, 5190, 5194, 5198, 5202, 5205, 5177, 5181] if ( a2 > *a1 || a2 < **(_QWORD **)(a1[2] + 16) )
[5216, 5211] return 0LL;
[5232, 5225, 5221, 5229] if ( a1[3] )
[5234, 5242, 5238] v3 = (_QWORD *)a1[3];
else
[5248, 5252, 5244] v3 = *(_QWORD **)(a1[2] + 16);
[5256, 5259] v4 = (long)v3;
[5281, 5284, 5288, 5263, 5267, 5271, 5274, 5278] if ( a2 >= *v3 / 2LL )
{
[5327, 5319, 5323, 5263] if ( a2 < *v3 )
[5338] v7 = -1;
else
[5336, 5329] v7 = 1;
}
else
{
[5298, 5290, 5294] v4 = *(_QWORD *)(a1[2] + 16);
[5306, 5310, 5317, 5302] v7 = 1;
}
[5345, 5348] v5 = (_QWORD *)v4;
[5432, 5443, 5440, 5436] while ( v5 != (_QWORD *)a1[2] )
{
[5353, 5357, 5350] if ( a2 == *v5 )
{
[5363, 5359] a1[3] = (long)v5;
[5371, 5367] return v5[1];
}
[5377, 5373] if ( v7 == 1 )
[5379, 5383] v6 = (_QWORD *)v5[2];
else
[5385] v6 = (_QWORD *)v5[3];
[5389] v5 = v6;
[5392, 5396, 5398, 5401, 5405] if ( v7 == 1 && a2 < *v6 )
{
[5407] v4 = (long)v6;
[5410] break;
}
[5412, 5416, 5418, 5421, 5425] if ( v7 == -1 && a2 > *v6 )
{
[5427] v4 = (long)v6;
[5430] break;
}
}
[5449, 5453, 5445] a1[3] = v4;
[5458] return 0LL;
[5459, 5461, 5462] }
//----- (0000000000001557) ----------------------------------------------------
_QWORD * array_to_word_list(long a1)
[5463] {
long bare_word; // rax
_QWORD *word_list; // [rsp+10h] [rbp-10h]
long i; // [rsp+18h] [rbp-8h]
[5475, 5479, 5484, 5486, 5490, 5494, 5463, 5497, 5467, 5468, 5471] if ( !a1 || !*(_QWORD *)(a1 + 8) )
[5504, 5499] return 0LL;
[5509] word_list = 0LL;
[5597, 5577, 5593, 5517, 5581, 5521, 5585, 5525, 5589, 5529, 5533] for ( i = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD *)(a1 + 16); i = *(_QWORD *)(i + 16) )
{
[5543, 5546, 5539, 5535] bare_word = make_bare_word(*(_QWORD *)(i + 8));
[5569, 5573, 5551, 5554, 5558, 5561, 5564] word_list = (_QWORD *)make_word_list(bare_word, word_list);
}
[5604, 5606, 5610, 5613, 5616, 5599] if ( word_list && *word_list )
[5635, 5618, 5622, 5625, 5630] return (_QWORD *)list_reverse(word_list);
else
[5637] return word_list;
[5641, 5642] }
// 2BE8: using guessed type long make_bare_word(_QWORD);
// 2BF0: using guessed type long make_word_list(_QWORD, _QWORD);
// 2BF8: using guessed type long list_reverse(_QWORD);
//----- (000000000000160B) ----------------------------------------------------
long * array_from_word_list(long ***a1)
[5643] {
long *v2; // [rsp+18h] [rbp-8h]
[5664, 5643, 5647, 5648, 5651, 5655, 5659] if ( !a1 )
[5666, 5671] return 0LL;
[5673, 5678] v2 = array_create();
[5696, 5701, 5682, 5686, 5690, 5693] return array_assign_list(v2, a1);
[5702] }
//----- (0000000000001647) ----------------------------------------------------
_QWORD * array_keys_to_word_list(long a1)
[5703] {
long bare_word; // rax
_QWORD *word_list; // [rsp+18h] [rbp-18h]
_QWORD *i; // [rsp+20h] [rbp-10h]
long v5; // [rsp+28h] [rbp-8h]
[5730, 5734, 5703, 5737, 5707, 5708, 5711, 5715, 5719, 5724, 5726] if ( !a1 || !*(_QWORD *)(a1 + 8) )
[5744, 5739] return 0LL;
[5749] word_list = 0LL;
[5856, 5761, 5860, 5765, 5864, 5769, 5868, 5773, 5872, 5876, 5757] for ( i = *(_QWORD **)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD **)(a1 + 16); i = (_QWORD *)i[2] )
{
[5775, 5779, 5782, 5785, 5790] v5 = itos(*i);
[5801, 5794, 5798] bare_word = make_bare_word(v5);
[5824, 5806, 5809, 5813, 5816, 5819] word_list = (_QWORD *)make_word_list(bare_word, word_list);
[5828, 5832, 5837, 5844, 5847, 5852] sh_xfree(v5, "array.c", 791LL);
}
[5889, 5892, 5895, 5878, 5883, 5885] if ( word_list && *word_list )
[5897, 5901, 5904, 5909, 5914] return (_QWORD *)list_reverse(word_list);
else
[5916] return word_list;
[5920, 5921] }
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2BE8: using guessed type long make_bare_word(_QWORD);
// 2BF0: using guessed type long make_word_list(_QWORD, _QWORD);
// 2BF8: using guessed type long list_reverse(_QWORD);
// 2C00: using guessed type long itos(_QWORD);
//----- (0000000000001722) ----------------------------------------------------
_QWORD * array_to_kvpair_list(long a1)
[5922] {
long bare_word; // rax
long v3; // rax
_QWORD *v4; // [rsp+10h] [rbp-20h]
long word_list; // [rsp+10h] [rbp-20h]
_QWORD *i; // [rsp+18h] [rbp-18h]
long v7; // [rsp+20h] [rbp-10h]
long v8; // [rsp+28h] [rbp-8h]
[5953, 5922, 5956, 5926, 5927, 5930, 5934, 5938, 5943, 5945, 5949] if ( !a1 || !*(_QWORD *)(a1 + 8) )
[5963, 5958] return 0LL;
[5968] v4 = 0LL;
[5984, 6144, 5988, 5992, 6124, 6140, 6128, 6132, 5976, 5980, 6136] for ( i = *(_QWORD **)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD **)(a1 + 16); i = (_QWORD *)i[2] )
{
[5997, 6001, 6004, 6007, 6012] v7 = itos(*i);
[6016, 6020, 6024] v8 = i[1];
[6032, 6035, 6028] bare_word = make_bare_word(v7);
[6050, 6053, 6058, 6040, 6043, 6047] word_list = make_word_list(bare_word, v4);
[6066, 6069, 6062] v3 = make_bare_word(v8);
[6081, 6084, 6087, 6092, 6074, 6077] v4 = (_QWORD *)make_word_list(v3, word_list);
[6112, 6115, 6120, 6096, 6100, 6105] sh_xfree(v7, "array.c", 812LL);
}
[6150, 6155, 6157, 6161, 6164, 6167] if ( v4 && *v4 )
[6176, 6181, 6186, 6169, 6173] return (_QWORD *)list_reverse(v4);
else
[6188] return v4;
[6192, 6193] }
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2BE8: using guessed type long make_bare_word(_QWORD);
// 2BF0: using guessed type long make_word_list(_QWORD, _QWORD);
// 2BF8: using guessed type long list_reverse(_QWORD);
// 2C00: using guessed type long itos(_QWORD);
//----- (0000000000001832) ----------------------------------------------------
long * array_assign_list(long *a1, long ***a2)
[6194] {
long v3; // r12
[6209, 6213, 6217, 6221, 6194, 6227, 6198, 6199, 6202, 6204, 6205] v3 = 0LL;
[6258, 6261] while ( a2 )
{
[6240, 6243, 6246, 6229, 6233, 6236] array_insert(a1, v3, (const char *)*a2[1]);
[6251] a2 = (long ***)*a2;
[6254] ++v3;
}
[6267, 6263] return a1;
[6272, 6274, 6275, 6271] }
//----- (0000000000001884) ----------------------------------------------------
long array_to_argv(long a1, _DWORD *a2)
[6276] {
size_t v3; // rax
char *v4; // rcx
int v5; // eax
int v6; // [rsp+14h] [rbp-2Ch]
long i; // [rsp+18h] [rbp-28h]
long v8; // [rsp+20h] [rbp-20h]
char *s; // [rsp+28h] [rbp-18h]
[6304, 6276, 6308, 6280, 6281, 6312, 6315, 6284, 6285, 6289, 6293, 6297, 6302] if ( a1 && *(_QWORD *)(a1 + 8) )
{
[6344, 6348, 6352, 6355, 6357, 6362] v8 = strvec_create((unsigned int)*(_QWORD *)(a1 + 8) + 1);
[6366] v6 = 0;
[6498, 6373, 6502, 6377, 6506, 6381, 6510, 6385, 6514, 6389, 6518] for ( i = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD *)(a1 + 16); i = *(_QWORD *)(i + 16) )
{
[6395, 6399, 6391] s = *(char **)(i + 8);
[6408, 6403] if ( s )
{
[6417, 6410, 6414] v3 = strlen(s);
[6438, 6441, 6446, 6422, 6426, 6431] v4 = (char *)sh_xmalloc(v3 + 1, "array.c", 849LL);
[6449] v5 = v6++;
[6468, 6472, 6476, 6480, 6483, 6452, 6486, 6455, 6458, 6491, 6460, 6494] *(_QWORD *)(8LL * v5 + v8) = strcpy(v4, s);
}
}
[6529, 6537, 6541, 6544, 6524, 6527] *(_QWORD *)(8LL * v6 + v8) = 0LL;
[6556, 6551] if ( a2 )
[6562, 6565, 6558] *a2 = v6;
[6567] return v8;
}
else
{
[6322, 6317] if ( a2 )
[6328, 6324] *a2 = 0;
[6339, 6334] return 0LL;
}
[6576, 6577, 6571, 6575] }
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2C08: using guessed type long strvec_create(_QWORD);
//----- (00000000000019B2) ----------------------------------------------------
long * array_from_argv(long *a1, const char **a2, int a3)
[6578] {
const char *v4; // rbx
size_t v5; // rax
char *v6; // rax
char *v7; // rax
const char *v8; // rbx
size_t v9; // rax
char *v10; // rax
char *v11; // rax
long k; // [rsp+28h] [rbp-28h]
long j; // [rsp+28h] [rbp-28h]
long i; // [rsp+28h] [rbp-28h]
long v16; // [rsp+30h] [rbp-20h]
long v17; // [rsp+30h] [rbp-20h]
const char *v18; // [rsp+38h] [rbp-18h]
char *v19; // [rsp+38h] [rbp-18h]
char *v20; // [rsp+38h] [rbp-18h]
[6595, 6599, 6602, 6607, 6609, 6578, 6613, 6582, 6583, 6617, 6586, 6587, 6620, 6591] if ( a1 && a1[1] )
{
[6688, 6691, 6693, 6696, 6702, 6706, 6680, 6684] if ( a1[1] == a3 && a3 == 1 )
{
[6712, 6720, 6716, 6724] v16 = *(_QWORD *)(a1[2] + 16);
[6728, 6738, 6732, 6735] if ( *a2 )
{
[6744, 6740] v4 = *a2;
[6754, 6747, 6757, 6751] v5 = strlen(*a2);
[6762, 6766, 6771, 6778, 6781] v6 = (char *)sh_xmalloc(v5 + 1, "array.c", 878LL);
[6792, 6786, 6789, 6797] v7 = strcpy(v6, v4);
}
else
{
[6799] v7 = 0LL;
}
[6804] v19 = v7;
[6816, 6821, 6828, 6831, 6808, 6812] sh_xfree(*(_QWORD *)(v16 + 8), "array.c", 879LL);
[6840, 6844, 6836, 6848] *(_QWORD *)(v16 + 8) = v19;
}
[6853, 6857, 6861, 6864, 6866, 6869] else if ( a1[1] > a3 )
{
[7120, 7123, 7116] array_flush(a1);
[7136, 7179, 7184, 7187, 7189, 7128, 7193] for ( i = 0LL; i < a3; ++i )
[7168, 7138, 7171, 7142, 7174, 7150, 7154, 7157, 7160, 7164] array_insert(a1, i, a2[i]);
}
else
{
[6883, 6875, 6879] v17 = a1[2];
[7041, 7045, 6887, 7049, 6895, 7055, 7032, 7037] for ( j = 0LL; j < a1[1]; ++j )
{
[6904, 6908, 6900] v17 = *(_QWORD *)(v17 + 16);
[6912, 6922, 6916, 6919] if ( *a2 )
{
[6928, 6924] v8 = *a2;
[6938, 6931, 6941, 6935] v9 = strlen(*a2);
[6946, 6950, 6955, 6962, 6965] v10 = (char *)sh_xmalloc(v9 + 1, "array.c", 888LL);
[6976, 6970, 6981, 6973] v11 = strcpy(v10, v8);
}
else
{
[6983] v11 = 0LL;
}
[6988] v20 = v11;
[7012, 7015, 6992, 6996, 7000, 7005] sh_xfree(*(_QWORD *)(v17 + 8), "array.c", 889LL);
[7024, 7020, 7028] *(_QWORD *)(v17 + 8) = v20;
}
[7106, 7108, 7112, 7114, 7103] while ( j < a3 )
{
[7073, 7076, 7079, 7083, 7087, 7057, 7090, 7061, 7093, 7069] array_insert(a1, j, a2[j]);
[7098] ++j;
}
}
[7195] return a1;
}
else
{
[6660, 6630, 6663, 6665, 6669, 6622, 6655] for ( k = 0LL; k < a3; ++k )
[6632, 6636, 6640, 6644, 6647, 6650] array_insert(a1, k, v18);
[6675, 6671] return a1;
}
[7203, 7204, 7205, 7199] }
// 19FA: variable 'v18' is possibly undefined
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
//----- (0000000000001C26) ----------------------------------------------------
long array_to_string_internal(long a1, long a2, const char *a3, int a4)
[7206] {
const char *v5; // rax
int v8; // [rsp+28h] [rbp-28h]
int v9; // [rsp+2Ch] [rbp-24h]
int v10; // [rsp+30h] [rbp-20h]
int v11; // [rsp+34h] [rbp-1Ch]
long v12; // [rsp+38h] [rbp-18h]
long i; // [rsp+40h] [rbp-10h]
char *src; // [rsp+48h] [rbp-8h]
[7233, 7237, 7206, 7241, 7210, 7211, 7214, 7218, 7222, 7226, 7230] if ( a1 == a2 )
[7248, 7243] return 0LL;
[7257, 7265, 7260, 7253] v10 = strlen(a3);
[7268] v12 = 0LL;
[7276] v9 = 0;
[7283, 7286] v8 = 0;
[7297, 7618, 7622, 7606, 7289, 7610, 7293, 7614] for ( i = a1; i != a2; i = *(_QWORD *)(i + 16) )
{
[7306, 7302] if ( !v8 )
{
[7308] v8 = 64;
[7332, 7337, 7315, 7320, 7327] v12 = sh_xmalloc(64LL, "array.c", 927LL);
}
[7352, 7345, 7341, 7349] if ( *(_QWORD *)(i + 8) )
{
[7362, 7358] if ( a4 )
[7364, 7368, 7372, 7375, 7380] v5 = (const char *)quote_string(*(_QWORD *)(i + 8));
else
[7386, 7382] v5 = *(const char **)(i + 8);
[7390] src = (char *)v5;
[7401, 7394, 7398, 7406] v11 = strlen(v5);
[7425, 7428, 7430, 7409, 7412, 7415, 7417, 7420, 7423] if ( v8 <= v11 + v10 + 2 + v9 )
{
[7435, 7438, 7441, 7443, 7446, 7449, 7451, 7454] while ( v8 <= v11 + v10 + 2 + v9 )
[7432] v8 *= 2;
[7456, 7459, 7462, 7466, 7471, 7478, 7481, 7486] v12 = sh_xrealloc(v12, v8, "array.c", 931LL);
}
[7490, 7493, 7496, 7500, 7503, 7507, 7510, 7513] strcpy((char *)(v12 + v9), src);
[7521, 7518] v9 += v11;
[7528, 7524] if ( a4 )
[7530, 7534, 7539, 7546, 7549] sh_xfree(src, "array.c", 936LL);
[7554, 7566, 7558, 7562] if ( a2 != *(_QWORD *)(i + 16) )
{
[7585, 7588, 7591, 7568, 7571, 7574, 7578, 7581] strcpy((char *)(v12 + v9), a3);
[7602, 7596, 7599] v9 += v10;
}
}
}
[7633, 7628] if ( v12 )
[7648, 7635, 7638, 7641, 7645] *(_BYTE *)(v9 + v12) = 0;
[7651, 7655] return v12;
[7656] }
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2B90: using guessed type long quote_string(_QWORD);
// 2C10: using guessed type long sh_xrealloc(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000001DE9) ----------------------------------------------------
char * array_to_kvpair(long a1, int a2)
[7657] {
long v3; // rax
int v4; // ebx
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
int v9; // eax
int v10; // [rsp+14h] [rbp-5Ch]
int v11; // [rsp+18h] [rbp-58h]
int v12; // [rsp+18h] [rbp-58h]
_BYTE *v13; // [rsp+20h] [rbp-50h]
_QWORD *i; // [rsp+28h] [rbp-48h]
char *src; // [rsp+30h] [rbp-40h]
char *srca; // [rsp+30h] [rbp-40h]
char *s; // [rsp+38h] [rbp-38h]
char v18[24]; // [rsp+40h] [rbp-30h] BYREF
unsigned long v19; // [rsp+58h] [rbp-18h]
[7686, 7657, 7661, 7662, 7665, 7666, 7670, 7674, 7677] v19 = __readfsqword(0x28u);
[7690, 7692, 7697, 7699, 7703, 7707, 7710] if ( !a1 || !*(_QWORD *)(a1 + 8) )
[7712, 7717] return 0LL;
[7722] v10 = 128;
[7746, 7751, 7729, 7734, 7741] v13 = (_BYTE *)sh_xmalloc(128LL, "array.c", 964LL);
[7755] v11 = 0;
[7762, 7766] *v13 = 0;
[7777, 8545, 7781, 8537, 7785, 8525, 8529, 8533, 7769, 8541, 7773] for ( i = *(_QWORD **)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD **)(a1 + 16); i = (_QWORD *)i[2] )
{
[7809, 7812, 7817, 7790, 7794, 7797, 7801, 7806] s = (char *)inttostr(*i, v18, 22LL);
[7832, 7825, 7821, 7829] if ( i[1] )
{
[7842, 7845, 7850, 7852, 7834, 7838] if ( (unsigned int)ansic_shouldquote(i[1]) )
[7872, 7875, 7880, 7854, 7858, 7862, 7867] v3 = ansic_quote(i[1], 0LL, 0LL);
else
[7882, 7886, 7890, 7893, 7898] v3 = sh_double_quote(i[1]);
}
else
{
[7900] v3 = 0LL;
}
[7905] src = (char *)v3;
[7909, 7914, 7916, 7920, 7923, 7925] if ( s && *s )
{
[7938, 7940, 7927, 7931, 7935] if ( s[1] )
{
[7942, 7946, 7950, 7953, 7955] if ( s[2] )
[7969, 7972, 7957, 7961, 7964] v4 = strlen(s) + 8;
else
[7979, 7974] v4 = 10;
}
else
{
[7986, 7981] v4 = 9;
}
}
else
{
[7988] v4 = 8;
}
[8000, 8004, 8007, 8009, 7993, 7998] if ( src && *src )
{
[8011, 8015, 8019, 8022, 8024] if ( src[1] )
{
[8034, 8037, 8039, 8026, 8030] if ( src[2] )
[8048, 8041, 8045, 8053] v5 = strlen(src);
else
[8060, 8055] v5 = 2;
}
else
{
[8067, 8062] v5 = 1;
}
}
else
{
[8069] v5 = 0;
}
[8079, 8082, 8085, 8088, 8090, 8093, 8095] if ( v10 <= v4 + v5 + 1 + v11 )
{
[8103, 8106, 8074, 8076, 8109, 8111, 8114] while ( v10 <= v4 + v5 + 1 + v11 )
[8097, 8100] v10 *= 2;
[8131, 8138, 8141, 8146, 8116, 8119, 8122, 8126] v13 = (_BYTE *)sh_xrealloc(v13, v10, "array.c", 975LL);
}
[8160, 8163, 8167, 8170, 8173, 8150, 8153, 8156] strcpy(&v13[v11], s);
[8192, 8194, 8178, 8183, 8185, 8189] if ( s && *s )
{
[8196, 8200, 8204, 8207, 8209] if ( s[1] )
{
[8224, 8211, 8215, 8219, 8222] if ( s[2] )
[8238, 8233, 8226, 8230] v6 = strlen(s);
else
[8240, 8245] v6 = 2;
}
else
{
[8252, 8247] v6 = 1;
}
}
else
{
[8254] v6 = 0;
}
[8264, 8267, 8259, 8262] v7 = v11 + v6;
[8273, 8270] v12 = v7 + 1;
[8283, 8276, 8286, 8279] v13[v7] = 32;
[8289, 8294] if ( src )
{
[8296, 8299, 8302, 8306, 8309, 8313, 8316, 8319] strcpy(&v13[v12], src);
[8324, 8329, 8331, 8335, 8338, 8340] if ( *src )
{
[8353, 8355, 8342, 8346, 8350] if ( src[1] )
{
[8357, 8361, 8365, 8368, 8370] if ( src[2] )
[8376, 8379, 8372, 8384] v8 = strlen(src);
else
[8386, 8391] v8 = 2;
}
else
{
[8393, 8398] v8 = 1;
}
}
else
{
[8400] v8 = 0;
}
[8408, 8413, 8410, 8405] v11 = v12 + v8;
}
else
{
[8418, 8421, 8425, 8428, 8435, 8438, 8415] strcpy(&v13[v12], "\"\"");
[8443] v11 = v12 + 2;
}
[8451, 8455, 8459, 8463, 8466, 8447] if ( i[2] != *(_QWORD *)(a1 + 16) )
{
[8468] v9 = v11++;
[8480, 8484, 8487, 8471, 8474, 8477] v13[v9] = 32;
}
[8490, 8495] if ( src )
[8513, 8516, 8521, 8497, 8501, 8506] sh_xfree(src, "array.c", 991LL);
}
[8551, 8554, 8557, 8560, 8562] if ( v10 <= v11 + 1 )
{
[8568, 8577, 8571, 8574] while ( v10 <= v11 + 1 )
[8564] v10 += 8;
[8609, 8579, 8582, 8585, 8589, 8594, 8601, 8604] v13 = (_BYTE *)sh_xrealloc(v13, v10, "array.c", 993LL);
}
[8613, 8616, 8619, 8623, 8626] v13[v11] = 0;
[8633, 8629] if ( a2 )
{
[8647, 8642, 8635, 8639] srca = (char *)sh_single_quote(v13);
[8651, 8655, 8660, 8667, 8670] sh_xfree(v13, "array.c", 999LL);
[8675, 8679] return srca;
}
[8707, 8683, 8687, 8691, 8700, 8702] return v13;
[8712, 8713, 8711] }
// 2089: conditional instruction was optimized away because %src.8!=0
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2C10: using guessed type long sh_xrealloc(_QWORD, _QWORD, _QWORD, _QWORD);
// 2C18: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// 2C20: using guessed type long ansic_shouldquote(_QWORD);
// 2C28: using guessed type long ansic_quote(_QWORD, _QWORD, _QWORD);
// 2C30: using guessed type long sh_double_quote(_QWORD);
// 2C38: using guessed type long sh_single_quote(_QWORD);
// 1DE9: using guessed type char var_30[24];
//----- (000000000000220A) ----------------------------------------------------
char * array_to_assign(long a1, int a2)
[8714] {
long v3; // rax
int v4; // ebx
int v5; // eax
int v6; // eax
int v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
int v11; // [rsp+14h] [rbp-5Ch]
int v12; // [rsp+18h] [rbp-58h]
int v13; // [rsp+18h] [rbp-58h]
_BYTE *v14; // [rsp+20h] [rbp-50h]
_QWORD *i; // [rsp+28h] [rbp-48h]
char *src; // [rsp+30h] [rbp-40h]
char *srca; // [rsp+30h] [rbp-40h]
char *s; // [rsp+38h] [rbp-38h]
char v19[24]; // [rsp+40h] [rbp-30h] BYREF
unsigned long v20; // [rsp+58h] [rbp-18h]
[8743, 8714, 8718, 8719, 8722, 8723, 8727, 8731, 8734] v20 = __readfsqword(0x28u);
[8747, 8749, 8754, 8756, 8760, 8764, 8767] if ( !a1 || !*(_QWORD *)(a1 + 8) )
[8769, 8774] return 0LL;
[8779] v11 = 128;
[8803, 8808, 8786, 8791, 8798] v14 = (_BYTE *)sh_xmalloc(128LL, "array.c", 1018LL);
[8816, 8812] *v14 = 40;
[8819] v12 = 1;
[9600, 8834, 9604, 8838, 9608, 8842, 9612, 9592, 8826, 9596, 8830] for ( i = *(_QWORD **)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD **)(a1 + 16); i = (_QWORD *)i[2] )
{
[8866, 8869, 8874, 8847, 8851, 8854, 8858, 8863] s = (char *)inttostr(*i, v19, 22LL);
[8889, 8882, 8886, 8878] if ( i[1] )
{
[8899, 8902, 8907, 8909, 8891, 8895] if ( (unsigned int)ansic_shouldquote(i[1]) )
[8929, 8932, 8937, 8911, 8915, 8919, 8924] v3 = ansic_quote(i[1], 0LL, 0LL);
else
[8939, 8943, 8947, 8950, 8955] v3 = sh_double_quote(i[1]);
}
else
{
[8957] v3 = 0LL;
}
[8962] src = (char *)v3;
[8966, 8971, 8973, 8977, 8980, 8982] if ( s && *s )
{
[8992, 8995, 8997, 8984, 8988] if ( s[1] )
{
[8999, 9003, 9007, 9010, 9012] if ( s[2] )
[9026, 9029, 9014, 9018, 9021] v4 = strlen(s) + 8;
else
[9036, 9031] v4 = 10;
}
else
{
[9043, 9038] v4 = 9;
}
}
else
{
[9045] v4 = 8;
}
[9057, 9061, 9064, 9066, 9050, 9055] if ( src && *src )
{
[9068, 9072, 9076, 9079, 9081] if ( src[1] )
{
[9091, 9094, 9096, 9083, 9087] if ( src[2] )
[9105, 9098, 9110, 9102] v5 = strlen(src);
else
[9112, 9117] v5 = 2;
}
else
{
[9124, 9119] v5 = 1;
}
}
else
{
[9126] v5 = 0;
}
[9152, 9136, 9139, 9142, 9145, 9147, 9150] if ( v11 <= v4 + v5 + 1 + v12 )
{
[9160, 9131, 9163, 9133, 9166, 9168, 9171] while ( v11 <= v4 + v5 + 1 + v12 )
[9154, 9157] v11 *= 2;
[9188, 9195, 9198, 9203, 9173, 9176, 9179, 9183] v14 = (_BYTE *)sh_xrealloc(v14, v11, "array.c", 1030LL);
}
[9207] v6 = v12;
[9210, 9213] v13 = v12 + 1;
[9216, 9226, 9219, 9223] v14[v6] = 91;
[9249, 9252, 9229, 9232, 9235, 9239, 9242, 9246] strcpy(&v14[v13], s);
[9257, 9262, 9264, 9268, 9271, 9273] if ( s && *s )
{
[9283, 9286, 9288, 9275, 9279] if ( s[1] )
{
[9290, 9294, 9298, 9301, 9303] if ( s[2] )
[9312, 9305, 9317, 9309] v7 = strlen(s);
else
[9324, 9319] v7 = 2;
}
else
{
[9331, 9326] v7 = 1;
}
}
else
{
[9333] v7 = 0;
}
[9338, 9346, 9341, 9343] v8 = v13 + v7;
[9349, 9352, 9355, 9358, 9362, 9365] v14[v8++] = 93;
[9368, 9371, 9374] v12 = v8 + 1;
[9384, 9377, 9387, 9380] v14[v8] = 61;
[9395, 9390] if ( src )
{
[9410, 9414, 9417, 9420, 9397, 9400, 9403, 9407] strcpy(&v14[v12], src);
[9441, 9425, 9430, 9432, 9436, 9439] if ( *src )
{
[9443, 9447, 9451, 9454, 9456] if ( src[1] )
{
[9458, 9462, 9466, 9469, 9471] if ( src[2] )
[9480, 9473, 9485, 9477] v9 = strlen(src);
else
[9492, 9487] v9 = 2;
}
else
{
[9499, 9494] v9 = 1;
}
}
else
{
[9501] v9 = 0;
}
[9506, 9509, 9511] v12 += v9;
}
[9514, 9518, 9522, 9526, 9530, 9533] if ( i[2] != *(_QWORD *)(a1 + 16) )
{
[9535] v10 = v12++;
[9538, 9541, 9544, 9547, 9551, 9554] v14[v10] = 32;
}
[9562, 9557] if ( src )
[9568, 9573, 9580, 9583, 9588, 9564] sh_xfree(src, "array.c", 1045LL);
}
[9618, 9621, 9624, 9627, 9629] if ( v11 <= v12 + 1 )
{
[9641, 9635, 9644, 9638] while ( v11 <= v12 + 1 )
[9631] v11 += 8;
[9668, 9671, 9676, 9646, 9649, 9652, 9656, 9661] v14 = (_BYTE *)sh_xrealloc(v14, v11, "array.c", 1047LL);
}
[9696, 9699, 9702, 9705, 9708, 9689, 9692] v14[v12] = 41;
[9680, 9712, 9683, 9715, 9686] v14[v12 + 1] = 0;
[9722, 9718] if ( a2 )
{
[9728, 9736, 9731, 9724] srca = (char *)sh_single_quote(v14);
[9740, 9744, 9749, 9756, 9759] sh_xfree(v14, "array.c", 1053LL);
[9768, 9764] return srca;
}
[9796, 9772, 9776, 9780, 9789, 9791] return v14;
[9800, 9801, 9802] }
// 24D6: conditional instruction was optimized away because %src.8!=0
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// 2B88: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// 2C10: using guessed type long sh_xrealloc(_QWORD, _QWORD, _QWORD, _QWORD);
// 2C18: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// 2C20: using guessed type long ansic_shouldquote(_QWORD);
// 2C28: using guessed type long ansic_quote(_QWORD, _QWORD, _QWORD);
// 2C30: using guessed type long sh_double_quote(_QWORD);
// 2C38: using guessed type long sh_single_quote(_QWORD);
// 220A: using guessed type char var_30[24];
//----- (000000000000264B) ----------------------------------------------------
char * array_to_string(long a1, const char *a2, int a3)
[9803] {
size_t v4; // rax
char *v5; // rax
[9826, 9831, 9803, 9807, 9808, 9811, 9815, 9819, 9823] if ( !a1 )
[9833, 9838] return 0LL;
[9840, 9851, 9844, 9848] if ( *(_QWORD *)(a1 + 8) )
[9922, 9926, 9929, 9933, 9936, 9906, 9910, 9914, 9918] return (char *)array_to_string_internal(*(_QWORD *)(*(_QWORD *)(a1 + 16) + 16LL), *(_QWORD *)(a1 + 16), a2, a3);
[9860, 9853] v4 = strlen(&s);
[9865, 9869, 9874, 9881, 9884] v5 = (char *)sh_xmalloc(v4 + 1, "array.c", 1068LL);
[9889, 9896, 9899, 9904, 9941] return strcpy(v5, &s);
[9942] }
// 2B80: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// nfuncs=59 queued=34 decompiled=34 lumina nreq=0 worse=0 better=0
// ALL OK, 34 function(s) have been successfully decompiled
|
long long abort_gzip_signal(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3) {
[880] remove_output_file(0x1, a1, a2, a3);
[880, 884, 885, 887, 892] if (exiting_signal == a0)
[897, 905, 903] _exit(0x2); /* do not return */
[929, 924] signal(a0, 0x0);
[907, 909, 911] return raise(a0);
[919] }
|
long long abort_gzip_signal(unsigned long a0) {
[15791] remove_output_file(0x1);
[15811, 15791, 15795, 15796, 15799, 15803, 15806] if (a0 == exiting_signal)
[15816, 15825, 15822] _exit(0x2); /* do not return */
[15832, 15827] signal(a0, 0x0);
[15840, 15845, 15847, 15837] return raise(a0);
[15857, 15862, 15863, 15864] }
|
long long ipneigh_dump_filter(struct_0 *a0, unsigned long a1) {
[2448] unsigned long long v1; // rax
[2448]
[2448] a0->field_1a = g_402018;
[2465, 2472, 2478, 2448, 2452, 2454, 2457, 2458, 2461] if (g_401ee4) {
v1 = addattr32();
[2512, 2517] if (v1) {
return v1;
[2499, 2500, 2502, 2495] } else {
v1 = *(&g_402010);
[2526] if (!*(&g_402010))
return v1;
[2499, 2500, 2502, 2495] return addattr32();
[4584, 4587, 4590] }
} else {
v1 = *(&g_402010);
[2485] if (*(&g_402010))
return addattr32();
[4584, 4587, 4590] return v1;
[2499, 2500, 2502, 2495] }
}
|
long long ipneigh_dump_filter(unsigned long long a0, unsigned long a1) {
[6192] unsigned int v0; // [bp-0x14]
[6192] struct_0 *v1; // [bp-0x10]
[6192] void* v3; // rax
[6192]
[6192] v1 = a0 + 16;
[6208, 6211, 6215, 6219, 6192, 6196, 6197, 6200, 6204] v1->field_a = g_402918;
[6230, 6234, 6223] if (g_4027e4) {
v0 = addattr32(a0, a1, 0x8, g_4027e4);
[6272, 6264, 6277] if (v0) {
v3 = v0;
[6286] } else {
if (!g_402910) {
v3 = 0;
[6345, 6350, 6351] } else {
v0 = addattr32(a0, a1, 0x9, g_402910);
[6331, 6318, 6326] if (!v0)
v3 = 0;
[6345, 6350, 6351] else
v3 = v0;
[6340] }
}
} else if (!g_402910) {
v3 = 0;
[6345, 6350, 6351] } else {
v0 = addattr32(a0, a1, 0x9, g_402910);
[6331, 6318, 6326] if (!v0)
v3 = 0;
[6345, 6350, 6351] else
v3 = v0;
[6340] }
return v3;
}
|
long double simple_round(int a1, long double a2)
[752] {
long double v10; // fst6
long double v11; // fst7
long double v12; // fst7
long v14; // [rsp+20h] [rbp-18h]
[770, 803, 775, 778, 780, 752, 785, 787, 756, 791, 760, 795, 764, 799] v10 = 9.223372036854775807e18 * (long double)(long)(a2 / 9.223372036854775807e18);
[805] v11 = a2 - v10;
[832, 835, 807, 810, 816, 823, 825, 828] switch ( a1 )
{
case 0:
[912, 916, 919, 924, 925, 926] v14 = simple_round_ceiling(v11);
[931] v12 = v10;
[934] break;
case 1:
[960, 944, 948, 951, 956, 958] v14 = simple_round_floor(v11);
[965] v12 = v10;
[968] break;
case 2:
[992, 976, 980, 983, 988, 990] v14 = simple_round_from_zero(v11);
[997] v12 = v10;
[1000] break;
case 3:
[848, 852, 855, 860, 861, 862] v14 = simple_round_to_zero(v11);
[867] v12 = v10;
break;
case 4:
[900, 901, 902, 888, 892, 895] v14 = simple_round_nearest(v11);
[907] v12 = v10;
[910] break;
default:
[11732] JUMPOUT(0x2DD4LL);
}
[874, 876, 870] return v12 + (long double)v14;
[880] }
// 343: control flows out of bounds to 2DD4
//----- (00000000000003F0) ----------------------------------------------------
bool include_field(unsigned long a1)
[1008] {
_QWORD *v1; // rax
[1008] v1 = (_QWORD *)frp;
[1018, 1020, 1015] if ( !frp )
[1072, 1076] return a1 == 1;
[1039] while ( 1 )
{
[1042, 1046, 1039] if ( *v1 == -1LL )
[1048, 1050] return 0;
[1024, 1027, 1029, 1033, 1039] if ( a1 >= *v1 && v1[1] >= a1 )
break;
[1035] v1 += 2;
}
[1050] return 1;
[1061, 1079] }
//----- (0000000000000440) ----------------------------------------------------
int emit_mandatory_arg_note()
[1088] {
FILE *v0; // rbp
char *v1; // rax
[1088, 1098, 1096, 1103] v0 = stdout;
[1089, 1110] v1 = dcgettext(0LL, "\nMandatory arguments to long options are mandatory for short options too.\n", 5);
[1122, 1115, 1118, 1119] return fputs_unlocked(v1, v0);
}
//----- (0000000000000470) ----------------------------------------------------
int print_padded_number()
[1136] {
FILE *v0; // rsi
int result; // eax
[1136, 1147] v0 = stdout;
[1154, 1157] if ( format_str_prefix )
{
[1147, 1140, 1159] fputs_unlocked(format_str_prefix, stdout);
[1164] v0 = stdout;
}
[1178, 1171] result = fputs_unlocked(padding_buffer, v0);
[1193, 1190] if ( format_str_suffix )
[1195, 1206, 1183] return fputs_unlocked(format_str_suffix, stdout);
[1202] return result;
[1216, 1220] }
//----- (00000000000004D0) ----------------------------------------------------
long simple_strtod_int(char *s1, const char **a2, long double *a3, char *a4)
[1232] {
const char *v4; // r14
long double v5; // fst7
char v6; // bp
unsigned int v7; // r15d
unsigned int v8; // r13d
char v9; // al
unsigned int v11; // [rsp+10h] [rbp-48h]
char v12; // [rsp+17h] [rbp-41h]
[1248, 1232, 1234, 1236, 1239, 1241, 1243, 1244, 1245] v4 = s1;
[1260, 1255] v12 = 0;
[1265, 1252] if ( *s1 == 45 )
{
[1267] v12 = 1;
[1272] v4 = s1 + 1;
}
[1281, 1276] v5 = 0.0;
[1283] v6 = 0;
[1285] v7 = 0;
[1288] v11 = 0;
[1296, 1302] *a4 = v12;
[1304, 1307] *a2 = v4;
[1361] while ( 1 )
{
[1361] v8 = *v4;
[1368, 1371, 1365] v9 = c_isdigit(v8);
[1376, 1379, 1381, 1383] if ( !v9 )
break;
[1389, 1391, 1394, 1398, 1400, 1402, 1404] if ( 0.0 != v5 || v8 != 48 )
[1410, 1406] ++v7;
[1312, 1316] if ( v7 > 0x12 )
{
[1322, 1318] if ( v7 > 0x1B )
[1504, 1506, 1514] return 2;
[1328] v11 = 1;
}
[1336, 1345, 1342] ++v4;
[1349] v6 = v9;
[1351] *a2 = v4;
[1385, 1354, 1356, 1359] v5 = v5 * 10.0 + (long double)(int)(v8 - 48);
}
[1472, 1475, 1416, 1480, 1419, 1483, 1485, 1458, 1465] if ( v6 || !strncmp(v4, decimal_point, decimal_point_length) )
{
[1426, 1421] if ( v12 )
[1428] v5 = -v5;
[1435, 1430] *a3 = v5;
}
else
{
[1489, 1497, 1487] return 3;
}
[1441, 1437] return v11;
[1445, 1446, 1447, 1449, 1451, 1453, 1455] }
// 27B4: using guessed type int decimal_point_length;
// 5244: using guessed type float LC19;
// 5AA0: using guessed type long c_isdigit(_QWORD);
//----- (00000000000005F0) ----------------------------------------------------
long simple_strtod_float(char *a1, const char **a2, long double *a3, _QWORD *a4)
[1520] {
unsigned int v6; // r12d
long v7; // r15
const char *v8; // r14
unsigned int v10; // eax
const char *v11; // rax
long v12; // rdx
long double v13; // fst7
long double v14; // fst7
long double v15; // fst6
long double v16; // fst7
char v17; // [rsp+16h] [rbp-62h] BYREF
char v18; // [rsp+17h] [rbp-61h] BYREF
const char *v19; // [rsp+18h] [rbp-60h] BYREF
LONG_DOUBLE_16 v20; // [rsp+20h] [rbp-58h] BYREF
unsigned long v21; // [rsp+38h] [rbp-40h]
[1536, 1539, 1543, 1520, 1552, 1522, 1524, 1526, 1529, 1531, 1532, 1535] v21 = __readfsqword(0x28u);
[1557, 1559] *a4 = 0LL;
[1576, 1571, 1566] v6 = simple_strtod_int(a1, a2, a3, &v17);
[1579, 1582] if ( v6 <= 1 )
{
[1584] v7 = decimal_point_length;
[1591] v8 = *a2;
[1601, 1604, 1607, 1612, 1614, 1616, 1621, 1594, 1630] if ( !strncmp(*a2, decimal_point, decimal_point_length) )
{
[1664, 1675] *a2 = &v8[v7];
[1688] *(long double *)&v20 = 0.0;
[1664, 1668, 1670, 1678, 1683, 1692] v10 = simple_strtod_int((char *)&v8[v7], &v19, (long double *)&v20.value, &v18);
[1697, 1700] if ( v10 > 1 )
[1723, 1700, 1726] return v10;
[1707] if ( v10 == 1 )
[1707, 1702] v6 = 1;
[1716, 1711] v10 = 3;
[1721] if ( v18 )
{
[1723] return v10;
}
else
{
[1728, 1760, 1734, 1739, 1742, 1745, 1748, 1752, 1756, 1757, 1759] v13 = powerld((int)v19 - *(_DWORD *)a2, 10.0);
[1765, 1766, 1767, 1772, 1776] v14 = *(long double *)&v20 / v13;
[1778] v15 = *a3;
[1781] if ( v17 )
[1808, 1810] v16 = v15 - v14;
else
[1783] v16 = v14 + v15;
[1785] *a3 = v16;
[1788] *a4 = v12;
[1792, 1795] *a2 = v11;
}
}
}
[1640, 1636] return v6;
[1643, 1644, 1645, 1647, 1649, 1651, 1653] }
// 6FC: variable 'v12' is possibly undefined
// 700: variable 'v11' is possibly undefined
// 27B4: using guessed type int decimal_point_length;
// 5244: using guessed type float LC19;
// 5F0: using guessed type long double var_58;
//----- (0000000000000720) ----------------------------------------------------
long unit_to_umax(const char *src)
[1824] {
size_t v1; // rax
size_t v2; // rbx
size_t v3; // r14
const char *v4; // r12
char *v5; // r13
char v6; // al
const char *v7; // r8
char *v9; // rax
char *v10; // r14
long v11; // r12
char *v12; // rax
char *v13; // [rsp+18h] [rbp-40h] BYREF
long v14[7]; // [rsp+20h] [rbp-38h] BYREF
[1824, 1826, 1828, 1830, 1831, 1834, 1835, 1839, 1848] v14[1] = __readfsqword(0x28u);
[1853, 1855] v1 = strlen(src);
[1860] v13 = 0LL;
[1872, 1869] if ( v1 )
{
[1883] v2 = v1;
[1886] v3 = v1 - 1;
[1890] v4 = src;
[1893] v5 = 0LL;
[1896, 1878] v6 = c_isdigit((unsigned int)src[v1 - 1]);
[1901] v7 = "KMGTPEZY";
[1908, 1910] if ( !v6 )
{
[2032, 2041, 2036] v9 = (char *)xmalloc(v2 + 2);
[2052] v10 = &v9[v3];
[2058] v4 = v9;
[2061] v13 = v10;
[2049, 2066, 2046, 2055] memcpy(v9, src, v2);
[2081, 2120, 2125, 2130, 2132, 2071, 2075, 2077] if ( *v10 != 105 || v2 <= 1 || (unsigned char)c_isdigit((unsigned int)*(v10 - 1)) )
{
[2083, 2087] v5 = (char *)v4;
[2090] v7 = "KMGTPEZY0";
[2097] v13 = v10 + 2;
[2112, 2107, 2102] *(_WORD *)(v10 + 1) = 66;
}
else
{
[2134] *v10 = 0;
[2138] v7 = "KMGTPEZY";
[2146, 2143] v5 = (char *)v4;
}
}
}
else
{
[2016] v4 = src;
[2019] v7 = "KMGTPEZY";
[2026, 2029] v5 = 0LL;
}
[1922, 1957, 1927, 1930, 1963, 1935, 1937, 1943, 1912, 1948, 1917, 1951] if ( (unsigned int)xstrtoumax(v4, &v13, 10LL, v14, v7) || *v13 || !v14[0] )
{
[2154, 2151] free(v5);
[2162, 2181, 2159] v11 = quote(src);
[2184, 2179, 2172, 2167] v12 = dcgettext(0LL, "invalid unit size: %s", 5);
[2209, 2189, 2192, 2194, 2199, 2202, 2204] error(1, 0, v12, v11);
}
[1969, 1972] free(v5);
[1987, 1996, 2002, 1977, 1982] return v14[0];
[2006, 2007, 2008, 2010, 2012, 2014] }
// 5AA0: using guessed type long c_isdigit(_QWORD);
// 5AC0: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5AD0: using guessed type long xmalloc(_QWORD);
// 5AE0: using guessed type long quote(_QWORD);
//----- (00000000000008B0) ----------------------------------------------------
long field_sep(unsigned char a1)
[2224] {
const unsigned short **v1; // rax
int v2; // edx
[2224, 2229, 2230, 2232, 2236] v1 = _ctype_b_loc();
[2251, 2254] LOBYTE(v2) = a1 == 10;
[2241, 2244, 2248, 2225, 2257, 2261] return v2 | (*v1)[a1] & 1u;
[2264, 2265, 2263] }
// 8D5: variable 'v2' is possibly undefined
//----- (00000000000008E0) ----------------------------------------------------
signed char * next_field(signed char **a1)
[2272] {
signed char *v2; // r12
signed char v3; // di
signed char *v4; // rbx
int v5; // eax
[2272, 2274, 2280, 2281, 2284, 2285] v2 = *a1;
[2288, 2285] v3 = **a1;
[2299, 2293] if ( delimiter == 128 )
{
[2352] v4 = v2;
[2360, 2355, 2358] if ( v3 )
{
[2381, 2385, 2390, 2392, 2394] while ( (unsigned char)field_sep(v3) )
{
[2368] v3 = *++v4;
[2376, 2379, 2372] if ( !v3 )
goto LABEL_6;
}
[2410, 2404, 2407] while ( *v4 )
{
[2412, 2417, 2419, 2404] if ( (unsigned char)field_sep(*v4) )
{
[2421] *a1 = v4;
[2425] return v2;
}
[2400] ++v4;
}
}
}
else
{
[2305] v4 = v2;
[2308, 2310, 2312, 2315, 2317, 2301] if ( delimiter != v3 && v3 )
{
do
[2320] v5 = *++v4;
[2324, 2328, 2330, 2332, 2334] while ( (_BYTE)v5 && delimiter != v5 );
}
}
LABEL_6:
[2336] *a1 = v4;
[2340, 2343] return v2;
[2432, 2344, 2345, 2347, 2428, 2429, 2430] }
// 2784: using guessed type int delimiter;
//----- (0000000000000990) ----------------------------------------------------
void parse_format_string(long a1)
[2448] {
char *v1; // r12
long v3; // rax
long v4; // rdx
char v5; // dl
long v6; // rbx
char v7; // r14
const char *v8; // rdi
size_t v9; // rax
char v10; // dl
int *v11; // rax
int *v12; // r13
long v13; // rbx
char v14; // dl
char *v15; // rax
char *v16; // rax
char *v17; // r13
char v18; // dl
char v19; // cl
char *v20; // rsi
char *v21; // rax
bool v22; // zf
const char *v23; // r14
const char *v24; // r12
const char *v25; // rbx
long v26; // rax
long v27; // r15
const char *v28; // r13
char *v29; // rax
const char *v30; // rbx
long v31; // rax
const unsigned short **v32; // rax
long v33; // rcx
long v34; // r12
char *v35; // rax
long v36; // r12
char *v37; // rax
long v38; // r12
char *v39; // rax
long v40; // r12
char *v41; // rax
long v42; // r12
char *v43; // rax
long v44; // r12
char *v45; // rax
const char *v46; // [rsp-8h] [rbp-60h]
char *nptr; // [rsp+8h] [rbp-50h]
char *endptr[9]; // [rsp+10h] [rbp-48h] BYREF
v1 = 0LL;
[2464, 2448, 2450, 2452, 2454, 2456, 2459, 2460, 2463] endptr[1] = (char *)__readfsqword(0x28u);
[2468, 2477] v3 = 0LL;
[2482] endptr[0] = 0LL;
[2484, 2493] while ( 1 )
[2516] {
v5 = *(_BYTE *)(a1 + v3);
[2516] if ( v5 != 37 )
[2521, 2524] {
if ( v5 )
[2496, 2498] {
v4 = 1LL;
[2504] goto LABEL_4;
}
v34 = quote(a1);
[3442, 3461, 3439] v35 = dcgettext(0LL, "format %s has no %% directive", 5);
[3464, 3459, 3452, 3447] error(1, 0, v35, v34);
[3469, 3472, 3474, 3479, 3482, 3484] LABEL_56:
v36 = quote(a1);
[3489, 3492, 3511] v37 = dcgettext(0LL, "invalid format %s, directive must be %%[0]['][-][N][.][N]f", 5);
[3497, 3514, 3509, 3502] error(1, 0, v37, v36);
[3522, 3524, 3529, 3532, 3534, 3539, 3519] }
v6 = v3 + 1;
[2531] if ( *(_BYTE *)(a1 + v3 + 1) != 37 )
[2526, 2535] break;
v4 = 2LL;
[2537, 2542] LABEL_4:
v3 += v4;
[2509] ++v1;
[2512] }
v7 = 0;
[2544] v8 = (const char *)(a1 + v6);
[2552, 2547, 2559] do
{
while ( 1 )
[2582] {
while ( 1 )
[2563] {
v9 = strspn(v8, " ");
[2560, 2563] v6 += v9;
[2568] v8 = (const char *)(a1 + v6);
[2571] v10 = *(_BYTE *)(a1 + v6);
[2576, 2571] if ( v10 != 39 )
[2579, 2582] break;
grouping = 1;
[2944] ++v6;
[2954] v8 = (const char *)(a1 + v6);
[2963, 2958] }
if ( v10 != 48 )
[2588, 2591] break;
++v6;
[2976] v7 = 1;
[2980] v8 = (const char *)(a1 + v6);
[2986, 2991] }
}
while ( v9 );
[2600, 2597] nptr = (char *)(a1 + v6);
[2602] v11 = _errno_location();
[2612, 2607] *v11 = 0;
[2630] v12 = v11;
[2636] v13 = strtol((const char *)(a1 + v6), endptr, 10);
[2627, 2602, 2639, 2649, 2617, 2622] if ( *v12 == 34 || v13 == 0x8000000000000000LL )
[2658, 2668, 2673, 2644, 2676, 2652] {
LABEL_60:
v44 = quote(a1);
[3697, 3716, 3694] v45 = dcgettext(0LL, "invalid format %s (width overflow)", 5);
[3714, 3707, 3702, 3719] error(1, 0, v45, v44);
[3724, 3727, 3729, 3734, 3737, 3739] setup_padding_buffer(1uLL);
[3740] return;
}
[2689, 2682, 2692, 2687] if ( endptr[0] != nptr && v13 )
{
[2707, 2715, 2701, 2694] if ( debug && padding_width )
{
[2721, 2730, 2724, 2733] if ( v7 && v13 > 0 )
{
LABEL_20:
[2746, 2739] zero_padding_width = v13;
goto LABEL_21;
}
[3184, 3177, 3186, 3172] v29 = dcgettext(0LL, "--format padding overriding --padding", 5);
[3200, 3191, 3193, 3195, 3198] error(0, 0, v29);
}
[3208, 3205] if ( v13 < 0 )
{
[3279] padding_alignment = 0;
[3289, 3299, 3292] padding_width = -v13;
}
else
{
[3210, 3213] if ( v7 )
goto LABEL_20;
[3226, 3219] padding_width = v13;
}
}
LABEL_21:
[2752, 2757, 2760] v14 = *endptr[0];
[2763] v15 = &endptr[0][-a1];
[2760, 2766, 2768] if ( !*endptr[0] )
{
[3544, 3547, 3566] v38 = quote(a1);
[3552, 3569, 3564, 3557] v39 = dcgettext(0LL, "format %s ends in %%", 5);
[3584, 3587, 3589, 3574, 3577, 3579] error(1, 0, v39, v38);
LABEL_58:
[3616, 3594, 3597] v40 = quote(a1);
[3602, 3619, 3614, 3607] v41 = dcgettext(0LL, "invalid precision in format %s", 5);
[3624, 3627, 3629, 3634, 3637, 3639] error(1, 0, v41, v40);
LABEL_59:
[3666, 3644, 3647] v42 = quote(a1);
[3664, 3657, 3652, 3669] v43 = dcgettext(0LL, "format %s has too many %% directives", 5);
[3684, 3687, 3689, 3674, 3677, 3679] error(1, 0, v43, v42);
goto LABEL_60;
}
[2777, 2774] if ( v14 != 46 )
goto LABEL_23;
[3304] *v12 = 0;
[3312] v30 = &v15[a1 + 1];
[3328, 3325, 3322, 3317] v31 = strtol(v30, endptr, 10);
[3333] v22 = *v12 == 34;
[3338] user_precision = v31;
[3345] if ( v22 )
goto LABEL_58;
[3354, 3351] if ( v31 < 0 )
goto LABEL_58;
[3360] v32 = _ctype_b_loc();
[3365] v33 = *v30;
[3369, 3372, 3375, 3379, 3385, 3388] if ( ((*v32)[v33] & 1) != 0 || (_BYTE)v33 == 43 )
goto LABEL_58;
[3394, 3402, 3399] v14 = *endptr[0];
[3408, 3405] v15 = &endptr[0][-a1];
LABEL_23:
[2786, 2783] if ( v14 != 102 )
goto LABEL_56;
[2792] v16 = v15 + 1;
[2796] v17 = &v16[a1];
[2801, 2796] v18 = v16[a1];
[2808, 2810, 2806] if ( !v18 )
{
[3425, 3434, 3428] if ( v1 )
goto LABEL_31;
LABEL_32:
[2906, 2899, 2908] if ( !dev_debug )
[2913, 2906, 2922] return;
LABEL_36:
[3012, 3017, 3022, 3029, 3032, 3035] v23 = (const char *)quote_n(2LL);
[3041, 3046] v24 = "Left";
[3053] v25 = "yes";
[3060] v26 = quote_n(1LL);
[3072, 3065, 3075] v27 = padding_width;
[3082] v28 = (const char *)v26;
[3092] if ( padding_alignment )
[3092, 3085] v24 = "Right";
[3110] if ( !grouping )
[3096, 3110, 3103] v25 = "no";
[3114, 3116, 3141] v46 = (const char *)quote_n(0LL);
[3138, 3142, 3145, 3150, 3152, 3121, 3154, 3156, 3158, 3128, 3131] _fprintf_chk(
stderr,
1LL,
"format String:\n input: %s\n grouping: %s\n padding width: %ld\n alignment: %s\n prefix: %s\n suffix: %s\n",
v46,
v25,
v27,
v24,
v28,
v23);
[2913, 3163, 3167] return;
}
do
{
[2825] while ( 1 )
{
[2825] v19 = v16[a1 + 1];
[2830] v20 = v16 + 1;
[2834, 2837] if ( v18 == 37 )
break;
[2816, 2825] v18 = (v16++)[a1 + 1];
[2818, 2821, 2823] if ( !v19 )
goto LABEL_30;
}
[2842, 2839] if ( v19 != 37 )
goto LABEL_59;
[2848] v16 += 2;
[2852] v18 = v16[a1];
}
[2857, 2859] while ( v18 );
LABEL_30:
[2864, 2861] if ( v1 )
{
LABEL_31:
[2870] v20 = v1;
[2873, 2876, 2870] v21 = (char *)ximemdup0(a1, v1);
[2881] v22 = *v17 == 0;
[2886] format_str_prefix = v21;
[2893] if ( v22 )
goto LABEL_32;
}
[3239, 3234, 3246, 3231] format_str_suffix = (char *)xstrdup(v17, v20);
[3256, 3253, 3262] if ( dev_debug )
goto LABEL_36;
[2928, 2913] }
// 2788: using guessed type int padding_alignment;
// 2790: using guessed type long user_precision;
// 27B0: using guessed type char dev_debug;
// 27C0: using guessed type char debug;
// 27F0: using guessed type long zero_padding_width;
// 27F8: using guessed type long padding_width;
// 2810: using guessed type int grouping;
// 5AE0: using guessed type long quote(_QWORD);
// 5B10: using guessed type long ximemdup0(_QWORD, _QWORD);
// 5B18: using guessed type long quote_n(_QWORD);
// 5B28: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 5B30: using guessed type long xstrdup(_QWORD, _QWORD);
//----- (0000000000000EA0) ----------------------------------------------------
void setup_padding_buffer(unsigned long a1)
[3744] {
[3744, 3751] if ( padding_buffer_size <= a1 )
{
[3775] padding_buffer_size = a1 + 1;
[3782, 3787, 3760, 3794, 3764, 3768] padding_buffer = (char *)xrealloc(padding_buffer);
}
[3753, 3798] }
// 2800: using guessed type long padding_buffer_size;
// 5B38: using guessed type long xrealloc(_QWORD);
//----- (0000000000000EE0) ----------------------------------------------------
_BOOL8 valid_suffix(char a1)
[3808] {
[3808, 3812, 3816, 3823, 3828, 3831, 3834, 3838] return strchr("KMGTPEZY", a1) != 0LL;
[3841] }
//----- (0000000000000F10) ----------------------------------------------------
void simple_strtod_fatal(int a1, long a2)
[3856] {
const char *v2; // rbp
long v3; // r12
char *v4; // rax
[3872, 3879, 3881, 3885, 3856, 3888, 3858, 3859, 3863, 3866] switch ( a1 )
{
case 0:
case 1:
[4044] abort();
case 2:
[4032] v2 = "value too large to be converted: %s";
[4039] goto LABEL_3;
case 3:
[3896] v2 = "invalid number: %s";
goto LABEL_3;
case 4:
[3968, 3975] v2 = "rejecting suffix in input: %s (consider using --from)";
[3982] if ( inval_style == 3 )
[3982] return;
goto LABEL_4;
case 5:
[4000] v2 = "invalid suffix in input: %s";
[4007] goto LABEL_3;
case 6:
[4016, 4023] v2 = "missing 'i' suffix in input: %s (e.g Ki/Mi/Gi)";
LABEL_3:
[3910, 3903] if ( inval_style != 3 )
{
LABEL_4:
[3912, 3930, 3915] v3 = quote(a2);
[3920, 3928, 3923, 3933] v4 = dcgettext(0LL, v2, 5);
[3938, 3944, 3947, 3953, 3956, 3961] error(conv_exit_code, 0, v4, v3);
}
return;
default:
[11743] JUMPOUT(0x2DDFLL);
}
[3949, 3984, 3991, 3988, 3989, 3958, 3959] }
// F30: control flows out of bounds to 2DDF
// 2820: using guessed type int inval_style;
// 5AE0: using guessed type long quote(_QWORD);
//----- (0000000000000FE0) ----------------------------------------------------
long double_to_human_constprop_0(int a1, char *a2, int a3, int a4, int a5, long double a6)
{
char *v17; // rbx
signed int v19; // eax
char v20; // dl
long v21; // r13
unsigned int v22; // ebp
long v23; // rdi
long double v24; // fst7
char v25; // dl
_BOOL4 v26; // r15d
const char *v27; // rax
unsigned int v28; // eax
const char *v29; // rax
const char *v30; // rdx
long double v31; // fst7
long double v32; // fst7
signed int v33; // eax
double v34; // xmm0_8
long double v35; // fst7
char *v36; // rax
char *v37; // rax
char v38; // [rsp+10h] [rbp-C8h]
long double v39; // [rsp+10h] [rbp-C8h]
long double v40; // [rsp+10h] [rbp-C8h]
long double v41; // [rsp+10h] [rbp-C8h]
long double v42; // [rsp+10h] [rbp-C8h]
long double v43; // [rsp+10h] [rbp-C8h]
char v44; // [rsp+10h] [rbp-C8h]
char v45; // [rsp+10h] [rbp-C8h]
long double v46; // [rsp+20h] [rbp-B8h]
double v47; // [rsp+30h] [rbp-A8h]
char v48; // [rsp+3Bh] [rbp-9Dh]
float v49; // [rsp+3Ch] [rbp-9Ch]
unsigned int v50; // [rsp+4Ch] [rbp-8Ch] BYREF
char v51; // [rsp+50h] [rbp-88h] BYREF
char v52; // [rsp+51h] [rbp-87h] BYREF
char v53; // [rsp+52h] [rbp-86h] BYREF
unsigned long v54; // [rsp+98h] [rbp-40h]
v54 = __readfsqword(0x28u);
v17 = &v52;
v51 = 37;
if ( a4 )
{
v52 = 39;
v17 = &v53;
}
if ( zero_padding_width )
v17 += (int)_snprintf_chk(v17, 62LL, 1LL, 63LL, "0%ld", zero_padding_width);
if ( dev_debug )
{
_fprintf_chk(stderr, 1LL, "double_to_human:\n");
if ( !a3 )
{
v43 = powerld(a1, 10.0);
v40 = simple_round(a5, a6 * v43) / v43;
if ( dev_debug )
{
v30 = " no scaling, returning (grouped) value: %'.*Lf\n";
if ( !a4 )
v30 = " no scaling, returning value: %.*Lf\n";
_fprintf_chk(stderr, 1LL, v30, (unsigned int)a1);
}
goto LABEL_8;
}
v45 = dev_debug;
v33 = default_scale_base(a3);
v50 = 0;
v34 = (double)v33;
v47 = (double)v33;
v35 = expld(v33, &v50, a6);
v46 = v35;
v20 = v45;
if ( v45 )
{
_fprintf_chk(stderr, 1LL, " scaled value to %Lf * %0.f ^ %u\n", v35, v34, v50);
v20 = dev_debug;
}
}
else
{
v38 = dev_debug;
if ( !a3 )
{
v39 = powerld(a1, 10.0);
v40 = simple_round(a5, a6 * v39) / v39;
LABEL_8:
strcpy(v17, ".*Lf");
if ( (unsigned int)_snprintf_chk(a2, 128LL, 1LL, -1LL, &v51, (unsigned int)a1, *(_QWORD *)&v40) > 0x7F )
{
v36 = dcgettext(0LL, "failed to prepare value '%Lf' for printing", 5);
error(1, 0, v36);
}
return __readfsqword(0x28u) ^ v54;
}
v19 = default_scale_base(a3);
v50 = 0;
v47 = (double)v19;
v46 = expld(v19, &v50, a6);
v20 = v38;
}
v21 = user_precision;
v22 = v50;
if ( user_precision == -1 )
{
v44 = v20;
v32 = absld(v46);
v20 = v44;
v49 = LC19;
LODWORD(v23) = v32 < 10.0;
}
else
{
v23 = 3 * v50;
if ( v23 > user_precision )
LODWORD(v23) = user_precision;
v49 = LC19;
}
v48 = v20;
v41 = powerld(v23, 10.0);
v42 = simple_round(a5, v46 * v41) / v41;
v24 = absld(v42);
v25 = v48;
if ( v24 >= v47 )
{
v50 = ++v22;
v42 = v42 / v47;
}
v26 = v42 != 0.0 && (v31 = absld(v42), v25 = v48, v49 > v31) && v22 != 0;
if ( v25 )
{
_fprintf_chk(stderr, 1LL, " after rounding, value=%Lf * %0.f ^ %u\n", v42, v47, v22);
v22 = v50;
v21 = user_precision;
}
strcpy(v17 + 4, "%s");
if ( v21 != -1 )
v26 = v21;
*(_DWORD *)v17 = 1716267566;
v27 = suffix_power_char(v22);
v28 = _snprintf_chk(a2, 127LL, 1LL, -1LL, &v51, v26, *(_OWORD *)&v42, v27);
if ( v28 <= 0x7E )
{
if ( a3 == 4 && v50 )
strncat(a2, "i", 127LL - (int)v28);
if ( dev_debug )
{
v29 = (const char *)quote(a2);
_fprintf_chk(stderr, 1LL, " returning value: %s\n", v29);
}
return __readfsqword(0x28u) ^ v54;
}
v37 = dcgettext(0LL, "failed to prepare value '%Lf' for printing", 5);
error(1, 0, v37);
return prepare_padded_number(1LL, a6);
}
// 2790: using guessed type long user_precision;
// 27B0: using guessed type char dev_debug;
// 27F0: using guessed type long zero_padding_width;
// 5244: using guessed type float LC19;
// 5AE0: using guessed type long quote(_QWORD);
// 5B28: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 5B50: using guessed type long _snprintf_chk(_QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
//----- (0000000000001580) ----------------------------------------------------
long prepare_padded_number(long a1, long double a2)
[5504] {
unsigned int v11; // r13d
char *v12; // rax
size_t v14; // rax
size_t v15; // rax
int v16; // ebp
char *v17; // rax
const char *v18; // rax
const char *v19; // rax
char *v20; // rax
unsigned int v21; // [rsp+4h] [rbp-B4h] BYREF
long v22; // [rsp+8h] [rbp-B0h] BYREF
char s[136]; // [rsp+10h] [rbp-A8h] BYREF
unsigned long v24; // [rsp+98h] [rbp-20h]
[5504, 5506, 5508, 5511, 5512, 5519, 5526, 5535] v24 = __readfsqword(0x28u);
[5568, 5572] if ( user_precision != -1 )
[5568, 5564] a1 = user_precision;
[5543, 5545, 5577, 5550, 5557] expld(0xAu, &v21, a2);
[5592, 5593, 5595, 5590] if ( scale_to )
{
[5736, 5740, 5743] if ( v21 > 0x1A )
{
LABEL_6:
[5626] v11 = 0;
[5636, 5629] if ( inval_style != 3 )
{
[5650, 5643, 5652, 5638] v12 = dcgettext(0LL, "value too large to be printed: '%Lg' (cannot handle values > 999Y)", 5);
[5664, 5700, 5670, 5672, 5709, 5679, 5689, 5684, 5657, 5690, 5692] error(conv_exit_code, 0, v12);
}
[5682, 5684, 5722] return v11;
}
goto LABEL_10;
}
[5601, 5605, 5608, 5611, 5615] if ( a1 + (unsigned long)v21 <= 0x12 )
{
[5624, 5621] if ( v21 > 0x1A )
goto LABEL_6;
LABEL_10:
[5763, 5766, 5773, 5582, 5584, 5745, 5776, 5750, 5783, 5757] double_to_human_constprop_0(a1, s, scale_to, grouping, round_style, a2);
[5795, 5796, 5797, 5800, 5788] if ( suffix )
{
[5802, 5805] v14 = strlen(s);
[5824, 5829, 5810, 5815, 5818, 5821] _strncat_chk(s, suffix, 127 - v14, 128LL);
}
[5841, 5834] if ( dev_debug )
{
[6128, 6131] v19 = (const char *)quote(s);
[6179, 6148, 6180, 6181, 6155, 6162, 6165, 6167, 6136, 6174, 6143] _fprintf_chk(stderr, 1LL, "formatting output:\n value: %Lf\n humanized: %s\n", a2, v19);
}
[5857, 5854, 5847] v15 = strlen(s);
[5865, 5867, 5870, 5862] if ( padding_width && padding_width > v15 )
{
[6051] v22 = padding_width;
[6016, 6048, 6023, 6056, 6030, 6035, 6041] mbsalign(s, padding_buffer, padding_buffer_size, &v22, (unsigned int)padding_alignment, 2LL);
[6068, 6061] if ( dev_debug )
{
[6081, 6074] v18 = (const char *)quote(padding_buffer);
[6115, 6086, 6093, 6098, 6105, 6108, 6110] _fprintf_chk(stderr, 1LL, " After padding: %s\n", v18);
}
}
else
{
[5880, 5876] setup_padding_buffer(v15 + 1);
[5892, 5885, 5895] strcpy(padding_buffer, s);
}
[5906, 5900] return 1;
}
[5920] v11 = 0;
[5930, 5923] if ( inval_style != 3 )
{
[5936] v16 = conv_exit_code;
[5950, 5947, 5942] if ( a1 )
{
[5963, 5956, 5965] v17 = dcgettext(0LL, "value/precision too large to be printed: '%Lg/%lu' (consider using --to)", 5);
[5988, 5991, 5994, 5996, 6001, 5970, 6003, 6004, 5977, 5979, 5981] error(v16, 0, v17, a1);
}
else
{
[6192, 6201, 6199] v20 = dcgettext(0LL, "value too large to be printed: '%Lg' (consider using --to)", 5);
[6213, 6215, 6217, 6224, 6227, 6229, 6238, 6234, 6236, 6206] error(v16, 0, v20);
}
}
[5722, 5715] return v11;
[5728, 5730, 5725, 5726] }
// 2788: using guessed type int padding_alignment;
// 2790: using guessed type long user_precision;
// 27A8: using guessed type int round_style;
// 27B0: using guessed type char dev_debug;
// 27F8: using guessed type long padding_width;
// 2800: using guessed type long padding_buffer_size;
// 2810: using guessed type int grouping;
// 2820: using guessed type int inval_style;
// 2824: using guessed type int scale_to;
// 5AE0: using guessed type long quote(_QWORD);
// 5B28: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 5B60: using guessed type long _strncat_chk(_QWORD, _QWORD, _QWORD, _QWORD);
// 5B70: using guessed type long mbsalign(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000001870) ----------------------------------------------------
long simple_strtod_human_constprop_0(
char *a1,
const char **a2,
long double *a3,
unsigned int *a4,
int a5)
{
unsigned int v8; // r12d
int v9; // eax
const char *v10; // r15
unsigned int v11; // r13d
int v12; // edi
int v13; // r8d
long double v14; // fst7
const char *i; // rdx
const char *v17; // r15
unsigned char v18; // al
long v19; // rdx
long v20; // rcx
long v21; // rsi
const char *v22; // r15
const char *v23; // rax
bool v24; // zf
long double v25; // fst7
unsigned int v27; // [rsp+20h] [rbp-58h]
int v28; // [rsp+20h] [rbp-58h]
int v29; // [rsp+3Ch] [rbp-3Ch]
if ( dev_debug )
{
v22 = (const char *)quote_n(1LL);
v23 = (const char *)quote_n(0LL);
_fprintf_chk(
stderr,
1LL,
"simple_strtod_human:\n input string: %s\n locale decimal-point: %s\n MAX_UNSCALED_DIGITS: %d\n",
v23,
v22,
18LL);
}
v8 = simple_strtod_float(a1, a2, a3, a4);
if ( v8 <= 1 )
{
if ( dev_debug )
_fprintf_chk(stderr, 1LL, " parsed numeric value: %Lf\n input precision = %d\n", *a3, *a4);
v9 = default_scale_base(a5);
v10 = *a2;
v29 = v9;
v11 = **a2;
if ( !**a2 )
{
if ( a5 != 4 )
{
v12 = 0;
v13 = 0;
goto LABEL_9;
}
return 6;
}
_ctype_b_loc();
for ( i = v10; ; v11 = *i )
{
v17 = i;
v18 = to_uchar(v11);
i = (const char *)(v19 + 1);
if ( (*(_BYTE *)(v20 + 2LL * v18) & 1) == 0 )
break;
*a2 = i;
}
if ( !valid_suffix(v11) )
return 5;
v21 = (unsigned int)a5;
if ( !a5 )
return 4;
v13 = suffix_power(v11);
*a2 = v17 + 1;
if ( a5 == 1 )
{
if ( v17[1] == 105 )
{
v24 = dev_debug == 0;
v29 = 1024;
*a2 = v17 + 2;
if ( !v24 )
{
v28 = v13;
_fprintf_chk(stderr, v21, " Auto-scaling, found 'i', switching to base %d\n", 1024LL);
v13 = v28;
}
}
*(_QWORD *)a4 = 0LL;
}
else
{
*(_QWORD *)a4 = 0LL;
if ( a5 == 4 )
{
if ( v17[1] != 105 )
return 6;
*a2 = v17 + 2;
}
}
v12 = v13;
LABEL_9:
v27 = v13;
v14 = powerld(v12, (long double)v29);
if ( dev_debug )
{
_fprintf_chk(stderr, 1LL, " suffix power=%d^%d = %Lf\n", (unsigned int)v29, v27, v14);
v24 = dev_debug == 0;
v25 = *a3 * v14;
*a3 = v25;
if ( !v24 )
_fprintf_chk(stderr, 1LL, " returning value: %Lf (%LG)\n", v25, v25);
}
else
{
*a3 = v14 * *a3;
}
}
return v8;
}
// 1955: variable 'v19' is possibly undefined
// 1959: variable 'v20' is possibly undefined
// 27B0: using guessed type char dev_debug;
// 5B18: using guessed type long quote_n(_QWORD);
// 5B28: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
//----- (0000000000001B40) ----------------------------------------------------
long parse_human_number_constprop_0(char *a1, long double *a2, unsigned int *a3)
{
unsigned int v3; // eax
unsigned int v4; // r12d
long v6; // rbx
long v7; // r13
char *v8; // rax
const char *v9[7]; // [rsp+0h] [rbp-38h] BYREF
v9[1] = (const char *)__readfsqword(0x28u);
v9[0] = 0LL;
v3 = simple_strtod_human_constprop_0(a1, v9, a2, a3, scale_from);
v4 = v3;
if ( v3 > 1 )
{
simple_strtod_fatal(v3, (long)a1);
}
else if ( v9[0] )
{
if ( *v9[0] )
{
v4 = 5;
if ( inval_style != 3 )
{
v6 = quote_n(1LL);
v7 = quote_n(0LL);
v8 = dcgettext(0LL, "invalid suffix in input %s: %s", 5);
error(conv_exit_code, 0, v8, v7, v6);
}
}
}
return v4;
}
// 2820: using guessed type int inval_style;
// 2828: using guessed type int scale_from;
// 5B18: using guessed type long quote_n(_QWORD);
//----- (0000000000001C30) ----------------------------------------------------
_BOOL8 process_suffixed_number(char *s, long double *a2, unsigned int *a3, long a4)
[7216] {
char *v6; // r15
size_t v7; // rbx
size_t v8; // rax
char v9; // bl
char *v10; // r15
unsigned char v11; // al
long v12; // rdx
int v13; // eax
unsigned int v14; // ebx
long double v15; // fst7
const char *v17; // rbx
int v18; // eax
char v19; // dl
const char *v20; // rax
long v21; // r13
char *v22; // rax
LONG_DOUBLE_16 v23; // [rsp+10h] [rbp-58h] BYREF
unsigned long v24; // [rsp+28h] [rbp-40h]
[7233, 7234, 7237, 7238, 7242, 7216, 7218, 7220, 7223, 7225, 7228, 7230] v6 = suffix;
[7249, 7258] v24 = __readfsqword(0x28u);
[7265, 7268, 7263] if ( suffix )
{
[7278, 7270] v7 = strlen(s);
[7281, 7275] v8 = strlen(suffix);
[7289, 7286] if ( v7 > v8 )
{
[7584, 7590] v17 = &s[v7 - v8];
[7593, 7587, 7596] v18 = strcmp(suffix, v17);
[7601] v19 = dev_debug;
[7608, 7610] if ( v18 )
{
[7768, 7770] if ( dev_debug )
[7776, 7783, 7790, 7795, 7797, 7802] _fprintf_chk(stderr, 1LL, "no valid suffix found\n");
}
else
{
[7616] *v17 = 0;
[7619, 7621] if ( v19 )
{
[7627, 7630] v20 = (const char *)quote(v6);
[7654, 7657, 7659, 7664, 7635, 7642, 7647] _fprintf_chk(stderr, 1LL, "trimming suffix %s\n", v20);
}
}
}
}
[7299, 7301, 7295] v9 = *s;
[7295] if ( *s )
{
[7307] _ctype_b_loc();
[7312, 7315, 7318] v10 = s;
do
{
[7344, 7341] v11 = to_uchar(v9);
[7352, 7356, 7349] if ( (*(_BYTE *)(v12 + 2LL * v11) & 1) == 0 )
break;
[7328] v9 = *++v10;
}
[7337, 7339, 7333] while ( v9 );
[7360, 7358] v13 = (_DWORD)s - (_DWORD)v10;
}
else
{
[7884] v10 = s;
[7889, 7887] v13 = 0;
}
[7369, 7363, 7371] if ( auto_padding )
{
[7381, 7385, 7373, 7375] if ( v13 || a4 > 1 )
{
[7856, 7859, 7867] padding_width = strlen(s);
[7864, 7874, 7879] setup_padding_buffer(padding_width);
}
else
{
[7391] padding_width = 0LL;
}
[7409, 7402] if ( dev_debug )
[7808, 7841, 7815, 7822, 7829, 7831, 7836] _fprintf_chk(stderr, 1LL, "setting Auto-Padding to %ld characters\n", padding_width);
}
[7428] *(long double *)&v23 = 0.0;
[7425, 7432, 7437, 7415, 7417, 7422] v14 = parse_human_number_constprop_0(v10, (long double *)&v23.value, a3);
[7696, 7442, 7703, 7439] if ( v14 == 1 && debug )
{
[7712, 7731, 7709] v21 = quote(v10);
[7724, 7717, 7734, 7719] v22 = dcgettext(0LL, "large input value %s: possible precision loss", 5);
[7744, 7746, 7749, 7751, 7756, 7739, 7742] error(0, 0, v22, v21);
}
[7448, 7455] v15 = *(long double *)&v23;
[7488, 7490, 7459, 7682, 7466, 7470, 7476, 7672, 7481, 7676, 7485] if ( from_unit_size != 1 || to_unit_size != 1 )
[7496, 7498, 7503, 7507, 7510, 7512] v15 = *(long double *)&v23
[7514] * (long double)(unsigned long)from_unit_size
[7520, 7523, 7526, 7531, 7540, 7546, 7518] / (long double)(unsigned long)to_unit_size;
[7552, 7554, 7556, 7558, 7560, 7550, 7551] *a2 = v15;
return v14 <= 1;
}
// 1CB8: variable 'v12' is possibly undefined
// 2798: using guessed type long to_unit_size;
// 27A0: using guessed type long from_unit_size;
// 27B0: using guessed type char dev_debug;
// 27C0: using guessed type char debug;
// 27D0: using guessed type int auto_padding;
// 27F8: using guessed type long padding_width;
// 5AE0: using guessed type long quote(_QWORD);
// 5B28: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 1C30: using guessed type long double var_58;
//----- (0000000000001EE0) ----------------------------------------------------
long process_field(char *s, unsigned long a2)
[7904] {
unsigned int v2; // eax
unsigned int v3; // r12d
long v5; // [rsp+8h] [rbp-40h] BYREF
long double v6; // [rsp+10h] [rbp-38h] BYREF
unsigned long v7; // [rsp+28h] [rbp-20h]
[7904, 7906, 7908, 7915, 7919, 7928] v7 = __readfsqword(0x28u);
[7933, 7935] v6 = 0.0;
[7939] v5 = 0LL;
[7912, 7948, 7909] LOBYTE(v2) = include_field(a2);
[7953, 7955] if ( (_BYTE)v2 )
{
[7973] v3 = v2;
[7970, 8068, 7976, 8072, 7981, 8077, 7983, 8082, 8083, 8084, 7957, 8086, 7960, 7965] if ( process_suffixed_number(s, &v6, (unsigned int *)&v5, a2) && (unsigned int)prepare_padded_number(v5, v6) )
{
[8088, 8093] print_padded_number();
}
else
{
[7995] v3 = 0;
[7992, 7985, 8003, 7998] fputs_unlocked(s, stdout);
}
}
else
{
[8018] v3 = 1;
[8034, 8008, 8043, 8015, 8024, 8029] fputs_unlocked(s, stdout);
}
[8049, 8045] return v3;
[8052, 8053, 8055] }
// 1F25: variable 'v2' is possibly undefined
//----- (0000000000001FB0) ----------------------------------------------------
long process_line(signed char *a1, char a2)
[8112] {
unsigned long v2; // rbp
unsigned char v3; // bl
char v4; // al
int v5; // edi
signed char *v6; // rdi
signed char *i; // [rsp+8h] [rbp-30h] BYREF
[8133, 8112, 8114, 8117, 8119, 8122, 8124, 8125, 8127] v2 = 0LL;
[8128] v3 = 1;
[8137, 8147, 8142, 8201] for ( i = a1; ; ++i )
{
[8210] ++v2;
[8219, 8214, 8207] v6 = next_field(&i);
[8230, 8227, 8222] if ( !*i )
break;
[8152] *i = 0;
[8155, 8158] v4 = process_field(v6, v2);
[8163] v5 = delimiter;
[8183] if ( !v4 )
[8176, 8178, 8183] v3 = 0;
[8193] if ( delimiter == 128 )
[8193, 8187] v5 = 32;
[8169, 8196] fputc_unlocked(v5, stdout);
}
[8232, 8235] if ( !(unsigned char)process_field(v6, v2) )
[8240, 8242, 8247] v3 = 0;
[8257, 8250, 8254] if ( a2 )
[8280, 8287] putchar_unlocked((unsigned char)line_delim);
[8259, 8263] return v3;
[8292, 8296, 8266, 8267, 8268, 8299, 8270, 8300, 8272, 8301, 8274, 8303, 8305, 8307] }
// 2780: using guessed type char line_delim;
// 2784: using guessed type int delimiter;
//----- (0000000000002080) ----------------------------------------------------
long emit_ancillary_info_constprop_0()
{
const char *v0; // rsi
__int128 *v1; // rbx
const char *v2; // r12
char *v3; // rax
char *v4; // rdi
const char *v5; // r13
char *v6; // rax
const char *v7; // rcx
const char *v8; // r13
char *v9; // rsi
FILE *v11; // rbp
char *v12; // rax
__int128 v13[7]; // [rsp+0h] [rbp-A8h] BYREF
unsigned long v14; // [rsp+78h] [rbp-30h]
v0 = "[";
v14 = __readfsqword(0x28u);
v1 = v13;
v13[0] = (__int128)_mm_unpacklo_epi64((__m128i)(unsigned long)"[", (__m128i)(unsigned long)"test invocation");
v13[1] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"coreutils",
(__m128i)(unsigned long)"Multi-call invocation");
v13[2] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha224sum",
(__m128i)(unsigned long)"sha2 utilities");
v13[3] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha256sum",
(__m128i)(unsigned long)"sha2 utilities");
v13[4] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha384sum",
(__m128i)(unsigned long)"sha2 utilities");
v13[5] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha512sum",
(__m128i)(unsigned long)"sha2 utilities");
v13[6] = 0LL;
do
{
if ( !strcmp("numfmt", v0) )
break;
v0 = (const char *)*((_QWORD *)v1++ + 2);
}
while ( v0 );
v2 = (const char *)*((_QWORD *)v1 + 1);
if ( !v2 )
v2 = "numfmt";
v3 = dcgettext(0LL, "\n%s online help: <%s>\n", 5);
_printf_chk(1LL, v3, "GNU coreutils", "https://www.gnu.org/software/coreutils/");
v4 = setlocale(5, 0LL);
if ( v4 && strncmp(v4, "en_", 3uLL) )
{
v11 = stdout;
v12 = dcgettext(0LL, "Report any translation bugs to <https://translationproject.org/team/>\n", 5);
fputs_unlocked(v12, v11);
}
v5 = "numfmt";
if ( !strcmp("numfmt", "[") )
v5 = "test";
v6 = dcgettext(0LL, "Full documentation <%s%s>\n", 5);
v7 = v5;
v8 = &LC1;
_printf_chk(1LL, v6, "https://www.gnu.org/software/coreutils/", v7);
if ( v2 == "numfmt" )
v8 = " invocation";
v9 = dcgettext(0LL, "or available locally via: info '(coreutils) %s%s'\n", 5);
return _printf_chk(1LL, v9, v2, v8);
}
// 5B90: using guessed type long _printf_chk(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000022D0) ----------------------------------------------------
void usage(int status)
[8912] {
long v1; // r12
char *v2; // rax
char *v3; // rax
long v4; // rcx
FILE *v5; // r12
char *v6; // rax
FILE *v7; // r12
char *v8; // rax
FILE *v9; // r12
char *v10; // rax
FILE *v11; // r12
char *v12; // rax
FILE *v13; // r12
char *v14; // rax
FILE *v15; // r12
char *v16; // rax
FILE *v17; // r12
char *v18; // rax
FILE *v19; // r12
char *v20; // rax
FILE *v21; // r12
char *v22; // rax
FILE *v23; // r12
char *v24; // rax
FILE *v25; // r12
char *v26; // rax
FILE *v27; // r12
char *v28; // rax
FILE *v29; // r12
char *v30; // rax
FILE *v31; // r12
char *v32; // rax
FILE *v33; // r12
char *v34; // rax
FILE *v35; // r12
char *v36; // rax
FILE *v37; // r12
char *v38; // rax
FILE *v39; // r12
char *v40; // rax
FILE *v41; // r12
char *v42; // rax
FILE *v43; // r12
char *v44; // rax
FILE *v45; // r12
char *v46; // rax
FILE *v47; // r12
char *v48; // rax
FILE *v49; // r12
char *v50; // rax
FILE *v51; // r12
char *v52; // rax
FILE *v53; // r12
char *v54; // rax
FILE *v55; // r12
char *v56; // rax
long v57; // r12
char *v58; // rax
long v59; // rcx
long v60; // r12
char *v61; // [rsp-8h] [rbp-20h]
[8930, 8912, 8916, 8918, 8923, 8924, 8926] v1 = program_name;
[8937, 8939] if ( status )
{
[8948, 8941, 8950] v2 = dcgettext(0LL, "Try '%s --help' for more information.\n", 5);
[8962, 8965, 8970, 8973, 8975, 8955] _fprintf_chk(stderr, 1LL, v2, v1);
}
else
{
[8987, 8996, 8989] v3 = dcgettext(0LL, "Usage: %s [OPTION]... [NUMBER]...\n", 5);
[9001, 9004, 9009, 9012, 9014] _printf_chk(1LL, v3, v1, v4);
[9024, 9026, 9019] v5 = stdout;
[9040, 9033] v6 = dcgettext(0LL, "Reformat NUMBER(s), or the numbers from standard input if none are specified.\n", 5);
[9048, 9051, 9045] fputs_unlocked(v6, v5);
[9056] emit_mandatory_arg_note();
[9061] v7 = stdout;
[9082, 9075, 9068, 9070] v8 = dcgettext(0LL, " --debug print warnings about invalid input\n", 5);
[9090, 9093, 9087] fputs_unlocked(v8, v7);
[9098] v9 = stdout;
[9112, 9105, 9107, 9119] v10 = dcgettext(0LL, " -d, --delimiter=X use X instead of whitespace for field delimiter\n", 5);
[9130, 9124, 9127] fputs_unlocked(v10, v9);
[9135] v11 = stdout;
[9144, 9156, 9149, 9142] v12 = dcgettext(
0LL,
" --field=FIELDS replace the numbers in these input fields (default=1);\n"
" see FIELDS below\n",
5);
[9161, 9164, 9167] fputs_unlocked(v12, v11);
[9172] v13 = stdout;
[9193, 9186, 9179, 9181] v14 = dcgettext(
0LL,
" --format=FORMAT use printf style floating-point FORMAT;\n"
" see FORMAT below for details\n",
5);
[9201, 9204, 9198] fputs_unlocked(v14, v13);
[9209] v15 = stdout;
[9216, 9218, 9230, 9223] v16 = dcgettext(
0LL,
" --from=UNIT auto-scale input numbers to UNITs; default is 'none';\n"
" see UNIT below\n",
5);
[9241, 9235, 9238] fputs_unlocked(v16, v15);
[9246] v17 = stdout;
[9267, 9260, 9253, 9255] v18 = dcgettext(0LL, " --from-unit=N specify the input unit size (instead of the default 1)\n", 5);
[9272, 9275, 9278] fputs_unlocked(v18, v17);
[9283] v19 = stdout;
[9304, 9297, 9290, 9292] v20 = dcgettext(
0LL,
" --grouping use locale-defined grouping of digits, e.g. 1,000,000\n"
" (which means it has no effect in the C/POSIX locale)\n",
5);
[9312, 9315, 9309] fputs_unlocked(v20, v19);
[9320] v21 = stdout;
[9329, 9341, 9334, 9327] v22 = dcgettext(
0LL,
" --header[=N] print (without converting) the first N header lines;\n"
" N defaults to 1 if not specified\n",
5);
[9352, 9346, 9349] fputs_unlocked(v22, v21);
[9357, 9359] v23 = stdout;
[9378, 9371, 9366] v24 = dcgettext(
0LL,
" --invalid=MODE failure mode for invalid numbers: MODE can be:\n"
" abort (default), fail, warn, ignore\n",
5);
[9386, 9389, 9383] fputs_unlocked(v24, v23);
[9394] v25 = stdout;
[9408, 9401, 9403, 9415] v26 = dcgettext(
0LL,
" --padding=N pad the output to N characters; positive N will\n"
" right-align; negative N will left-align;\n"
" padding is ignored if the output is wider than N;\n"
" the default is to automatically pad if a whitespace\n"
" is found\n",
5);
[9426, 9420, 9423] fputs_unlocked(v26, v25);
[9431] v27 = stdout;
[9440, 9452, 9445, 9438] v28 = dcgettext(
0LL,
" --round=METHOD use METHOD for rounding when scaling; METHOD can be:\n"
" up, down, from-zero (default), towards-zero, nearest\n",
5);
[9457, 9460, 9463] fputs_unlocked(v28, v27);
[9468] v29 = stdout;
[9489, 9482, 9475, 9477] v30 = dcgettext(
0LL,
" --suffix=SUFFIX add SUFFIX to output numbers, and accept optional\n"
" SUFFIX in input numbers\n",
5);
[9497, 9500, 9494] fputs_unlocked(v30, v29);
[9505] v31 = stdout;
[9512, 9514, 9526, 9519] v32 = dcgettext(0LL, " --to=UNIT auto-scale output numbers to UNITs; see UNIT below\n", 5);
[9537, 9531, 9534] fputs_unlocked(v32, v31);
[9542] v33 = stdout;
[9563, 9556, 9549, 9551] v34 = dcgettext(0LL, " --to-unit=N the output unit size (instead of the default 1)\n", 5);
[9568, 9571, 9574] fputs_unlocked(v34, v33);
[9579] v35 = stdout;
[9600, 9593, 9586, 9588] v36 = dcgettext(0LL, " -z, --zero-terminated line delimiter is NUL, not newline\n", 5);
[9608, 9611, 9605] fputs_unlocked(v36, v35);
[9616] v37 = stdout;
[9625, 9637, 9630, 9623] v38 = dcgettext(0LL, " --help display this help and exit\n", 5);
[9648, 9642, 9645] fputs_unlocked(v38, v37);
[9653] v39 = stdout;
[9674, 9667, 9660, 9662] v40 = dcgettext(0LL, " --version output version information and exit\n", 5);
[9682, 9685, 9679] fputs_unlocked(v40, v39);
[9690] v41 = stdout;
[9704, 9697, 9699, 9711] v42 = dcgettext(0LL, "\nUNIT options:\n", 5);
[9722, 9716, 9719] fputs_unlocked(v42, v41);
[9727] v43 = stdout;
[9736, 9748, 9741, 9734] v44 = dcgettext(0LL, " none no auto-scaling is done; suffixes will trigger an error\n", 5);
[9753, 9756, 9759] fputs_unlocked(v44, v43);
[9764] v45 = stdout;
[9785, 9778, 9771, 9773] v46 = dcgettext(
0LL,
" auto accept optional single/two letter suffix:\n"
" 1K = 1000,\n"
" 1Ki = 1024,\n"
" 1M = 1000000,\n"
" 1Mi = 1048576,\n",
5);
[9793, 9796, 9790] fputs_unlocked(v46, v45);
[9801] v47 = stdout;
[9808, 9810, 9822, 9815] v48 = dcgettext(
0LL,
" si accept optional single letter suffix:\n"
" 1K = 1000,\n"
" 1M = 1000000,\n"
" ...\n",
5);
[9833, 9827, 9830] fputs_unlocked(v48, v47);
[9838] v49 = stdout;
[9859, 9852, 9845, 9847] v50 = dcgettext(
0LL,
" iec accept optional single letter suffix:\n"
" 1K = 1024,\n"
" 1M = 1048576,\n"
" ...\n",
5);
[9864, 9867, 9870] fputs_unlocked(v50, v49);
[9875] v51 = stdout;
[9896, 9889, 9882, 9884] v52 = dcgettext(
0LL,
" iec-i accept optional two-letter suffix:\n"
" 1Ki = 1024,\n"
" 1Mi = 1048576,\n"
" ...\n",
5);
[9904, 9907, 9901] fputs_unlocked(v52, v51);
[9912] v53 = stdout;
[9921, 9933, 9926, 9919] v54 = dcgettext(
0LL,
"\n"
"FIELDS supports cut(1) style field ranges:\n"
" N N'th field, counted from 1\n"
" N- from N'th field, to end of line\n"
" N-M from N'th to M'th field (inclusive)\n"
" -M from first to M'th field (inclusive)\n"
" - all fields\n"
"Multiple fields/ranges can be separated with commas\n",
5);
[9944, 9938, 9941] fputs_unlocked(v54, v53);
[9949] v55 = stdout;
[9970, 9963, 9956, 9958] v56 = dcgettext(
0LL,
"\n"
"FORMAT must be suitable for printing one floating-point argument '%f'.\n"
"Optional quote (%'f) will enable --grouping (if supported by current locale).\n"
"Optional width value (%10f) will pad output. Optional zero (%010f) width\n"
"will zero pad the number. Optional negative values (%-10f) will left align.\n"
"Optional precision (%.1f) will override the input determined precision.\n",
5);
[9978, 9981, 9975] fputs_unlocked(v56, v55);
[9986] v57 = program_name;
[10000, 9993, 9995, 10007] v58 = dcgettext(
0LL,
"\n"
"Exit status is 0 if all input numbers were successfully converted.\n"
"By default, %s will stop at the first conversion error with exit status 2.\n"
"With --invalid='fail' a warning is printed for each conversion error\n"
"and the exit status is 2. With --invalid='warn' each conversion error is\n"
"diagnosed, but the exit status is 0. With --invalid='ignore' conversion\n"
"errors are not diagnosed and the exit status is 0.\n",
5);
[10020, 10023, 10025, 10012, 10015] _printf_chk(1LL, v58, v57, v59);
[10030] v60 = program_name;
[10051, 10068, 10037, 10039, 10044] v61 = dcgettext(
0LL,
"\n"
"Examples:\n"
" $ %s --to=si 1000\n"
" -> \"1.0K\"\n"
" $ %s --to=iec 2048\n"
" -> \"2.0K\"\n"
" $ %s --to=iec-i 4096\n"
" -> \"4.0Ki\"\n"
" $ echo 1K | %s --from=si\n"
" -> \"1000\"\n"
" $ echo 1K | %s --from=iec\n"
" -> \"1024\"\n"
" $ df -B1 | %s --header --field 2-4 --to=si\n"
" $ ls -l | %s --header --field 5 --to=iec\n"
" $ ls -lh | %s --header --field 5 --from=iec --padding=10\n"
" $ ls -lh | %s --header --field 5 --from=iec --format %%10f\n",
5);
[10081, 10083, 10085, 10087, 10056, 10089, 10059, 10062, 10065, 10069, 10072, 10077, 10079] _printf_chk(1LL, v61, v60, v60);
[10098, 10094, 10103] emit_ancillary_info_constprop_0();
}
[8980, 8982] exit(status);
}
// 2336: variable 'v4' is possibly undefined
// 2729: variable 'v59' is possibly undefined
// 5B28: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 5B90: using guessed type long _printf_chk(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002DD4) ----------------------------------------------------
void simple_round_cold()
{
__asm
{
fstp st; jumptable 0000000000000343 default case
fstp st
fldz
}
JUMPOUT(0x36CLL);
}
// 2DD4: inconsistent fpu stack
// 2DDA: control flows out of bounds to 36C
//----- (0000000000002DDF) ----------------------------------------------------
void simple_strtod_fatal_cold()
{
JUMPOUT(0xF3FLL);
}
// 2DE1: control flows out of bounds to F3F
//----- (00000000000045D0) ----------------------------------------------------
int main(int argc, const char **argv, const char **envp)
[17872] {
const char **v3; // r12
const char *v5; // rdi
char *v6; // r13
char *v7; // rax
int v8; // eax
char *v9; // rax
char *v10; // rdi
char v11; // al
_BOOL4 v12; // eax
int v13; // eax
long v14; // rax
int i; // ebx
signed char *v17; // rdi
char *v18; // rcx
int v19; // edx
bool v20; // si
__ssize_t v21; // rax
char *v23; // rax
char *v24; // rax
char *v25; // rax
char *v26; // rax
char *v27; // rax
char *v28; // rax
char *v29; // r12
int *v30; // rax
long v31; // r12
char *v32; // rax
char *v33; // rax
char *v34; // rax
char *v35; // rax
char *v36; // rax
char *s; // [rsp+8h] [rbp-40h] BYREF
size_t n[7]; // [rsp+10h] [rbp-38h] BYREF
[17888, 17889, 17872, 17876, 17878, 17880, 17882, 17885, 17886] v3 = argv;
[17893] v5 = *argv;
[17896, 17905] n[1] = __readfsqword(0x28u);
[17912, 17910] set_program_name(v5);
[17929, 17948, 17924, 17917] v6 = setlocale(6, &LC1);
[17941, 17934, 17951] bindtextdomain("coreutils", "/usr/local/share/locale");
[17963, 17956] textdomain("coreutils");
[17968, 17973] v7 = nl_langinfo(0x10000);
[17978] decimal_point = v7;
[17985, 17988, 17994, 17997, 18002, 18005] if ( !v7 || !strlen(v7) )
LABEL_33:
[18864, 18878, 18871] decimal_point = ".";
[18018, 18025, 18035, 18011, 18047] decimal_point_length = strlen(decimal_point);
[18040, 18058, 18053] atexit((void (*)(void))&close_stdout);
[18086] while ( 1 )
{
[18086, 18064, 18067, 18074, 18077, 18079] v8 = getopt_long(argc, (char *const *)v3, "d:z", &longopts, 0LL);
[18091, 18094] if ( v8 == -1 )
break;
[18105, 18100] if ( v8 > 141 )
goto LABEL_88;
[18120, 18114, 18111] if ( v8 <= 99 )
{
[18888, 18883] if ( v8 == -131 )
{
[19904, 19906, 19909, 19916, 19890, 19923, 19897, 19930] version_etc(stdout, "numfmt", "GNU coreutils", Version, "Assaf Gordon", 0LL);
[19937, 19935] exit(0);
}
[18899, 18894] if ( v8 == -130 )
[18905, 18907] usage(0);
LABEL_88:
[19866, 19871] usage(1);
}
[18123, 18126, 18132, 18136, 18139] switch ( v8 )
{
case 100:
[18624, 18627, 18629, 18631, 18635] if ( *optarg && optarg[1] )
goto LABEL_95;
[18624, 18641] delimiter = *optarg;
[18647] continue;
case 122:
[18605] line_delim = 0;
[18612] continue;
case 128:
[18529, 18593, 18565, 18599, 18536, 18572, 18543, 18577, 18579, 18549, 18582, 18551, 18589, 18525, 18558] scale_from = scale_from_types[_xargmatch_internal(
"--from",
optarg,
scale_from_args,
scale_from_types,
4LL,
argmatch_die,
1LL)];
[18600] continue;
case 129:
[18513, 18508, 18501] from_unit_size = unit_to_umax(optarg);
[18520] continue;
case 130:
[18467, 18438, 18472, 18474, 18444, 18476, 18446, 18479, 18420, 18453, 18486, 18424, 18490, 18460, 18431] scale_to = scale_to_types[_xargmatch_internal(
"--to",
optarg,
scale_to_args,
scale_to_types,
4LL,
argmatch_die,
1LL)];
[18496] continue;
case 131:
[18408, 18403, 18396] to_unit_size = unit_to_umax(optarg);
[18415] continue;
case 132:
[18368, 18369, 18340, 18372, 18342, 18379, 18316, 18349, 18383, 18320, 18385, 18356, 18327, 18363, 18334] round_style = round_types[_xargmatch_internal(
"--round",
optarg,
round_args,
round_types,
4LL,
argmatch_die,
1LL)];
[18391] continue;
case 133:
[18304, 18297] suffix = optarg;
[18311] continue;
case 134:
[18282] grouping = 1;
[18292] continue;
case 135:
[18242, 18214, 18219, 18191, 18224, 18226, 18232, 18239, 18198, 18200, 18207] if ( (unsigned int)xstrtol(optarg, 0LL, 10LL, &padding_width, &LC1)
|| (padding_width & 0x7FFFFFFFFFFFFFFFLL) == 0 )
{
[19968, 19949, 19942] v31 = quote(optarg);
[19954, 19971, 19966, 19959] v32 = dcgettext(0LL, "invalid padding value %s", 5);
[19976, 19979, 19981, 19986, 19989, 19991] error(1, 0, v32, v31);
goto LABEL_93;
}
[18248, 18251] if ( padding_width < 0 )
{
[18257] padding_alignment = 0;
[18267, 18270] padding_width = -padding_width;
}
[18277] break;
case 136:
[18166, 18158] if ( n_frp )
goto LABEL_96;
[18184, 18179, 18172] set_fields(optarg, 1LL);
[18189] continue;
case 137:
goto LABEL_9;
case 138:
[18142] dev_debug = 1;
LABEL_9:
[18149] debug = 1;
[18156] continue;
case 139:
[18760, 18757, 18766] if ( optarg )
{
[18787, 18792, 18794, 18796, 18768, 18804, 18775, 18780, 18750] if ( (unsigned int)xstrtoumax(optarg, 0LL, 10LL, &header, &LC1) || !header )
{
[18817, 18810, 18836] v3 = (const char **)quote(optarg);
[18834, 18827, 18822, 18839] v9 = dcgettext(0LL, "invalid header value %s", 5);
[18849, 18854, 18857, 18859, 18844, 18847] error(1, 0, v9, v3);
goto LABEL_33;
}
}
else
{
[18912, 18923] header = 1LL;
}
continue;
case 140:
[18738, 18731] format_str = optarg;
[18745] continue;
case 141:
[18656, 18720, 18692, 18663, 18699, 18670, 18704, 18705, 18706, 18676, 18709, 18678, 18716, 18652, 18685] inval_style = inval_types[_xargmatch_internal(
"--invalid",
optarg,
inval_args,
inval_types,
4LL,
argmatch_die,
1LL)];
[18726] continue;
default:
goto LABEL_88;
}
}
[18928] v10 = format_str;
[18938, 18947, 18940, 18935] if ( format_str && grouping )
{
LABEL_93:
[20008, 20001, 20010, 19996] v33 = dcgettext(0LL, "--grouping cannot be combined with --format", 5);
[20015, 20017, 20022, 20025, 20027] error(1, 0, v33);
goto LABEL_94;
}
[18953] v11 = debug;
[18960, 18963] if ( !v6 )
{
[18969, 18971] if ( !debug )
goto LABEL_42;
[19393, 19405, 19398, 19407] v23 = dcgettext(0LL, "failed to set locale", 5);
[19412, 19414, 19416, 19419, 19421] error(0, 0, v23);
[19426] v11 = debug;
[19433] v10 = format_str;
}
[19460, 19440, 19442, 19448, 19454] if ( !v11 || __PAIR64__(scale_from, scale_to) )
{
LABEL_42:
[18977, 18980] if ( !v10 )
goto LABEL_44;
goto LABEL_43;
}
[19473, 19466] if ( !grouping )
{
[19487, 19479] if ( padding_width )
{
[19876, 19885, 19879] if ( !v10 )
goto LABEL_47;
}
[19496, 19493] else if ( !v10 )
{
[19514, 19507, 19502] v24 = dcgettext(0LL, "no conversion option specified", 5);
[19521, 19523, 19526, 19528, 19519] error(0, 0, v24);
[19533] v10 = format_str;
[19540] goto LABEL_42;
}
LABEL_43:
[18982] parse_format_string((long)v10);
LABEL_44:
[18995, 18993, 18987] if ( !grouping )
goto LABEL_47;
[19004, 18997] if ( !scale_to )
goto LABEL_46;
LABEL_94:
[20032, 20044, 20037, 20046] v34 = dcgettext(0LL, "grouping cannot be combined with --to", 5);
[20051, 20053, 20058, 20061, 20063] error(1, 0, v34);
LABEL_95:
[20080, 20073, 20082, 20068] v35 = dcgettext(0LL, "the delimiter must be a single character", 5);
[20097, 20099, 20087, 20089, 20094] error(1, 0, v35);
LABEL_96:
[20104, 20116, 20109, 20118] v36 = dcgettext(0LL, "multiple field specifications", 5);
[20130, 20133, 20135, 20140, 20123, 20125] error(1, 0, v36);
}
[19809, 19806, 19815] if ( v10 )
goto LABEL_43;
LABEL_46:
[19017, 19010] if ( debug )
{
[19618, 19623] v25 = nl_langinfo(65537);
[19639, 19636, 19628, 19631] if ( !strlen(v25) )
{
[19659, 19652, 19645, 19647] v26 = dcgettext(0LL, "grouping has no effect in this locale", 5);
[19664, 19666, 19668, 19671, 19673, 19678] error(0, 0, v26);
}
}
LABEL_47:
[19030, 19023] setup_padding_buffer(padding_width);
[19035] v12 = 0;
[19045, 19037] if ( !padding_width )
[19049, 19059, 19047] v12 = delimiter == 128;
[19062] auto_padding = v12;
[19076, 19074, 19068] if ( inval_style )
[19078] conv_exit_code = 0;
[19088] v13 = optind;
[19096, 19094] if ( optind < argc )
{
[19552, 19545] if ( debug )
{
[19554, 19562] if ( header )
{
[19768, 19754, 19766, 19759] v28 = dcgettext(0LL, "--header ignored with command-line input", 5);
[19777, 19780, 19782, 19773, 19775] error(0, 0, v28);
[19787] v13 = optind;
[19801, 19793, 19795] if ( argc <= optind )
[19795] return 0;
}
}
[19568, 19573] i = 1;
do
{
[19587, 19592, 19576, 19578, 19583] i &= process_line((signed char *)v3[v13], 1);
[19600, 19594] v13 = optind + 1;
[19603] optind = v13;
}
[19609, 19611, 19613] while ( v13 < argc );
}
else
{
[19102] v14 = header;
[19114, 19109, 19119] s = 0LL;
[19128] n[0] = 0LL;
[19137, 19141] --header;
[19153, 19148, 19151] if ( v14 )
{
do
{
[19200, 19207, 19214, 19217, 19220, 19225, 19228] if ( getdelim(&s, n, (unsigned char)line_delim, stdin) <= 0 )
break;
[19160, 19172, 19167] fputs_unlocked(s, stdout);
}
[19177, 19184, 19188, 19195, 19198] while ( header-- );
}
[19280, 19235, 19285, 19230] for ( i = 1; ; i &= process_line(v17, v20) )
{
[19301, 19304, 19307, 19287, 19294] v21 = getdelim(&s, n, (unsigned char)line_delim, stdin);
[19312, 19315] if ( v21 <= 0 )
break;
[19240] v17 = s;
[19245] v18 = &s[v21 - 1];
[19257] v19 = *v18;
[19250, 19260, 19262] v20 = v19 == (unsigned char)line_delim;
[19250, 19266] if ( v19 == (unsigned char)line_delim )
{
[19268] *v18 = 0;
[19276, 19271] v17 = s;
}
}
[19329, 19331, 19324, 19317] if ( ferror_unlocked(stdin) )
{
[19820, 19822, 19827, 19834, 19839] v29 = dcgettext(0LL, "error reading input", 5);
[19842] v30 = _errno_location();
[19847, 19850, 19852, 19854, 19856, 19861] error(0, *v30, v29);
}
}
[19344, 19337] if ( debug )
{
[19360, 19365, 19374, 19350, 19352, 19358] if ( i )
[19392] return 0;
[19721, 19733, 19726, 19719] v27 = dcgettext(0LL, "failed to convert some of the input numbers", 5);
[19745, 19747, 19752, 19738, 19740, 19742] error(0, 0, v27);
}
[19683, 19685] else if ( i )
{
[19685] return 0;
}
[19714, 19691, 19697, 19703, 19709] if ( (unsigned int)(inval_style - 2) <= 1 )
[19700, 19703] return 0;
[19380] return 2;
[19384, 19385, 19386, 19388, 19390] }
// 2780: using guessed type char line_delim;
// 2784: using guessed type int delimiter;
// 2788: using guessed type int padding_alignment;
// 2798: using guessed type long to_unit_size;
// 27A0: using guessed type long from_unit_size;
// 27A8: using guessed type int round_style;
// 27B0: using guessed type char dev_debug;
// 27B4: using guessed type int decimal_point_length;
// 27C0: using guessed type char debug;
// 27C8: using guessed type long header;
// 27D0: using guessed type int auto_padding;
// 27F8: using guessed type long padding_width;
// 2810: using guessed type int grouping;
// 2820: using guessed type int inval_style;
// 2824: using guessed type int scale_to;
// 2828: using guessed type int scale_from;
// 2D80: using guessed type _DWORD inval_types[4];
// 2D90: using guessed type _DWORD round_types[8];
// 2DB0: using guessed type _DWORD scale_to_types[4];
// 2DC0: using guessed type _DWORD scale_from_types[5];
// 5120: using guessed type char *inval_args[4];
// 5160: using guessed type char *round_args[5];
// 51A0: using guessed type char *scale_to_args[4];
// 51E0: using guessed type char *scale_from_args[5];
// 5AC0: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5AE0: using guessed type long quote(_QWORD);
// 5BB0: using guessed type long set_program_name(_QWORD);
// 5BD0: using guessed type void (*close_stdout)(void);
// 5BF8: using guessed type long set_fields(_QWORD, _QWORD);
// 5C00: using guessed type long xstrtol(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5C10: using guessed type long _xargmatch_internal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5C40: using guessed type long version_etc(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// nfuncs=83 queued=37 decompiled=37 lumina nreq=0 worse=0 better=0
// ALL OK, 37 function(s) have been successfully decompiled
|
long double simple_round(int a1, long double a2)
[1575] {
long double result; // fst7
long v11; // [rsp+10h] [rbp-10h]
long v12; // [rsp+18h] [rbp-8h]
long double v13; // [rsp+30h] [rbp+10h]
[1600, 1604, 1575, 1576, 1607, 1579, 1611, 1614, 1583, 1586, 1589, 1595, 1597] v12 = (long)(a2 / 9.223372036854775807e18);
[1634, 1636, 1617, 1620, 1623, 1629, 1631] v13 = a2 - (long double)v12 * 9.223372036854775807e18;
[1667, 1670, 1639, 1672, 1643, 1679, 1649, 1682, 1652, 1660] switch ( a1 )
{
case 0:
[1696, 1700, 1685, 1688, 1691] v11 = simple_round_ceiling(v13);
[1704] goto LABEL_8;
case 1:
[1706, 1709, 1712, 1717, 1721] v11 = simple_round_floor(v13);
[1725] goto LABEL_8;
case 2:
[1730, 1733, 1738, 1742, 1727] v11 = simple_round_from_zero(v13);
[1746] goto LABEL_8;
case 3:
[1763, 1748, 1751, 1754, 1759] v11 = simple_round_to_zero(v13);
[1767] goto LABEL_8;
case 4:
[1769, 1772, 1775, 1780, 1784, 1788] v11 = simple_round_nearest(v13);
LABEL_8:
[1794, 1797, 1803, 1805, 1808] result = (long double)v12 * 9.223372036854775807e18 + (long double)v11;
break;
default:
[1790] result = 0.0;
[1792] break;
}
[1810] return result;
[1811] }
//----- (0000000000000714) ----------------------------------------------------
long simple_strtod_int(const char *a1, const char **a2, long double *a3, _BYTE *a4)
[1812] {
const char *v7; // [rsp+18h] [rbp-28h]
char v8; // [rsp+23h] [rbp-1Dh]
unsigned int v9; // [rsp+24h] [rbp-1Ch]
unsigned int v10; // [rsp+28h] [rbp-18h]
long double v11; // [rsp+30h] [rbp-10h]
[1824, 1812, 1816, 1817, 1820] v7 = a1;
[1832, 1840, 1828, 1836] v9 = 0;
[1849, 1847] v11 = 0.0;
[1852] v10 = 0;
[1859] v8 = 0;
[1872, 1867, 1870, 1863] if ( *a1 == 45 )
{
[1874] v7 = a1 + 1;
[1883, 1886, 1879] *a4 = 1;
}
else
{
[1888, 1892] *a4 = 0;
}
[2048, 2050, 1895, 2055, 2057, 1899, 1903, 2032, 1906, 2035, 2039, 2042, 2045] for ( *a2 = v7; (unsigned char)c_isdigit((unsigned int)**a2); ++*a2 )
{
[1927, 1931, 1934, 1936, 1938, 1940] v8 = 1;
[1953, 1947, 1957, 1942, 1912, 1945, 1915, 1949, 1951] if ( 0.0 != v11 || **a2 != 48 )
[1959] ++v10;
[1963, 1967] if ( v10 > 0x12 )
[1969] v9 = 1;
[1976, 1980] if ( v10 > 0x1B )
[1987, 1982] return 2LL;
[1921, 2017, 1924, 2021, 2024, 2028, 2001, 2003, 2014, 2006, 1912, 2009, 1915, 2012, 1918] v11 = (long double)(**a2 - 48) + v11 * 10.0;
}
[2080, 2083, 2090, 2094, 2063, 2097, 2067, 2100, 2070, 2103, 2072, 2074, 2108, 2110] if ( v8 != 1 && strncmp(*a2, decimal_point, decimal_point_length) )
[2112, 2117] return 3LL;
[2128, 2123, 2126, 2119] if ( *a4 )
[2130, 2133, 2135] v11 = -v11;
[2138, 2143] if ( a3 )
[2152, 2145, 2149] *a3 = v11;
[2154, 2157] return v9;
[2158] }
// 3468: using guessed type int decimal_point_length;
// 5AC0: using guessed type long c_isdigit(_QWORD);
//----- (000000000000086F) ----------------------------------------------------
long simple_strtod_float(const char *a1, const char **a2, long double *a3, const char **a4)
[2159] {
long double v5; // fst6
long double v6; // fst7
char v9; // [rsp+46h] [rbp-3Ah] BYREF
char v10; // [rsp+47h] [rbp-39h] BYREF
unsigned int v11; // [rsp+48h] [rbp-38h]
unsigned int v12; // [rsp+4Ch] [rbp-34h]
const char *v13; // [rsp+50h] [rbp-30h] BYREF
const char *v14; // [rsp+58h] [rbp-28h]
LONG_DOUBLE_16 v15; // [rsp+60h] [rbp-20h] BYREF
unsigned long v16; // [rsp+78h] [rbp-8h]
[2179, 2183, 2187, 2159, 2163, 2164, 2196, 2167, 2171, 2175] v16 = __readfsqword(0x28u);
[2200, 2202] v11 = 0;
[2209, 2214] if ( a4 )
[2216, 2220] *a4 = 0LL;
[2243, 2246, 2251, 2227, 2231, 2235, 2239] v11 = simple_strtod_int(a1, a2, a3, &v9);
[2258, 2254] if ( v11 >= 2 )
[2264, 2266, 2260, 2269] return v11;
[2274, 2308, 2310, 2280, 2283, 2290, 2294, 2297, 2300, 2303] if ( !strncmp(*a2, decimal_point, decimal_point_length) )
{
[2316, 2318] *(long double *)&v15 = 0.0;
[2336, 2339, 2343, 2321, 2325, 2328, 2334] *a2 += decimal_point_length;
[2368, 2373, 2346, 2350, 2353, 2357, 2361, 2365] v12 = simple_strtod_int(*a2, &v13, (long double *)&v15.value, &v10);
[2376, 2380] if ( v12 >= 2 )
[2386, 2388, 2382, 2391] return v12;
[2400, 2396] if ( v12 == 1 )
[2402, 2405] v11 = 1;
[2408, 2412, 2414] if ( v10 )
[2416, 2421] return 3LL;
[2434, 2437, 2440, 2443, 2426, 2430] v14 = (const char *)(v13 - *a2);
[2482, 2478] v5 = *(long double *)&v15;
[2468, 2471, 2473, 2447, 2450, 2453, 2485, 2487, 2457, 2463] *(long double *)&v15 = v5 / powerld((int)v14, 10.0);
[2490, 2495] if ( a3 )
{
[2497, 2501, 2503] if ( v9 )
[2505, 2514, 2509, 2511] v6 = *a3 - *(long double *)&v15;
else
[2528, 2530, 2533, 2535, 2539, 2524] v6 = *a3 + *(long double *)&v15;
[2520, 2522, 2516] *a3 = v6;
}
[2546, 2541] if ( a4 )
[2552, 2548, 2556] *a4 = v14;
[2563, 2567, 2559] *a2 = v13;
}
[2593, 2570, 2573, 2577, 2586, 2588] return v11;
[2594] }
// 3468: using guessed type int decimal_point_length;
// 86F: using guessed type long double var_20;
//----- (0000000000000A23) ----------------------------------------------------
long simple_strtod_human(const char *a1, const char **a2, long double *a3, const char **a4, int a5)
[2595] {
const char *v5; // rbx
const char *v6; // rax
const unsigned short *v8; // rbx
unsigned int v12; // [rsp+54h] [rbp-2Ch]
int v13; // [rsp+58h] [rbp-28h]
unsigned int v14; // [rsp+5Ch] [rbp-24h]
long double v15; // [rsp+60h] [rbp-20h]
[2624, 2595, 2628, 2599, 2600, 2603, 2604, 2608, 2612, 2616, 2620] v12 = 0;
[2640, 2635, 2645, 2638] v13 = default_scale_base(a5);
[2648, 2657, 2655] if ( dev_debug )
{
[2659, 2666, 2669, 2674, 2679] v5 = (const char *)quote_n(1LL, decimal_point);
[2689, 2682, 2694, 2686] v6 = (const char *)quote_n(0LL, a1);
[2725, 2728, 2699, 2733, 2702, 2709, 2715, 2718] fprintf(
stderr,
"simple_strtod_human:\n input string: %s\n locale decimal-point: %s\n MAX_UNSCALED_DIGITS: %d\n",
v6,
v5,
18LL);
}
[2754, 2757, 2762, 2738, 2742, 2746, 2750] v14 = simple_strtod_float(a1, a2, a3, a4);
[2769, 2765] if ( v14 >= 2 )
[2777, 2771, 2780, 2775] return v14;
[2792, 2785, 2794] if ( dev_debug )
[2818, 2823, 2826, 2796, 2800, 2833, 2803, 2836, 2805, 2841, 2809, 2811, 2846] fprintf(stderr, " parsed numeric value: %Lf\n input precision = %d\n", *a3, (unsigned int)*a4);
[2850, 2854, 2857, 2860, 2862, 2868] if ( **a2 )
{
[2893] while ( 1 )
{
[2888, 2893] v8 = *_ctype_b_loc();
[2916, 2919, 2922, 2925, 2896, 2928, 2931, 2900, 2934, 2903, 2936, 2906, 2909, 2911] if ( (v8[(unsigned char)to_uchar(**a2)] & 1) == 0 )
break;
[2881, 2885, 2870, 2874, 2877] ++*a2;
}
[2945, 2948, 2951, 2953, 2958, 2960, 2938, 2942] if ( !valid_suffix(**a2) )
[2962, 2967] return 5LL;
[2976, 2972] if ( !a5 )
[2978, 2983] return 4LL;
[3008, 2988, 2992, 2995, 2998, 3001, 3003] v12 = suffix_power(**a2);
[3011, 3015, 3018, 3022, 3026] ++*a2;
[3042, 3045, 3047, 3029, 3033, 3035, 3039] if ( a5 == 1 && **a2 == 105 )
{
[3049] v13 = 1024;
[3056, 3060, 3063, 3067, 3071] ++*a2;
[3081, 3074, 3083] if ( dev_debug )
[3105, 3110, 3085, 3092, 3095, 3102] fprintf(stderr, " Auto-scaling, found 'i', switching to base %d\n", 1024LL);
}
[3115, 3119] *a4 = 0LL;
}
[3130, 3126] if ( a5 == 4 )
{
[3136, 3139, 3142, 3144, 3132] if ( **a2 != 105 )
[3171, 3166] return 6LL;
[3146, 3150, 3153, 3157, 3161, 3164] ++*a2;
}
[3201, 3176, 3179, 3182, 3187, 3190, 3192, 3197] v15 = powerld(v12, (long double)v13);
[3211, 3204, 3213] if ( dev_debug )
[3234, 3241, 3244, 3215, 3249, 3222, 3254, 3225, 3228, 3231] fprintf(stderr, " suffix power=%d^%d = %Lf\n", (unsigned int)v13, v12, v15);
[3264, 3267, 3269, 3273, 3258, 3262] *a3 = *a3 * v15;
[3282, 3275, 3284] if ( dev_debug )
[3296, 3298, 3330, 3300, 3333, 3338, 3307, 3343, 3312, 3315, 3286, 3320, 3290, 3323, 3292] fprintf(stderr, " returning value: %Lf (%LG)\n", *a3, *a3);
[3347, 3350] return v14;
[3354, 3355] }
// 346C: using guessed type char dev_debug;
// 5AC8: using guessed type long quote_n(_QWORD, _QWORD);
//----- (0000000000000D1C) ----------------------------------------------------
void simple_strtod_fatal(int a1, long a2)
[3356] {
long v2; // rbx
char *v3; // rax
char *msgid; // [rsp+18h] [rbp-18h]
[3360, 3361, 3364, 3365, 3369, 3372, 3376, 3356] msgid = 0LL;
[3393, 3401, 3408, 3411, 3413, 3420, 3384, 3388, 3390, 3423] switch ( a1 )
{
case 0:
case 1:
[3426] abort();
case 2:
[3438, 3431] msgid = "value too large to be converted: %s";
[3442] break;
case 3:
[3451, 3444] msgid = "invalid number: %s";
[3455] break;
case 4:
[3464, 3457] msgid = "rejecting suffix in input: %s (consider using --from)";
[3468] break;
case 5:
[3477, 3470] msgid = "invalid suffix in input: %s";
[3481] break;
case 6:
[3490, 3483, 3494] msgid = "missing 'i' suffix in input: %s (e.g Ki/Mi/Gi)";
break;
default:
break;
}
[3504, 3501, 3495] if ( inval_style != 3 )
{
[3513, 3506, 3518, 3510] v2 = quote(a2);
[3528, 3521, 3525] v3 = gettext(msgid);
[3552, 3557, 3562, 3533, 3536, 3542, 3545, 3550] error(conv_exit_code, 0, v3, v2);
}
[3568, 3569, 3563, 3567] }
// 33F8: using guessed type int inval_style;
// 5AE8: using guessed type long quote(_QWORD);
//----- (0000000000000DF2) ----------------------------------------------------
unsigned long double_to_human(int a1, char *a2, size_t a3, int a4, int a5, int a6, long double a7)
[3570] {
char *v15; // rax
long double v16; // fst7
long double v17; // fst6
char *v18; // rax
int v19; // eax
long double v20; // fst7
long double v21; // fst6
_BOOL4 v22; // eax
unsigned int v23; // eax
short *v24; // rax
char *v25; // rax
const char *v26; // rax
unsigned int v32; // [rsp+3Ch] [rbp-74h] BYREF
int v33; // [rsp+40h] [rbp-70h]
unsigned int v34; // [rsp+44h] [rbp-6Ch]
unsigned int v35; // [rsp+48h] [rbp-68h]
int v36; // [rsp+4Ch] [rbp-64h]
char *s; // [rsp+50h] [rbp-60h]
double v38; // [rsp+58h] [rbp-58h]
char format; // [rsp+60h] [rbp-50h] BYREF
_BYTE v40[7]; // [rsp+61h] [rbp-4Fh] BYREF
unsigned long v41; // [rsp+A8h] [rbp-8h]
long double v42; // [rsp+C0h] [rbp+10h]
long double v43; // [rsp+C0h] [rbp+10h]
v41 = __readfsqword(0x28u);
s = v40;
format = 37;
if ( a5 )
{
v15 = s++;
*v15 = 39;
[3585, 3618, 3591, 3625, 3598, 3570, 3634, 3605, 3574, 3575, 3578, 3611] }
[3648, 3652, 3656, 3638, 3640, 3644] if ( zero_padding_width )
[3660] s += snprintf(s, 0x3EuLL, "0%ld", zero_padding_width);
[3670, 3663] if ( dev_debug )
fprintf(stderr, "double_to_human:\n");
[3672] if ( a4 )
[3680, 3676, 3684] goto LABEL_15;
v16 = powerld(a1, 10.0);
[3697, 3694, 3687] v17 = simple_round(a6, v16 * a7);
[3713, 3720, 3725, 3728, 3699, 3733, 3738, 3706, 3740, 3710] a7 = v17 / powerld(a1, 10.0);
[3744, 3753, 3751] if ( dev_debug )
[3777, 3755, 3762, 3769, 3772] {
[3789, 3782] if ( a5 )
fprintf(stderr, " no scaling, returning (grouped) value: %'.*Lf\n", (unsigned int)a1);
[3812, 3815, 3817, 3795, 3801, 3807] else
[3840, 3843, 3846, 3848, 3822, 3826, 3891, 3829, 3831, 3834] fprintf(stderr, " no scaling, returning value: %.*Lf\n", (unsigned int)a1);
[3872, 3877, 3880, 3882, 3853, 3887, 3857, 3860, 3894, 3896, 3866] }
[3906, 3899, 3908] stpcpy(s, ".*Lf");
v36 = snprintf(a2, a3, &format, (unsigned int)a1);
[3917, 3910] if ( v36 < 0 || v36 >= (int)a3 )
[3942, 3948, 3951, 3919, 3954, 3957, 3926] {
v18 = gettext("failed to prepare value '%Lf' for printing");
[3970, 3942, 3954, 3957, 3960, 3965] error(1, 0, v18);
LABEL_15:
[3985, 3978, 3988, 3974] v38 = (double)(int)default_scale_base(a4);
[4031, 4003, 4036, 4040, 4010, 4017, 4020, 4023, 3993, 4026, 3999] v32 = 0;
[4043, 4047, 4049, 4056, 4059] v42 = expld((int)v38, &v32, a7);
if ( dev_debug )
[4072, 4065] fprintf(stderr, " scaled value to %Lf * %0.f ^ %u\n", v42, v38, v32);
[4096, 4101, 4106, 4077, 4080, 4083, 4086, 4091] v33 = 0;
if ( user_precision == -1 )
[4110, 4116, 4118, 4123, 4127] {
[4132] v33 = absld(v42) < 10.0;
[4161, 4164, 4166, 4139, 4171, 4175, 4144, 4149, 4151, 4155, 4158] }
[4185, 4178, 4187] else
[4192, 4224, 4229, 4199, 4234, 4203, 4206, 4209, 4221, 4214, 4189] {
[4238] v19 = user_precision;
[4256, 4252, 4245] if ( 3 * v32 <= user_precision )
v19 = 3 * v32;
[4288, 4291, 4294, 4299, 4303, 4309, 4311, 4313, 4315] v33 = v19;
}
v20 = powerld(v33, 10.0);
v21 = simple_round(a6, v20 * v42);
[4269] v43 = v21 / powerld(v33, 10.0);
[4258, 4261, 4263, 4265, 4267, 4279] if ( absld(v43) >= v38 )
[4276, 4279] {
[4283, 4286] v43 = v43 / v38;
++v32;
[4322, 4325, 4331, 4336, 4339, 4341] }
[4353, 4355, 4358, 4364, 4367, 4370, 4372, 4346, 4412, 4350] v22 = 0.0 != v43 && absld(v43) < 10.0 && v32;
[4384, 4417, 4387, 4393, 4398, 4401, 4403, 4408, 4377, 4381, 4415] v34 = v22;
[4420, 4423, 4426, 4431, 4435, 4438, 4440, 4442, 4444] if ( dev_debug )
fprintf(stderr, " after rounding, value=%Lf * %0.f ^ %u\n", v43, v38, v32);
[4449, 4454, 4452, 4446] stpcpy(s, ".*Lf%s");
[4457, 4460, 4463, 4466, 4469, 4471, 4473, 4475] if ( user_precision == -1 )
v23 = v34;
[4480, 4482, 4484, 4486, 4488, 4491, 4494, 4499, 4503, 4509, 4511, 4513, 4515, 4518, 4520, 4522, 4527, 4529, 4477] else
[4534] v23 = user_precision;
[4544, 4537, 4546] v35 = v23;
[4548, 4580, 4551, 4583, 4588, 4558, 4593, 4562, 4565, 4568, 4573] v24 = suffix_power_char(v32);
[4608, 4601, 4611, 4597] v36 = snprintf(a2, a3 - 1, &format, v35, v24);
[4616, 4627, 4623] if ( v36 < 0 || v36 >= (int)a3 - 1 )
[4638] {
v25 = gettext("failed to prepare value '%Lf' for printing");
[4636, 4629] error(1, 0, v25);
[4641] }
[4649, 4644, 4647] if ( a4 == 4 && v32 )
[4704, 4675, 4708, 4682, 4685, 4654, 4688, 4657, 4691, 4694, 4664, 4699, 4668, 4671] strncat(a2, "i", a3 - v36 - 1);
[4711, 4715, 4717, 4724, 4727, 4730] if ( dev_debug )
{
[4739, 4732] v26 = (const char *)quote(a2);
[4768, 4773, 4744, 4747, 4750, 4753, 4758, 4763] fprintf(stderr, " returning value: %s\n", v26);
}
[4777, 4784, 4786, 4789, 4791] }
[4832, 4805, 4808, 4811, 4815, 4822, 4793, 4796, 4829, 4798] return __readfsqword(0x28u) ^ v41;
[4844, 4837, 4846] }
// 33D8: using guessed type long user_precision;
// 3428: using guessed type long zero_padding_width;
// 346C: using guessed type char dev_debug;
// 5AE8: using guessed type long quote(_QWORD);
//----- (0000000000001339) ----------------------------------------------------
long unit_to_umax(const char *a1)
[4921] {
long v1; // rbx
char *v2; // rax
_BYTE *v4; // [rsp+18h] [rbp-48h] BYREF
long v5; // [rsp+20h] [rbp-40h] BYREF
const char *v6; // [rsp+28h] [rbp-38h]
void *dest; // [rsp+30h] [rbp-30h]
const char *v8; // [rsp+38h] [rbp-28h]
size_t n; // [rsp+40h] [rbp-20h]
unsigned long v10; // [rsp+48h] [rbp-18h]
[4929, 4930, 4934, 4938, 4947, 4921, 4925, 4926] v10 = __readfsqword(0x28u);
[4953, 4957, 4951] v6 = a1;
[4961] dest = 0LL;
[4976, 4969, 4973, 4981] n = strlen(a1);
[4985] v4 = 0LL;
[5000, 4993] v8 = "KMGTPEZY";
[5027, 5030, 5033, 5004, 5036, 5038, 5009, 5043, 5046, 5015, 5048, 5019, 5023] if ( n && (unsigned char)c_isdigit((unsigned int)a1[n - 1]) != 1 )
{
[5058, 5062, 5065, 5070, 5054] dest = (void *)xmalloc(n + 2);
[5089, 5074, 5078, 5082, 5086] v4 = (char *)dest + n - 1;
[5093, 5097, 5101, 5105, 5108, 5111] memcpy(dest, a1, n);
[5120, 5123, 5155, 5125, 5158, 5127, 5160, 5132, 5148, 5134, 5138, 5142, 5145, 5116, 5150] if ( *v4 == 105 && n > 1 && (unsigned char)c_isdigit((unsigned int)(char)*(v4 - 1)) != 1 )
{
[5169, 5162, 5166] *v4 = 0;
}
else
{
[5187, 5171, 5175, 5179, 5183] *++v4 = 66;
[5190, 5194, 5198, 5202, 5206] *++v4 = 0;
[5216, 5209] v8 = "KMGTPEZY0";
}
[5224, 5220] v6 = (const char *)dest;
}
[5250, 5255, 5258, 5263, 5266, 5270, 5272, 5276, 5279, 5281, 5283, 5287, 5290, 5228, 5232, 5236, 5240, 5244, 5247] if ( (unsigned int)xstrtoumax(v6, &v4, 10LL, &v5, v8) || *v4 || !v5 )
{
[5296, 5299, 5292] free(dest);
[5304, 5316, 5308, 5311] v1 = quote(a1);
[5326, 5319] v2 = gettext("invalid unit size: %s");
[5347, 5352, 5331, 5334, 5337, 5342] error(1, 0, v2, v1);
}
[5361, 5364, 5357] free(dest);
[5377, 5386, 5388, 5393, 5369, 5373] return v5;
[5397, 5398, 5399] }
// 5AC0: using guessed type long c_isdigit(_QWORD);
// 5AE8: using guessed type long quote(_QWORD);
// 5B18: using guessed type long xmalloc(_QWORD);
// 5B28: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000001518) ----------------------------------------------------
char * setup_padding_buffer(unsigned long a1)
[5400] {
char *result; // rax
[5408, 5412, 5416, 5400, 5404, 5405] result = (char *)padding_buffer_size;
[5427, 5423] if ( a1 >= padding_buffer_size )
{
[5433, 5437, 5429] padding_buffer_size = a1 + 1;
[5444, 5451, 5458, 5461, 5464] result = (char *)xrealloc(padding_buffer, a1 + 1);
[5476, 5469] padding_buffer = result;
}
[5479] return result;
[5480] }
// 3418: using guessed type long padding_buffer_size;
// 5B38: using guessed type long xrealloc(_QWORD, _QWORD);
//----- (0000000000001569) ----------------------------------------------------
void usage(int a1)
[5481] {
long v1; // rbx
char *v2; // rax
char *v3; // rax
FILE *v4; // rbx
char *v5; // rax
FILE *v6; // rbx
char *v7; // rax
FILE *v8; // rbx
char *v9; // rax
FILE *v10; // rbx
char *v11; // rax
FILE *v12; // rbx
char *v13; // rax
FILE *v14; // rbx
char *v15; // rax
FILE *v16; // rbx
char *v17; // rax
FILE *v18; // rbx
char *v19; // rax
FILE *v20; // rbx
char *v21; // rax
FILE *v22; // rbx
char *v23; // rax
FILE *v24; // rbx
char *v25; // rax
FILE *v26; // rbx
char *v27; // rax
FILE *v28; // rbx
char *v29; // rax
FILE *v30; // rbx
char *v31; // rax
FILE *v32; // rbx
char *v33; // rax
FILE *v34; // rbx
char *v35; // rax
FILE *v36; // rbx
char *v37; // rax
FILE *v38; // rbx
char *v39; // rax
FILE *v40; // rbx
char *v41; // rax
FILE *v42; // rbx
char *v43; // rax
FILE *v44; // rbx
char *v45; // rax
FILE *v46; // rbx
char *v47; // rax
FILE *v48; // rbx
char *v49; // rax
FILE *v50; // rbx
char *v51; // rax
FILE *v52; // rbx
char *v53; // rax
FILE *v54; // rbx
char *v55; // rax
long v56; // rbx
char *v57; // rax
long v58; // r15
long v59; // r14
long v60; // r13
long v61; // r12
long v62; // rbx
char *v63; // rax
long v64; // [rsp+8h] [rbp-58h]
long v65; // [rsp+10h] [rbp-50h]
long v66; // [rsp+18h] [rbp-48h]
long v67; // [rsp+20h] [rbp-40h]
[5511, 5481, 5485, 5486, 5489, 5491, 5493, 5495, 5497, 5498] v1 = program_name;
[5505, 5509, 5502] if ( a1 )
{
[5525, 5518] v2 = gettext("Try '%s --help' for more information.\n");
[5540, 5543, 5546, 5549, 5554, 5559, 5530, 5533] fprintf(stderr, v2, v1);
}
else
{
[5578, 5571, 5564] v3 = gettext("Usage: %s [OPTION]... [NUMBER]...\n");
[5594, 5586, 5589, 5583] printf(v3, v1);
[5599] v4 = stdout;
[5613, 5606] v5 = gettext("Reformat NUMBER(s), or the numbers from standard input if none are specified.\n");
[5624, 5618, 5621] fputs_unlocked(v5, v4);
[5629] emit_mandatory_arg_note();
[5634] v6 = stdout;
[5648, 5641] v7 = gettext(" --debug print warnings about invalid input\n");
[5656, 5659, 5653] fputs_unlocked(v7, v6);
[5664] v8 = stdout;
[5678, 5671] v9 = gettext(" -d, --delimiter=X use X instead of whitespace for field delimiter\n");
[5689, 5683, 5686] fputs_unlocked(v9, v8);
[5694] v10 = stdout;
[5708, 5701] v11 = gettext(
" --field=FIELDS replace the numbers in these input fields (default=1);\n"
" see FIELDS below\n");
[5713, 5716, 5719] fputs_unlocked(v11, v10);
[5724] v12 = stdout;
[5738, 5731] v13 = gettext(
" --format=FORMAT use printf style floating-point FORMAT;\n"
" see FORMAT below for details\n");
[5746, 5749, 5743] fputs_unlocked(v13, v12);
[5754] v14 = stdout;
[5768, 5761] v15 = gettext(
" --from=UNIT auto-scale input numbers to UNITs; default is 'none';\n"
" see UNIT below\n");
[5776, 5779, 5773] fputs_unlocked(v15, v14);
[5784] v16 = stdout;
[5798, 5791] v17 = gettext(" --from-unit=N specify the input unit size (instead of the default 1)\n");
[5809, 5803, 5806] fputs_unlocked(v17, v16);
[5814] v18 = stdout;
[5828, 5821] v19 = gettext(
" --grouping use locale-defined grouping of digits, e.g. 1,000,000\n"
" (which means it has no effect in the C/POSIX locale)\n");
[5833, 5836, 5839] fputs_unlocked(v19, v18);
[5844] v20 = stdout;
[5858, 5851] v21 = gettext(
" --header[=N] print (without converting) the first N header lines;\n"
" N defaults to 1 if not specified\n");
[5866, 5869, 5863] fputs_unlocked(v21, v20);
[5874] v22 = stdout;
[5888, 5881] v23 = gettext(
" --invalid=MODE failure mode for invalid numbers: MODE can be:\n"
" abort (default), fail, warn, ignore\n");
[5896, 5899, 5893] fputs_unlocked(v23, v22);
[5904] v24 = stdout;
[5918, 5911] v25 = gettext(
" --padding=N pad the output to N characters; positive N will\n"
" right-align; negative N will left-align;\n"
" padding is ignored if the output is wider than N;\n"
" the default is to automatically pad if a whitespace\n"
" is found\n");
[5929, 5923, 5926] fputs_unlocked(v25, v24);
[5934] v26 = stdout;
[5948, 5941] v27 = gettext(
" --round=METHOD use METHOD for rounding when scaling; METHOD can be:\n"
" up, down, from-zero (default), towards-zero, nearest\n");
[5953, 5956, 5959] fputs_unlocked(v27, v26);
[5964] v28 = stdout;
[5978, 5971] v29 = gettext(
" --suffix=SUFFIX add SUFFIX to output numbers, and accept optional\n"
" SUFFIX in input numbers\n");
[5986, 5989, 5983] fputs_unlocked(v29, v28);
[5994] v30 = stdout;
[6008, 6001] v31 = gettext(" --to=UNIT auto-scale output numbers to UNITs; see UNIT below\n");
[6016, 6019, 6013] fputs_unlocked(v31, v30);
[6024] v32 = stdout;
[6038, 6031] v33 = gettext(" --to-unit=N the output unit size (instead of the default 1)\n");
[6049, 6043, 6046] fputs_unlocked(v33, v32);
[6054] v34 = stdout;
[6068, 6061] v35 = gettext(" -z, --zero-terminated line delimiter is NUL, not newline\n");
[6073, 6076, 6079] fputs_unlocked(v35, v34);
[6084] v36 = stdout;
[6098, 6091] v37 = gettext(" --help display this help and exit\n");
[6106, 6109, 6103] fputs_unlocked(v37, v36);
[6114] v38 = stdout;
[6128, 6121] v39 = gettext(" --version output version information and exit\n");
[6136, 6139, 6133] fputs_unlocked(v39, v38);
[6144] v40 = stdout;
[6158, 6151] v41 = gettext("\nUNIT options:\n");
[6169, 6163, 6166] fputs_unlocked(v41, v40);
[6174] v42 = stdout;
[6188, 6181] v43 = gettext(" none no auto-scaling is done; suffixes will trigger an error\n");
[6193, 6196, 6199] fputs_unlocked(v43, v42);
[6204] v44 = stdout;
[6218, 6211] v45 = gettext(
" auto accept optional single/two letter suffix:\n"
" 1K = 1000,\n"
" 1Ki = 1024,\n"
" 1M = 1000000,\n"
" 1Mi = 1048576,\n");
[6226, 6229, 6223] fputs_unlocked(v45, v44);
[6234] v46 = stdout;
[6248, 6241] v47 = gettext(
" si accept optional single letter suffix:\n"
" 1K = 1000,\n"
" 1M = 1000000,\n"
" ...\n");
[6256, 6259, 6253] fputs_unlocked(v47, v46);
[6264] v48 = stdout;
[6278, 6271] v49 = gettext(
" iec accept optional single letter suffix:\n"
" 1K = 1024,\n"
" 1M = 1048576,\n"
" ...\n");
[6289, 6283, 6286] fputs_unlocked(v49, v48);
[6294] v50 = stdout;
[6308, 6301] v51 = gettext(
" iec-i accept optional two-letter suffix:\n"
" 1Ki = 1024,\n"
" 1Mi = 1048576,\n"
" ...\n");
[6313, 6316, 6319] fputs_unlocked(v51, v50);
[6324] v52 = stdout;
[6338, 6331] v53 = gettext(
"\n"
"FIELDS supports cut(1) style field ranges:\n"
" N N'th field, counted from 1\n"
" N- from N'th field, to end of line\n"
" N-M from N'th to M'th field (inclusive)\n"
" -M from first to M'th field (inclusive)\n"
" - all fields\n"
"Multiple fields/ranges can be separated with commas\n");
[6346, 6349, 6343] fputs_unlocked(v53, v52);
[6354] v54 = stdout;
[6368, 6361] v55 = gettext(
"\n"
"FORMAT must be suitable for printing one floating-point argument '%f'.\n"
"Optional quote (%'f) will enable --grouping (if supported by current locale).\n"
"Optional width value (%10f) will pad output. Optional zero (%010f) width\n"
"will zero pad the number. Optional negative values (%-10f) will left align.\n"
"Optional precision (%.1f) will override the input determined precision.\n");
[6376, 6379, 6373] fputs_unlocked(v55, v54);
[6384] v56 = program_name;
[6398, 6391] v57 = gettext(
"\n"
"Exit status is 0 if all input numbers were successfully converted.\n"
"By default, %s will stop at the first conversion error with exit status 2.\n"
"With --invalid='fail' a warning is printed for each conversion error\n"
"and the exit status is 2. With --invalid='warn' each conversion error is\n"
"diagnosed, but the exit status is 0. With --invalid='ignore' conversion\n"
"errors are not diagnosed and the exit status is 0.\n");
[6409, 6403, 6406, 6414] printf(v57, v56);
[6426, 6419] v67 = program_name;
[6437, 6430] v66 = program_name;
[6441] v58 = program_name;
[6448] v59 = program_name;
[6462, 6455] v65 = program_name;
[6473, 6466] v64 = program_name;
[6477] v60 = program_name;
[6484] v61 = program_name;
[6491] v62 = program_name;
[6505, 6498] v63 = gettext(
"\n"
"Examples:\n"
" $ %s --to=si 1000\n"
" -> \"1.0K\"\n"
" $ %s --to=iec 2048\n"
" -> \"2.0K\"\n"
" $ %s --to=iec-i 4096\n"
" -> \"4.0Ki\"\n"
" $ echo 1K | %s --from=si\n"
" -> \"1000\"\n"
" $ echo 1K | %s --from=iec\n"
" -> \"1024\"\n"
" $ df -B1 | %s --header --field 2-4 --to=si\n"
" $ ls -l | %s --header --field 5 --to=iec\n"
" $ ls -lh | %s --header --field 5 --from=iec --padding=10\n"
" $ ls -lh | %s --header --field 5 --from=iec --format %%10f\n");
[6528, 6531, 6534, 6537, 6540, 6510, 6513, 6545, 6516, 6518, 6520, 6524] printf(v63, v62, v61, v60, v64, v65, v59, v58, v66, v67);
[6561, 6554, 6550] emit_ancillary_info("numfmt");
}
[6569, 6571, 6566] exit(a1);
}
//----- (00000000000019B0) ----------------------------------------------------
unsigned long parse_format_string(long a1)
[6576] {
long v1; // rbx
char *v2; // rax
long v3; // rax
long v4; // rbx
char *v5; // rax
char *v6; // rax
long v7; // rbx
char *v8; // rax
long v9; // rbx
char *v10; // rax
long v11; // rbx
char *v12; // rax
long v13; // rbx
char *v14; // rax
long v15; // rax
const char *v16; // rax
const char *v17; // r14
const char *v18; // rax
const char *v19; // r13
const char *v20; // r12
long v21; // r15
const char *v22; // rbx
const char *v23; // rax
char v25; // [rsp+17h] [rbp-69h]
char *endptr; // [rsp+18h] [rbp-68h] BYREF
char *i; // [rsp+20h] [rbp-60h]
long v28; // [rsp+28h] [rbp-58h]
long v29; // [rsp+30h] [rbp-50h]
size_t v30; // [rsp+38h] [rbp-48h]
char *v31; // [rsp+40h] [rbp-40h]
unsigned long v32; // [rsp+48h] [rbp-38h]
[6592, 6593, 6597, 6601, 6576, 6610, 6580, 6581, 6584, 6586, 6588, 6590] v32 = __readfsqword(0x28u);
[6616, 6614] v28 = 0LL;
[6624] v29 = 0LL;
[6632] endptr = 0LL;
[6640] v25 = 0;
[6780, 6786, 6790, 6760, 6794, 6764, 6797, 6768, 6800, 6802, 6644, 6772, 6775, 6778, 6652, 6782] for ( i = 0LL; i[a1] != 37 || i[a1 + 1] == 37; i += v3 )
{
[6658, 6662, 6665, 6668, 6670, 6654] if ( !i[a1] )
{
[6672, 6676, 6684, 6679] v1 = quote(a1);
[6694, 6687] v2 = gettext("format %s has no %% directive");
[6720, 6699, 6702, 6705, 6710, 6715] error(1, 0, v2, v1);
}
[6725] ++v28;
[6730, 6734, 6738, 6741, 6744, 6746] if ( i[a1] == 37 )
[6753, 6748] v3 = 2LL;
else
[6755] v3 = 1LL;
}
[6808] ++i;
do
{
[6865, 6867, 6862] while ( 1 )
{
[6839] while ( 1 )
{
[6817, 6821, 6824, 6831, 6834, 6839, 6813] v30 = strspn(&i[a1], " ");
[6843, 6847] i += v30;
[6851, 6867, 6859, 6855] if ( i[a1] != 39 )
break;
[6869] grouping = 1;
[6884, 6879] ++i;
}
[6886, 6890, 6894, 6897, 6900, 6902] if ( i[a1] != 48 )
break;
[6904] v25 = 1;
[6913, 6908] ++i;
}
}
[6920, 6922, 6915] while ( v30 );
[6930, 6924, 6925] *_errno_location() = 0;
[6944, 6948, 6952, 6957, 6960, 6968, 6963, 6936, 6940] v29 = strtol(&i[a1], &endptr, 10);
[6977, 6979, 6982, 6984, 6994, 6998, 6972] if ( *_errno_location() == 34 || v29 == 0x8000000000000000LL )
{
[7000, 7004, 7012, 7007] v4 = quote(a1);
[7022, 7015] v5 = gettext("invalid format %s (width overflow)");
[7043, 7048, 7027, 7030, 7033, 7038] error(1, 0, v5, v4);
}
[7077, 7082, 7053, 7057, 7061, 7064, 7068, 7071] if ( &i[a1] != endptr && v29 )
{
[7106, 7109, 7111, 7115, 7118, 7088, 7120, 7122, 7127, 7095, 7097, 7099] if ( debug && padding_width && (v25 != 1 || v29 <= 0) )
{
[7136, 7129] v6 = gettext("--format padding overriding --padding");
[7141, 7144, 7149, 7154, 7159] error(0, 0, v6);
}
[7169, 7164] if ( v29 >= 0 )
{
[7201, 7197] if ( v25 )
[7203, 7214, 7207] zero_padding_width = v29;
else
[7216, 7220] padding_width = v29;
}
else
{
[7171] padding_alignment = 0;
[7185, 7195, 7188, 7181] padding_width = -v29;
}
}
[7235, 7227, 7231] i = &endptr[-a1];
[7239, 7243, 7247, 7250, 7253, 7255] if ( !*endptr )
{
[7264, 7257, 7261, 7269] v7 = quote(a1);
[7272, 7279] v8 = gettext("format %s ends in %%");
[7300, 7305, 7284, 7287, 7290, 7295] error(1, 0, v8, v7);
}
[7310, 7314, 7318, 7321, 7324, 7326] if ( i[a1] == 46 )
{
[7332] ++i;
[7337, 7342] *_errno_location() = 0;
[7360, 7364, 7369, 7372, 7375, 7348, 7380, 7352, 7356] user_precision = strtol(&i[a1], &endptr, 10);
[7427, 7430, 7433, 7437, 7440, 7443, 7446, 7449, 7452, 7454, 7456, 7460, 7464, 7467, 7470, 7472, 7387, 7392, 7394, 7397, 7399, 7406, 7409, 7411, 7416, 7419, 7423] if ( *_errno_location() == 34 || user_precision < 0 || ((*_ctype_b_loc())[i[a1]] & 1) != 0 || i[a1] == 43 )
{
[7486, 7481, 7474, 7478] v9 = quote(a1);
[7496, 7489] v10 = gettext("invalid precision in format %s");
[7522, 7501, 7504, 7507, 7512, 7517] error(1, 0, v10, v9);
}
[7535, 7531, 7527] i = &endptr[-a1];
}
[7553, 7555, 7539, 7543, 7547, 7550] if ( i[a1] != 102 )
{
[7561, 7569, 7564, 7557] v11 = quote(a1);
[7579, 7572] v12 = gettext("invalid format %s, directive must be %%[0]['][-][N][.][N]f");
[7584, 7587, 7590, 7595, 7600, 7605] error(1, 0, v12, v11);
}
[7623, 7610, 7619, 7615] v31 = ++i;
[7752, 7756, 7760, 7763, 7766, 7768] while ( i[a1] )
{
[7651, 7655, 7625, 7658, 7629, 7661, 7663, 7633, 7636, 7639, 7641, 7643, 7647] if ( i[a1] == 37 && i[a1 + 1] != 37 )
{
[7672, 7665, 7677, 7669] v13 = quote(a1);
[7680, 7687] v14 = gettext("format %s has too many %% directives");
[7713, 7692, 7695, 7698, 7703, 7708] error(1, 0, v14, v13);
}
[7718, 7722, 7726, 7729, 7732, 7734] if ( i[a1] == 37 )
[7736, 7741] v15 = 2LL;
else
[7743] v15 = 1LL;
[7748] i += v15;
}
[7779, 7774] if ( v28 )
[7781, 7785, 7789, 7792, 7795, 7800] format_str_prefix = (char *)ximemdup0(a1, v28);
[7811, 7815, 7818, 7821, 7823, 7807] if ( v31[a1] )
[7844, 7825, 7829, 7833, 7836, 7839] format_str_suffix = (char *)xstrdup(&v31[a1]);
[7858, 7851, 7860] if ( dev_debug )
{
[7873, 7866, 7876] if ( format_str_suffix )
[7885, 7878] v16 = format_str_suffix;
else
[7887] v16 = locale;
[7897, 7907, 7902, 7894] v17 = (const char *)quote_n(2LL, v16);
[7920, 7917, 7910] if ( format_str_prefix )
[7929, 7922] v18 = format_str_prefix;
else
[7931] v18 = locale;
[7938, 7946, 7941, 7951] v19 = (const char *)quote_n(1LL, v18);
[7960, 7954, 7962] if ( padding_alignment )
[7973] v20 = "Right";
else
[7971, 7964] v20 = "Left";
[7980] v21 = padding_width;
[7993, 7987, 7995] if ( grouping )
[8004, 7997] v22 = "yes";
else
[8006] v22 = "no";
[8025, 8017, 8020, 8013] v23 = (const char *)quote_n(0LL, a1);
[8033, 8068, 8040, 8073, 8042, 8044, 8047, 8050, 8053, 8060, 8030, 8063] fprintf(
stderr,
"format String:\n input: %s\n grouping: %s\n padding width: %ld\n alignment: %s\n prefix: %s\n suffix: %s\n",
v23,
v22,
v21,
v20,
v19,
v17);
}
[8098, 8077, 8078, 8082, 8091, 8093] return __readfsqword(0x28u) ^ v32;
[8102, 8103, 8105, 8107, 8109, 8111, 8112] }
// 33D8: using guessed type long user_precision;
// 33E4: using guessed type int padding_alignment;
// 3408: using guessed type int grouping;
// 3420: using guessed type long padding_width;
// 3428: using guessed type long zero_padding_width;
// 3458: using guessed type char debug;
// 346C: using guessed type char dev_debug;
// 5AC8: using guessed type long quote_n(_QWORD, _QWORD);
// 5AE8: using guessed type long quote(_QWORD);
// 5B68: using guessed type long ximemdup0(_QWORD, _QWORD);
// 5B70: using guessed type long xstrdup(_QWORD);
//----- (0000000000001FB1) ----------------------------------------------------
long parse_human_number(const char *a1, long double *a2, const char **a3)
[8113] {
long v4; // r12
long v5; // rbx
char *v6; // rax
unsigned int v7; // [rsp+2Ch] [rbp-24h]
const char *v8[4]; // [rsp+30h] [rbp-20h] BYREF
[8128, 8132, 8136, 8140, 8113, 8117, 8118, 8149, 8121, 8123, 8124] v8[1] = (const char *)__readfsqword(0x28u);
[8153, 8155] v8[0] = 0LL;
[8163, 8196, 8169, 8173, 8177, 8181, 8185, 8188, 8191] v7 = simple_strtod_human(a1, v8, a2, a3, scale_from);
[8203, 8199] if ( v7 < 2 )
{
[8233, 8237, 8240, 8242, 8246, 8249, 8251] if ( v8[0] && *v8[0] )
{
[8259, 8253, 8262] if ( inval_style != 3 )
{
[8264, 8268, 8271, 8276, 8281] v4 = quote_n(1LL, v8[0]);
[8288, 8291, 8296, 8301, 8284] v5 = quote_n(0LL, a1);
[8304, 8311] v6 = gettext("invalid suffix in input %s: %s");
[8325, 8328, 8331, 8336, 8338, 8343, 8316, 8319] error(conv_exit_code, 0, v6, v5, v4);
}
[8348] return 5;
}
[8355, 8358, 8362, 8371, 8373] return v7;
}
else
{
[8205, 8209, 8211, 8215, 8218, 8221, 8223] simple_strtod_fatal(v7, (long)a1);
[8228, 8231] return v7;
}
[8385, 8386, 8378, 8382, 8383] }
// 33F0: using guessed type int scale_from;
// 33F8: using guessed type int inval_style;
// 5AC8: using guessed type long quote_n(_QWORD, _QWORD);
//----- (00000000000020C3) ----------------------------------------------------
long prepare_padded_number(long a1, long double a2)
[8387] {
char *v11; // rax
char *v12; // rax
char *v14; // rax
size_t v15; // rax
const char *v16; // rax
const char *v17; // rax
size_t v18; // rax
unsigned int v19; // [rsp+1Ch] [rbp-A4h] BYREF
long v20; // [rsp+20h] [rbp-A0h] BYREF
long v21; // [rsp+28h] [rbp-98h]
char s[136]; // [rsp+30h] [rbp-90h] BYREF
unsigned long v23; // [rsp+B8h] [rbp-8h]
[8418, 8387, 8391, 8392, 8395, 8402, 8409] v23 = __readfsqword(0x28u);
[8422, 8424, 8431, 8435, 8437, 8444] if ( user_precision != -1 )
[8446] a1 = user_precision;
[8453] v21 = a1;
[8481, 8460, 8467, 8470, 8473, 8476] expld(0xAu, &v19, a2);
[8512, 8514, 8486, 8488, 8521, 8492, 8524, 8528, 8498, 8500, 8506] if ( scale_to || (unsigned long)v19 + v21 <= 0x12 )
{
[8682, 8676, 8685] if ( v19 <= 0x1A )
{
[8768, 8802, 8804, 8774, 8809, 8812, 8781, 8783, 8756, 8790, 8793, 8762, 8796, 8799] double_to_human(v21, s, 0x80uLL, scale_to, grouping, round_style, a2);
[8817, 8828, 8821, 8831] if ( suffix )
{
[8840, 8833, 8843] v15 = strlen(s);
[8870, 8873, 8876, 8848, 8853, 8856, 8863] strncat(s, suffix, 127 - v15);
}
[8888, 8881, 8890] if ( dev_debug )
{
[8899, 8892, 8902] v16 = (const char *)quote(s);
[8930, 8933, 8938, 8907, 8910, 8943, 8917, 8920, 8923] fprintf(stderr, "formatting output:\n value: %Lf\n humanized: %s\n", a2, v16);
}
[8963, 8970, 8973, 8978, 8947, 8985, 8954, 8988, 8957] if ( padding_width && strlen(s) < padding_width )
{
[8997, 8990] v20 = padding_width;
[9024, 9031, 9004, 9038, 9010, 9044, 9047, 9017, 9050] mbsalign(s, padding_buffer, padding_buffer_size, &v20, (unsigned int)padding_alignment, 2LL);
[9064, 9062, 9055] if ( dev_debug )
{
[9073, 9066, 9076] v17 = (const char *)quote(padding_buffer);
[9091, 9098, 9101, 9106, 9111, 9081, 9084] fprintf(stderr, " After padding: %s\n", v17);
}
}
else
{
[9120, 9113, 9123] v18 = strlen(s);
[9128, 9132, 9135] setup_padding_buffer(v18 + 1);
[9154, 9157, 9160, 9165, 9140, 9147] strcpy(padding_buffer, s);
}
[9186, 9188, 9168, 9173, 9177] return 1LL;
}
else
{
[8696, 8693, 8687] if ( inval_style != 3 )
{
[8705, 8698] v14 = gettext("value too large to be printed: '%Lg' (cannot handle values > 999Y)");
[8737, 8710, 8742, 8713, 8719, 8722, 8725, 8730, 8732] error(conv_exit_code, 0, v14);
}
[8746, 8751] return 0LL;
}
}
else
{
[8540, 8534, 8543] if ( inval_style != 3 )
{
[8545, 8553] if ( v21 )
{
[8562, 8555] v11 = gettext("value/precision too large to be printed: '%Lg/%lu' (consider using --to)");
[8576, 8612, 8583, 8616, 8586, 8589, 8602, 8592, 8595, 8567, 8600, 8570, 8607] error(conv_exit_code, 0, v11, v21);
}
else
{
[8625, 8618] v12 = gettext("value too large to be printed: '%Lg' (consider using --to)");
[8642, 8645, 8650, 8652, 8657, 8630, 8662, 8633, 8639] error(conv_exit_code, 0, v12);
}
}
[8666, 8671] return 0LL;
}
[9193, 9194] }
// 33C0: using guessed type int round_style;
// 33D8: using guessed type long user_precision;
// 33E4: using guessed type int padding_alignment;
// 33F4: using guessed type int scale_to;
// 33F8: using guessed type int inval_style;
// 3408: using guessed type int grouping;
// 3418: using guessed type long padding_buffer_size;
// 3420: using guessed type long padding_width;
// 346C: using guessed type char dev_debug;
// 5AE8: using guessed type long quote(_QWORD);
// 5B78: using guessed type long mbsalign(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000023EB) ----------------------------------------------------
int print_padded_number()
[9195] {
int result; // eax
[9195, 9199, 9200, 9203, 9210, 9213] if ( format_str_prefix )
[9222, 9229, 9232, 9235, 9215] fputs_unlocked(format_str_prefix, stdout);
[9254, 9257, 9260, 9240, 9247] fputs_unlocked(padding_buffer, stdout);
[9265] result = (int)format_str_suffix;
[9272, 9275] if ( format_str_suffix )
[9284, 9291, 9294, 9297, 9277] return fputs_unlocked(format_str_suffix, stdout);
[9302, 9303] return result;
[9304] }
//----- (0000000000002459) ----------------------------------------------------
_BOOL8 process_suffixed_number(char *a1, long double *a2, const char **a3, long a4)
[9305] {
size_t v4; // rbx
size_t v5; // rbx
const char *v6; // rax
const unsigned short *v7; // rbx
long v8; // rbx
char *v9; // rax
unsigned int v13; // [rsp+3Ch] [rbp-44h]
unsigned char *i; // [rsp+40h] [rbp-40h]
char *s2; // [rsp+48h] [rbp-38h]
LONG_DOUBLE_16 v16; // [rsp+50h] [rbp-30h] BYREF
unsigned long v17; // [rsp+68h] [rbp-18h]
[9313, 9314, 9318, 9322, 9326, 9330, 9334, 9305, 9309, 9310, 9343] v17 = __readfsqword(0x28u);
[9347, 9356, 9349, 9359] if ( suffix )
{
[9369, 9377, 9372, 9365] v4 = strlen(a1);
[9380, 9387, 9390, 9395, 9398] if ( v4 > strlen(suffix) )
{
[9408, 9411, 9404, 9416] v5 = strlen(a1);
[9440, 9444, 9447, 9419, 9426, 9429, 9434, 9437] s2 = &a1[v5 - strlen(suffix)];
[9473, 9475, 9451, 9458, 9462, 9465, 9468] if ( !strcmp(suffix, s2) )
{
[9481, 9477] *s2 = 0;
[9491, 9484, 9493] if ( dev_debug )
{
[9505, 9502, 9495] v6 = (const char *)quote(suffix);
[9540, 9510, 9513, 9520, 9527, 9530, 9535] fprintf(stderr, "trimming suffix %s\n", v6);
}
}
[9549, 9542, 9551] else if ( dev_debug )
{
[9570, 9575, 9553, 9560, 9567] fprintf(stderr, "no valid suffix found\n");
}
}
}
[9602, 9604, 9580, 9584, 9588, 9590, 9595, 9599] for ( i = (unsigned char *)a1; *i; ++i )
{
[9611, 9606] v7 = *_ctype_b_loc();
[9634, 9637, 9640, 9643, 9614, 9646, 9649, 9618, 9651, 9621, 9624, 9626, 9631] if ( (v7[(unsigned char)to_uchar(*i)] & 1) == 0 )
break;
}
[9664, 9670, 9672] if ( auto_padding )
{
[9674, 9678, 9680, 9653, 9685, 9657, 9661] if ( (_DWORD)a1 == (_DWORD)i && a4 <= 1 )
{
[9723] padding_width = 0LL;
}
else
{
[9691, 9699, 9694, 9687] padding_width = strlen(a1);
[9713, 9706, 9716, 9721] setup_padding_buffer(padding_width);
}
[9741, 9734, 9743] if ( dev_debug )
[9766, 9769, 9774, 9745, 9752, 9759] fprintf(stderr, "setting Auto-Padding to %ld characters\n", padding_width);
}
[9779, 9781] *(long double *)&v16 = 0.0;
[9792, 9796, 9799, 9802, 9807, 9784, 9788] v13 = parse_human_number((const char *)i, (long double *)&v16.value, a3);
[9825, 9810, 9814, 9816, 9823] if ( v13 == 1 && debug )
{
[9834, 9827, 9839, 9831] v8 = quote(i);
[9849, 9842] v9 = gettext("large input value %s: possible precision loss");
[9857, 9860, 9865, 9870, 9875, 9854] error(0, 0, v9, v8);
}
[9920, 9891, 9923, 9893, 9925, 9931, 9900, 9904, 9906, 9880, 9913, 9917, 9887] if ( from_unit_size != 1 || to_unit_size != 1 )
[9952, 9955, 9957, 9963, 9933, 9965, 9967, 9936, 9938, 9945, 9949] *(long double *)&v16 = (long double)(unsigned long)from_unit_size
[9977, 9970, 9973] * *(long double *)&v16
[9985, 9989, 9991, 10023, 9996, 9979, 9983] / (long double)(unsigned long)to_unit_size;
[10027, 10028, 10029] *a2 = *(long double *)&v16;
return v13 <= 1;
}
// 33C8: using guessed type long from_unit_size;
// 33D0: using guessed type long to_unit_size;
// 3420: using guessed type long padding_width;
// 3448: using guessed type int auto_padding;
// 3458: using guessed type char debug;
// 346C: using guessed type char dev_debug;
// 5AE8: using guessed type long quote(_QWORD);
// 2459: using guessed type long double var_30;
//----- (000000000000272E) ----------------------------------------------------
char * next_field(unsigned char **a1)
[10030] {
unsigned char *v2; // [rsp+10h] [rbp-10h]
char *v3; // [rsp+18h] [rbp-8h]
[10050, 10053, 10030, 10034, 10035, 10038, 10042, 10046] v3 = (char *)*a1;
[10057, 10061] v2 = *a1;
[10065, 10076, 10071] if ( delimiter == 128 )
{
[10147, 10150, 10152, 10154, 10158, 10161, 10164, 10166, 10175, 10171, 10173, 10143] while ( *v2 && field_sep(*v2) )
[10138] ++v2;
[10210, 10213, 10182, 10215, 10186, 10189, 10191, 10193, 10197, 10200, 10203, 10205] while ( *v2 && !field_sep(*v2) )
[10177] ++v2;
}
[10082, 10085, 10088, 10094, 10096, 10098, 10078] else if ( *v3 != delimiter )
{
[10112, 10114, 10116, 10120, 10123, 10126, 10132, 10134, 10136, 10105, 10109] while ( *v2 && (char)*v2 != delimiter )
[10100] ++v2;
}
[10217, 10225, 10221] *a1 = v2;
[10232, 10228] return v3;
[10233] }
//----- (00000000000027FA) ----------------------------------------------------
bool include_field(unsigned long a1)
[10234] {
_QWORD *v2; // [rsp+10h] [rbp-8h]
[10242, 10246, 10253, 10234, 10238, 10239] v2 = (_QWORD *)frp;
[10257, 10262] if ( !frp )
[10264, 10272, 10269] return a1 == 1;
[10313, 10317, 10320, 10324, 10326] while ( *v2 != -1LL )
{
[10274, 10278, 10281, 10285, 10287, 10291, 10295, 10299] if ( a1 >= *v2 && a1 <= v2[1] )
[10306, 10301] return 1;
[10308] v2 += 2;
}
[10331] return 0;
[10332] }
//----- (000000000000285D) ----------------------------------------------------
_BOOL8 process_field(char *a1, unsigned long a2)
[10333] {
_BOOL4 v2; // eax
bool v4; // [rsp+27h] [rbp-29h]
const char *v5; // [rsp+28h] [rbp-28h] BYREF
LONG_DOUBLE_16 v6; // [rsp+30h] [rbp-20h] BYREF
unsigned long v7; // [rsp+48h] [rbp-8h]
[10337, 10338, 10341, 10345, 10349, 10353, 10362, 10333] v7 = __readfsqword(0x28u);
[10368, 10370, 10366] *(long double *)&v6 = 0.0;
[10373] v5 = 0LL;
[10381] v4 = 1;
[10385, 10389, 10392, 10397, 10399] if ( include_field(a2) )
{
[10401, 10405, 10409, 10413, 10417, 10420] v2 = process_suffixed_number(a1, (long double *)&v6.value, &v5, a2);
[10425, 10427, 10430] v4 = v2;
[10433, 10437] if ( v2 )
[10466, 10468, 10439, 10471, 10443, 10446, 10451, 10454, 10457, 10462] v4 = (unsigned int)prepare_padded_number((long)v5, *(long double *)&v6) != 0;
[10474, 10478] if ( v4 )
[10480, 10485] print_padded_number();
else
[10498, 10501, 10504, 10509, 10487, 10494] fputs_unlocked(a1, stdout);
}
else
{
[10528, 10511, 10518, 10522, 10525] fputs_unlocked(a1, stdout);
}
[10533, 10537, 10541, 10550, 10552, 10557] return v4;
[10558] }
// 285D: using guessed type long double var_20;
//----- (000000000000293F) ----------------------------------------------------
long process_line(unsigned char *a1, char a2)
[10559] {
int v2; // eax
unsigned char *v4; // [rsp+8h] [rbp-28h] BYREF
unsigned char v5; // [rsp+1Fh] [rbp-11h]
unsigned long v6; // [rsp+20h] [rbp-10h]
char *v7; // [rsp+28h] [rbp-8h]
[10563, 10564, 10567, 10571, 10559] v4 = a1;
[10577, 10580, 10575] v6 = 0LL;
[10588] v5 = 1;
[10592] while ( 1 )
{
[10592] ++v6;
[10609, 10601, 10604, 10597] v7 = next_field(&v4);
[10617, 10620, 10613, 10622] if ( !*v4 )
break;
[10624, 10628] *v4 = 0;
[10631, 10635, 10639, 10642, 10645, 10650, 10653, 10655] if ( !process_field(v7, v6) )
[10657] v5 = 0;
[10674, 10668, 10661, 10679] if ( delimiter == 128 )
[10689] v2 = 32;
else
[10681, 10687] v2 = delimiter;
[10697, 10699, 10694] fputc_unlocked(v2, stdout);
[10704, 10716, 10708, 10712] ++v4;
}
[10722, 10726, 10729, 10732, 10737, 10740, 10742, 10718] if ( !process_field(v7, v6) )
[10744] v5 = 0;
[10753, 10748, 10749] if ( a2 )
[10762, 10755, 10765, 10767] putchar_unlocked((unsigned char)line_delim);
[10776, 10772] return v5;
[10777] }
// 33EC: using guessed type char line_delim;
//----- (0000000000002A1A) ----------------------------------------------------
int main(int argc, const char **argv, const char **envp)
[10778] {
long v3; // rbx
char *v4; // rax
char *v5; // rax
char *v6; // rax
long v7; // rbx
char *v8; // rax
char *v9; // rax
char *v10; // rax
char *v11; // rax
char *v12; // rax
char *v13; // rax
char *v14; // rax
_BOOL4 v15; // eax
char *v16; // rax
long v17; // rax
int v18; // edx
char *v19; // rbx
int *v20; // rax
char *v21; // rax
bool v23; // [rsp+12h] [rbp-3Eh]
bool v24; // [rsp+13h] [rbp-3Dh]
int v25; // [rsp+14h] [rbp-3Ch]
int v26; // [rsp+18h] [rbp-38h]
int v27; // [rsp+1Ch] [rbp-34h]
char *s; // [rsp+20h] [rbp-30h] BYREF
size_t n; // [rsp+28h] [rbp-28h] BYREF
__ssize_t v30; // [rsp+30h] [rbp-20h]
unsigned long v31; // [rsp+38h] [rbp-18h]
[10786, 10787, 10791, 10794, 10798, 10807, 10778, 10782, 10783] v31 = __readfsqword(0x28u);
[10811, 10813] v25 = 1;
[10824, 10827, 10820, 10830] set_program_name(*argv, argv, envp);
[10852, 10855, 10858, 10835, 10842, 10847] v23 = setlocale(6, locale) != 0LL;
[10875, 10868, 10861] bindtextdomain("coreutils", "/usr/local/share/locale");
[10880, 10887] textdomain("coreutils");
[10897, 10892, 10902] decimal_point = nl_langinfo(0x10000);
[10916, 10919, 10921, 10928, 10931, 10936, 10939, 10909] if ( !decimal_point || !strlen(decimal_point) )
[10948, 10941] decimal_point = ".";
[10970, 10962, 10955, 10965] decimal_point_length = strlen(decimal_point);
[10976, 10986, 10983] atexit((void (*)(void))&close_stdout);
[11025] while ( 1 )
{
[11011, 11018, 11020, 10991, 11025, 10995, 10998, 11004] v27 = getopt_long(argc, (char *const *)argv, "d:z", &longopts, 0LL);
[11032, 11028] if ( v27 == -1 )
break;
[11045, 11038] if ( v27 > 141 )
goto LABEL_44;
[11051, 11055] if ( v27 < 100 )
{
[11064, 11057] if ( v27 == -131 )
{
[12160, 12193, 12166, 12198, 12173, 12176, 12146, 12183, 12153, 12190] version_etc(stdout, "numfmt", "GNU coreutils", Version, "Assaf Gordon", 0LL);
[12208, 12203] exit(0);
}
[11083, 11077, 11070] if ( v27 == -130 )
[12136, 12141] usage(0);
LABEL_44:
[12218, 12213] usage(1);
}
[11105, 11113, 11088, 11120, 11091, 11123, 11125, 11094, 11135, 11097, 11132, 11103] switch ( v27 )
{
case 100:
[11745, 11747, 11754, 11758, 11761, 11763, 11733, 11740, 11743] if ( *optarg && optarg[1] )
{
[11772, 11765] v6 = gettext("the delimiter must be a single character");
[11777, 11780, 11785, 11790, 11795] error(1, 0, v6);
}
[11800, 11810, 11813, 11807] delimiter = *optarg;
[11819] continue;
case 122:
[11824] line_delim = 0;
[11831] continue;
case 128:
[11200, 11138, 11174, 11208, 11145, 11181, 11215, 11152, 11184, 11218, 11156, 11158, 11191, 11161, 11196, 11167] scale_from = scale_from_types[_xargmatch_internal(
"--from",
optarg,
scale_from_args,
scale_from_types,
4LL,
argmatch_die,
1LL)];
[11224] continue;
case 129:
[11244, 11236, 11229, 11239] from_unit_size = unit_to_umax(optarg);
[11251] continue;
case 130:
[11299, 11333, 11270, 11302, 11336, 11274, 11276, 11309, 11279, 11314, 11285, 11318, 11256, 11292, 11326, 11263] scale_to = scale_to_types[_xargmatch_internal(
"--to",
optarg,
scale_to_args,
scale_to_types,
4LL,
argmatch_die,
1LL)];
[11342] continue;
case 131:
[11354, 11347, 11357, 11362] to_unit_size = unit_to_umax(optarg);
[11369] continue;
case 132:
[11392, 11394, 11427, 11397, 11432, 11403, 11436, 11374, 11420, 11410, 11444, 11381, 11417, 11451, 11388, 11454] round_style = round_types[_xargmatch_internal(
"--round",
optarg,
&round_args,
round_types,
4LL,
argmatch_die,
1LL)];
[11460] continue;
case 133:
[11843, 11836] suffix = optarg;
[11850] continue;
case 134:
[11465] grouping = 1;
[11475] continue;
case 135:
[11552, 11521, 11519, 11523, 11555, 11494, 11530, 11501, 11533, 11535, 11506, 11542, 11511, 11480, 11514, 11487] if ( (unsigned int)xstrtol(optarg, 0LL, 10LL, &padding_width, locale)
|| !padding_width
|| padding_width == 0x8000000000000000LL )
{
[11564, 11557, 11572, 11567] v3 = quote(optarg);
[11582, 11575] v4 = gettext("invalid padding value %s");
[11587, 11590, 11593, 11598, 11603, 11608] error(1, 0, v4, v3);
}
[11620, 11613, 11623] if ( padding_width < 0 )
{
[11629] padding_alignment = 0;
[11649, 11646, 11639] padding_width = -padding_width;
}
[11656] continue;
case 136:
[11668, 11661, 11671] if ( n_frp )
{
[11680, 11673] v5 = gettext("multiple field specifications");
[11685, 11688, 11693, 11698, 11703] error(1, 0, v5);
}
[11720, 11715, 11708, 11723] set_fields(optarg, 1LL);
[11728] continue;
case 137:
[11855] debug = 1;
[11862] continue;
case 138:
[11867] dev_debug = 1;
[11874] debug = 1;
[11881] continue;
case 139:
[11896, 11893, 11886] if ( !optarg )
goto LABEL_39;
[11905, 11937, 11939, 11941, 11912, 11948, 11919, 11951, 11924, 11929, 11898, 11932] if ( (unsigned int)xstrtoumax(optarg, 0LL, 10LL, &header, locale) || !header )
{
[11972, 11964, 11957, 11967] v7 = quote(optarg);
[11982, 11975] v8 = gettext("invalid header value %s");
[12003, 12008, 11987, 11990, 11993, 11998] error(1, 0, v8, v7);
LABEL_39:
[12013] header = 1LL;
}
[12024] break;
case 140:
[12036, 12029] format_str = (long)optarg;
[12043] continue;
case 141:
[12128, 12066, 12068, 12101, 12071, 12106, 12077, 12110, 12048, 12094, 12084, 12118, 12055, 12091, 12125, 12062] inval_style = inval_types[_xargmatch_internal(
"--invalid",
optarg,
inval_args,
inval_types,
4LL,
argmatch_die,
1LL)];
[12134] continue;
default:
goto LABEL_44;
}
}
[12256, 12235, 12236, 12243, 12246, 12248, 12254] if ( format_str && grouping )
{
[12265, 12258] v9 = gettext("--grouping cannot be combined with --format");
[12288, 12270, 12273, 12278, 12283] error(1, 0, v9);
}
[12293, 12300, 12302, 12304, 12308, 12311, 12313] if ( debug && !v23 )
{
[12322, 12315] v10 = gettext("failed to set locale");
[12327, 12330, 12335, 12340, 12345] error(0, 0, v10);
}
[12387, 12357, 12389, 12359, 12391, 12361, 12398, 12367, 12369, 12401, 12371, 12403, 12413, 12377, 12410, 12379, 12381, 12350] if ( debug && !scale_from && !scale_to && !grouping && !padding_width && !format_str )
{
[12422, 12415] v11 = gettext("no conversion option specified");
[12427, 12430, 12435, 12440, 12445] error(0, 0, v11);
}
[12457, 12450, 12460] if ( format_str )
[12472, 12469, 12462] parse_format_string(format_str);
[12485, 12483, 12477] if ( grouping )
{
[12495, 12493, 12487] if ( scale_to )
{
[12504, 12497] v12 = gettext("grouping cannot be combined with --to");
[12512, 12517, 12522, 12527, 12509] error(1, 0, v12);
}
[12539, 12532, 12541] if ( debug )
{
[12548, 12543] v13 = nl_langinfo(65537);
[12553, 12556, 12564, 12561] if ( !strlen(v13) )
{
[12573, 12566] v14 = gettext("grouping has no effect in this locale");
[12578, 12581, 12586, 12591, 12596] error(0, 0, v14);
}
}
}
[12608, 12601, 12611] setup_padding_buffer(padding_width);
[12641, 12646, 12616, 12648, 12623, 12626, 12628, 12634, 12639] v15 = !padding_width && delimiter == 128;
[12653] auto_padding = v15;
[12665, 12659, 12667] if ( inval_style )
[12669] conv_exit_code = 0;
[12688, 12685, 12679] if ( argc <= optind )
{
[12827] s = 0LL;
[12843, 12835] n = 0LL;
[12867] while ( 1 )
{
[12867] v17 = header--;
[12928, 12897, 12904, 12874, 12907, 12878, 12911, 12915, 12885, 12918, 12888, 12890, 12923, 12926] if ( !v17 || getdelim(&s, &n, (unsigned char)line_delim, stdin) <= 0 )
break;
[12845, 12852, 12856, 12859, 12862] fputs_unlocked(s, stdout);
}
[13047] while ( 1 )
{
[13028, 13031, 13035, 13039, 13042, 13014, 13047, 13021] v30 = getdelim(&s, &n, (unsigned char)line_delim, stdin);
[13056, 13051] if ( v30 <= 0 )
break;
[12930, 12934, 12938, 12942, 12945, 12948, 12951] v18 = s[v30 - 1];
[12961, 12963, 12966, 12958] v24 = v18 == (unsigned char)line_delim;
[12969, 12973, 12958] if ( v18 == (unsigned char)line_delim )
[12975, 12979, 12983, 12987, 12990] s[v30 - 1] = 0;
[12993, 12997, 13001, 13003, 13006, 13011] v25 &= process_line((unsigned char *)s, v24);
}
[13058, 13065, 13068, 13073, 13075] if ( ferror_unlocked(stdin) )
{
[13089, 13084, 13077] v19 = gettext("error reading input");
[13092] v20 = _errno_location();
[13097, 13099, 13102, 13104, 13109, 13114] error(0, *v20, v19);
}
}
else
{
[12705, 12712, 12715, 12694, 12701, 12703] if ( debug && header )
{
[12724, 12717] v16 = gettext("--header ignored with command-line input");
[12737, 12742, 12747, 12752, 12729, 12732] error(0, 0, v16);
}
[12817, 12811, 12820, 12822] while ( argc > optind )
{
[12770, 12774, 12777, 12780, 12785, 12754, 12788, 12760, 12793, 12762] v25 &= process_line((unsigned char *)argv[optind], 1);
[12802, 12796, 12805] ++optind;
}
}
[13126, 13128, 13130, 13134, 13119] if ( debug && !v25 )
{
[13136, 13143] v21 = gettext("failed to convert some of the input numbers");
[13156, 13161, 13166, 13148, 13151] error(0, 0, v21);
}
[13171] v26 = 0;
[13184, 13190, 13193, 13195, 13201, 13204, 13178, 13182] if ( !v25 && inval_style != 2 && inval_style != 3 )
[13206] return 2;
[13216, 13220, 13229, 13231, 13236, 13213] return v26;
[13240, 13241] }
// 33C0: using guessed type int round_style;
// 33C8: using guessed type long from_unit_size;
// 33D0: using guessed type long to_unit_size;
// 33E4: using guessed type int padding_alignment;
// 33EC: using guessed type char line_delim;
// 33F0: using guessed type int scale_from;
// 33F4: using guessed type int scale_to;
// 33F8: using guessed type int inval_style;
// 3408: using guessed type int grouping;
// 3420: using guessed type long padding_width;
// 3430: using guessed type long format_str;
// 3448: using guessed type int auto_padding;
// 3450: using guessed type long header;
// 3458: using guessed type char debug;
// 3468: using guessed type int decimal_point_length;
// 346C: using guessed type char dev_debug;
// 3650: using guessed type _DWORD scale_from_types[8];
// 3670: using guessed type _DWORD scale_to_types[4];
// 36B0: using guessed type _DWORD round_types[5];
// 36E0: using guessed type _DWORD inval_types[4];
// 5260: using guessed type char *scale_from_args[5];
// 52A0: using guessed type char *scale_to_args[4];
// 52E0: using guessed type void *round_args;
// 5320: using guessed type char *inval_args[4];
// 5AE8: using guessed type long quote(_QWORD);
// 5B28: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5BA0: using guessed type long set_program_name(_QWORD, _QWORD, _QWORD);
// 5BC0: using guessed type void (*close_stdout)(void);
// 5BE8: using guessed type long _xargmatch_internal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5BF0: using guessed type long xstrtol(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 5C00: using guessed type long set_fields(_QWORD, _QWORD);
// 5C10: using guessed type long version_etc(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// nfuncs=81 queued=35 decompiled=35 lumina nreq=0 worse=0 better=0
// ALL OK, 35 function(s) have been successfully decompiled
|
int build_reverse_script(unsigned long long a0[74]) {
[3152] void* v2; // r12
[3152] void* v3; // r13
[3152] char v5; // dl
[3152] void* v6; // r9
[3152] void* v7; // rbx
[3152] void* v8; // rbp
[3152] void* v9; // rcx
[3152] unsigned long long v10; // rax
[3152] void* v11; // rsi
[3152] void* v12; // rdi
[3152] unsigned int v13; // r8, Other Possible Types: void*, unsigned long long
[3152]
[3152] v2 = a0[35];
[3173] v3 = a0[73];
[3180] if (a0[25] > 0) {
[3194, 3197] LABEL_400c88:
v11 = 0;
[3208] v12 = 0;
[3210] v13 = 0;
[3212] do {
[3216] do {
[3216] v5 = *((v3 + v11));
[3216, 3221] if (!(!*((v2 + v12))) || !(!*((v3 + v11)))) {
[3216, 3221, 3227, 3229, 3231] v7 = v12;
[3272] if (!*((v2 + v12))) {
[3216] v6 = 0;
[3360] } else {
do {
[3280] v7 += 1;
[3280] } while (*((v2 + v7)));
[3280, 3284] v6 = v7 - 0;
[3297, 3300, 3302, 3210, 3291, 3294] }
v8 = v11;
[3297] if (!v5) {
v9 = 0;
[3352] } else {
do {
[3312] v8 += 1;
[3312] } while (*((v3 + v8)));
[3312, 3316] v9 = v8 - 0;
[3330, 3333, 3208, 3324, 3327] }
v10 = add_change(v12, v11, v6, v9, v13);
[3330, 3333] v11 = v8;
[3338] v12 = v7;
[3341] v13 = v10;
[3344] }
v12 += 1;
[3233] v11 += 1;
[3237] } while (a0[25] > v12);
[3216, 3241, 3244] } while (a0[63] > v11);
[3216, 3249, 3246] } else {
if (!(a0[63] <= 0))
[3202, 3199] goto LABEL_400c88;
[3202, 3199] v13 = 0;
[3365] }
return v13;
}
|
int build_reverse_script(unsigned long long a0[74]) {
[7875] void* v0; // [bp-0x50], Other Possible Types: unsigned long
[7875] void* v1; // [bp-0x48]
[7875] void* v2; // [bp-0x40]
[7875] void* v3; // [bp-0x38]
[7875] void* v4; // [bp-0x30]
[7875] unsigned long v5; // [bp-0x28]
[7875] unsigned long v6; // [bp-0x20]
[7875] void* v7; // [bp-0x18]
[7875] void* v8; // [bp-0x10]
[7875]
[7875] v0 = 0;
[7875, 7879, 7880, 7883, 7887, 7891] v3 = a0[35];
[7910, 7899, 7903] v4 = a0[73];
[7914, 7918, 7924, 7931] v5 = a0[25];
[7939, 7946, 7935] v6 = a0[63];
[7950, 7954, 7960, 7967] v1 = 0;
[7971] v2 = 0;
[7979] while (true) {
if (v1 >= v5 && v2 >= v6)
[8165, 8151, 8169, 8155, 8173, 8159] break;
[8169, 8165, 8173] if ((*((v4 + v2)) | *((v3 + v1)))) {
[8000, 8020, 8014] v7 = v1;
[8026, 8030] for (v8 = v2; *((v3 + v1)); v1 += 1);
[8065, 8034, 8038, 8044, 8049, 8053, 8057, 8060, 8063] for (; *((v4 + v2)); v2 += 1);
[8069, 8074, 8078, 8082, 8085, 8088, 8090] v0 = add_change(v7, v8, v1 - v7, v2 - v8, v0);
[8132, 8137, 8141, 8146, 8151, 8155, 8159, 8096, 8107] }
v1 += 1;
[8065, 8044, 8141, 8049, 8053, 8057, 8060, 8063] v2 += 1;
[8069, 8074, 8078, 8146, 8082, 8085, 8151, 8088, 8090, 8155, 8159] }
return v0;
}
|
size_t add_range_pair(long a1, long a2)
[48] {
size_t v2; // rdx
__m128 *v3; // rdi
size_t result; // rax
__m128 *v5; // rax
double v6[2]; // [rsp+8h] [rbp-10h] BYREF
[48, 52] v2 = n_frp;
[66, 59, 70] v3 = (__m128 *)frp;
[77] *(_QWORD *)&v6[0] = a2;
[82] if ( n_frp == n_frp_allocated )
{
[128, 140, 133, 70] v5 = (__m128 *)x2nrealloc(frp, &n_frp_allocated, 16LL);
[145] v2 = n_frp;
[152] frp = v5;
[162, 159] v3 = v5;
}
[96, 89, 84, 92] result = 16 * v2;
[96, 105, 100] v3[v2] = _mm_loadh_ps(v6);
[109] n_frp = v2 + 1;
[116] return result;
[120] }
// 650: using guessed type long n_frp_allocated;
// 8E0: using guessed type long x2nrealloc(_QWORD, _QWORD, _QWORD);
// 30: using guessed type double var_10[2];
//----- (00000000000000B0) ----------------------------------------------------
void complement_rp()
[176] {
_QWORD *v0; // r13
size_t v1; // r12
_QWORD *v2; // rbx
long v3; // rdi
long v4; // rdi
[176, 178, 180, 181, 182, 186] v0 = frp;
[193] v1 = n_frp;
[200] frp = 0LL;
[211] n_frp = 0LL;
[222] n_frp_allocated = 0LL;
[233, 241, 237] if ( *v0 > 1uLL )
[233, 243, 252, 247] add_range_pair(1LL, *v0 - 1LL);
[257, 261] if ( v1 > 1 )
{
[266, 263] v2 = v0 + 2;
do
{
[280, 287] v3 = *(v2 - 1) + 1LL;
[291, 284, 294] if ( v3 != *v2 )
[296, 284, 300] add_range_pair(v3, *v2 - 1LL);
[305] v2 += 2;
}
[270, 274, 309, 277, 312] while ( &v0[2 * v1] != v2 );
}
[314, 318] v4 = v0[2 * v1 - 1];
[323, 327] if ( v4 != -1 )
[329, 340, 333] add_range_pair(v4 + 1, -1LL);
[349, 358] free(v0);
[352, 353, 354, 356, 345] }
// 650: using guessed type long n_frp_allocated;
//----- (0000000000000170) ----------------------------------------------------
void * set_fields(char *a1, unsigned long a2)
[368] {
char *v2; // rbp
unsigned long v3; // r8
char v4; // dl
char v5; // r13
char v6; // r14
char v7; // r15
unsigned long v8; // r12
unsigned char v9; // al
long v10; // rcx
_QWORD *v11; // r9
char *v12; // rbx
size_t v13; // rdx
long v14; // r12
long v15; // rbp
size_t v16; // rbx
long v17; // r14
unsigned long v18; // rax
char *v19; // rsi
_QWORD *v20; // rdi
void *result; // rax
int v22; // edi
unsigned long v23; // rax
char *v24; // rdx
size_t v25; // rsi
void *v26; // rbp
long v27; // rdx
long v28; // rcx
long v29; // r8
long v30; // r12
char *v31; // rdx
const char *v32; // rsi
char *v33; // rdx
long v34; // r12
char *v35; // rdx
char *v36; // rdx
unsigned char v37; // [rsp+Fh] [rbp-49h]
unsigned long v38; // [rsp+10h] [rbp-48h]
int v39; // [rsp+18h] [rbp-40h]
char v40; // [rsp+1Ch] [rbp-3Ch]
[386, 387, 368, 372, 374, 376, 378, 380, 382, 383] v2 = a1;
[394] v40 = a2;
[398, 391] v39 = a2 & 1;
[416, 418, 391, 402, 404, 411] if ( (a2 & 1) != 0 && (a2 = (unsigned long)"-", !strcmp(a1, "-")) )
{
[1148] v2 = a1 + 1;
[1152] v3 = 1LL;
[1163, 1158] v4 = 1;
}
else
{
[424] v3 = 0LL;
[427] v4 = 0;
}
[429] v5 = v4;
[432] v6 = 0;
[435] v7 = 0;
[444, 438] v8 = 1LL;
[600] while ( 1 )
{
[600] v12 = (char *)(unsigned char)*v2;
[604, 607] if ( (_BYTE)v12 != 45 )
break;
[616, 613] if ( v5 )
goto LABEL_60;
[625, 630, 628, 622] v6 = v4 & (v3 == 0);
[633] if ( v6 )
{
LABEL_53:
[1185, 1195, 1190] if ( (v40 & 4) != 0 )
[1208, 1201, 1210, 1215] v24 = dcgettext(0LL, "byte/character positions are numbered from 1", 5);
else
[1441, 1443, 1448, 1451, 1434] v24 = dcgettext(0LL, "fields are numbered from 1", 5);
[1224] while ( 1 )
{
[1224, 1218, 1220, 1222] error(0, 0, v24);
LABEL_56:
[1234, 1229] usage(1LL);
LABEL_57:
[1249, 1257, 1246, 1239] v25 = strspn(v12, "0123456789");
[1257, 1260, 1254, 1268] v26 = (void *)ximemdup0(v12, v25);
[1265, 1276, 1281, 1271] v30 = quote(v26, v25, v27, v28, v29);
[1289, 1284] if ( (v40 & 4) != 0 )
[1305, 1298, 1291, 1300] v31 = dcgettext(0LL, "byte/character offset %s is too large", 5);
else
[1415, 1422, 1424, 1429, 1432] v31 = dcgettext(0LL, "field number %s is too large", 5);
[1313, 1315, 1317, 1308, 1311] error(0, 0, v31, v30);
[1322, 1325] free(v26);
[1330, 1335] usage(1LL);
LABEL_60:
[1345, 1340, 1350] if ( (v40 & 4) != 0 )
[1352, 1359, 1361, 1366, 1369] v24 = dcgettext(0LL, "invalid byte or character range", 5);
else
[1473, 1456, 1463, 1465, 1470] v24 = dcgettext(0LL, "invalid field range", 5);
}
}
[641, 639] if ( v4 )
{
[647] v8 = v3;
[650] v5 = v4;
[656, 653] v3 = 0LL;
}
else
{
[1000] v6 = 0;
[1003] v3 = 0LL;
[1006] v5 = 1;
[1018, 1012] v8 = 1LL;
}
LABEL_16:
[596] ++v2;
}
[456, 459] if ( (_BYTE)v12 != 44 )
{
[461] v38 = v3;
[466] v37 = v4;
[470] _ctype_b_loc();
[481, 475, 478] v9 = to_uchar((char)v12);
[486] v4 = v37;
[491] v3 = v38;
[496, 499, 502, 507] if ( (*(_BYTE *)(*v11 + 2LL * v9) & 1) == 0 )
{
[509, 511] if ( (_BYTE)v12 )
{
[1024, 475] v22 = (char)v12 - 48;
[1027, 1030] if ( (unsigned int)v22 <= 9 )
{
[1036, 1039, 1041, 1048, 1051] if ( !v6 || (v12 = num_start_6449) == 0LL )
{
[1136] num_start_6449 = v2;
[1146, 1143] v12 = v2;
}
[1061] if ( v5 )
[1064] v7 = v5;
else
[1056, 1061, 1053] v4 = 1;
[1081, 1068, 1078] if ( v38 > 0x1999999999999999LL )
goto LABEL_57;
[1091, 1094, 1087] v23 = v22 + 10 * v38;
[1098, 1107, 1101, 1111] if ( v23 < v38 || v23 == -1LL )
goto LABEL_57;
[1113, 1091, 1094] v3 = v22 + 10 * v38;
[1116] v6 = 1;
[1122] goto LABEL_16;
}
[1478, 486, 1481, 491, 1486, 1491] v34 = quote(v2, a2, v37, v10, v38);
[1499, 1494] if ( (v40 & 4) != 0 )
[1515, 1508, 1501, 1510] v35 = dcgettext(0LL, "invalid byte/character position %s", 5);
else
[1576, 1583, 1585, 1590, 1593] v35 = dcgettext(0LL, "invalid field value %s", 5);
[1518, 1520, 1523, 1525, 1527] error(0, 0, v35, v34);
[1537, 1532] usage(1LL);
LABEL_71:
[1552, 1547, 1542] if ( (v40 & 4) != 0 )
{
[1568, 1561, 1554, 1563] v36 = dcgettext(0LL, "missing list of byte/character positions", 5);
[1571] error(0, 0, v36);
[1571] goto LABEL_56;
}
[1595] v32 = "missing list of fields";
[1602] goto LABEL_63;
}
}
}
[520, 517] if ( v5 )
{
[528, 526] if ( v4 )
{
[960, 963] if ( v7 )
goto LABEL_38;
LABEL_13:
[561] a2 = -1LL;
[568, 571] add_range_pair(v8, -1LL);
}
else
{
[537, 534] if ( !v7 )
{
[547, 549, 543] if ( v39 )
{
[555] v8 = 1LL;
goto LABEL_13;
}
[1401, 1413, 1406] v32 = "invalid range with no endpoint: -";
LABEL_63:
[1393, 1386, 1388] v33 = dcgettext(0LL, v32, 5);
[1396] error(0, 0, v33);
[1396] goto LABEL_56;
}
LABEL_38:
[969, 972] if ( v8 > v3 )
{
[1379, 1374] v32 = "invalid decreasing range";
goto LABEL_63;
}
[978] a2 = v3;
[984, 989, 978, 981] add_range_pair(v8, v3);
}
[576, 580] if ( !*v2 )
goto LABEL_24;
LABEL_15:
[582] v3 = 0LL;
[585] v6 = 0;
[588] v5 = 0;
[591] v7 = 0;
[594] v4 = 0;
goto LABEL_16;
}
[664, 667] if ( !v3 )
goto LABEL_53;
[673] a2 = v3;
[673, 676, 679] add_range_pair(v3, v3);
[688, 684] if ( *v2 )
goto LABEL_15;
LABEL_24:
[697, 700] if ( !n_frp )
goto LABEL_71;
[706, 713, 718, 690, 725] qsort(frp, n_frp, 0x10uLL, (__compar_fn_t)compare_ranges);
[730] v13 = n_frp;
[737, 740] if ( n_frp )
{
[746] v14 = -2LL;
[753] v15 = 16LL;
[760, 758] v16 = 0LL;
do
{
[768, 772, 775] if ( ++v16 >= v13 )
break;
[777] v17 = v15 - 16;
[854] while ( 1 )
{
[854] v20 = (char *)frp + v15;
[850, 858] v18 = *(_QWORD *)((char *)frp + v17 + 8);
[862, 854, 865] if ( *(_QWORD *)((char *)frp + v15) > v18 )
break;
[792, 796] if ( v20[1] >= v18 )
[796] v18 = v20[1];
[785, 804, 781] v19 = (char *)frp + v15 + 16;
[850, 811] *(_QWORD *)((char *)frp + v17 + 8) = v18;
[801, 815, 807] memmove(v20, v19, 16 * (v14 + v13));
[827, 820] v13 = n_frp - 1;
[831] n_frp = v13;
[841, 843, 838] if ( v13 <= v16 )
goto LABEL_34;
}
[867] v15 += 16LL;
[870] --v14;
}
[874, 877, 879] while ( v16 < v13 );
}
LABEL_34:
[880, 885] if ( (v40 & 2) != 0 )
{
[1168] complement_rp();
[1180, 1173] v13 = n_frp;
}
[902] n_frp = v13 + 1;
[902, 909, 913, 891, 895] result = (void *)xrealloc(frp, 16 * (v13 + 1));
[929, 925, 918] frp = result;
[936, 940] *((_OWORD *)result + n_frp - 1) = -1LL;
[945] return result;
[949, 950, 951, 953, 955, 957, 959] }
// 1F0: variable 'v11' is possibly undefined
// 4F7: variable 'v27' is possibly undefined
// 4F7: variable 'v28' is possibly undefined
// 4F7: variable 'v29' is possibly undefined
// 5C9: variable 'v10' is possibly undefined
// 910: using guessed type long xrealloc(_QWORD, _QWORD);
// 928: using guessed type long usage(_QWORD);
// 938: using guessed type long ximemdup0(_QWORD, _QWORD);
// 940: using guessed type long quote(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// nfuncs=18 queued=5 decompiled=5 lumina nreq=0 worse=0 better=0
// ALL OK, 5 function(s) have been successfully decompiled
|
size_t add_range_pair(long a1, long a2)
[15] {
[35, 42, 15, 49, 19, 20, 52, 23, 27, 31] if ( n_frp == n_frp_allocated )
[66, 73, 76, 81, 54, 61] frp = (void *)x2nrealloc(frp, &n_frp_allocated, 16LL);
[102, 106, 109, 113, 88, 95] *((_QWORD *)frp + 2 * n_frp) = a1;
[130, 134, 137, 141, 116, 123] *((_QWORD *)frp + 2 * n_frp + 1) = a2;
[163, 164, 145, 152, 156] return ++n_frp;
[165] }
// 948: using guessed type long n_frp_allocated;
// BC0: using guessed type long x2nrealloc(_QWORD, _QWORD, _QWORD);
//----- (00000000000000A6) ----------------------------------------------------
long compare_ranges(_QWORD *a1, _QWORD *a2)
[166] {
int v3; // [rsp+18h] [rbp-8h]
int v4; // [rsp+1Ch] [rbp-4h]
[166, 170, 171, 174, 178, 182, 186, 189] v3 = *a1;
[192, 196, 199] v4 = *a2;
[208, 202, 205] if ( v3 < v4 )
[224] return 0xFFFFFFFFLL;
else
[210, 213, 216, 219, 222] return v3 > v4;
[229, 230] }
//----- (00000000000000E7) ----------------------------------------------------
void complement_rp()
[231] {
unsigned long i; // [rsp+8h] [rbp-18h]
_QWORD *ptr; // [rsp+10h] [rbp-10h]
size_t v2; // [rsp+18h] [rbp-8h]
[231, 235, 236, 239, 243, 250] ptr = frp;
[261, 254] v2 = n_frp;
[265] frp = 0LL;
[276] n_frp = 0LL;
[287] n_frp_allocated = 0LL;
[305, 298, 309, 302] if ( *ptr > 1uLL )
[322, 325, 330, 311, 315, 318] add_range_pair(1LL, *ptr - 1LL);
[335, 464, 469, 343, 473, 477] for ( i = 1LL; i < v2; ++i )
{
[353, 387, 357, 390, 361, 393, 364, 396, 368, 372, 376, 345, 380, 349, 383] if ( ptr[2 * i - 1] + 1LL != ptr[2 * i] )
[416, 450, 419, 453, 423, 456, 427, 461, 398, 431, 402, 435, 406, 439, 409, 442, 413, 446] add_range_pair(ptr[2 * i - 1] + 1LL, ptr[2 * i] - 1LL);
}
[483, 487, 491, 495, 499, 502, 506, 510] if ( ptr[2 * v2 - 1] != -1LL )
[512, 546, 516, 549, 520, 524, 528, 531, 535, 539] add_range_pair(ptr[2 * v2 - 1] + 1LL, -1LL);
[566, 561, 554, 558] free(ptr);
[568, 567] }
// 948: using guessed type long n_frp_allocated;
//----- (0000000000000239) ----------------------------------------------------
unsigned long set_fields(char *a1, char a2)
[569] {
char *v2; // rax
char *v3; // rax
long v4; // rax
const unsigned short *v5; // rbx
char *v6; // rax
char *v7; // rax
char *v8; // rax
long v9; // rbx
char *v10; // rax
long v11; // rbx
char *v12; // rax
char *v13; // rax
unsigned long v14; // rax
char *v15; // rax
char *s1; // [rsp+8h] [rbp-58h]
char v18; // [rsp+14h] [rbp-4Ch]
char v19; // [rsp+15h] [rbp-4Bh]
char v20; // [rsp+16h] [rbp-4Ah]
char v21; // [rsp+17h] [rbp-49h]
unsigned long v22; // [rsp+18h] [rbp-48h]
unsigned long v23; // [rsp+20h] [rbp-40h]
size_t i; // [rsp+28h] [rbp-38h]
size_t v25; // [rsp+30h] [rbp-30h]
size_t v26; // [rsp+38h] [rbp-28h]
void *ptr; // [rsp+40h] [rbp-20h]
unsigned long v28; // [rsp+48h] [rbp-18h]
[577, 578, 582, 569, 573, 574] s1 = a1;
[586, 589, 598] v28 = __readfsqword(0x28u);
[602, 604] v23 = 1LL;
[612] v22 = 0LL;
[620] v18 = 0;
[624] v19 = 0;
[628] v20 = 0;
[632] v21 = 0;
[642, 644, 646, 650, 657, 660, 665, 667, 636, 639] if ( (a2 & 1) != 0 && !strcmp(a1, "-") )
{
[669] v22 = 1LL;
[677] v18 = 1;
[681] v20 = 1;
[685] s1 = a1 + 1;
}
[976, 978] while ( 1 )
{
[697, 699] while ( 1 )
{
[690, 699, 694] while ( *s1 == 45 )
{
[705] v21 = 0;
[713, 709] if ( v20 )
{
[721, 715, 718, 723] if ( (a2 & 4) != 0 )
[737, 732, 725] v2 = gettext("invalid byte or character range");
else
[746, 739] v2 = gettext("invalid field range");
[769, 751, 754, 759, 764] error(0, 0, v2);
[779, 774] usage(1LL);
}
[784] v20 = 1;
[788] ++s1;
[803, 806, 793, 797, 799] if ( v18 && !v22 )
{
[808, 816, 811, 814] if ( (a2 & 4) != 0 )
[825, 818, 830] v3 = gettext("byte/character positions are numbered from 1");
else
[832, 839] v3 = gettext("fields are numbered from 1");
[844, 847, 852, 857, 862] error(0, 0, v3);
[872, 867] usage(1LL);
}
[881, 877] if ( v18 )
[883, 887] v4 = v22;
else
[889] v4 = 1LL;
[894] v23 = v4;
[898, 906] v22 = 0LL;
}
[920, 915, 918, 911] if ( *s1 == 44 )
break;
[922, 927] v5 = *_ctype_b_loc();
[930, 962, 965, 934, 967, 937, 969, 940, 973, 942, 947, 950, 953, 956, 959] if ( (v5[(unsigned char)to_uchar(*s1)] & 1) != 0 || !*s1 )
break;
[1347, 1350, 1353, 1356, 1359, 1343] if ( (unsigned int)(*s1 - 48) > 9 )
{
[1707, 1715, 1710, 1703] v11 = quote(s1);
[1721, 1724, 1718, 1726] if ( (a2 & 4) != 0 )
[1728, 1740, 1735] v12 = gettext("invalid byte/character position %s");
else
[1749, 1742] v12 = gettext("invalid field value %s");
[1760, 1765, 1770, 1775, 1754, 1757] error(0, 0, v12, v11);
[1785, 1780, 1790] usage(1LL);
}
else
{
[1376, 1383, 1386, 1365, 1369, 1372, 1374] if ( v21 != 1 || !num_start_5771 )
[1392, 1388] num_start_5771 = s1;
[1399] v21 = 1;
[1403, 1407] if ( v20 )
[1409, 1413] v19 = 1;
else
[1415] v18 = 1;
[1536, 1419, 1423, 1433, 1436, 1438, 1442, 1445, 1449, 1452, 1455, 1458, 1462, 1465, 1468, 1471, 1473, 1476, 1480, 1483, 1485, 1489, 1492, 1496, 1499, 1502, 1505, 1509, 1512, 1515, 1518, 1520, 1523, 1527, 1528, 1532] if ( v22 > 0x1999999999999999LL || *s1 - 48 + 10 * v22 < v22 || (v22 = 10 * v22 + *s1 - 48, v22 == -1LL) )
{
v26 = strspn(num_start_5771, "0123456789");
ptr = (void *)ximemdup0(num_start_5771, v26);
[1542, 1549, 1556, 1559, 1564] v9 = quote(ptr);
[1568, 1572, 1579, 1582, 1585, 1590] if ( (a2 & 4) != 0 )
[1601, 1594, 1598, 1606] v10 = gettext("byte/character offset %s is too large");
[1617, 1609, 1612, 1615] else
[1626, 1619, 1631] v10 = gettext("field number %s is too large");
error(0, 0, v10, v9);
[1640, 1633] free(ptr);
[1666, 1645, 1648, 1651, 1656, 1661] usage(1LL);
[1675, 1678, 1671] }
[1688, 1683] ++s1;
}
[1698, 1693] }
v21 = 0;
if ( v20 )
[984] {
[992, 988] v20 = 0;
if ( v18 != 1 && v19 != 1 )
[998] {
[1002, 1006, 1009, 1011, 1013, 1017, 1020, 1022] if ( (a2 & 1) != 0 )
{
[1024, 1032, 1027, 1030] v23 = 1LL;
}
[1034, 1042] else
{
v6 = gettext("invalid range with no endpoint: -");
error(0, 0, v6);
[1051, 1044] usage(1LL);
[1056, 1059, 1064, 1069, 1074] }
[1084, 1079] }
if ( v19 != 1 )
{
[1096, 1089, 1098, 1093] add_range_pair(v23, -1LL);
}
[1100, 1104, 1111, 1114, 1119] else
{
if ( v23 > v22 )
{
[1121, 1125, 1129] v7 = gettext("invalid decreasing range");
error(0, 0, v7);
[1138, 1131] usage(1LL);
[1156, 1161, 1143, 1146, 1151] }
[1171, 1166] add_range_pair(v23, v22);
}
[1184, 1187, 1190, 1176, 1180] v22 = 0LL;
}
[1195, 1203] else
{
if ( !v22 )
{
[1209, 1212, 1205] if ( (a2 & 4) != 0 )
v8 = gettext("byte/character positions are numbered from 1");
[1217, 1220, 1222, 1214] else
[1224, 1236, 1231] v8 = gettext("fields are numbered from 1");
error(0, 0, v8);
[1245, 1238] usage(1LL);
[1250, 1253, 1258, 1263, 1268] }
[1273, 1278] add_range_pair(v22, v22);
v22 = 0LL;
[1283, 1287, 1291, 1294, 1297] }
[1302] if ( !*s1 )
break;
[1314, 1317, 1310, 1319] ++s1;
v18 = 0;
[1325] v19 = 0;
[1330] }
[1338, 1334] if ( !n_frp )
{
[1803, 1795, 1796, 1806] if ( (a2 & 4) != 0 )
v13 = gettext("missing list of byte/character positions");
[1808, 1816, 1811, 1814] else
[1825, 1818, 1830] v13 = gettext("missing list of fields");
error(0, 0, v13);
[1832, 1839] usage(1LL);
[1857, 1862, 1844, 1847, 1852] }
[1872, 1867] qsort(frp, n_frp, 0x10uLL, (__compar_fn_t)compare_ranges);
for ( i = 0LL; i < n_frp; ++i )
[1891, 1898, 1903, 1906, 1877, 1884] {
[2187, 1911, 2192, 2199, 2203, 1919] v25 = i + 1;
while ( v25 < n_frp && *((_QWORD *)frp + 2 * v25) <= *((_QWORD *)frp + 2 * i + 1) )
[1928, 1932, 1924, 1936] {
[1952, 1984, 2178, 1987, 1956, 1959, 2184, 1962, 1980, 1969, 1941, 1973, 1977, 1948, 2174] v14 = *((_QWORD *)frp + 2 * v25 + 1);
if ( *((_QWORD *)frp + 2 * i + 1) >= v14 )
[2022, 2026, 2030, 2033, 2015] v14 = *((_QWORD *)frp + 2 * i + 1);
[2055, 2058, 2004, 2008, 2011] *((_QWORD *)frp + 2 * i + 1) = v14;
[1993, 2058, 2000, 2004, 2011] memmove((char *)frp + 16 * i + 16, (char *)frp + 16 * i + 32, 16 * (n_frp - (i + 1) - 1));
[2048, 2052, 2062, 2037, 2044] --n_frp;
[2081, 2085, 2117, 2088, 2121, 1932, 2125, 2095, 2128, 2066, 2099, 2131, 2134, 2103, 2073, 2107, 2077, 2110] }
[2146, 2150, 2157, 2162, 2167, 2139] }
if ( (a2 & 2) != 0 )
complement_rp();
[2209, 2217, 2212, 2215] ++n_frp;
[2219] frp = (void *)xrealloc(frp, 16 * n_frp);
[2224, 2235, 2231] v15 = (char *)frp + 16 * n_frp - 16;
[2242, 2274, 2249, 2253, 2256, 2263, 2266, 2269] *((_QWORD *)v15 + 1) = -1LL;
[2281, 2288, 2295, 2299, 2303] *((_QWORD *)frp + 2 * n_frp - 2) = *((_QWORD *)v15 + 1);
[2306] return __readfsqword(0x28u) ^ v28;
[2336, 2339, 2343, 2314, 2321, 2328, 2332] }
// BE8: using guessed type long usage(_QWORD);
// C00: using guessed type long ximemdup0(_QWORD, _QWORD);
// C08: using guessed type long quote(_QWORD);
// C20: using guessed type long xrealloc(_QWORD, _QWORD);
// nfuncs=19 queued=5 decompiled=5 lumina nreq=0 worse=0 better=0
// ALL OK, 5 function(s) have been successfully decompiled
|
void do_ssh2_kex(unsigned long a0) {
[4480] int tmp_57; // tmp #57
[4480] int tmp_55; // tmp #55
[4480] int tmp_34; // tmp #34
[4480] int tmp_65; // tmp #65
[4480] int tmp_63; // tmp #63
[4480] int tmp_75; // tmp #75
[4480] int tmp_73; // tmp #73
[4480] int tmp_85; // tmp #85
[4480] int tmp_83; // tmp #83
[4480] int tmp_95; // tmp #95
[4480] int tmp_93; // tmp #93
[4480] int tmp_12; // tmp #12
[4480] int tmp_9; // tmp #9
[4480] int tmp_21; // tmp #21
[4480] int tmp_22; // tmp #22
[4480] int tmp_4; // tmp #4
[4480] int tmp_2; // tmp #2
[4480] int tmp_43; // tmp #43
[4480] int tmp_36; // tmp #36
[4480] int tmp_39; // tmp #39
[4480] int tmp_46; // tmp #46
[4480] int tmp_47; // tmp #47
[4480] int tmp_54; // tmp #54
[4480] int tmp_41; // tmp #41
[4480] int tmp_52; // tmp #52
[4480] char v0; // [bp-0x90]
[4480] unsigned long v1; // [bp-0x88], Other Possible Types: int
[4480] unsigned long v2; // [bp-0x80]
[4480] int v3; // [bp-0x78]
[4480] int v4; // [bp-0x68]
[4480] int v5; // [bp-0x58]
[4480] int v6; // [bp-0x48]
[4480] char v7; // [bp-0x30]
[4480] struct_0 *v9; // rbp
[4480] void* v10; // rax
[4480] void* v13; // rax
[4480] unsigned long long v15; // rax
[4480] uint128_t v16[9]; // rdx
[4480] unsigned long long v17; // xmm0lq
[4480] unsigned long long v18; // xmm0hq
[4480] unsigned long long v19; // xmm0lq
[4480] unsigned long long v20; // xmm0hq
[4480] unsigned long long *v21; // fs
[4480] unsigned long long v22; // rax
[4480]
[4480] v9 = a0;
[4480, 4482, 4489, 4491, 4496, 4498, 4499] tmp_57 = BinaryOp InterleaveLO;
[4513, 4548, 4522, 4527, 4529, 4502, 4536, 4506, 4541] *(&v1) = tmp_57;
[4552] tmp_65 = BinaryOp InterleaveLO;
[4561, 4568, 4556] *(&v3) = tmp_65;
[4572] tmp_75 = BinaryOp InterleaveLO;
[4577, 4582, 4589] *(&v4) = tmp_75;
[4593] tmp_85 = BinaryOp InterleaveLO;
[4610, 4598, 4603] *(&v5) = tmp_85;
[4614] tmp_95 = BinaryOp InterleaveLO;
[4624, 4619] *(&v6) = tmp_95;
[4628] v10 = compat_kex_proposal();
[4633] v1 = v10;
[4645, 4648, 4638] tmp_12 = BinaryOp InterleaveLO;
[4674] *(&v3) = tmp_12;
[4678] tmp_21 = BinaryOp InterleaveLO;
[4683, 4691] *(&v4) = tmp_21;
[4695] if (false) {
[4738, 4732, 4725, 4741] tmp_4 = BinaryOp InterleaveLO;
[4704, 4711, 4716] *(&v5) = tmp_4;
[4738, 4741, 4720, 4725, 4732] }
ssh_packet_set_rekey_limits(v9);
v13 = compat_pkalg_proposal(v9, list_hostkey_types(a0, 0xe8ef894800005504, 0xfc08548000fe1ec));
v2 = v13;
v15 = kex_setup(v9, &v1);
if (!v15) {
v16 = &v9->field_8->padding_0[136];
tmp_43 = BinaryOp InterleaveLO;
tmp_46 = BinaryOp InterleaveLO;
*(&(&v9->field_8->padding_0)[1]) = tmp_43;
tmp_54 = BinaryOp InterleaveLO;
v16[4] = tmp_46;
v16[3] = tmp_54;
v17 = got.kex_gen_server;
v16[5] = tmp_46;
v18 = got.kexgex_server;
v16[8] = tmp_46;
*(&v16[6]) = reg_224;
v19 = got.kexgex_server;
v20 = got.kex_gen_server;
*(&v16[7]) = reg_224;
ssh_dispatch_run_fatal(v9, 0x0, v16, sensitive_data);
free(v10);
free(compat_cipher_proposal(a0, 0xed058948c80f48ef));
free(v13);
sshlog("sshd.c", "do_ssh2_kex", 0x985, 0x0, 0x5, 0x0, "KEX done", *(&v0));
v22 = *(&v7) ^ v21[5];
return;
}
sshfatal("sshd.c", "do_ssh2_kex", 0x963, 0x0, 0x1, ssh_err(v15), "kex_setup");
__stack_chk_fail(); /* do not return */
}
|
void do_ssh2_kex(struct_0 *a0) {
[27475] unsigned long long v0; // [bp-0xb8]
[27475] unsigned int v1; // [bp-0x8c]
[27475] void* v2; // [bp-0x88]
[27475] void* v3; // [bp-0x80]
[27475] void* v4; // [bp-0x78]
[27475] unsigned long long v5[35]; // [bp-0x70]
[27475] unsigned long v6; // [bp-0x68], Other Possible Types: unsigned long long
[27475] unsigned long long v7; // [bp-0x60], Other Possible Types: unsigned long
[27475] unsigned long v8; // [bp-0x58], Other Possible Types: unsigned long long
[27475] unsigned long long v9; // [bp-0x50], Other Possible Types: void*
[27475] unsigned long long v10; // [bp-0x48]
[27475] unsigned long long v11; // [bp-0x40]
[27475] unsigned long long v12; // [bp-0x38]
[27475] unsigned long long v13; // [bp-0x30]
[27475] unsigned long long v14; // [bp-0x28]
[27475] unsigned long long v15; // [bp-0x20]
[27475] unsigned long long v16; // [bp-0x10]
[27475] unsigned long long v18; // rax
[27475] unsigned long long *v19; // fs
[27475] unsigned long long v20; // rax
[27475]
[27475] v6 = "[email protected],curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256";
[27475, 27479, 27480, 27483, 27490, 27497, 27506, 27510, 27512, 27519] v7 = "[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected],rsa-sha2-512,rsa-sha2-256";
[27530, 27523] v8 = "[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]";
[27541, 27534] v9 = "[email protected],aes128-ctr,aes192-ctr,aes256-ctr,[email protected],[email protected]";
[27552, 27545] v10 = "[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1";
[27563, 27556] v11 = "[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1";
[27574, 27567] v12 = "none,[email protected]";
[27585, 27578] v13 = "none,[email protected]";
[27596, 27589] v14 = &g_40737c;
[27600, 27607] v15 = &g_40737c;
[27618, 27611] v2 = 0;
[27622] v3 = 0;
[27630] v4 = 0;
[27638] v2 = compat_kex_proposal(a0, 0xd84539ffffff7305, 0xd84539ffffff7305);
[27666, 27646, 27671] v6 = v2;
[27675, 27679] v3 = compat_cipher_proposal(a0, 0xe0458b48c2014803, 0xe0458b48c2014803);
[27683, 27708, 27703] v9 = v3;
[27712, 27716] v8 = v9;
[27720, 27724] v11 = 10016524839311018312;
[27728, 27735] v10 = v11;
[27739, 27743] if (false) {
[27788, 27794, 27796] v13 = "none";
[27764, 27757] v12 = v13;
[27776, 27783, 27786, 27768, 27772] }
ssh_packet_set_rekey_limits(a0, 0x7d8348e045894800, 0xfe307e8107400e0, 0x7d8348e045894800);
v18 = list_hostkey_types();
v4 = compat_pkalg_proposal(a0, v18, v18);
v7 = v4;
v1 = kex_setup(a0, &v6, &v6);
if (v1) {
ssh_err(v1);
v0 = "kex_setup";
sshfatal("sshd.c");
}
v5[0] = a0->field_8;
v5[25] = got.kex_gen_server;
v5[26] = got.kex_gen_server;
v5[27] = got.kex_gen_server;
v5[28] = got.kex_gen_server;
v5[29] = got.kex_gen_server;
v5[30] = got.kexgex_server;
v5[31] = got.kexgex_server;
v5[32] = got.kex_gen_server;
v5[33] = got.kex_gen_server;
v5[34] = got.kex_gen_server;
v5[21] = get_hostkey_public_by_type;
v5[22] = get_hostkey_private_by_type;
v5[23] = get_hostkey_index;
v5[24] = sshd_hostkey_sign;
ssh_dispatch_run_fatal(a0, 0x0, &v5[17]);
free(v2);
free(v3);
free(v4);
v16 = "KEX done";
sshlog("sshd.c", "do_ssh2_kex", 0x985, 0x0, 0x5, 0x0);
v20 = v16 ^ v19[5];
return;
}
|
void do_setstat(struct_0 *a0, unsigned long a1, unsigned long long a2) {
[15856] unsigned long v0; // [bp-0x40], Other Possible Types: char
[15856] unsigned long v1; // [bp-0x30]
[15856] unsigned long long v3; // rdi
[15856] void* v4; // rax
[15856] unsigned long long v5; // rax
[15856]
[15856] v1 = a1;
[15872, 15874, 15876, 15882, 15885, 15890, 15891, 15894, 15901, 15902, 15905, 15909, 15856, 15860, 15862, 15869] sshlog("sftp-client.c", "do_setstat", 0x3c2, 0x0, 0x6, 0x0, "Sending SSH2_FXP_SETSTAT \"%s\"");
[15872, 15876, 15910, 15917, 15918, 15885, 15920, 15894, 15869] a0->field_18 = a0->field_18 + 1;
[15937, 15925, 15929, 15932] send_string_attrs_request(a0, a0->field_18, 0x9, *(&v0), strlen(*(&v0)), a2);
[15940, 15945, 15950, 15953, 15956, 15959, 15962, 15965] v3 = get_status(a0, a0->field_18);
[15976, 15981] v4 = 0;
[15984, 15983] if (!v3)
return;
[16001, 15991, 15995, 15996, 15997, 15999] fx2txt(v3);
[16008] v0 = a1;
[16036, 16041, 16013, 16017, 16020, 16022, 16023, 16030] sshlog("sftp-client.c", "do_setstat", 0x3ca, 0x0, 0x2, 0x0, "remote setstat \"%s\": %s");
[16036, 16042, 16049, 16017, 16020, 16056, 16057, 16059, 16030] v5 = 4294967295;
[16064, 16068] return;
[16081, 16083, 16073, 16077, 16078, 16079] }
|
void do_setstat(struct_0 *a0, char *a1, unsigned long long a2) {
[14584] int tmp_17; // tmp #17
[14584] unsigned long v0; // [bp-0x50]
[14584] unsigned long v1; // [bp-0x40]
[14584] struct_0 *v2; // [bp-0x20]
[14584] unsigned int v3; // [bp-0x10]
[14584] unsigned int v4; // [bp-0xc]
[14584] void* v6; // rax
[14584] unsigned long long v7; // rax
[14584]
[14584] v2 = a0;
[14592, 14596, 14584, 14588, 14589] v1 = a1;
[14608, 14600, 14604] sshlog("sftp-client.c", "do_setstat", 0x3c2, 0x0, 0x6, 0x0, "Sending SSH2_FXP_SETSTAT \"%s\"");
[14660, 14611, 14618, 14619, 14625, 14631, 14636, 14641, 14648, 14655] tmp_17 = a0->field_18;
[14673, 14665, 14669] a0->field_18 = a0->field_18 + 1;
[14665, 14669, 14673, 14676, 14679, 14683] v3 = tmp_17;
[14686] send_string_attrs_request(a0, v3, 0x9, a1, strlen(a1), a2);
[14721, 14724, 14727, 14732, 14735, 14696, 14701, 14703, 14707, 14711, 14714, 14718] v4 = get_status(a0, v3);
[14752, 14757] if (v4) {
fx2txt(v4);
[14769, 14771, 14766] v0 = a1;
[14776, 14780, 14781] sshlog("sftp-client.c", "do_setstat", 0x3ca, 0x0, 0x2, 0x0, "remote setstat \"%s\": %s");
[14784, 14791, 14792, 14798, 14804, 14809, 14814, 14821, 14828, 14833] }
if (!v4)
v6 = 0;
else
v7 = 4294967295;
return;
}
|
long strnvis(char *a1, long a2, const char *a3, unsigned int a4)
[4448] {
long v5; // [rsp+0h] [rbp-18h] BYREF
char *v6; // [rsp+8h] [rbp-10h] BYREF
[4448, 4452, 4463] v6 = a1;
[4473] v5 = a2;
[4480, 4485, 4456, 4468, 4477] return istrsenvisxl_constprop_0(&v6, &v5, a3, a4, (const char *)&LC3);
[4489] }
//----- (0000000000001190) ----------------------------------------------------
long stravis(char **a1, const char *a2, unsigned int a3)
[4496] {
[4496, 4500] *a1 = 0LL;
[4516, 4519, 4521, 4507, 4509] return istrsenvisxl_constprop_0(a1, 0LL, a2, a3, (const char *)&LC3);
}
//----- (00000000000011B0) ----------------------------------------------------
long strvisx(char *a1, const char *a2, unsigned long a3, unsigned int a4)
[4528] {
char *v5; // [rsp+10h] [rbp-10h] BYREF
[4528, 4532, 4549, 4559] v5 = a1;
[4546, 4579, 4568, 4554, 4563, 4566, 4536, 4570, 4539, 4575] return istrsenvisx(&v5, 0LL, a2, a3, a4, (const char *)&LC3, 0LL);
}
//----- (00000000000011F0) ----------------------------------------------------
long strnvisx(char *a1, long a2, const char *a3, unsigned long a4, unsigned int a5)
[4592] {
long v6; // [rsp+8h] [rbp-18h] BYREF
char *v7; // [rsp+10h] [rbp-10h] BYREF
[4592, 4624, 4596, 4628, 4607] v7 = a1;
[4617] v6 = a2;
[4612, 4621, 4630, 4600, 4635, 4639] return istrsenvisx(&v7, &v6, a3, a4, a5, (const char *)&LC3, 0LL);
}
//----- (0000000000001220) ----------------------------------------------------
long strenvisx(char *a1, long a2, const char *a3, unsigned long a4, unsigned int a5, int *a6)
[4640] {
long v7; // [rsp+8h] [rbp-18h] BYREF
char *v8; // [rsp+10h] [rbp-10h] BYREF
[4640, 4665, 4648, 4644] v8 = a1;
[4658] v7 = a2;
[4678, 4683, 4653, 4687, 4662, 4669, 4671] return istrsenvisx(&v8, &v7, a3, a4, a5, (const char *)&LC3, a6);
}
// nfuncs=38 queued=23 decompiled=23 lumina nreq=0 worse=0 better=0
// ALL OK, 23 function(s) have been successfully decompiled
|
long strnvis(char *a1, size_t a2, const char *a3, int a4)
[5201] {
size_t v5; // [rsp+10h] [rbp-10h] BYREF
char *v6; // [rsp+18h] [rbp-8h] BYREF
[5201, 5205, 5206, 5209, 5213] v6 = a1;
[5217] v5 = a2;
[5249, 5221, 5256, 5225, 5259, 5228, 5231, 5264, 5235, 5239, 5243] return istrsenvisxl(&v6, &v5, a3, a4, (char *)&unk_18E8, 0LL);
[5265] }
//----- (0000000000001492) ----------------------------------------------------
long stravis(char **a1, const char *a2, int a3)
[5266] {
[5282, 5286, 5289, 5293, 5266, 5270, 5271, 5274, 5278] *a1 = 0LL;
[5317, 5324, 5329, 5300, 5332, 5303, 5337, 5307, 5311] return istrsenvisxl(a1, 0LL, a2, a3, (char *)&unk_18E8, 0LL);
[5338] }
//----- (00000000000014DB) ----------------------------------------------------
long strvisx(char *a1, const char *a2, unsigned long a3, int a4)
[5339] {
char *v5; // [rsp+20h] [rbp-8h] BYREF
[5344, 5347, 5381, 5351, 5385, 5339, 5343] v5 = a1;
[5377, 5410, 5414, 5405, 5355, 5387, 5359, 5394, 5363, 5397, 5366, 5369, 5402, 5373] return istrsenvisx(&v5, 0LL, a2, a3, a4, (char *)&unk_18E8, 0LL);
[5415] }
//----- (0000000000001528) ----------------------------------------------------
long strnvisx(char *a1, size_t a2, const char *a3, unsigned long a4, int a5)
[5416] {
size_t v6; // [rsp+28h] [rbp-10h] BYREF
char *v7; // [rsp+30h] [rbp-8h] BYREF
[5416, 5420, 5421, 5424, 5428, 5467, 5471] v7 = a1;
[5432] v6 = a2;
[5440, 5473, 5444, 5448, 5480, 5451, 5483, 5486, 5455, 5459, 5491, 5463, 5436, 5495] return istrsenvisx(&v7, &v6, a3, a4, a5, (char *)&unk_18E8, 0LL);
[5496] }
//----- (0000000000001579) ----------------------------------------------------
long strenvisx(char *a1, size_t a2, const char *a3, unsigned long a4, int a5, int *a6)
[5497] {
size_t v7; // [rsp+28h] [rbp-10h] BYREF
char *v8; // [rsp+30h] [rbp-8h] BYREF
[5505, 5509, 5552, 5497, 5501, 5502] v8 = a1;
[5513] v7 = a2;
[5536, 5569, 5540, 5572, 5544, 5577, 5548, 5517, 5581, 5521, 5556, 5525, 5559, 5529, 5533, 5566] return istrsenvisx(&v8, &v7, a3, a4, a5, (char *)&unk_18E8, a6);
[5582] }
// nfuncs=39 queued=23 decompiled=23 lumina nreq=0 worse=0 better=0
// ALL OK, 23 function(s) have been successfully decompiled
|
long gl_list_set_last(long a1, long a2)
[176] {
long result; // rax
long v3; // rdx
[176, 180, 184] result = gl_list_nx_set_last(a1, a2);
[192, 189] if ( !result )
{
[204, 199] xalloc_die(a1, a2, v3);
[205] return gl_list_add_first(a1, a2);
}
[194] return result;
[198] }
// C7: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 330: using guessed type long gl_list_nx_set_last(_QWORD, _QWORD);
//----- (00000000000000D0) ----------------------------------------------------
long gl_list_add_first(long a1, long a2)
[208] {
long result; // rax
long v3; // rdx
[208, 212, 216] result = gl_list_nx_add_first(a1, a2);
[224, 221] if ( !result )
{
[236, 231] xalloc_die(a1, a2, v3);
[237] return gl_list_add_last(a1, a2);
}
[226] return result;
[230] }
// E7: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 338: using guessed type long gl_list_nx_add_first(_QWORD, _QWORD);
//----- (00000000000000F0) ----------------------------------------------------
long gl_list_add_last(long a1, long a2)
[240] {
long result; // rax
long v3; // rdx
[240, 248, 244] result = gl_list_nx_add_last(a1, a2);
[256, 253] if ( !result )
{
[268, 263] xalloc_die(a1, a2, v3);
[269] return gl_list_add_before(a1, a2);
}
[258] return result;
[262] }
// 107: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 340: using guessed type long gl_list_nx_add_last(_QWORD, _QWORD);
//----- (0000000000000110) ----------------------------------------------------
long gl_list_add_before(long a1, long a2)
[272] {
long result; // rax
long v3; // rdx
[272, 280, 276] result = gl_list_nx_add_before(a1, a2);
[288, 285] if ( !result )
{
[300, 295] xalloc_die(a1, a2, v3);
[301] return gl_list_add_after(a1, a2);
}
[290] return result;
[294] }
// 127: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 348: using guessed type long gl_list_nx_add_before(_QWORD, _QWORD);
//----- (0000000000000130) ----------------------------------------------------
long gl_list_add_after(long a1, long a2)
[304] {
long result; // rax
long v3; // rdx
[304, 312, 308] result = gl_list_nx_add_after(a1, a2);
[320, 317] if ( !result )
{
[332, 327] xalloc_die(a1, a2, v3);
[333] return gl_list_add_at(a1, a2);
}
[322] return result;
[326] }
// 147: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 350: using guessed type long gl_list_nx_add_after(_QWORD, _QWORD);
//----- (0000000000000150) ----------------------------------------------------
long gl_list_add_at(long a1, long a2)
[336] {
long result; // rax
long v3; // rdx
[336, 344, 340] result = gl_list_nx_add_at(a1, a2);
[352, 349] if ( !result )
{
[364, 359] xalloc_die(a1, a2, v3);
[365] return gl_sortedlist_add(a1, a2);
}
[354] return result;
[358] }
// 167: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 358: using guessed type long gl_list_nx_add_at(_QWORD, _QWORD);
//----- (0000000000000170) ----------------------------------------------------
long gl_sortedlist_add(long a1, long a2)
[368] {
long result; // rax
long v3; // rdx
[368, 372, 376] result = gl_sortedlist_nx_add(a1, a2);
[384, 381] if ( !result )
{
[391] xalloc_die(a1, a2, v3);
[396] JUMPOUT(0x18CLL);
}
[386] return result;
[390] }
// 187: control flows out of bounds to 18C
// 187: variable 'v3' is possibly undefined
// 308: using guessed type long xalloc_die(_QWORD, _QWORD, _QWORD);
// 360: using guessed type long gl_sortedlist_nx_add(_QWORD, _QWORD);
// nfuncs=25 queued=12 decompiled=12 lumina nreq=0 worse=0 better=0
// ALL OK, 12 function(s) have been successfully decompiled
|
long gl_list_set_last(long a1, long a2)
[390] {
long v3; // [rsp+18h] [rbp-8h]
[418, 421, 390, 424, 394, 395, 429, 398, 402, 406, 410, 414] v3 = gl_list_nx_set_last(a1, a2);
[433, 438] if ( !v3 )
[440] xalloc_die(a1);
[449, 445] return v3;
[450] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 520: using guessed type long gl_list_nx_set_last(_QWORD, _QWORD);
//----- (00000000000001C3) ----------------------------------------------------
long gl_list_add_first(long a1, long a2)
[451] {
long v3; // [rsp+18h] [rbp-8h]
[482, 451, 485, 455, 456, 490, 459, 463, 467, 471, 475, 479] v3 = gl_list_nx_add_first(a1, a2);
[499, 494] if ( !v3 )
[501] xalloc_die(a1);
[506, 510] return v3;
[511] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 528: using guessed type long gl_list_nx_add_first(_QWORD, _QWORD);
//----- (0000000000000200) ----------------------------------------------------
long gl_list_add_last(long a1, long a2)
[512] {
long v3; // [rsp+18h] [rbp-8h]
[512, 546, 516, 517, 551, 520, 524, 528, 532, 536, 540, 543] v3 = gl_list_nx_add_last(a1, a2);
[560, 555] if ( !v3 )
[562] xalloc_die(a1);
[571, 567] return v3;
[572] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 530: using guessed type long gl_list_nx_add_last(_QWORD, _QWORD);
//----- (000000000000023D) ----------------------------------------------------
long gl_list_add_before(long a1, long a2, long a3)
[573] {
long v4; // [rsp+28h] [rbp-8h]
[577, 578, 609, 605, 581, 612, 615, 585, 620, 589, 593, 597, 601, 573] v4 = gl_list_nx_add_before(a1, a2, a3);
[624, 629] if ( !v4 )
[631] xalloc_die(a1);
[640, 636] return v4;
[641] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 538: using guessed type long gl_list_nx_add_before(_QWORD, _QWORD, _QWORD);
//----- (0000000000000282) ----------------------------------------------------
long gl_list_add_after(long a1, long a2, long a3)
[642] {
long v4; // [rsp+28h] [rbp-8h]
[642, 674, 646, 647, 678, 681, 650, 684, 654, 689, 658, 662, 666, 670] v4 = gl_list_nx_add_after(a1, a2, a3);
[698, 693] if ( !v4 )
[700] xalloc_die(a1);
[705, 709] return v4;
[710] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 540: using guessed type long gl_list_nx_add_after(_QWORD, _QWORD, _QWORD);
//----- (00000000000002C7) ----------------------------------------------------
long gl_list_add_at(long a1, long a2, long a3)
[711] {
long v4; // [rsp+28h] [rbp-8h]
[739, 711, 743, 715, 716, 747, 750, 719, 753, 723, 758, 727, 731, 735] v4 = gl_list_nx_add_at(a1, a2, a3);
[762, 767] if ( !v4 )
[769] xalloc_die(a1);
[778, 774] return v4;
[779] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 548: using guessed type long gl_list_nx_add_at(_QWORD, _QWORD, _QWORD);
//----- (000000000000030C) ----------------------------------------------------
long gl_sortedlist_add(long a1, long a2, long a3)
[780] {
long v4; // [rsp+28h] [rbp-8h]
[800, 804, 808, 780, 812, 784, 785, 816, 819, 788, 822, 792, 827, 796] v4 = gl_sortedlist_nx_add(a1, a2, a3);
[836, 831] if ( !v4 )
[838] xalloc_die(a1);
[843, 847] return v4;
[848] }
// 4F8: using guessed type long xalloc_die(_QWORD);
// 550: using guessed type long gl_sortedlist_nx_add(_QWORD, _QWORD, _QWORD);
// nfuncs=25 queued=12 decompiled=12 lumina nreq=0 worse=0 better=0
// ALL OK, 12 function(s) have been successfully decompiled
|
long long coproc_alloc(char *a0, unsigned long a1, unsigned long a2, unsigned long long a3) {
[11216] coproc_init(&sh_coproc);
[11216, 11220, 11221, 11224, 11231] g_409464 = 2;
[11236, 11239] g_409448 = a1;
[11249] g_409464 = 0;
[11292, 11293] sh_coproc = strcpy(sh_xmalloc(strlen(a0) + 1, "execute_cmd.c", 0x802, a3), a0);
[11265, 11303, 11272, 11276, 11287, 11255, 11260] return &sh_coproc;
[11317, 11310] }
|
long long coproc_alloc(char *a0, unsigned long a1) {
[12083] unsigned long long v0; // [bp-0x10]
[12083]
[12083] v0 = &sh_coproc;
[12099, 12102, 12109, 12083, 12087, 12088, 12091, 12095] coproc_init(v0);
[12113, 12117, 12120] *((v0 + 36)) = 2;
[12129, 12125] *((v0 + 8)) = a1;
[12136, 12140, 12143] *(v0) = strcpy(sh_xmalloc(strlen(a0) + 1, "execute_cmd.c", 0x802), a0);
[12162, 12195, 12167, 12200, 12204, 12177, 12153, 12158] *((v0 + 36)) = 0;
[12129, 12211, 12125, 12207] return v0;
[12218, 12222, 12223] }
|
void print_bool(unsigned long long a0, unsigned long a1) {
[848] unsigned long long v1; // rdx
[848] unsigned long v2; // r8
[848] void* v3; // rcx
[848] unsigned long long v4; // rsi
[848] unsigned long long v5; // rdi
[848] unsigned long long v6; // rax
[848]
[848] v1 = a0;
[848] v2 = a1;
[851] v3 = 0;
[855] v4 = 6;
[857] v5 = 2;
[862] v6 = print_color_bool();
[867, 2896, 2901, 2903] return;
[2896, 867, 2901, 2903] }
|
void print_bool(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long a3) {
[36] unsigned long long v1; // rax
[36]
[36] v1 = print_color_bool(a0, 0x6, a1, a2, a3);
[64, 68, 72, 75, 78, 83, 85, 36, 37, 40, 44, 47, 51, 55, 57, 60] return;
[90, 91] }
|
int automount_stat_err(char *a0, void* a1, unsigned long a2) {
[992] unsigned int *v3; // rax
[992] unsigned int v4; // ebp
[992] unsigned int *v5; // rbp
[992] unsigned int v6; // r12d
[992] unsigned int v7; // r12d
[992]
[992] if (reg_56 >= 0) {
[1021, 1023] reg_56 = open(a0, 0x900, a2);
[1088, 1091, 1093, 1009, 1011, 1012, 1016] v6 = fstat(reg_56, a1);
[1100, 1095] if (v6)
v6 = *(__errno_location());
[1107, 1112, 1115, 1117] close(v4);
[1115, 1117] return v6;
[1122, 1126, 1129, 1130, 1132, 1134, 1136] } else {
v3 = __errno_location();
[1025] v7 = *(v3);
[1030] v5 = v3;
[1033] if (*(v3) != 2 && *(v5) != 20) {
[1040, 1042, 1036, 1046] v7 = stat(a0, a1);
[1059, 1054] if (v7)
v7 = *(v5);
[1066, 1070, 1074, 1077, 1078, 1080, 1082, 1084] }
return v7;
[1070, 1074, 1077, 1078, 1080, 1082, 1084] }
}
|
int automount_stat_err(char *a0, void* a1, unsigned long a2) {
[796] unsigned int v0; // [bp-0x10]
[796] unsigned int v1; // [bp-0xc]
[796] unsigned int v3; // rax
[796]
[796] v0 = open(a0, 0x900, a2);
[833, 838] if (v0 >= 0) {
[841, 845] v3 = fstat(v0, a1);
[929, 931, 919, 923, 926] if (!v3)
v3 = 0;
[960, 962, 949, 954, 957] else
v3 = *(__errno_location());
[945, 940] v1 = v3;
[954] close(v0);
[960, 962, 957] v3 = v1;
[967, 970, 971] } else if (*(__errno_location()) == 2) {
[857, 854, 847] v3 = *(__errno_location());
[876, 871] } else if (*(__errno_location()) == 20) {
[866, 859, 869] v3 = *(__errno_location());
[876, 871] } else {
v3 = stat(a0, a1);
[880, 884, 888, 891, 894] if (!v3)
v3 = 0;
[912] else
v3 = *(__errno_location());
[908, 903] }
return v3;
}
|
void getsel1package(struct_0 *a0) {
[0] unsigned long long v0; // [bp-0x18]
[0] unsigned long long v1; // [bp-0x10]
[0] unsigned long long v2; // [bp-0x8]
[0] char v3; // [bp+0x0]
[0] unsigned long long v5; // rax
[0] unsigned long long v6; // r12
[0] unsigned long long v7; // rbx
[0] char *v8; // rax
[0] unsigned int v11; // edx
[0] unsigned int v12; // ecx
[0] unsigned long long v13; // rbx
[0] unsigned long long v14; // rbp
[0] unsigned long long v15; // r12
[0] unsigned long long v16; // rax
[0]
[0] v5 = a0->field_10;
[0] if (a0->field_10) {
v2 = v6;
[16] v1 = &v3;
[18, 23] v0 = v7;
[24, 27] v8 = pkg_name();
[33, 28] pkg_want_name(a0);
[57] v11 = v8;
[69] v12 = (v12 > 0 ? 1 : 6 - (strlen(v8) >> 3));
[72, 44, 52] v13 = v0;
[78] v14 = v1;
[84] v15 = v2;
[101] v16 = __printf_chk(0x1, "%s%.*s%s\n", v11, v12, &.LC0);
[94, 103] }
return;
}
|
void getsel1package(struct_0 *a0) {
[28] unsigned int v0; // [bp-0x14]
[28] char *v1; // [bp-0x10]
[28] unsigned long long v3; // rax
[28] unsigned long long v4; // rax
[28]
[28] v3 = a0->field_10;
[32, 33, 36, 40, 44, 48, 28] if (!a0->field_10)
return;
[174, 175] v1 = pkg_name(a0, 0x1);
[72, 59, 67] v0 = strlen(v1);
[88, 83] v0 >>= 3;
[91] v0 = 6 - v0;
[100, 103, 95] if (v0 <= 0)
[106, 110] v0 = 1;
[112, 119, 123, 126] pkg_want_name(a0);
[119, 123, 126] v4 = printf("%s%.*s%s\n", v1, v0, &g_4007f0);
[161, 131, 166, 134, 137, 141, 144, 151, 154] return;
[174, 175] }
|
void copy_stat(unsigned long a0, unsigned long a1, unsigned long a2) {
[9600] unsigned long v0; // [bp-0x48]
[9600] unsigned long v1; // [bp-0x40]
[9600] unsigned long v2; // [bp-0x38], Other Possible Types: uint128_t
[9600] char v3; // [bp-0x20]
[9600] unsigned long long v5; // rax
[9600] unsigned long long v6; // rax
[9600] unsigned int *v7; // rax
[9600] unsigned int v8; // r12d
[9600] unsigned int *v9; // rbx
[9600] unsigned int *v11; // rax
[9600] unsigned int v12; // ebp
[9600] unsigned int *v13; // rbx
[9600] unsigned long long *v14; // fs
[9600] unsigned long long v15; // rax
[9600]
[9600] v0 = get_stat_mtime(g_403288, g_403290);
[9650, 9669, 9655, 9662] v1 = a2;
[9673] v2 = get_stat_mtime(g_403298, g_4032a0);
[9683, 9690, 9678] if (!decompress) {
v5 = fdutimens(0x8801578d48014e8d, d_buf, &v0);
[9985, 9992, 9976, 9982] if (v5) {
v7 = __errno_location();
[10005] v8 = *(v7);
[10010] v9 = v7;
[10013] *(&v7) = quiet;
[10016] if (!quiet) {
rpl_fprintf(*(&stderr), "%s: ", 0x75c084078801578d);
[10182, 10189, 10168, 10175] *(&v7) = quiet;
[10200, 10194] if (!exit_code)
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
} else {
if (!exit_code) {
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
}
}
}
} else if (true) {
v5 = fdutimens(0x8801578d48014e8d, d_buf, &v0);
[9985, 9992, 9976, 9982] if (v5) {
v7 = __errno_location();
[10005] v8 = *(v7);
[10010] v9 = v7;
[10013] *(&v7) = quiet;
[10016] if (!quiet) {
rpl_fprintf(*(&stderr), "%s: ", 0x75c084078801578d);
[10182, 10189, 10168, 10175] *(&v7) = quiet;
[10200, 10194] if (!exit_code)
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
} else {
if (!exit_code) {
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
}
}
}
} else if (v2 != 74900193067783) {
[9737, 9732, 9725] v2 = 74900193067783;
[9760, 9767, 9743, 9749, 9757] v6 = fdutimens(0x8801578d48014e8d, d_buf, &v0);
[9760, 9772] if (!v6) {
if (verbose > 1)
[9792, 9785] rpl_fprintf(*(&stderr), "%s: timestamp restored\n", d_buf);
[10245, 10247, 10224, 10231, 10238] } else {
v7 = __errno_location();
[10005] v8 = *(v7);
[10010] v9 = v7;
[10013] *(&v7) = quiet;
[10016] if (!quiet) {
rpl_fprintf(*(&stderr), "%s: ", 0x75c084078801578d);
[10182, 10189, 10168, 10175] *(&v7) = quiet;
[10200, 10194] if (!exit_code)
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
} else {
if (!exit_code) {
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
}
}
}
} else if (a2 != 16207284668654848328) {
[9960, 9965] v2 = 74900193067783;
[9760, 9767, 9743, 9749, 9757] v6 = fdutimens(0x8801578d48014e8d, d_buf, &v0);
[9760, 9772] if (v6) {
v7 = __errno_location();
[10005] v8 = *(v7);
[10010] v9 = v7;
[10013] *(&v7) = quiet;
[10016] if (!quiet) {
rpl_fprintf(*(&stderr), "%s: ", 0x75c084078801578d);
[10182, 10189, 10168, 10175] *(&v7) = quiet;
[10200, 10194] if (!exit_code)
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
} else {
if (!exit_code) {
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
}
}
} else if (verbose > 1) {
[9792, 9785] rpl_fprintf(*(&stderr), "%s: timestamp restored\n", d_buf);
[10245, 10247, 10224, 10231, 10238] }
} else {
v5 = fdutimens(0x8801578d48014e8d, d_buf, &v0);
[9985, 9992, 9976, 9982] if (v5) {
v7 = __errno_location();
[10005] v8 = *(v7);
[10010] v9 = v7;
[10013] *(&v7) = quiet;
[10016] if (!quiet) {
rpl_fprintf(*(&stderr), "%s: ", 0x75c084078801578d);
[10182, 10189, 10168, 10175] *(&v7) = quiet;
[10200, 10194] if (!exit_code)
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
} else if (!exit_code) {
exit_code = 2;
[10054, 10056, 10044] if (!v7) {
*(v9) = v8;
[10062] perror(d_buf);
[10072, 10065] }
}
}
}
do_chown(0x8801578d48014e8d, 0xffffffff, g_403260);
if (fchmod(0x48014e8d, g_403258 & 511)) {
v11 = __errno_location();
v12 = *(v11);
v13 = v11;
*(&v11) = quiet;
if (!quiet) {
rpl_fprintf(*(&stderr), "%s: ", 0x75c084078801578d);
*(&v11) = quiet;
if (!exit_code)
exit_code = 2;
if (!v11) {
*(v13) = v12;
perror(d_buf);
}
} else if (!exit_code) {
exit_code = 2;
if (!v11) {
*(v13) = v12;
perror(d_buf);
}
}
}
do_chown(0x8801578d48014e8d, g_40325c, 0xffffffff);
v15 = *(&v3) ^ v14[5];
return;
}
|
void copy_stat(unsigned int a0[9], unsigned long a1, unsigned long a2) {
[13608] char v0; // [bp-0x49]
[13608] unsigned int v1; // [bp-0x48]
[13608] unsigned int v2; // [bp-0x44]
[13608] unsigned int v3; // [bp-0x40]
[13608] unsigned int v4; // [bp-0x3c]
[13608] unsigned long v5; // [bp-0x38]
[13608] unsigned long v6; // [bp-0x30]
[13608] unsigned long v7; // [bp-0x28], Other Possible Types: unsigned long long
[13608] unsigned long v8; // [bp-0x20], Other Possible Types: unsigned long long
[13608] char v9; // [bp-0x10]
[13608] char v11; // al
[13608] unsigned long long *v13; // fs
[13608] unsigned long long v14; // rax
[13608]
[13608] v1 = a0[6] & 511;
[13633, 13637, 13639, 13643, 13646, 13651, 13608, 13612, 13613, 13616, 13620, 13624] v5 = get_stat_atime(a0);
[13666, 13661] v6 = a2;
[13670] v7 = get_stat_mtime(a0);
[13681, 13686] v8 = a2;
[13690] if (!decompress) {
v11 = 0;
[13760, 13763, 13767, 13771, 13755] } else if (true) {
v11 = 0;
[13760, 13763, 13767, 13771, 13755] } else if (v7 != 10180387026389042571) {
[13720, 13730, 13716, 13727] v11 = 1;
[13748] } else if (v8 == 14378102450199071541) {
[13736, 13746, 13732, 13743] v11 = 0;
[13760, 13763, 13767, 13771, 13755] } else {
v11 = 1;
[13748] }
v0 = v11;
v0 &= 1;
if (v0) {
v7 = 10180387026389042571;
v8 = 14378102450199071541;
}
if (fdutimens(0xf9158b48e5894855, &ofname, &v5)) {
v2 = *(__errno_location());
if (!quiet)
fprintf(*(&stderr), "%s: ", -116028600);
if (!exit_code)
exit_code = 2;
if (!quiet) {
*(__errno_location()) = v2;
perror(&ofname);
}
} else if (v0 && verbose > 1) {
fprintf(*(&stderr), "%s: timestamp restored\n", &ofname);
}
do_chown(0xf9158b48e5894855, &ofname, 0xffffffff, a0[8]);
v3 = fchmod(0xe5894855, v1);
if (v3) {
v4 = *(__errno_location());
if (!quiet)
fprintf(*(&stderr), "%s: ", -116028600);
if (!exit_code)
exit_code = 2;
if (!quiet) {
*(__errno_location()) = v4;
perror(&ofname);
}
}
do_chown(0xf9158b48e5894855, &ofname, a0[7], 0xffffffff);
v14 = *(&v9) ^ v13[5];
return;
}
|
int compare(const void **a1, _QWORD *a2)
[19472] {
int result; // eax
char *v5; // r12
char *v6; // r14
char *v7; // r13
char *v8; // r15
const void *v9; // rsi
const void *v10; // rdi
size_t v11; // rdx
[19488, 19520, 19492, 19527, 19500, 19502, 19472, 19474, 19507, 19476, 19509, 19478, 19511, 19480, 19481, 19484, 19485, 19518] if ( !keylist || (result = keycompare((long)a1, (long)a2)) == 0 && !unique && !stable )
{
[19529] v5 = (char *)a1[1];
[19533] v6 = (char *)a2[1];
[19537, 19540] v7 = v6 - 1;
[19544] v8 = v5 - 1;
[19544, 19548] if ( v5 == (_BYTE *)to_uchar + 1 )
{
[19552, 19555, 19558, 19540, 19550] result = -(v6 != (_BYTE *)to_uchar + 1);
}
else
{
[19592] result = 1;
[19600, 19540, 19597] if ( v6 != (_BYTE *)to_uchar + 1 )
{
[19609, 19602] v9 = (const void *)*a2;
[19613] v10 = *a1;
[19616] if ( hard_LC_COLLATE )
{
[19529, 19533, 19664, 19667, 19670, 19673, 19678] result = xmemcoll0(v10, a1[1], *a2, a2[1]);
}
else
{
[19618, 19621] v11 = (size_t)(v6 - 1);
[19624] if ( v8 <= v7 )
[19624] v11 = (size_t)(v5 - 1);
[19628] result = memcmp(v10, v9, v11);
[19633, 19635] if ( !result )
{
[19637] result = -1;
[19642, 19645] if ( v8 >= v7 )
[19649, 19655, 19652, 19647] result = v5 != v6;
}
}
}
}
[19560, 19567] if ( reverse )
[19569] return -result;
}
[19571] return result;
[19585, 19575, 19576, 19577, 19579, 19581, 19583] }
// 7C10: using guessed type long keylist;
// 7C19: using guessed type char unique;
// 7C1A: using guessed type char stable;
// 7C1B: using guessed type char reverse;
// 8061: using guessed type char hard_LC_COLLATE;
// D2E0: using guessed type long xmemcoll0(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000004CE0) ----------------------------------------------------
int mergelines(__m128i *a1, unsigned long a2, const void **a3)
[19680] {
const void **v3; // r15
const void **v4; // r13
unsigned long v5; // r12
__m128i *v6; // rbx
__m128i *v7; // r14
__m128i *i; // rbp
long v9; // rax
bool v10; // zf
__m128i v11; // xmm3
__m128i v12; // xmm5
long v14; // [rsp+8h] [rbp-40h]
[19680, 19682, 19685, 19687, 19719, 19690, 19696, 19698, 19701, 19705] v3 = a3;
[19692] v4 = a3 - 4;
[19702] v5 = a2 >> 1;
[19712] v6 = a1;
[19728, 19723, 19702] v14 = a2 - (a2 >> 1);
[19731, 19706, 19715, 19709] v7 = &a1[-2 * (a2 >> 1)];
[19793, 19738, 19797, 19734] for ( i = v7 - 2; ; i -= 2 )
{
[19750] while ( 1 )
{
[19750] v6 -= 2;
[19744, 19754, 19747] LODWORD(v9) = compare(v4, i);
[19761, 19759] if ( (int)v9 > 0 )
break;
[19814] v11 = _mm_loadu_si128((const __m128i *)v3 - 1);
[19808, 19820] *v6 = _mm_loadu_si128((const __m128i *)v3 - 2);
[19823] v6[1] = v11;
[19827, 19831] if ( !--v5 )
[19888, 19831] return v9;
[19833] v3 = v4;
[19840, 19836] v4 -= 4;
}
[19769] v10 = v14-- == 1;
[19763, 19775] *v6 = _mm_loadu_si128(v7 - 2);
[19784, 19778] v6[1] = _mm_loadu_si128(v7 - 1);
[19788] if ( v10 )
break;
[19790] v7 = i;
}
[19848, 19855] v9 = -32LL;
do
{
[19862] v12 = _mm_loadu_si128((const __m128i *)&v3[(unsigned long)v9 / 8 + 2]);
[19856, 19869] v6[(unsigned long)v9 / 0x10] = _mm_loadu_si128((const __m128i *)&v3[(unsigned long)v9 / 8]);
[19873] v6[(unsigned long)v9 / 0x10 + 1] = v12;
[19878] v9 -= 32LL;
[19882] --v5;
}
[19886] while ( v5 );
[19888] return v9;
[19892, 19893, 19894, 19896, 19898, 19900, 19902] }
//----- (0000000000004DC0) ----------------------------------------------------
int sequential_sort(const __m128i *a1, unsigned long a2, __m128i *a3, char a4)
[19904] {
__m128i *v4; // r13
const void **v5; // r12
unsigned long v8; // r14
unsigned long v9; // rsi
const void **v10; // rdi
__m128i v11; // xmm3
const void **v12; // rax
long v13; // rax
__m128i v14; // xmm1
__m128i v15; // xmm0
__m128i v16; // xmm4
__m128i v17; // xmm5
int v18; // edx
const __m128i *v19; // rdx
__m128i v20; // xmm7
__m128i v21; // xmm4
__m128i v22; // xmm5
[19904, 19906, 19908, 19911, 19916, 19917] v4 = a3;
[19913] v5 = (const void **)a1;
[19920, 19924, 19918] if ( a2 == 2 )
{
[20080, 20088, 20084] LODWORD(v13) = compare((const void **)&a1[-2], (const __m128i *)a1[-4].m128i_i64);
[20093, 20095] if ( a4 )
{
[20176, 20178, 20181, 20184] v18 = (int)v13 > 0;
[20186, 20196] v13 = 32LL * (v18 - 2);
[20193, 20200, 20204, 20189, 20191] v19 = &a1[2 * ~v18];
[20216, 20207] v20 = _mm_loadu_si128((const __m128i *)((char *)a1 + v13 + 16));
[20223] v21 = _mm_loadu_si128(v19);
[20227] v22 = _mm_loadu_si128(v19 + 1);
[20232, 20210, 20207] v4[-4] = _mm_loadu_si128((const __m128i *)((char *)a1 + v13));
[20237] v4[-2] = v21;
[20242] v4[-1] = v22;
[20247] v4[-3] = v20;
}
[20097, 20099] else if ( (int)v13 > 0 )
{
[20101] v14 = _mm_loadu_si128(a1 - 2);
[20108] v15 = _mm_loadu_si128(a1 - 1);
[20115] v16 = _mm_loadu_si128(a1 - 4);
[20122] v17 = _mm_loadu_si128(a1 - 3);
[20129] v4[-2] = v14;
[20134] v4[-1] = v15;
[20139] a1[-2] = v16;
[20145] a1[-1] = v17;
[20151] a1[-4] = v14;
[20157] a1[-3] = v15;
}
}
else
{
[19936, 19930, 19933] v8 = a2 >> 1;
[19936, 19939, 19942] v9 = a2 - (a2 >> 1);
[19952, 19945, 19949] v10 = (const void **)&a1[-2 * v8];
[19960, 19958] if ( a4 )
{
[20040, 20048, 20043, 19955] sequential_sort(v10, v9, &a3[-2 * v8], 1);
[20057, 20053] if ( a2 > 3 )
[20064, 20067, 20070, 20075, 20059, 20061] sequential_sort(v5, v8, v4, 0);
}
else
{
[19962, 19964, 19967] sequential_sort(v10, v9, a3, 0);
[19976, 19972] if ( a2 > 3 )
{
[20264, 20267, 20270, 20275, 20278] sequential_sort(v5, v8, v4, 1);
[20289, 20283, 20292, 20286] v12 = (const void **)v4;
}
else
{
[19989] v11 = _mm_loadu_si128((const __m128i *)v5 - 1);
[19996] v12 = (const void **)v4;
[19982, 19999] v4[-2] = _mm_loadu_si128((const __m128i *)v5 - 2);
[20004] v4[-1] = v11;
}
[20009] v4 = (__m128i *)v5;
[20012] v5 = v12;
}
[20016, 20032, 20019, 20022] LODWORD(v13) = mergelines(v4, a2, v5);
}
[20015] return v13;
[20256, 20258, 20163, 20164, 20165, 20252, 20167, 20260, 20169, 20171, 20254, 20025, 20026, 20028, 20253, 20030] }
//----- (0000000000004F50) ----------------------------------------------------
int write_unique(long a1, FILE *a2, char *a3)
[20304] {
int result; // eax
char *v4; // [rsp+8h] [rbp-10h]
[20320, 20304, 20306, 20309, 20313] if ( !unique )
[20320, 20393, 20398] return (unsigned int)write_line((const void **)a1, a2, a3);
[20353, 20322, 20357, 20330, 20362, 20332, 20364, 20339, 20344, 20348] if ( !(_QWORD)saved_line || (v4 = a3, result = compare((const void **)a1, &saved_line), a3 = v4, result) )
{
[20370, 20366] saved_line = (__int128)_mm_loadu_si128((const __m128i *)a1);
[20377, 20382] xmmword_8050 = (__int128)_mm_loadu_si128((const __m128i *)(a1 + 16));
[20393, 20389, 20398] return (unsigned int)write_line((const void **)a1, a2, a3);
}
[20389] return result;
[20408, 20412, 20396, 20414] }
// 7C19: using guessed type char unique;
// 8040: using guessed type __int128 saved_line;
// 8050: using guessed type __int128 xmmword_8050;
//----- (0000000000004FC0) ----------------------------------------------------
int mergelines_node(long a1, unsigned long a2, FILE *a3, char *a4)
[20416] {
const __m128i *v7; // rdx
long v8; // r12
unsigned int v9; // edi
long v10; // r13
long v11; // rcx
unsigned long v12; // rax
const __m128i *v13; // rsi
__m128i **v14; // r11
long v15; // rdi
long v16; // r8
long v17; // rdx
__m128i *v18; // r14
long v19; // rax
__m128i v20; // xmm0
unsigned long v21; // rbp
long v22; // rax
__m128i v23; // xmm2
long v24; // r9
long v25; // r10
long v26; // rdi
long v27; // rdi
unsigned long v28; // r15
long v29; // rdi
long v30; // rcx
unsigned long v31; // r15
unsigned long v32; // rdx
__m128i v33; // xmm4
const __m128i *v34; // rcx
unsigned long v35; // rdx
const __m128i *v36; // rsi
__m128i v37; // xmm6
unsigned long v38; // r15
const __m128i *v40; // [rsp+8h] [rbp-40h]
[20416, 20418, 20420, 20423, 20425, 20427, 20428, 20431, 20432, 20435, 20439] v7 = *(const __m128i **)(a1 + 8);
[20443] v8 = *(_QWORD *)a1;
[20446] v9 = *(_DWORD *)(a1 + 80);
[20449] v40 = v7;
[20454] v10 = v8;
[20464] v11 = *(_QWORD *)(a1 + 16);
[20457, 20468, 20461] v12 = (a2 >> (2 * (unsigned char)v9 + 2)) + 1;
[20472] v13 = v7;
[20475, 20478] if ( v9 > 1 )
{
[20484] v14 = *(__m128i ***)(a1 + 32);
[20488] v15 = v8;
[20491] v16 = 0LL;
[20494] v17 = 0LL;
[20496] v18 = *v14;
[20504, 20499, 20502] if ( v8 == v11 )
{
LABEL_11:
[20673] v24 = *(_QWORD *)(a1 + 48);
[20677] v25 = *(_QWORD *)(a1 + 40);
[20681, 20684] if ( v24 == v16 )
{
LABEL_13:
[20695] *v14 = v18;
goto LABEL_14;
}
}
else
{
[20558] while ( 1 )
{
[20562, 20558] if ( *(const __m128i **)(a1 + 24) == v13 )
{
[21088, 21096, 21093] v14 = *(__m128i ***)(a1 + 32);
[21106, 21100] v17 = (v8 - v15) >> 5;
[21110, 21103] v16 = ((char *)v40 - (char *)v13) >> 5;
goto LABEL_38;
}
[20568] v21 = v12 - 1;
[20572, 20575] if ( !v12 )
break;
[20589] v18 -= 2;
[20581, 20585, 20593, 20598, 20600] if ( compare((const void **)(v15 - 32), (const __m128i *)v13[-2].m128i_i64) > 0 )
{
[20512] v19 = *(_QWORD *)(a1 + 8);
[20516] v15 = *(_QWORD *)a1;
[20519] v11 = *(_QWORD *)(a1 + 16);
[20523] v20 = _mm_loadu_si128((const __m128i *)(v19 - 32));
[20528] v13 = (const __m128i *)(v19 - 32);
[20528, 20532] *(_QWORD *)(a1 + 8) = v19 - 32;
[20536] *v18 = v20;
[20545, 20540] v18[1] = _mm_loadu_si128((const __m128i *)(v19 - 16));
[20553, 20550] if ( v11 == v15 )
goto LABEL_10;
}
else
{
[20602] v22 = *(_QWORD *)a1;
[20605] v11 = *(_QWORD *)(a1 + 16);
[20609] v13 = *(const __m128i **)(a1 + 8);
[20602, 20613] v23 = _mm_loadu_si128((const __m128i *)(*(_QWORD *)a1 - 32LL));
[20602, 20618] v15 = *(_QWORD *)a1 - 32LL;
[20622] *(_QWORD *)a1 = v15;
[20625] *v18 = v23;
[20634, 20629] v18[1] = _mm_loadu_si128((const __m128i *)(v22 - 16));
[20642, 20639] if ( v15 == v11 )
{
LABEL_10:
[20649, 20652, 20644] v14 = *(__m128i ***)(a1 + 32);
[20656] v12 = v21;
[20665, 20659] v17 = (v8 - v15) >> 5;
[20669, 20662] v16 = ((char *)v40 - (char *)v13) >> 5;
goto LABEL_11;
}
}
[20555] v12 = v21;
}
[21232, 21240, 21237] v14 = *(__m128i ***)(a1 + 32);
[21244] v12 = -1LL;
[21257, 21251] v17 = (v8 - v15) >> 5;
[21265, 21261, 21254] v16 = ((char *)v40 - (char *)v13) >> 5;
LABEL_38:
[21114] v24 = *(_QWORD *)(a1 + 48);
[21118] v25 = *(_QWORD *)(a1 + 40);
[21122, 21125] if ( v24 == v16 )
{
[21131, 21134] if ( v11 != v15 )
{
[21140] v32 = v12 - 1;
[21144, 21147] if ( v12 )
{
[21153, 21157] v12 = v15 - 32;
[21186] while ( 1 )
{
[21186] v33 = _mm_loadu_si128((const __m128i *)v12);
[21190] v18 -= 2;
[21194] *(_QWORD *)a1 = v12;
[21197] v15 = v12;
[21200] *v18 = v33;
[21209, 21204] v18[1] = _mm_loadu_si128((const __m128i *)(v12 + 16));
[21217, 21214] if ( v12 == v11 )
break;
[21168] --v32;
[21172] v12 -= 32LL;
[21176, 21180] if ( v32 == -1LL )
goto LABEL_13;
}
[21219] v15 = v11;
}
}
[21222] goto LABEL_13;
}
}
[20689, 20686] if ( v25 == v17 )
{
[21280] v34 = *(const __m128i **)(a1 + 24);
[21284, 21287] if ( v34 != v13 )
{
[21293] v35 = v12 - 1;
[21297, 21300] if ( v12 )
{
[21306, 21310] v36 = v13 - 2;
do
{
[21330] v37 = _mm_loadu_si128(v36);
[21334] v18 -= 2;
[21338] *(_QWORD *)(a1 + 8) = v36;
[21342] v12 = (unsigned long)v36;
[21345] *v18 = v37;
[21354, 21349] v18[1] = _mm_loadu_si128(v36 + 1);
[21362, 21359] if ( v36 == v34 )
{
[21372, 21369, 21364, 21375] v16 = ((char *)v40 - (char *)v36) >> 5;
[21379] goto LABEL_13;
}
[21312] --v35;
[21316] v36 -= 2;
}
[21320, 21324] while ( v35 != -1LL );
[21536, 21544, 21547, 21541] v16 = (long)((long)v40->m128i_i64 - v12) >> 5;
}
}
}
[21551] goto LABEL_13;
}
[20736] v16 = 0LL;
[20739] v26 = 0LL;
[20744, 20746, 20741] if ( v8 == v11 )
{
LABEL_24:
[20888] v24 = *(_QWORD *)(a1 + 48);
[20892] v25 = *(_QWORD *)(a1 + 40);
[20896, 20899] if ( v24 == v16 )
{
[20901] v24 = v16;
[20904] v15 = v11;
[20907] goto LABEL_14;
}
goto LABEL_29;
}
[20794, 20798] while ( *(const __m128i **)(a1 + 24) != v13 )
{
[20800] v28 = v12 - 1;
[20804, 20807] if ( !v12 )
{
[20912] v12 = -1LL;
break;
}
[20809, 20813, 20817, 20822, 20824] if ( compare((const void **)(v10 - 32), (const __m128i *)v13[-2].m128i_i64) > 0 )
{
[20752, 20762] v27 = *(_QWORD *)(a1 + 8) - 32LL;
[20766] *(_QWORD *)(a1 + 8) = v27;
[20770, 20756, 20759] write_unique(v27, a3, a4);
[20775] v10 = *(_QWORD *)a1;
[20778] v11 = *(_QWORD *)(a1 + 16);
[20782] v13 = *(const __m128i **)(a1 + 8);
[20786, 20789, 20775] if ( *(_QWORD *)a1 == v11 )
goto LABEL_23;
}
else
{
[20826, 20835] v29 = *(_QWORD *)a1 - 32LL;
[20839] *(_QWORD *)a1 = v29;
[20832, 20842, 20829] write_unique(v29, a3, a4);
[20847] v10 = *(_QWORD *)a1;
[20850] v11 = *(_QWORD *)(a1 + 16);
[20854] v13 = *(const __m128i **)(a1 + 8);
[20858, 20861, 20847] if ( v11 == *(_QWORD *)a1 )
{
LABEL_23:
[20871, 20868, 20863] v12 = v28;
[20880, 20874] v26 = (v8 - v11) >> 5;
[20884, 20877] v16 = ((char *)v40 - (char *)v13) >> 5;
goto LABEL_24;
}
}
[20791] v12 = v28;
}
[20924, 20919] v24 = *(_QWORD *)(a1 + 48);
[20928, 20931] v16 = ((char *)v40 - (char *)v13) >> 5;
[20938, 20935] if ( v24 != v16 )
{
[20940, 20943] v25 = *(_QWORD *)(a1 + 40);
[20947, 20950] v26 = (v8 - v10) >> 5;
LABEL_29:
[20954, 20957] if ( v26 != v25 )
goto LABEL_30;
[21392, 21396] if ( v13 == *(const __m128i **)(a1 + 24) )
goto LABEL_30;
[21402] v38 = v12 - 1;
[21409, 21411, 21406] if ( !v12 )
goto LABEL_30;
do
{
[21434, 21444] *(_QWORD *)(a1 + 8) = v13 - 2;
[21448, 21441, 21434, 21438] LODWORD(v12) = write_unique((long)v13[-2].m128i_i64, a3, a4);
[21453] v13 = *(const __m128i **)(a1 + 8);
[21457, 21461] if ( v13 == *(const __m128i **)(a1 + 24) )
break;
[21424] --v38;
}
[21432, 21428] while ( v38 != -1LL );
[21468, 21463] v15 = *(_QWORD *)a1;
[21471] v25 = *(_QWORD *)(a1 + 40);
[21475] v24 = *(_QWORD *)(a1 + 48);
[21482, 21485, 21479] v16 = ((char *)v40 - (char *)v13) >> 5;
[21489] goto LABEL_14;
}
[20976] v30 = v10;
[20993, 20996, 20998, 20979, 20983, 20989] if ( *(_QWORD *)(a1 + 16) == v10 || (v31 = v12 - 1, !v12) )
{
[21560, 21556] v25 = *(_QWORD *)(a1 + 40);
LABEL_30:
[20963] v15 = v10;
[20966] goto LABEL_14;
}
do
{
[21032, 21022] *(_QWORD *)a1 = v30 - 32;
[21026, 21035, 21029, 21022] LODWORD(v12) = write_unique(v30 - 32, a3, a4);
[21040] v30 = *(_QWORD *)a1;
[21043] v15 = *(_QWORD *)(a1 + 16);
[21040, 21050, 21047] if ( *(_QWORD *)a1 == v15 )
{
[21064] v25 = *(_QWORD *)(a1 + 40);
[21068] v24 = *(_QWORD *)(a1 + 48);
[21072, 21057, 21052, 21061] v16 = ((long)v40->m128i_i64 - *(_QWORD *)(a1 + 8)) >> 5;
[21076] goto LABEL_14;
}
[21008] --v31;
}
[21016, 21012] while ( v31 != -1LL );
[21513] v15 = *(_QWORD *)a1;
[21519] v25 = *(_QWORD *)(a1 + 40);
[21523] v24 = *(_QWORD *)(a1 + 48);
[21504, 21509, 21516, 21527, 21531] v16 = ((long)v40->m128i_i64 - *(_QWORD *)(a1 + 8)) >> 5;
LABEL_14:
[20698, 20708, 20701] *(_QWORD *)(a1 + 48) = v24 - v16;
[20704, 20698, 20715, 20712] *(_QWORD *)(a1 + 40) = v25 - ((v8 - v15) >> 5);
[20719] return v12;
[20723, 20724, 20725, 20727, 20729, 20731, 20733] }
//----- (0000000000005440) ----------------------------------------------------
int merge_loop(long a1, unsigned long a2, FILE *a3, char *a4)
[21568] {
long v6; // rbp
[21568, 21570, 21573, 21575, 21578, 21580, 21583, 21584, 21585, 21588, 21655] while ( 1 )
{
[21655, 21650, 21647] v6 = queue_pop(a1);
[21658, 21661, 21663] if ( !*(_DWORD *)(v6 + 80) )
break;
[21600, 21603, 21606, 21609, 21612] mergelines_node(v6, a2, a3, a4);
[21617, 21620, 21623] queue_check_insert(a1, v6);
[21634, 21628, 21631] queue_check_insert_parent(a1, v6);
[21642, 21639] unlock_node(v6);
}
[21665, 21668] unlock_node(v6);
[21673, 21674, 21677, 21687] return queue_insert(a1, v6);
[21680, 21681, 21683, 21685] }
//----- (00000000000054C0) ----------------------------------------------------
unsigned long sortlines(
const __m128i *a1,
unsigned long a2,
unsigned long a3,
__m128i *a4,
long a5,
FILE *a6,
char *a7)
{
unsigned long v10; // r9
unsigned long v11; // r12
long v12; // rax
__m128i *v13; // r11
const void **v14; // r10
long v15; // rax
int v17; // eax
const __m128i *v18; // [rsp+8h] [rbp-B0h]
long v19; // [rsp+8h] [rbp-B0h]
long v20; // [rsp+8h] [rbp-B0h]
const void **v21; // [rsp+10h] [rbp-A8h]
unsigned long v22; // [rsp+18h] [rbp-A0h]
long v23; // [rsp+18h] [rbp-A0h]
long v24; // [rsp+18h] [rbp-A0h]
long v25; // [rsp+20h] [rbp-98h]
long v26; // [rsp+28h] [rbp-90h]
pthread_t newthread; // [rsp+38h] [rbp-80h] BYREF
long arg[7]; // [rsp+40h] [rbp-78h] BYREF
unsigned long v29; // [rsp+78h] [rbp-40h]
v10 = a4[2].m128i_u64[1];
v11 = a4[3].m128i_u64[0];
v29 = __readfsqword(0x28u);
v12 = a4[4].m128i_i64[0];
arg[0] = (long)a1;
arg[1] = a2 >> 1;
arg[3] = v12;
arg[2] = a3;
arg[4] = a5;
arg[5] = (long)a6;
arg[6] = (long)a7;
if ( v10 + v11 > 0x1FFFF && a2 > 1 )
{
v24 = a5;
v17 = pthread_create(&newthread, 0LL, sortlines_thread, arg);
a5 = v24;
if ( !v17 )
{
sortlines(
(const void **)&a1[-2 * a4[2].m128i_i64[1]],
a2 - (a2 >> 1),
a3,
(__m128i *)a4[4].m128i_i64[1],
v24,
a6,
a7);
pthread_join(newthread, 0LL);
return __readfsqword(0x28u) ^ v29;
}
v10 = a4[2].m128i_u64[1];
v11 = a4[3].m128i_u64[0];
}
v13 = (__m128i *)&a1[-2 * a3];
v14 = (const void **)&a1[-2 * v10];
v15 = -32LL * v10;
if ( v11 > 1 )
{
v25 = -32LL * v10;
v26 = a5;
v22 = v10;
v18 = &a1[-2 * v10];
sequential_sort(v18, v11, &v13[-2 * (v10 >> 1)], 0);
a5 = v26;
v15 = v25;
v10 = v22;
v13 = (__m128i *)&a1[-2 * a3];
v14 = (const void **)v18;
}
if ( v10 > 1 )
{
v23 = a5;
v21 = v14;
v19 = v15;
sequential_sort(a1, v10, v13, 0);
a5 = v23;
v14 = v21;
v15 = v19;
}
a4[1].m128i_i64[0] = (long)v14;
v20 = a5;
a4[1].m128i_i64[1] = (long)a1->m128i_i64 + v15 - 32 * v11;
*a4 = _mm_unpacklo_epi64((__m128i)(unsigned long)a1, (__m128i)(unsigned long)v14);
queue_insert(a5, (long)a4);
merge_loop(v20, a3, a6, a7);
return __readfsqword(0x28u) ^ v29;
}
//----- (0000000000005700) ----------------------------------------------------
void * sortlines_thread(void *a1)
[22272] {
[22272, 22306, 22276, 22280, 22284, 22288, 22292, 22296, 22299, 22303] sortlines(
*(const __m128i **)a1,
*((_QWORD *)a1 + 1),
*((_QWORD *)a1 + 2),
*((__m128i **)a1 + 3),
*((_QWORD *)a1 + 4),
*((FILE **)a1 + 5),
*((char **)a1 + 6));
[22313, 22317, 22311] return 0LL;
}
//----- (0000000000005730) ----------------------------------------------------
long check(char *a1, char a2)
[22320] {
struct _IO_FILE *v3; // rax
size_t v4; // rdx
FILE *v5; // r14
unsigned char v6; // bl
size_t v7; // r12
long v8; // rax
__m128i *v9; // r15
unsigned long v10; // rbp
const void **v11; // rdi
size_t v12; // rdx
__m128i v13; // xmm1
__m128i v14; // xmm0
__m128i v15; // xmm1
long v16; // rax
unsigned int v17; // r12d
long v19; // rax
long v20; // rax
long v21; // rbp
long v22; // rbx
char *v23; // rax
char *v24; // rax
long v25; // [rsp+10h] [rbp-D8h]
long v26; // [rsp+18h] [rbp-D0h]
__m128i dest[2]; // [rsp+30h] [rbp-B8h] BYREF
void *ptr[2]; // [rsp+50h] [rbp-98h] BYREF
long v29; // [rsp+60h] [rbp-88h]
long v30; // [rsp+68h] [rbp-80h]
char v31[24]; // [rsp+90h] [rbp-58h] BYREF
unsigned long v32; // [rsp+A8h] [rbp-40h]
[22368, 22351, 22320, 22322, 22324, 22326, 22360, 22329, 22331, 22332, 22333] v32 = __readfsqword(0x28u);
[22344, 22370, 22340] v3 = xfopen(a1, "r");
[22387, 22382, 22375] v4 = merge_buffer_size;
[22394] v5 = v3;
[22404, 22397] v6 = unique ^ 1;
[22414] if ( sort_size >= (unsigned long)merge_buffer_size )
[22414, 22407] v4 = sort_size;
[22422] v7 = 0LL;
[22425, 22430] v26 = keylist;
[22441, 22446, 22438] initbuf((long)ptr, 0x20uLL, v4);
[22456, 22451] dest[0].m128i_i64[0] = 0LL;
[22465, 22474] v25 = 0LL;
[22479] while ( 1 )
{
[22497, 22479, 22484, 22487, 22490, 22495] if ( !(unsigned char)fillbuf((long *)ptr, v5, a1) )
{
[22982] v17 = 1;
[22988] goto LABEL_19;
}
[22513, 22508, 22503] v8 = buffer_linelim_isra_0((long)ptr[0], v30);
[22521, 22526, 22529, 22518] v9 = (__m128i *)(v8 - 32);
[22537, 22533] v10 = v8 - 32 * v29;
[22545, 22540, 22543] if ( v7 )
{
[22435, 22730, 22735, 22738, 22743, 22745, 22751] if ( v6 <= compare((const void **)dest, v9) )
break;
}
[22580] while ( 1 )
{
[22580] v11 = (const void **)v9;
[22586, 22583] if ( v10 >= (unsigned long)v9 )
break;
[22560] v9 -= 2;
[22435, 22564, 22567, 22572, 22574] if ( v6 <= compare(v11, v9) )
goto LABEL_17;
}
[22588] v12 = v9->m128i_u64[1];
[22592, 22597] v25 += v29;
[22602, 22605] if ( v12 > v7 )
{
[22693] while ( 1 )
{
[22693] v7 *= 2LL;
[22696] if ( !v7 )
break;
[22688, 22691] if ( v12 <= v7 )
goto LABEL_15;
}
[22698, 22588] v7 = v9->m128i_u64[1];
LABEL_15:
[22706, 22701] free((void *)dest[0].m128i_i64[0]);
[22714, 22711] v16 = xmalloc(v7);
[22719] v12 = v9->m128i_u64[1];
[22728, 22723] dest[0].m128i_i64[0] = v16;
}
[22610, 22615, 22607] memcpy((void *)dest[0].m128i_i64[0], (const void *)v9->m128i_i64[0], v12);
[22624, 22620, 22630] dest[0].m128i_i64[1] = v9->m128i_i64[1];
[22635] if ( v26 )
{
[22641] v13 = _mm_loadu_si128(v9);
[22656, 22652, 22646] v14 = _mm_sub_epi64(_mm_loadu_si128(v9 + 1), _mm_unpacklo_epi64(v13, v13));
[22660] v15 = _mm_loadl_epi64(dest);
[22679, 22666, 22670, 22674] dest[1] = _mm_add_epi64(v14, _mm_unpacklo_epi64(v15, v15));
}
}
LABEL_17:
[22752] v17 = 0;
[22760, 22755] if ( a2 == 99 )
{
[22842, 22837, 22847] v19 = buffer_linelim_isra_0((long)ptr[0], v30);
[22852, 22860, 22863, 22866, 22870, 22875] v20 = umaxtostr(v25 + ((v19 - (long)v9) >> 5), v31);
[22880] v21 = program_name;
[22901] v22 = v20;
[22904, 22889, 22894, 22887] v23 = dcgettext(0LL, "%s: %s:%s: disorder: ", 5);
[22912, 22915, 22918, 22925, 22928, 22933, 22935, 22909] _fprintf_chk(stderr, 1LL, v23, v21, a1, v22);
[22954, 22947, 22940, 22942] v24 = dcgettext(0LL, "standard error", 5);
[22977, 22959, 22966, 22969, 22972] write_line((const void **)v9, stderr, v24);
}
LABEL_19:
[22768, 22762, 22765] xfclose(v5, a1);
[22778, 22773] free(ptr[0]);
[22788, 22793, 22801, 22810, 22783] free((void *)dest[0].m128i_i64[0]);
[22816, 22823] return v17;
[22826, 22827, 22828, 22830, 22832, 22834, 22836] }
// 7A28: using guessed type long merge_buffer_size;
// 7C10: using guessed type long keylist;
// 7C19: using guessed type char unique;
// 7C38: using guessed type long sort_size;
// D070: using guessed type long xmalloc(_QWORD);
// D298: using guessed type long umaxtostr(_QWORD, _QWORD);
// D308: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// 5730: using guessed type char var_58[24];
//----- (00000000000059E0) ----------------------------------------------------
unsigned long mergefps(
long a1,
unsigned long a2,
unsigned long a3,
FILE *a4,
char *a5,
FILE **a6)
{
const void ***v8; // rbp
unsigned long *v9; // r15
unsigned long v10; // rbx
unsigned long v11; // r15
long *v12; // rbp
unsigned long v13; // rdx
char **v14; // r12
long v15; // rax
__m128i si128; // xmm0
__m128i v17; // xmm2
__m128i *v18; // rax
__m128i v19; // xmm1
unsigned long v20; // rax
unsigned long v21; // rax
unsigned long v22; // rax
unsigned long v23; // rbx
unsigned long *v24; // r13
__m128d v25; // xmm0
const __m128i *v26; // r13
const void ***v27; // rbx
long v28; // rax
long v29; // rdx
long v30; // rdx
const void **v31; // rdi
long v32; // rcx
unsigned long v33; // rbx
unsigned long v34; // rax
unsigned long v35; // r13
unsigned long v36; // rbx
unsigned long v37; // r14
unsigned long *v38; // r12
int v39; // eax
unsigned long v40; // rdi
unsigned long *v41; // rax
__m128i v42; // xmm3
unsigned long v43; // rax
size_t v44; // r12
void *v45; // rdi
const void *v46; // rsi
__m128i v47; // xmm0
__m128i v48; // xmm1
unsigned long v49; // rsi
unsigned long *v50; // rax
unsigned long v51; // rax
unsigned long v52; // rdx
unsigned long v53; // rax
const __m128i *v54; // rdx
__m128i v55; // xmm4
__m128i v56; // xmm5
__m128i v57; // xmm6
long v58; // r9
__m128i v59; // xmm7
const void **v60; // r9
long v61; // r9
unsigned long *v62; // rax
__m128i v63; // xmm1
unsigned long v64; // rax
FILE *v65; // rax
size_t v67; // rax
long v68; // rax
const void ***v69; // [rsp+8h] [rbp-E0h]
const void ***v70; // [rsp+10h] [rbp-D8h]
unsigned long v71; // [rsp+10h] [rbp-D8h]
unsigned long v72; // [rsp+18h] [rbp-D0h]
_QWORD *v73; // [rsp+20h] [rbp-C8h]
long *v74; // [rsp+28h] [rbp-C0h]
unsigned long *v76; // [rsp+38h] [rbp-B0h]
const void **v77; // [rsp+38h] [rbp-B0h]
unsigned long v79; // [rsp+48h] [rbp-A0h]
size_t v83; // [rsp+68h] [rbp-80h]
long v84; // [rsp+78h] [rbp-70h]
__m128i dest[2]; // [rsp+80h] [rbp-68h] BYREF
unsigned long v86; // [rsp+A8h] [rbp-40h]
v72 = a3;
v86 = __readfsqword(0x28u);
v74 = (long *)xnmalloc(a3, 56LL);
v8 = (const void ***)xnmalloc(a3, 8LL);
v73 = (_QWORD *)xnmalloc(a3, 8LL);
dest[0].m128i_i64[0] = 0LL;
v9 = (unsigned long *)xnmalloc(a3, 8LL);
v84 = keylist;
if ( !a3 )
goto LABEL_72;
v70 = v8;
v10 = 0LL;
v76 = v9;
while ( 1 )
{
while ( 1 )
{
v11 = 8 * v10;
v12 = &v74[7 * v10];
v13 = merge_buffer_size;
if ( sort_size / v72 >= merge_buffer_size )
v13 = sort_size / v72;
initbuf((long)&v74[7 * v10], 0x20uLL, v13);
v14 = (char **)(a1 + 16 * v10);
if ( !(unsigned char)fillbuf(v12, a6[v10], *v14) )
break;
v15 = buffer_linelim_isra_0(*v12, v12[3]);
v70[v10] = (const void **)(v15 - 32);
v73[v10++] = v15 - 32 * v12[2];
if ( v10 >= v72 )
{
v8 = v70;
v9 = v76;
goto LABEL_8;
}
}
xfclose(a6[v10], *v14);
if ( v10 < a2 )
{
--a2;
zaptemp(*v14);
}
free((void *)*v12);
if ( v72 - 1 <= v10 )
break;
do
{
v65 = a6[v11 / 8 + 1];
*(__m128i *)(a1 + 2 * v11) = _mm_loadu_si128((const __m128i *)(a1 + 2 * v11 + 16));
a6[v11 / 8] = v65;
v11 += 8LL;
}
while ( 8 * v72 - 8 != v11 );
--v72;
}
v8 = v70;
v9 = v76;
--v72;
LABEL_8:
if ( !v72 )
goto LABEL_72;
v79 = v72 - 1;
if ( v72 - 1 > 2 )
{
si128 = _mm_load_si128((const __m128i *)&LC61);
v17 = _mm_load_si128((const __m128i *)&LC62);
v18 = (__m128i *)v9;
do
{
v19 = si128;
++v18;
si128 = _mm_add_epi64(si128, v17);
v18[-1] = v19;
}
while ( &v9[2 * (v72 >> 1)] != (unsigned long *)v18 );
v20 = v72 & 0xFFFFFFFFFFFFFFFELL;
if ( (v72 & 1) == 0 || (v9[v20] = v20, v21 = v20 + 1, v21 >= v72) )
{
LABEL_16:
v23 = 1LL;
do
{
while ( 1 )
{
v24 = &v9[v23];
if ( compare(v8[*(v24 - 1)], v8[*v24]) <= 0 )
break;
v25 = (__m128d)_mm_loadu_si128((const __m128i *)(v24 - 1));
v23 = 1LL;
*(__m128d *)(v24 - 1) = _mm_shuffle_pd(v25, v25, 1);
}
++v23;
}
while ( v23 < v72 );
goto LABEL_20;
}
LABEL_14:
v9[v21] = v21;
v22 = v21 + 1;
if ( v22 < v72 )
v9[v22] = v22;
goto LABEL_16;
}
*v9 = 0LL;
if ( v72 != 1 )
{
v21 = 1LL;
goto LABEL_14;
}
LABEL_20:
v83 = 0LL;
v77 = 0LL;
while ( 1 )
{
while ( 1 )
{
while ( 1 )
{
v26 = (const __m128i *)v8[*v9];
if ( unique )
{
if ( v77 )
{
if ( !compare(v77, v8[*v9]) )
goto LABEL_24;
write_line((const void **)dest, a4, a5);
}
v44 = v26->m128i_u64[1];
v45 = (void *)dest[0].m128i_i64[0];
if ( v44 > v83 )
{
v67 = v83;
while ( v67 )
{
v67 *= 2LL;
if ( v44 <= v67 )
{
v44 = v67;
break;
}
}
free((void *)dest[0].m128i_i64[0]);
v68 = xmalloc(v44);
v83 = v44;
v44 = v26->m128i_u64[1];
dest[0].m128i_i64[0] = v68;
v45 = (void *)v68;
}
v46 = (const void *)v26->m128i_i64[0];
dest[0].m128i_i64[1] = v44;
memcpy(v45, v46, v44);
v77 = (const void **)dest;
if ( v84 )
{
v47 = _mm_loadu_si128(v26);
v48 = _mm_loadl_epi64(dest);
dest[1] = _mm_add_epi64(
_mm_sub_epi64(_mm_loadu_si128(v26 + 1), _mm_unpacklo_epi64(v47, v47)),
_mm_unpacklo_epi64(v48, v48));
}
}
else
{
write_line(v8[*v9], a4, a5);
}
LABEL_24:
v71 = *v9;
if ( v73[*v9] >= (unsigned long)v26 )
break;
v33 = v72;
v31 = (const void **)&v26[-2];
v69 = &v8[*v9];
*v69 = (const void **)&v26[-2];
if ( v72 != 1 )
goto LABEL_27;
LABEL_42:
*v9 = v71;
}
if ( !(unsigned char)fillbuf(&v74[7 * *v9], a6[*v9], *(char **)(a1 + 16 * *v9)) )
break;
v71 = *v9;
v27 = &v8[*v9];
v28 = buffer_linelim_isra_0(v74[7 * *v9], v74[7 * *v9 + 3]);
v69 = v27;
v30 = *(_QWORD *)(v29 + 16);
v31 = (const void **)(v28 - 32);
*v27 = (const void **)(v28 - 32);
v73[v32] = v28 - 32 * v30;
v33 = v72;
if ( v72 == 1 )
goto LABEL_42;
LABEL_27:
v34 = v33;
v35 = 1LL;
v36 = 1LL;
v37 = v34;
while ( 1 )
{
v38 = &v9[v35];
v39 = compare(v31, v8[*v38]);
if ( v39 < 0 || !v39 && *v38 > v71 )
break;
v36 = v35 + 1;
v35 = (v35 + 1 + v37) >> 1;
if ( v36 >= v37 )
goto LABEL_34;
LABEL_31:
v31 = *v69;
}
v37 = v35;
v35 = (v36 + v35) >> 1;
if ( v36 < v37 )
goto LABEL_31;
LABEL_34:
v40 = v36 - 1;
if ( v36 != 1 )
{
if ( v36 == 2 )
{
v43 = 0LL;
goto LABEL_39;
}
v41 = v9;
do
{
v42 = _mm_loadu_si128((const __m128i *)(v41 + 1));
v41 += 2;
*((__m128i *)v41 - 1) = v42;
}
while ( v41 != &v9[2 * (v40 >> 1)] );
v43 = v40 & 0xFFFFFFFFFFFFFFFELL;
if ( (v40 & 1) != 0 )
LABEL_39:
v9[v43] = v9[v43 + 1];
}
v9[v36 - 1] = v71;
}
v49 = *v9;
v50 = v9 + 1;
if ( v72 != 1 )
{
do
{
if ( *v50 > v49 )
{
--*v50;
v49 = *v9;
}
++v50;
}
while ( &v9[v72] != v50 );
}
xfclose(a6[v49], *(char **)(a1 + 16 * v49));
v51 = *v9;
if ( *v9 < a2 )
{
--a2;
zaptemp(*(char **)(a1 + 16 * v51));
v51 = *v9;
}
free((void *)v74[7 * v51]);
v52 = *v9;
if ( v79 > *v9 )
{
v53 = 8 * v52;
v54 = (const __m128i *)&v74[7 * v52];
do
{
v55 = _mm_loadu_si128((const __m128i *)(a1 + 2 * v53 + 16));
v54 = (const __m128i *)((char *)v54 + 56);
v56 = _mm_loadu_si128(v54);
v57 = _mm_loadu_si128(v54 + 1);
a6[v53 / 8] = a6[v53 / 8 + 1];
v58 = v54[3].m128i_i64[0];
v59 = _mm_loadu_si128(v54 + 2);
*(__m128i *)(a1 + 2 * v53) = v55;
v54[-1].m128i_i64[1] = v58;
v60 = v8[v53 / 8 + 1];
*(__m128i *)((char *)v54 - 56) = v56;
v8[v53 / 8] = v60;
v61 = v73[v53 / 8 + 1];
*(__m128i *)((char *)v54 - 40) = v57;
v73[v53 / 8] = v61;
v53 += 8LL;
*(__m128i *)((char *)v54 - 24) = v59;
}
while ( 8 * v72 - 8 != v53 );
}
if ( !v79 )
break;
if ( v72 == 2 )
{
v64 = 0LL;
LABEL_62:
v9[v64] = v9[v64 + 1];
goto LABEL_63;
}
v62 = v9;
do
{
v63 = _mm_loadu_si128((const __m128i *)(v62 + 1));
v62 += 2;
*((__m128i *)v62 - 1) = v63;
}
while ( v62 != &v9[2 * (v79 >> 1)] );
v64 = v79 & 0xFFFFFFFFFFFFFFFELL;
if ( (v79 & 1) != 0 )
goto LABEL_62;
LABEL_63:
v72 = v79--;
}
if ( v77 && unique )
{
write_line((const void **)dest, a4, a5);
free((void *)dest[0].m128i_i64[0]);
}
LABEL_72:
xfclose(a4, a5);
free(a6);
free(v74);
free(v9);
free(v73);
free(v8);
return __readfsqword(0x28u) ^ v86;
}
// 5D22: variable 'v29' is possibly undefined
// 5D39: variable 'v32' is possibly undefined
// 7A28: using guessed type long merge_buffer_size;
// 7C10: using guessed type long keylist;
// 7C19: using guessed type char unique;
// 7C38: using guessed type long sort_size;
// BC10: using guessed type __int128 LC61;
// BC20: using guessed type __int128 LC62;
// D070: using guessed type long xmalloc(_QWORD);
// D310: using guessed type long xnmalloc(_QWORD, _QWORD);
//----- (0000000000006260) ----------------------------------------------------
long sort_buffer_size_constprop_0(FILE **a1, long a2, long a3, long a4)
{
long v4; // rbx
unsigned long v6; // rbp
long i; // r15
long v8; // r8
__off_t st_size; // rsi
unsigned long v10; // rcx
const char *v11; // r14
bool v12; // al
int v13; // eax
char *v15; // rbp
char *v16; // rax
struct stat v18; // [rsp+20h] [rbp-D8h] BYREF
unsigned long v19; // [rsp+B8h] [rbp-40h]
v4 = a4 + 2;
v19 = __readfsqword(0x28u);
if ( a3 )
{
v6 = a4 + 1;
for ( i = 0LL; i != a3; ++i )
{
if ( i )
{
v11 = *(const char **)(a2 + 8 * i);
if ( !strcmp(v11, "-") )
v12 = fstat(0, &v18) != 0;
else
v12 = stat(v11, &v18) != 0;
}
else
{
v13 = fileno(*a1);
v12 = fstat(v13, &v18) != 0;
}
if ( v12 )
{
v15 = *(char **)(a2 + 8 * i);
v16 = dcgettext(0LL, "stat failed", 5);
sort_die(v16, v15);
}
if ( (v18.st_mode & 0xF000) == 0x8000 )
{
v8 = size_bound_8354;
st_size = v18.st_size;
if ( !size_bound_8354 )
{
v8 = sort_size;
size_bound_8354 = sort_size;
if ( !sort_size )
goto LABEL_15;
}
}
else
{
v8 = sort_size;
if ( sort_size )
return v8;
v8 = size_bound_8354;
st_size = 0x20000LL;
if ( !size_bound_8354 )
{
LABEL_15:
size_bound_8354 = default_sort_size();
v8 = size_bound_8354;
}
}
v10 = st_size * v6 + 1;
if ( v10 / v6 != st_size || v10 >= v8 - v4 )
return v8;
v4 += v10;
}
}
return v4;
}
// 7A40: using guessed type long size_bound_8354;
// 7C38: using guessed type long sort_size;
//----- (0000000000006440) ----------------------------------------------------
long reap_constprop_0()
{
int v0; // eax
unsigned int v1; // r12d
long v3; // r13
char *v4; // r12
int *v5; // rax
long v6; // r12
char *v7; // rax
int stat_loc; // [rsp+4h] [rbp-24h] BYREF
unsigned long v9; // [rsp+8h] [rbp-20h]
v9 = __readfsqword(0x28u);
v0 = waitpid(-1, &stat_loc, 0);
if ( v0 < 0 )
{
v3 = quotearg_style(4LL, compress_program);
v4 = dcgettext(0LL, "waiting for %s [-d]", 5);
v5 = _errno_location();
error(2, *v5, v4, v3);
}
else
{
v1 = v0;
if ( !v0 || !(unsigned char)delete_proc(v0) )
return v1;
if ( !(stat_loc & 0x7F | BYTE1(stat_loc)) )
{
--nprocs;
return v1;
}
}
v6 = quotearg_style(4LL, compress_program);
v7 = dcgettext(0LL, "%s [-d] terminated abnormally", 5);
error(2, 0, v7, v6);
return reap_some();
}
// 7B5C: using guessed type int nprocs;
// D1C8: using guessed type long quotearg_style(_QWORD, _QWORD);
//----- (0000000000006540) ----------------------------------------------------
long reap_some()
[25920] {
[25920, 25924] reap_constprop_0();
[25929, 25933] return reap_exited();
}
//----- (0000000000006560) ----------------------------------------------------
long pipe_fork(int *a1, long a2)
[25952] {
long v2; // rbx
int *v3; // rbp
void *v4; // r14
__pid_t v5; // eax
int v6; // r15d
unsigned int v7; // r12d
double v9; // [rsp+0h] [rbp-D8h]
char v10[136]; // [rsp+10h] [rbp-C8h] BYREF
unsigned long v11; // [rsp+98h] [rbp-40h]
[25952, 25954, 25956, 25958, 25991, 25960, 25961, 25962, 25965, 25970, 25977, 25982] v11 = __readfsqword(0x28u);
[26008, 26001, 26006, 25999] if ( (int)rpl_pipe2(a1, 0x80000LL) < 0 )
{
[26336, 26330] return (unsigned int)-1;
}
else
{
[26020, 26029, 26014, 26023] if ( nmerge + 1 < (unsigned int)nprocs )
[26320, 26325] reap_some();
[26040, 26049, 26044] v2 = a2 - 1;
[26057, 26035] v3 = _errno_location();
[26065, 26060] v9 = *(double *)&LC64;
[26075] while ( 1 )
{
[26072, 26075] cs_enter((long)v10);
[26080] v4 = temphead;
[26087] temphead = 0LL;
[26098] v5 = fork();
[26103] v6 = *v3;
[26107] v7 = v5;
[26112, 26110] if ( !v5 )
{
[26114, 26117] cs_leave((long)v10);
[26122] *v3 = v6;
[26128, 26126] close(0);
[26151, 26160, 26133, 26138, 26143] close(1);
[26138, 26173] return v7;
}
[26195] temphead = v4;
[26192, 26202] cs_leave((long)v10);
[26207] *v3 = v6;
[26211, 26214] if ( (v7 & 0x80000000) == 0 )
break;
[26216, 26220] if ( v6 != 11 )
goto LABEL_12;
[26227] --v2;
[26222, 26231] xnanosleep(v9);
[26241, 26249, 26236, 26245] v9 = v9 + v9;
[26254] reap_exited();
[26259, 26263] if ( v2 == -1 )
{
[26269] v6 = *v3;
LABEL_12:
[26280, 26273, 26278] close(*a1);
[26288, 26285] close(a1[1]);
[26293] *v3 = v6;
[26297, 26173] return v7;
}
}
[26309, 26302] ++nprocs;
}
[26173, 26166] return v7;
[26176, 26177, 26178, 26180, 26182, 26184, 26186] }
// 7A1C: using guessed type int nmerge;
// 7B5C: using guessed type int nprocs;
// BBE8: using guessed type long LC64;
// D320: using guessed type long rpl_pipe2(_QWORD, _QWORD);
// D330: using guessed type long xnanosleep(double);
//----- (00000000000066F0) ----------------------------------------------------
FILE * open_temp(long a1)
[26352] {
int v1; // r12d
int v2; // eax
FILE *v3; // r12
int *v5; // rbp
int v6; // edi
int *v7; // rax
int v8; // ebx
int *v9; // rbp
int *v10; // rax
long v11; // r12
char *v12; // rax
long v13; // rsi
long *v14; // rdx
int v15; // [rsp+0h] [rbp-28h] BYREF
int fd; // [rsp+4h] [rbp-24h]
[26372, 26352, 26354, 26355, 26358, 26359, 26363] unsigned long v17; // [rsp+8h] [rbp-20h]
[26377, 26379, 26383]
[26576, 26579, 26584] v17 = __readfsqword(0x28u);
[26402, 26389, 26393, 26395, 26397] if ( *(_BYTE *)(a1 + 12) == 1 )
[26405, 26407] wait_proc(*(_DWORD *)(a1 + 8));
[26568, 26571] v1 = open((const char *)(a1 + 13), 0);
[26416, 26421, 26413] if ( v1 < 0 )
[26426, 26429] return 0LL;
v2 = pipe_fork(&v15, 9LL);
[26433, 26431] if ( v2 != -1 )
{
[26612, 26615] if ( !v2 )
[26625, 26620, 26622] {
[26634, 26630, 26639] close(v15);
[26662, 26665, 26644, 26651, 26653, 26655] move_fd(v1, 0);
[26670] move_fd(fd, 1);
[26682, 26675, 26684] execlp(compress_program, compress_program, "-d", 0LL);
v10 = _errno_location();
[26439] async_safe_die(*v10, "couldn't execute compress program (with -d)");
[26442, 26445] }
[26450, 26453] *(_DWORD *)(a1 + 8) = v2;
[26458, 26462] register_proc(a1);
[26482, 26467, 26477, 26470] close(v1);
[26504, 26485, 26488, 26490, 26495] close(fd);
v3 = fdopen(v15, "r");
[26589] if ( !v3 )
[26597] {
[26599] v7 = _errno_location();
[26594, 26602] v8 = *v7;
[26610, 26607] v9 = v7;
close(v15);
[26514, 26607] *v9 = v8;
}
[26528, 26536] return v3;
[26539, 26533] }
v5 = _errno_location();
[26545] if ( *v5 == 24 )
[26548] {
[26551] v6 = v1;
[26563, 26556] v3 = 0LL;
[26521, 26514] close(v6);
*v5 = 24;
[26706, 26725, 26701, 26694] return v3;
[26728, 26723, 26716, 26711] }
[26754, 26733, 26765, 26736, 26739, 26744, 26747, 26749] v11 = quotearg_style(4LL, compress_program);
[26766, 26510] v12 = dcgettext(0LL, "couldn't create process for %s -d", 5);
[26517, 26518, 26519] v13 = (unsigned int)*v5;
error(2, v13, v12, v11);
return (FILE *)open_input_files(2LL, v13, v14);
}
// 688E: variable 'v14' is possibly undefined
// D1C8: using guessed type long quotearg_style(_QWORD, _QWORD);
//----- (0000000000006890) ----------------------------------------------------
long open_input_files(long a1, long a2, long *a3)
[26768] {
long v5; // rax
long v6; // rbp
long v7; // r13
struct _IO_FILE *v8; // rax
long v9; // rdi
FILE *v10; // rax
[26785, 26790, 26793, 26768, 26770, 26773, 26775, 26777, 26780, 26781, 26782] v5 = xnmalloc(a2, 8LL);
[26798] *a3 = v5;
[26802, 26805] if ( a2 )
{
[26807] v6 = v5;
[26810, 26820, 26813] v7 = 0LL;
[26866] while ( 1 )
{
[26866] v9 = *(_QWORD *)(a1 + 8);
[26873, 26875, 26870, 26879] if ( v9 && *(_BYTE *)(v9 + 12) )
{
[26881] v10 = open_temp(v9);
[26886] *(_QWORD *)(v6 + 8 * v7) = v10;
[26891, 26894] if ( !v10 )
[26897, 26894] return v7;
}
else
{
[26832, 26835, 26838] v8 = stream_open(*(char **)a1, "r");
[26843] *(_QWORD *)(v6 + 8 * v7) = v8;
[26848, 26851] if ( !v8 )
[26897, 26851] return v7;
}
[26853] ++v7;
[26857] a1 += 16LL;
[26864, 26861] if ( a2 == v7 )
[26864, 26897] return v7;
}
}
[26896] return 0LL;
[26900, 26901, 26903, 26905, 26907] }
// D310: using guessed type long xnmalloc(_QWORD, _QWORD);
//----- (0000000000006930) ----------------------------------------------------
unsigned long mergefiles(long a1, unsigned long a2, unsigned long a3, FILE *a4, char *a5)
[26928] {
unsigned long v8; // rax
unsigned long v9; // r12
char *v11; // rbp
char *v12; // rax
FILE **v13[9]; // [rsp+0h] [rbp-48h] BYREF
[26945, 26946, 26949, 26956, 26928, 26960, 26930, 26933, 26935, 26969, 26938, 26940, 26974, 26943] v13[1] = (FILE **)__readfsqword(0x28u);
[26976, 26953, 26979, 26950] v8 = open_input_files(a1, a3, (long *)v13);
[26984] v9 = v8;
[26992, 26987, 26996, 26990] if ( a3 > v8 && v8 <= 1 )
{
[27056, 27074] v11 = *(char **)(a1 + 16 * v8);
[27067, 27060, 27069, 27079] v12 = dcgettext(0LL, "open failed", 5);
[27090, 27084, 27087] sort_die(v12, v11);
}
[27008, 27011, 27014, 27017, 27022, 27027, 26998, 27002, 27036, 27005] mergefps(a1, a2, v8, a4, a5, v13[0]);
[27042, 27038] return v9;
[27045, 27046, 27047, 27049, 27051, 27053, 27055] }
//----- (00000000000069E0) ----------------------------------------------------
long maybe_create_temp(FILE **a1, char a2)
[27104] {
unsigned long v2; // rax
long v3; // r12
bool v4; // zf
int v5; // eax
FILE *v6; // rax
char *v8; // rax
int *v9; // rax
int fd; // [rsp+Ch] [rbp-2Ch] BYREF
int v11; // [rsp+10h] [rbp-28h] BYREF
int v12; // [rsp+14h] [rbp-24h]
unsigned long v13; // [rsp+18h] [rbp-20h]
[27104, 27106, 27110, 27111, 27114, 27118, 27127] v13 = __readfsqword(0x28u);
[27139, 27132, 27134] v2 = create_temp_file(&fd, a2);
[27144] v3 = v2;
[27147, 27150] if ( v2 )
{
[27152] v4 = compress_program == 0LL;
[27160] *(_BYTE *)(v2 + 12) = 0;
[27164] if ( !v4 )
{
[27176, 27171, 27166] v5 = pipe_fork(&v11, 4LL);
[27181] *(_DWORD *)(v3 + 8) = v5;
[27186, 27188] if ( v5 > 0 )
{
[27248, 27252] close(fd);
[27257, 27261] close(v11);
[27273] fd = v12;
[27266, 27277, 27270, 27282] register_proc(v3);
}
[27190] else if ( !v5 )
{
[27320, 27316] close(v12);
[27329, 27325, 27334] move_fd(fd, 1);
[27345, 27339, 27343] move_fd(v11, 0);
[27361, 27364, 27350, 27357, 27359] execlp(compress_program, compress_program, 0LL);
[27369] v9 = _errno_location();
[27381, 27374, 27383] async_safe_die(*v9, "couldn't execute compress program");
}
}
[27192, 27203, 27196] v6 = fdopen(fd, "w");
[27208] *a1 = v6;
[27211, 27214, 27216, 27221, 27230] if ( !v6 )
{
[27298, 27291, 27284, 27293] v8 = dcgettext(0LL, "couldn't create temporary file", 5);
[27311, 27308, 27303] sort_die(v8, (char *)(v3 + 13));
}
}
[27240, 27236] return v3;
[27243, 27244, 27246] }
//----- (0000000000006B10) ----------------------------------------------------
long create_temp(FILE **a1)
[27408] {
[27410] return maybe_create_temp(a1, 0);
}
//----- (0000000000006B20) ----------------------------------------------------
unsigned long avoid_trashing_input(long a1, unsigned long a2, unsigned long a3, const char *a4)
[27424] {
const char **v5; // rbx
const char **v6; // r14
struct stat *outstatus; // r12
const char *v8; // r12
int v9; // ebp
double v11[2]; // [rsp+8h] [rbp-F0h] BYREF
FILE *v12; // [rsp+18h] [rbp-E0h] BYREF
struct stat v13; // [rsp+20h] [rbp-D8h] BYREF
unsigned long v14; // [rsp+B8h] [rbp-40h]
[27424, 27426, 27428, 27430, 27432, 27433, 27434, 27441, 27450] v14 = __readfsqword(0x28u);
[27458, 27460, 27463] if ( a2 < a3 )
{
[27480, 27485, 27477] v11[0] = 0.0;
[27469, 27494] v5 = (const char **)(a1 + 16 * a2);
[27473, 27498, 27502] v6 = (const char **)(a1 + 16 * a3);
do
{
[27573] while ( 1 )
{
[27573] v8 = *v5;
[27576, 27586, 27591, 27583] v9 = strcmp(*v5, "-");
[27593, 27596] if ( a4 )
{
[27601, 27604, 27598] if ( !strcmp(a4, v8) )
break;
}
[27618, 27613] outstatus = get_outstatus();
[27624, 27621] if ( !outstatus )
[27624, 27724, 27733] return __readfsqword(0x28u) ^ v14;
[27626, 27628] if ( v9 )
{
[27650, 27655, 27630, 27633, 27636, 27641, 27643, 27645] if ( stat(*v5, &v13) || v13.st_ino != outstatus->st_ino )
goto LABEL_7;
goto LABEL_14;
}
LABEL_5:
[27553, 27555, 27529, 27531, 27534, 27539, 27541, 27543, 27548] if ( fstat(0, &v13) || v13.st_ino != outstatus->st_ino )
goto LABEL_7;
LABEL_14:
[27657, 27666, 27668, 27661] if ( v13.st_dev == outstatus->st_dev )
goto LABEL_15;
LABEL_7:
[27560] v5 += 2;
[27564, 27567] if ( v5 == v6 )
[27724, 27567] return __readfsqword(0x28u) ^ v14;
}
[27504, 27506] if ( !v9 )
{
[27512, 27517] outstatus = get_outstatus();
[27520, 27523] if ( !outstatus )
[27523, 27724] return __readfsqword(0x28u) ^ v14;
goto LABEL_5;
}
LABEL_15:
[27672, 27680, 27685, 27678] if ( !*(_QWORD *)&v11[0] )
{
[27760, 27765, 27789] *(_QWORD *)&v11[0] = create_temp(&v12);
[27777, 27780, 27802, 27784, 27794, 27797, 27770, 27775] mergefiles((long)v5, 0LL, 1uLL, v12, (char *)(*(_QWORD *)&v11[0] + 13LL));
}
[27689, 27694] v5 += 2;
[27698, 27703] *((__m128 *)v5 - 1) = _mm_loadh_ps(v11);
}
[27716, 27707, 27609, 27611, 27710] while ( v5 != v6 );
}
[27724, 27735] return __readfsqword(0x28u) ^ v14;
[27744, 27746, 27748, 27750, 27752, 27742, 27743] }
// 6B20: using guessed type double var_F0[2];
//----- (0000000000006CB0) ----------------------------------------------------
unsigned long merge(__m128i *a1, unsigned long a2, unsigned long a3, char *a4)
[27824] {
unsigned long v6; // rbx
unsigned long v7; // r13
long v8; // rbp
unsigned long v9; // rsi
unsigned long v10; // rax
unsigned long v11; // rdx
__m128 v12; // xmm0
unsigned long v13; // rcx
long v14; // rdx
unsigned long v15; // rdx
__m128i *v16; // r10
__m128i *v17; // r11
unsigned long v18; // rax
__m128i *v19; // rsi
__m128i *v20; // rdi
size_t v21; // rdx
unsigned long v22; // r13
unsigned long v23; // rax
unsigned long v24; // rbp
unsigned long v25; // r15
char **v26; // r12
char **v27; // rbp
long v28; // rax
unsigned long v29; // r12
unsigned long v30; // r13
size_t v31; // rdx
FILE *v32; // rax
char *v33; // rax
unsigned long v34; // rsi
unsigned long v35; // rax
unsigned long v36; // rdx
__m128 v37; // xmm0
char *v39; // rbp
char *v40; // rax
unsigned long v41; // [rsp+0h] [rbp-88h] BYREF
unsigned long v42; // [rsp+8h] [rbp-80h]
unsigned long v43; // [rsp+10h] [rbp-78h]
__m128i *v44; // [rsp+18h] [rbp-70h]
char *file; // [rsp+20h] [rbp-68h]
__m128i *v46; // [rsp+28h] [rbp-60h]
FILE **v47; // [rsp+38h] [rbp-50h] BYREF
FILE *v48; // [rsp+40h] [rbp-48h] BYREF
unsigned long i; // [rsp+48h] [rbp-40h]
[27840, 27844, 27824, 27826, 27828, 27831, 27833, 27835, 27838, 27839] v6 = (unsigned int)nmerge;
[27850] v42 = a3;
[27860, 27855] file = a4;
[28097, 27874, 28102, 27879, 27881, 28107, 27884, 28110, 27865, 28094] for ( i = __readfsqword(0x28u); v42 > v6; v42 += v7 - v8 )
{
[27890] v7 = 0LL;
[27893] v8 = 0LL;
[27906, 27900, 27895] if ( v6 > v42 )
{
[28652] v13 = v42;
[28657] v18 = v6;
[28660] v16 = a1;
[28663] v17 = a1;
[28666, 28668] v15 = 0LL;
}
else
{
do
{
[27920] v9 = a2;
[27912, 27915, 27941] v41 = create_temp(&v48);
[27937, 27931, 27951] if ( (unsigned int)nmerge <= a2 )
[27948, 27951] v9 = (unsigned int)nmerge;
[27945, 27923, 27955, 27926, 27959, 27962, 27931] v10 = mergefiles((long)a1[v8].m128i_i64, v9, (unsigned int)nmerge, v48, (char *)(v41 + 13));
[27967] v11 = a2;
[27970, 27980, 27983, 27975] v6 = (unsigned int)nmerge;
[27989] v12 = _mm_loadh_ps((const double *)&v41);
[27993] if ( v10 <= a2 )
[27993] v11 = v10;
[27997] v8 += v10;
[28000] v13 = v42 - v8;
[28003] a2 -= v11;
[28006] v14 = v7++;
[28009, 28013, 28017] a1[v14] = (__m128i)v12;
}
[28025, 28022] while ( v6 <= v13 );
[28032, 28035, 28038, 28027, 28030] v15 = v7 % v6;
[28041, 28052] v16 = &a1[v7];
[28049, 28045, 28055] v17 = &a1[v8];
[28058, 28038] v18 = v6 - v7 % v6;
}
[28064, 28061] if ( v13 > v18 )
{
[28504] v44 = v16;
[28512, 28509] v46 = v17;
[28496, 28517] v43 = v13 + v15 + 1 - v6;
[28540, 28537, 28532] v34 = a2;
[28522, 28501, 28549] v41 = create_temp(&v48);
[28562] if ( v43 <= a2 )
[28562] v34 = v43;
[28544, 28553, 28556, 28559, 28527, 28566] v35 = mergefiles((long)v46, v34, v43, v48, (char *)(v41 + 13));
[28571] v36 = a2;
[28584, 28579, 28587, 28574] v37 = _mm_loadh_ps((const double *)&v41);
[28591] v6 = (unsigned int)nmerge;
[28597] if ( v35 <= a2 )
[28597] v36 = v35;
[28601] v8 += v35;
[28604] ++v7;
[28608] *v44 = (__m128i)v37;
[28622] a2 -= v36;
[28634, 28618, 28612, 28615] v19 = &a1[v8];
[28625, 28637, 28630] v20 = &a1[v7];
[28640, 28643, 28647] v21 = 16 * (v42 - v8);
}
else
{
[28074, 28070] v19 = v17;
[28077] v20 = v16;
[28080] v21 = 16 * v13;
}
[28083] memmove(v20, v19, v21);
[28088, 28091] a2 += v7;
}
[28116] v22 = v42;
[28129, 28132, 28137, 28140, 28121, 28126] avoid_trashing_input((long)a1, a2, v42, file);
[28145, 28150] v41 = a2;
[28154, 28159] v44 = (__m128i *)&v47;
[28171] while ( 1 )
{
[28160, 28168, 28171, 28165] v23 = open_input_files((long)a1, v22, v44->m128i_i64);
[28176] v24 = v23;
[28179, 28182] if ( v22 != v23 )
{
[28192, 28188] if ( v23 <= 2 )
{
[28745, 28755, 28747, 28751] v39 = (char *)a1[v23].m128i_i64[0];
[28760, 28738, 28735] v40 = dcgettext(0LL, "open failed", 5);
[28768, 28771, 28765] sort_die(v40, v39);
}
goto LABEL_15;
}
[28408, 28420, 28413] v32 = stream_open(file, "w");
[28425, 28428] if ( v32 )
break;
[28448, 28434, 28439, 28442, 28444] if ( *_errno_location() != 24 || v22 <= 2 )
{
[28468, 28461, 28454, 28463] v33 = dcgettext(0LL, "open failed", 5);
[28481, 28473, 28478] sort_die(v33, file);
}
LABEL_15:
[28198] v25 = v24 - 1;
[28209, 28202, 28213, 28205] v26 = (char **)&a1[v24 - 1];
[28237] while ( 1 )
{
[28237] v27 = v26;
[28240, 28233, 28228, 28244] xfclose(v47[v25], *v26);
[28262] v26 -= 2;
[28258, 28266, 28249, 28251, 28255] v28 = maybe_create_temp(&v48, v25 > 2);
[28274, 28271] if ( v28 )
break;
[28224] --v25;
}
[28280, 28285] v43 = v28;
[28305] v42 = v28 + 13;
[28313, 28310] v29 = v41;
[28316] if ( v41 > v25 )
[28316] v29 = v25;
[28320] v30 = v22 - v25;
[28289, 28323, 28292, 28326, 28297, 28302, 28276] mergefps((long)a1, v29, v25, v48, (char *)(v28 + 13), v47);
[28347, 28342] v31 = 16 * v30;
[28355] v22 = v30 + 1;
[28369, 28364, 28373, 28359] *a1 = _mm_unpacklo_epi64((__m128i)v42, (__m128i)v43);
[28331, 28336, 28339, 28377, 28351] memmove(&a1[1], v27, v31);
[28386, 28389, 28393, 28397, 28382] v41 = v41 - v29 + 1;
}
[28673, 28677, 28682, 28685, 28688, 28693, 28696, 28699] mergefps((long)a1, v41, v22, v32, file, v47);
[28704, 28720, 28709, 28718] return __readfsqword(0x28u) ^ i;
[28724, 28725, 28726, 28728, 28730, 28732, 28734] }
// 7A1C: using guessed type int nmerge;
//----- (0000000000007070) ----------------------------------------------------
long reap_all()
[28784] {
long result; // rax
[28805, 28811, 28813, 28790, 28792, 28794, 28798] for ( ; nprocs > 0; result = (unsigned int)nprocs )
[28800] reap_constprop_0();
[28819, 28815] return result;
[28820] }
// 7B5C: using guessed type int nprocs;
//----- (00000000000070A0) ----------------------------------------------------
unsigned long sort(char **a1, unsigned long a2, char *a3, unsigned long a4)
[28832] {
char *v5; // r13
FILE *v6; // rsi
char v7; // r15
const __m128i *v8; // rbp
char *v9; // r14
long v11; // rdx
unsigned long v12; // rax
long v13; // rax
_QWORD *v14; // rbx
__m128i *v15; // rbp
__m128i *i; // rdx
char *v17; // rax
unsigned long v18; // [rsp+8h] [rbp-140h]
__m128i *v19; // [rsp+10h] [rbp-138h]
unsigned long v20; // [rsp+28h] [rbp-120h]
long v21; // [rsp+30h] [rbp-118h]
FILE *v24; // [rsp+50h] [rbp-F8h] BYREF
FILE *stream; // [rsp+58h] [rbp-F0h] BYREF
void *ptr; // [rsp+60h] [rbp-E8h] BYREF
long v27; // [rsp+68h] [rbp-E0h]
unsigned long v28; // [rsp+70h] [rbp-D8h]
long v29; // [rsp+78h] [rbp-D0h]
long v30; // [rsp+80h] [rbp-C8h]
char v31; // [rsp+90h] [rbp-B8h]
char v32[104]; // [rsp+A0h] [rbp-A8h] BYREF
unsigned long v33; // [rsp+108h] [rbp-40h]
[28832, 28834, 28836, 28838, 28840, 28841, 28842, 28849, 28854] v20 = a2;
[28864, 28873, 28859] v33 = __readfsqword(0x28u);
[28881, 28883] v29 = 0LL;
[28892, 28895] if ( !a2 )
goto LABEL_27;
[28928, 28901, 28933, 28906, 28938, 28909, 28918, 28923] v18 = 0LL;
LABEL_3:
[28955, 28943] v5 = *a1;
[28966] v21 = 48LL;
[28961, 28948, 28958, 28975] v24 = xfopen(*a1, "r");
[28980] v6 = v24;
[28987, 28983] if ( a4 > 1 )
{
[29536] v11 = 1LL;
[29546, 29541] v12 = 1LL;
do
{
[29552] v12 *= 2LL;
[29555] ++v11;
}
[29562, 29559] while ( a4 > v12 );
[29568, 29564, 29574] v21 = 32 * v11;
[29579] if ( v29 )
goto LABEL_5;
goto LABEL_25;
}
[28993, 28999] if ( !v29 )
{
LABEL_25:
[29600, 29605, 29608, 29585, 29590, 29595] v13 = sort_buffer_size_constprop_0(&v24, (long)a1, v20, v21);
[29624, 29618, 29613, 29621] initbuf((long)&ptr, v21, v13);
[29634, 29629] v6 = v24;
}
LABEL_5:
[29005] --v20;
[29019, 29011] v31 = 0;
[29157, 29162, 29165, 29170, 29172] while ( (unsigned char)fillbuf((long *)&ptr, v6, v5) )
{
[29178] v7 = v31;
[29192, 29195] if ( !v31 )
goto LABEL_12;
[29203, 29197] if ( v20 )
{
[29219, 29222, 29226, 29229, 29241, 29235, 29238, 29209, 29214] if ( v21 + 1 < v29 - v27 - v28 * v21 )
{
[29762] v30 = v27;
[29754, 29770, 29775, 29759] xfclose(v24, v5);
LABEL_21:
[29525] ++a1;
[29531] goto LABEL_3;
}
LABEL_12:
[29247] *(_QWORD *)&saved_line = 0LL;
[29258, 29187, 29268, 29263] v8 = (const __m128i *)buffer_linelim_isra_0((long)ptr, v29);
LABEL_13:
[29276, 29271] ++v18;
[29282] v7 = 0;
[29290, 29285, 29271] v9 = (char *)(create_temp(&stream) + 13);
goto LABEL_14;
}
[29408] *(_QWORD *)&saved_line = 0LL;
[29424, 29187, 29429, 29419] v8 = (const __m128i *)buffer_linelim_isra_0((long)ptr, v29);
[29432, 29445, 29437] if ( v30 | v18 )
goto LABEL_13;
[29456, 29451, 29459] xfclose(v24, v5);
[29464] v9 = a3;
[29484] v18 = 0LL;
[29476, 29479, 29493, 29498, 29469] stream = xfopen(a3, "w");
LABEL_14:
[29300, 29294] if ( v28 > 1 )
{
[29024, 29035, 29032, 29038] queue_init((long)v32, a4);
[29069, 29043, 29048, 29051, 29054] v19 = (__m128i *)merge_tree_init(a4, v28, (unsigned long)v8);
[29059, 29091, 29063, 29066, 29099, 29074, 29081, 29084, 29086] sortlines(v8, a4, v28, v19 + 8, (long)v32, stream, v9);
[29104, 29115, 29109, 29112] merge_tree_destroy(a4, v19->m128i_i8);
[29120, 29123] queue_destroy((long)v32);
[29128, 29133, 29136] xfclose(stream, v9);
[29146, 29141, 29142, 29143] if ( v7 )
goto LABEL_16;
}
else
{
[29306, 29315, 29318, 29311] write_unique((long)v8[-2].m128i_i64, stream, v9);
[29328, 29323, 29331] xfclose(stream, v9);
[29336, 29339] if ( v7 )
{
LABEL_16:
[29345, 29350] free(ptr);
goto LABEL_17;
}
}
[29152] v6 = v24;
}
[29504, 29512, 29509] xfclose(v24, v5);
[29523, 29517] if ( v20 )
goto LABEL_21;
[29644, 29639] v20 = v18;
LABEL_27:
[29649, 29654] free(ptr);
[29664, 29669] v14 = temphead;
[29681, 29659, 29676] v15 = (__m128i *)xnmalloc(v20, 16LL);
[29711, 29715, 29684, 29718, 29687, 29690, 29692] for ( i = v15; v14; i[-1].m128i_i64[0] = (long)v17 )
{
[29696] i->m128i_i64[1] = (long)v14;
[29700] v17 = (char *)v14 + 13;
[29704] v14 = (_QWORD *)*v14;
[29707] ++i;
}
[29730, 29733, 29736, 29720, 29725] merge(v15, v20, v20, a3);
[29744, 29749, 29741] free(v15);
LABEL_17:
[29355] reap_all();
[29360, 29377, 29368, 29383] return __readfsqword(0x28u) ^ v33;
[29390, 29391, 29392, 29394, 29396, 29398, 29400] }
// 8040: using guessed type __int128 saved_line;
// D310: using guessed type long xnmalloc(_QWORD, _QWORD);
//----- (0000000000007460) ----------------------------------------------------
long emit_ancillary_info_constprop_0()
{
const char *v0; // rsi
__int128 *v1; // rbx
char *v2; // rax
char *v3; // rdi
char *v4; // rax
char *v5; // rsi
FILE *v7; // rbp
char *v8; // rax
__int128 v9[7]; // [rsp+0h] [rbp-A8h] BYREF
unsigned long v10; // [rsp+78h] [rbp-30h]
v0 = "[";
v10 = __readfsqword(0x28u);
v1 = v9;
v9[0] = (__int128)_mm_unpacklo_epi64((__m128i)(unsigned long)"[", (__m128i)(unsigned long)"test invocation");
v9[1] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"coreutils",
(__m128i)(unsigned long)"Multi-call invocation");
v9[2] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha224sum",
(__m128i)(unsigned long)"sha2 utilities");
v9[3] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha256sum",
(__m128i)(unsigned long)"sha2 utilities");
v9[4] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha384sum",
(__m128i)(unsigned long)"sha2 utilities");
v9[5] = (__int128)_mm_unpacklo_epi64(
(__m128i)(unsigned long)"sha512sum",
(__m128i)(unsigned long)"sha2 utilities");
v9[6] = 0LL;
do
{
if ( !strcmp("sort", v0) )
break;
v0 = (const char *)*((_QWORD *)v1++ + 2);
}
while ( v0 );
v2 = dcgettext(0LL, "\n%s online help: <%s>\n", 5);
_printf_chk(1LL, v2);
v3 = setlocale(5, 0LL);
if ( v3 && strncmp(v3, "en_", 3uLL) )
{
v7 = stdout;
v8 = dcgettext(0LL, "Report any translation bugs to <https://translationproject.org/team/>\n", 5);
fputs_unlocked(v8, v7);
}
strcmp("sort", "[");
v4 = dcgettext(0LL, "Full documentation <%s%s>\n", 5);
_printf_chk(1LL, v4);
v5 = dcgettext(0LL, "or available locally via: info '(coreutils) %s%s'\n", 5);
return _printf_chk(1LL, v5);
}
// D168: using guessed type long _printf_chk(_QWORD, _QWORD);
//----- (00000000000076B0) ----------------------------------------------------
void initialize_exit_failure_constprop_0()
{
exit_failure = 2;
}
//----- (00000000000076C0) ----------------------------------------------------
void usage(int status)
[30400] {
long v1; // r12
char *v2; // rax
char *v3; // rax
FILE *v4; // r12
char *v5; // rax
FILE *v6; // r12
char *v7; // rax
FILE *v8; // r12
char *v9; // rax
FILE *v10; // r12
char *v11; // rax
FILE *v12; // r12
char *v13; // rax
FILE *v14; // r12
char *v15; // rax
FILE *v16; // r12
char *v17; // rax
FILE *v18; // r12
char *v19; // rax
FILE *v20; // r12
char *v21; // rax
FILE *v22; // r12
char *v23; // rax
FILE *v24; // r12
char *v25; // rax
FILE *v26; // r12
char *v27; // rax
FILE *v28; // r12
char *v29; // rax
char *v30; // rax
FILE *v31; // r12
char *v32; // rax
FILE *v33; // r12
char *v34; // rax
FILE *v35; // r12
char *v36; // rax
FILE *v37; // r12
char *v38; // rax
FILE *v39; // r12
char *v40; // rax
v1 = program_name;
if ( status )
[30400, 30404, 30406, 30411, 30412, 30414, 30418] {
[30425, 30427] v2 = dcgettext(0LL, "Try '%s --help' for more information.\n", 5);
_fprintf_chk(stderr, 1LL, v2, v1);
[30436, 30429, 30438] }
[30443, 30450, 30453, 30458, 30461, 30463] else
{
v3 = dcgettext(0LL, "Usage: %s [OPTION]... [FILE]...\n or: %s [OPTION]... --files0-from=F\n", 5);
_printf_chk(1LL, v3);
[30475, 30484, 30477] v4 = stdout;
[30500, 30503, 30505, 30489, 30492, 30495] v5 = dcgettext(0LL, "Write sorted concatenation of all FILE(s) to standard output.\n", 5);
[30515, 30517, 30510] fputs_unlocked(v5, v4);
[30531, 30524] emit_stdin_note();
[30536, 30539, 30542] emit_mandatory_arg_note();
[30547] v6 = stdout;
[30552] v7 = dcgettext(0LL, "Ordering options:\n\n", 5);
[30557] fputs_unlocked(v7, v6);
[30578, 30571, 30564, 30566] v8 = stdout;
[30586, 30589, 30583] v9 = dcgettext(
[30594] 0LL,
[30608, 30601, 30603, 30615] " -b, --ignore-leading-blanks ignore leading blanks\n"
" -d, --dictionary-order consider only blanks and alphanumeric characters\n"
" -f, --ignore-case fold lower case to upper case characters\n",
5);
fputs_unlocked(v9, v8);
v10 = stdout;
[30626, 30620, 30623] v11 = dcgettext(
[30631] 0LL,
[30640, 30652, 30645, 30638] " -g, --general-numeric-sort compare according to general numerical value\n"
" -i, --ignore-nonprinting consider only printable characters\n"
" -M, --month-sort compare (unknown) < 'JAN' < ... < 'DEC'\n",
5);
fputs_unlocked(v11, v10);
v12 = stdout;
[30657, 30660, 30663] v13 = dcgettext(0LL, " -h, --human-numeric-sort compare human readable numbers (e.g., 2K 1G)\n", 5);
[30668] fputs_unlocked(v13, v12);
[30689, 30682, 30675, 30677] v14 = stdout;
[30697, 30700, 30694] v15 = dcgettext(
[30705] 0LL,
[30712, 30714, 30726, 30719] " -n, --numeric-sort compare according to string numerical value\n"
" -R, --random-sort shuffle, but group identical keys. See shuf(1)\n"
" --random-source=FILE get random bytes from FILE\n"
" -r, --reverse reverse the result of comparisons\n",
5);
fputs_unlocked(v15, v14);
v16 = stdout;
[30737, 30731, 30734] v17 = dcgettext(
[30742] 0LL,
[30763, 30756, 30749, 30751] " --sort=WORD sort according to WORD:\n"
" general-numeric -g, human-numeric -h, month -M,\n"
" numeric -n, random -R, version -V\n"
" -V, --version-sort natural sort of (version) numbers within text\n"
"\n",
5);
fputs_unlocked(v17, v16);
v18 = stdout;
[30768, 30771, 30774] v19 = dcgettext(0LL, "Other options:\n\n", 5);
[30779] fputs_unlocked(v19, v18);
[30800, 30793, 30786, 30788] v20 = stdout;
[30808, 30811, 30805] v21 = dcgettext(
[30816] 0LL,
[30825, 30837, 30830, 30823] " --batch-size=NMERGE merge at most NMERGE inputs at once;\n"
" for more use temp files\n",
5);
fputs_unlocked(v21, v20);
v22 = stdout;
[30848, 30842, 30845] v23 = dcgettext(
[30853] 0LL,
[30874, 30867, 30860, 30862] " -c, --check, --check=diagnose-first check for sorted input; do not sort\n"
" -C, --check=quiet, --check=silent like -c, but do not report first bad line\n"
" --compress-program=PROG compress temporaries with PROG;\n"
" decompress them with PROG -d\n",
5);
fputs_unlocked(v23, v22);
v24 = stdout;
[30882, 30885, 30879] v25 = dcgettext(
[30890] 0LL,
[30904, 30897, 30899, 30911] " --debug annotate the part of the line used to sort,\n"
" and warn about questionable usage to stderr\n"
" --files0-from=F read input from the files specified by\n"
" NUL-terminated names in file F;\n"
" If F is - then read names from standard input\n",
5);
fputs_unlocked(v25, v24);
v26 = stdout;
[30922, 30916, 30919] v27 = dcgettext(
[30927] 0LL,
[30936, 30948, 30941, 30934] " -k, --key=KEYDEF sort via a key; KEYDEF gives location and type\n"
" -m, --merge merge already sorted files; do not sort\n",
5);
fputs_unlocked(v27, v26);
v28 = stdout;
[30953, 30956, 30959] v29 = dcgettext(
[30964] 0LL,
[30985, 30978, 30971, 30973] " -o, --output=FILE write result to FILE instead of standard output\n"
" -s, --stable stabilize sort by disabling last-resort comparison\n"
" -S, --buffer-size=SIZE use SIZE for main memory buffer\n",
5);
fputs_unlocked(v29, v28);
v30 = dcgettext(
[30993, 30996, 30990] 0LL,
[31008, 31001, 31003, 31015] " -t, --field-separator=SEP use SEP instead of non-blank to blank transition\n"
" -T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR or %s;\n"
" multiple options specify multiple directories\n"
" --parallel=N change the number of sorts run concurrently to N\n"
" -u, --unique with -c, check for strict ordering;\n"
" without -c, output only the first of an equal run\n",
5);
_printf_chk(1LL, v30);
v31 = stdout;
[31020, 31027, 31032, 31035, 31037] v32 = dcgettext(0LL, " -z, --zero-terminated line delimiter is NUL, not newline\n", 5);
[31042] fputs_unlocked(v32, v31);
[31056, 31049, 31051, 31063] v33 = stdout;
[31074, 31068, 31071] v34 = dcgettext(0LL, " --help display this help and exit\n", 5);
[31079] fputs_unlocked(v34, v33);
[31088, 31100, 31093, 31086] v35 = stdout;
[31105, 31108, 31111] v36 = dcgettext(0LL, " --version output version information and exit\n", 5);
[31116] fputs_unlocked(v36, v35);
[31137, 31130, 31123, 31125] v37 = stdout;
[31145, 31148, 31142] v38 = dcgettext(
[31153] 0LL,
[31160, 31162, 31174, 31167] "\n"
"KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, where F is a\n"
"field number and C a character position in the field; both are origin 1, and\n"
"the stop position defaults to the line's end. If neither -t nor -b is in\n"
"effect, characters in a field are counted from the beginning of the preceding\n"
"whitespace. OPTS is one or more single-letter ordering options [bdfgiMhnRrV],\n"
"which override global ordering options for that key. If no key is given, use\n"
"the entire line as the key. Use --debug to diagnose incorrect key usage.\n"
"\n"
"SIZE may be followed by the following multiplicative suffixes:\n",
5);
fputs_unlocked(v38, v37);
v39 = stdout;
[31185, 31179, 31182] v40 = dcgettext(
[31216] 0LL,
[31204, 31211, 31219, 31190, 31197, 31199] "% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.\n"
"\n"
"*** WARNING ***\n"
"The locale specified by the environment affects sort order.\n"
"Set LC_ALL=C to get the traditional sort order that uses\n"
"native byte values.\n",
5);
fputs_unlocked(v40, v39);
emit_ancillary_info_constprop_0();
[31216, 31219, 31222] }
[31232, 31227] exit(status);
}
// D168: using guessed type long _printf_chk(_QWORD, _QWORD);
// D308: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
//----- (000000000000A360) ----------------------------------------------------
int main(int argc, const char **argv, const char **envp)
[41824] {
const char **v3; // rbx
struct lconv *v4; // rax
char *decimal_point; // rcx
char *thousands_sep; // rdx
int *v7; // rbp
int *v8; // r12
int *v9; // r14
int v10; // r15d
int v11; // r14d
unsigned long v12; // rbp
char v13; // r13
int v14; // r15d
long *v15; // r12
long v16; // rax
const char *v17; // rdx
int v18; // edx
const char *v19; // rax
long v20; // rax
long v21; // rdx
long v22; // rdx
char v23; // cl
char v24; // al
int v25; // eax
__m128i *v26; // rdx
int v27; // eax
char v28; // r14
char *v29; // rax
long v30; // r15
char *v31; // rax
const char *v32; // rdi
char *v33; // rdx
int v34; // eax
char *v35; // rdx
int v36; // eax
char *v37; // rdx
int v38; // esi
int v39; // eax
char *v40; // rdi
const char *v41; // rdi
char *v42; // rdx
int v43; // eax
unsigned long v44; // rax
char *v45; // r8
char *v46; // rdi
char *v48; // rax
long v49; // r8
char *v50; // rax
unsigned long v51; // rax
char *v52; // rdi
unsigned long v53; // rcx
char *v55; // rax
char *v56; // rax
unsigned char v57; // al
unsigned long v58; // rax
long v59; // rdx
const char *v60; // rdx
char *v61; // rax
_QWORD *v62; // r8
char *v63; // rdi
char *v64; // rax
__m128i *v65; // rdi
long v66; // rax
__m128 v67; // xmm0
unsigned long v68; // rax
long v69; // r8
char *v70; // rdi
long v71; // rax
unsigned long v72; // rax
long v73; // rax
long v74; // r12
char *v75; // rax
char *v76; // rax
long i; // rax
long v78; // rcx
long v79; // rdx
char *v80; // rax
long v81; // r8
char *v82; // rax
char *v83; // rax
long v84; // r8
char *v85; // rdi
long v86; // rax
char *v87; // rax
unsigned long v88; // rax
unsigned long v89; // rax
char *v90; // rax
char *v91; // rax
char *v92; // rax
char *v93; // rax
char *v94; // rax
unsigned long v95; // rax
char *v96; // rax
FILE *v97; // r14
char *v98; // rsi
const char *v99; // r15
long v100; // r12
char *v101; // rax
long v102; // r12
char *v103; // rax
long v104; // r12
char *v105; // rax
long v106; // r12
char *v107; // rax
char *v108; // rax
char v110; // [rsp+Eh] [rbp-2FAh]
char v111; // [rsp+Fh] [rbp-2F9h]
char *v112; // [rsp+18h] [rbp-2F0h]
char *v113; // [rsp+20h] [rbp-2E8h]
char *s1; // [rsp+30h] [rbp-2D8h]
char *s1a; // [rsp+30h] [rbp-2D8h]
unsigned long v116; // [rsp+38h] [rbp-2D0h]
char *v117; // [rsp+40h] [rbp-2C8h]
char *v118; // [rsp+48h] [rbp-2C0h]
char *v119; // [rsp+50h] [rbp-2B8h]
char *v120; // [rsp+50h] [rbp-2B8h]
_QWORD *v121; // [rsp+58h] [rbp-2B0h]
_QWORD *v122; // [rsp+58h] [rbp-2B0h]
long v123; // [rsp+58h] [rbp-2B0h]
long v124; // [rsp+58h] [rbp-2B0h]
char v125[80]; // [rsp+60h] [rbp-2A8h] BYREF
__m128i v126[2]; // [rsp+B0h] [rbp-258h] BYREF
__m128i v127; // [rsp+D0h] [rbp-238h] BYREF
char v128; // [rsp+E0h] [rbp-228h]
char v129; // [rsp+E1h] [rbp-227h]
char v130; // [rsp+E2h] [rbp-226h]
unsigned char v131; // [rsp+E3h] [rbp-225h]
char v132; // [rsp+E4h] [rbp-224h]
char v133; // [rsp+E5h] [rbp-223h]
char v134; // [rsp+E6h] [rbp-222h]
char v135; // [rsp+E7h] [rbp-221h]
char v136; // [rsp+E8h] [rbp-220h]
long v137[36]; // [rsp+100h] [rbp-208h] BYREF
struct sigaction v138; // [rsp+220h] [rbp-E8h] BYREF
char v139[2]; // [rsp+2C6h] [rbp-42h] BYREF
unsigned long v140; // [rsp+2C8h] [rbp-40h]
[41824, 41828, 41830, 41832, 41834, 41836, 41837, 41838, 41841] v3 = argv;
[41876, 41859, 41868] v140 = __readfsqword(0x28u);
[41878, 41848, 41883, 41852, 41886] v118 = getenv("POSIXLY_CORRECT");
[41891, 41896, 41904, 41909, 41914] v111 = (unsigned int)posix2_version() - 200112 > 0x2B8;
[41901, 41919] set_program_name(*argv);
[41936, 41931, 41924, 41955] v117 = setlocale(6, &LC4);
[41960, 41948, 41941] bindtextdomain("coreutils", "/usr/local/share/locale");
[41972, 41965] textdomain("coreutils");
[41977] initialize_exit_failure_constprop_0();
[41992, 41987, 41997, 41982] hard_LC_COLLATE = hard_locale(3LL);
[42008, 42003] hard_LC_TIME = hard_locale(2LL);
[42014] v4 = localeconv();
[42019] decimal_point = v4->decimal_point;
[42025, 42019, 42022] _decimal_point = *v4->decimal_point;
[42033, 42043, 42039, 42031] if ( !_decimal_point || decimal_point[1] )
[42688, 42695] _decimal_point = 46;
[42049] thousands_sep = v4->thousands_sep;
[42056, 42053] _thousands_sep = *thousands_sep;
[42064, 42062] if ( !_thousands_sep )
goto LABEL_71;
[42074, 42070] if ( !thousands_sep[1] )
goto LABEL_5;
LABEL_70:
[43559] thousands_sep_ignored = 1;
LABEL_71:
[43576, 43566] _thousands_sep = 128;
LABEL_5:
[42080] v7 = (int *)&sig_9212;
[42087] have_read_stdin = 0;
[42102, 42094] inittables();
[42114] v8 = (int *)((char *)&sig_9212 + 44);
[42118] v9 = (int *)&sig_9212;
[42121, 42107, 42126] sigemptyset(&caught_signals);
do
{
[42128] v10 = *v9;
[42136, 42131, 42139, 42133] sigaction(*v9, 0LL, &v138);
[42144, 42153] if ( v138.sa_handler != (__sighandler_t)((char *)to_uchar + 1) )
[42155, 42165, 42158] sigaddset(&caught_signals, v10);
[42170] ++v9;
}
[42177, 42174] while ( v8 != v9 );
[42202, 42195] v138.sa_flags = 0;
[42229] v138.sa_handler = (__sighandler_t)sighandler;
[42179, 42260] *(__m128i *)v138.sa_mask.__val = _mm_load_si128((const __m128i *)&caught_signals);
[42187, 42284] *(__m128i *)&v138.sa_mask.__val[2] = _mm_load_si128((const __m128i *)&caught_signals.__val[2]);
[42292, 42213] *(__m128i *)&v138.sa_mask.__val[4] = _mm_load_si128((const __m128i *)&caught_signals.__val[4]);
[42300, 42221] *(__m128i *)&v138.sa_mask.__val[6] = _mm_load_si128((const __m128i *)&caught_signals.__val[6]);
[42244, 42237, 42308] *(__m128i *)&v138.sa_mask.__val[8] = _mm_load_si128((const __m128i *)&caught_signals.__val[8]);
[42252, 42316] *(__m128i *)&v138.sa_mask.__val[10] = _mm_load_si128((const __m128i *)&caught_signals.__val[10]);
[42268, 42324] *(__m128i *)&v138.sa_mask.__val[12] = _mm_load_si128((const __m128i *)&caught_signals.__val[12]);
[42340, 42276, 42332] *(__m128i *)&v138.sa_mask.__val[14] = _mm_load_si128((const __m128i *)&caught_signals.__val[14]);
do
{
[42361] while ( 1 )
{
[42361] v11 = *v7;
[42368, 42371, 42376, 42378, 42365] if ( sigismember(&caught_signals, *v7) )
break;
[42352, 42356, 42359] if ( v8 == ++v7 )
goto LABEL_13;
}
[42388] ++v7;
[42392, 42385, 42380, 42382] sigaction(v11, &v138, 0LL);
}
[42400, 42397] while ( v8 != v7 );
LABEL_13:
[42409, 42402, 42404] v12 = 0LL;
[42411] v13 = 0;
[42414] signal(17, 0LL);
[42426, 42429] v14 = 0;
[42419, 42436] atexit(exit_cleanup);
[42441, 42452, 42449, 42457] key_init((long)v126);
[42472, 42467] v126[0].m128i_i64[0] = -1LL;
[42489] v110 = 0;
[42494] v113 = 0LL;
[42484, 42462, 42503] v15 = (long *)xnmalloc(argc, 8LL);
[42506, 42514] v112 = 0LL;
[42523] v116 = 0LL;
[42546, 42532, 42541] s1 = 0LL;
[42723, 42725, 42719] while ( 1 )
{
[42655] while ( 1 )
{
[42655] LODWORD(v137[0]) = -1;
[42666, 42670] if ( v14 == -1 )
{
LABEL_23:
[42672] v16 = optind;
[42679] break;
}
[42552, 42561, 42555, 42566] if ( v12 && v118 )
{
[42577, 42572] v16 = optind;
[42584, 42586, 42591] if ( v111 != 1 || v110 )
break;
[42593, 42597] if ( argc == optind )
{
[43064, 43070] if ( v112 )
goto LABEL_161;
[43076] v110 = 0;
goto LABEL_45;
}
[42603, 42606] v17 = v3[optind];
[42723, 42704, 42610, 42708, 42613, 42710, 42615, 42714, 42716] if ( *v17 != 45 || v17[1] != 111 || !v17[2] && optind + 1 == argc )
break;
}
[42754, 42728, 42733, 42737, 42740, 42747] LODWORD(v20) = getopt_long(argc, (char *const *)v3, "-bcCdfghik:mMno:rRsS:t:T:uVy:z", &long_options, (int *)v137);
[42759] v14 = v20;
[42762, 42765] if ( (_DWORD)v20 == -1 )
goto LABEL_23;
[42772, 42767] if ( (int)v20 > 135 )
goto LABEL_162;
[42778, 42780] if ( (int)v20 <= 0 )
{
[43036, 43031] if ( (_DWORD)v20 == -131 )
{
[45824, 45798, 45799, 45831, 45806, 45838, 45808, 45845, 45815, 45817] version_etc(stdout, "sort", "GNU coreutils", Version, "Mike Haertel", "Paul Eggert", 0LL, v20);
[45850, 45852] exit(0);
}
[43042, 43047] if ( (_DWORD)v20 == -130 )
[43053, 43055] usage(0);
goto LABEL_162;
}
[42786, 42791, 42797, 42799, 42803, 42806] switch ( (int)v20 )
{
case 1:
[44227] v50 = optarg;
[44234, 44237] if ( *optarg != 43 )
goto LABEL_110;
[44746, 44742] if ( optind == argc )
{
[45435, 45443] LODWORD(v119) = 0;
}
else
{
[44752, 44735] v60 = v3[optind];
[44756] LODWORD(v119) = 0;
[44764, 44767] if ( *v60 == 45 )
[44769, 44773, 44775, 44778, 44781, 44785] LODWORD(v119) = (unsigned int)(v60[1] - 48) <= 9;
}
[44802, 44795, 44789, 44798] v111 |= (unsigned char)v119 & (v118 == 0LL);
[44806] if ( !v111 )
goto LABEL_110;
[44834, 44837, 44812, 44817, 44822, 44824, 44827] v121 = (_QWORD *)key_init((long)v125);
[44842, 44837, 44846] v61 = (char *)parse_field_count((long)(optarg + 1), v121, 0LL);
[44851] v62 = v121;
[44856, 44859] v63 = v61;
[44862] if ( !v61 )
{
[45720, 45731, 45716, 45726] if ( !*v121 && !v121[1] )
[45744, 45737] *v121 = -1LL;
LABEL_144:
[44921, 44914] v50 = optarg;
LABEL_110:
[44243, 44247] v15[v12++] = (long)v50;
[44251] continue;
}
[44868, 44871] if ( *v61 != 46 )
{
[44881, 44892, 44877, 44887] if ( *v121 || v121[1] )
goto LABEL_168;
LABEL_142:
[44898] *v62 = -1LL;
goto LABEL_143;
}
[45753, 45759, 45749, 45757] v89 = parse_field_count((long)(v61 + 1), v121 + 1, 0LL);
[45764] v62 = v121;
[45769] v63 = (char *)v89;
[45793, 45772, 45776, 45782, 45787] if ( !*v121 && !v121[1] )
goto LABEL_142;
LABEL_143:
[44905, 44908] if ( !v63 )
goto LABEL_144;
LABEL_168:
[45488, 45493] v122 = v62;
[45498, 45490] v80 = set_ordering(v63, (long)v62, 0);
[45503] v81 = (long)v122;
[45508, 45511] if ( *v80 )
goto LABEL_144;
[45522, 45517] if ( !(_DWORD)v119 )
goto LABEL_176;
[45528, 45547, 45551] v82 = (char *)v3[optind++];
[45568] v119 = v82;
[45539, 45573, 45544, 45557, 45564, 45535] v83 = (char *)parse_field_count((long)(v82 + 1), v122 + 2, "invalid number after '-'");
[45578] v84 = (long)v122;
[45586, 45583] v85 = v83;
[45589] if ( !v83 )
[46117, 46124, 46129, 46136, 46143] _assert_fail("s", "src/sort.c", 0x1161u, "main");
[45595, 45598] if ( *v83 != 46 )
goto LABEL_172;
goto LABEL_191;
case 67:
case 99:
goto LABEL_37;
case 77:
case 82:
case 86:
case 98:
case 100:
case 102:
case 103:
case 104:
case 105:
case 110:
case 114:
goto LABEL_34;
case 83:
[44217, 44212, 44205, 44198] specify_sort_size(v137[0], 83, (long)optarg);
[44222] continue;
case 84:
[44188, 44181] add_temp_dir((long)optarg);
[44193] continue;
case 107:
[44032, 44027, 44054] v120 = (char *)key_init((long)v125);
[44059, 44051, 44044, 44037] v44 = parse_field_count((long)optarg, v120, "invalid number at field start");
[44064] v45 = v120;
[44069] v46 = (char *)v44;
[44072, 44075, 44079, 44082, 44085] if ( !(*(_QWORD *)v120)-- )
goto LABEL_212;
[44091, 44094] if ( *v46 == 46 )
{
[45251, 45255, 45259, 45264, 45271] v72 = parse_field_count((long)(v46 + 1), (_QWORD *)v120 + 1, "invalid number after '.'");
[45276] v45 = v120;
[45281] v46 = (char *)v72;
[45284] v73 = *((_QWORD *)v120 + 1);
[45288, 45292] *((_QWORD *)v120 + 1) = v73 - 1;
[45296, 45299] if ( !v73 )
{
[45312, 45305, 45319] badfieldspec((long)optarg, "character offset is zero");
LABEL_161:
[45328, 45352, 45324, 45333] v74 = quotearg_style(4LL, *v15);
[45338, 45355, 45350, 45343] v75 = dcgettext(0LL, "extra operand %s", 5);
[45360, 45363, 45365, 45367, 45370, 45372] error(0, 0, v75, v74);
[45377, 45389, 45382, 45391] v76 = dcgettext(0LL, "file operands cannot be combined with --files0-from", 5);
[45408, 45415, 45418, 45420, 45396, 45403] _fprintf_chk(stderr, 1LL, "%s\n", v76);
LABEL_162:
[45425, 45430] usage(2);
}
}
[44104, 44106, 44100, 44111] if ( !*(_QWORD *)v45 && !*((_QWORD *)v45 + 1) )
[44668, 44661] *(_QWORD *)v45 = -1LL;
[44122] v119 = v45;
[44117, 44127, 44119] v48 = set_ordering(v46, (long)v45, 0);
[44132] v49 = (long)v119;
[44137, 44140] if ( *v48 == 44 )
{
[45160, 45164, 45168, 45173, 45180] v68 = parse_field_count((long)(v48 + 1), (_QWORD *)v119 + 2, "invalid number after ','");
[45185] v69 = (long)v119;
[45190] v70 = (char *)v68;
[45193] v71 = *((_QWORD *)v119 + 2);
[45201, 45197] *((_QWORD *)v119 + 2) = v71 - 1;
[45208, 45205] if ( !v71 )
goto LABEL_212;
[45217, 45214] if ( *v70 == 46 )
{
[45698, 45678, 45682, 45686, 45691] v88 = parse_field_count((long)(v70 + 1), (_QWORD *)v119 + 3, "invalid number after '.'");
[45703] v69 = (long)v119;
[45708, 45711] v70 = (char *)v88;
}
[45226, 45231] v119 = (char *)v69;
[45236, 45223] v48 = set_ordering(v70, v69, 1);
[45241, 45246] v49 = (long)v119;
}
else
{
[44146, 44154] *((__m128i *)v119 + 1) = _mm_load_si128((const __m128i *)&LC125);
}
[44162, 44159] if ( *v48 )
{
LABEL_185:
[45907, 45900, 45893] badfieldspec((long)optarg, "stray character in field spec");
LABEL_186:
[45912, 45924, 45917, 45926] v91 = dcgettext(0LL, "multiple compress programs specified", 5);
[45931, 45933] v40 = (_BYTE *)&locret_2;
[45938, 45941, 45943] error(2, 0, v91);
LABEL_187:
[45948, 45967] v15 = (long *)quote(v40);
[45953, 45970, 45965, 45958] v92 = dcgettext(0LL, "multi-character tab %s", 5);
[45985, 45988, 45990, 45975, 45978, 45980] error(2, 0, v92, v15);
LABEL_188:
[46000, 46009, 45995, 46007] v93 = dcgettext(0LL, "incompatible tabs", 5);
[46016, 46021, 46024, 46026, 46014] error(2, 0, v93);
LABEL_189:
[46043, 46036, 46045, 46031] v94 = dcgettext(0LL, "multiple output files specified", 5);
[46050, 46052, 46057, 46060, 46062] error(2, 0, v94);
LABEL_190:
[46067] v85 = "cC";
[46074, 46067] incompatible_options((long)"cC");
LABEL_191:
[46087, 46079] v124 = v84;
[46099, 46083, 46092, 46079] v95 = parse_field_count((long)(v85 + 1), (_QWORD *)(v84 + 24), "invalid number after '.'");
[46104] v84 = v124;
[46112, 46109] v85 = (char *)v95;
LABEL_172:
[45609, 45604] if ( !*(_QWORD *)(v84 + 24) )
{
[45611] v86 = *(_QWORD *)(v84 + 16);
[45618, 45615] if ( v86 )
[45624, 45620] *(_QWORD *)(v84 + 16) = v86 - 1;
}
[45636, 45631] v123 = v84;
[45641, 45628] v87 = set_ordering(v85, v84, 1);
[45646] v81 = v123;
[45651, 45654] if ( *v87 )
{
[46160, 46153, 46148] badfieldspec((long)v119, "stray character in field spec");
LABEL_194:
[46170, 46165] if ( !v110 )
[46172] v110 = 111;
LABEL_196:
[46177, 46189] opts_9300[0] = v110;
[46200, 46195, 46182] incompatible_options((long)opts_9300);
}
LABEL_176:
[45660] *(_BYTE *)(v81 + 57) = 1;
[45665, 45673, 45668] insertkey(v81);
}
else
{
[44168, 44171] insertkey(v49);
}
[44176] break;
case 109:
[42809] v13 = 1;
[42815] continue;
case 111:
[43974] v41 = v113;
[43979] v42 = optarg;
[43986, 43989] if ( v113 )
{
[43994] v113 = optarg;
[43999, 43991] v43 = strcmp(v41, optarg);
[44004] v42 = v113;
[44009, 44011] if ( v43 )
goto LABEL_189;
}
[44017] v113 = v42;
[44022] continue;
case 115:
[43962] stable = 1;
[43969] continue;
case 116:
[43880] v39 = *optarg;
[43880, 43883, 43885] if ( !*optarg )
{
[45857, 45869, 45862, 45871] v90 = dcgettext(0LL, "empty tab", 5);
[45888, 45876, 45878, 45883, 45886] error(2, 0, v90);
goto LABEL_185;
}
[43891, 43895] if ( optarg[1] )
{
[43904] v119 = optarg;
[43921, 43914, 43919] v40 = optarg;
[43897, 43873, 43909] if ( strcmp(optarg, "\\0") )
goto LABEL_187;
[43927] v39 = 0;
}
[43941, 43943, 43945, 43929, 43935] if ( tab == 128 || tab == v39 )
{
[43951] tab = v39;
[43957] continue;
}
goto LABEL_188;
case 117:
[43861] unique = 1;
[43868] continue;
case 121:
[43809, 43802] v37 = optarg;
[43817, 43795, 43812] if ( v3[optind - 1] == optarg )
{
[43826] while ( 1 )
{
[43826, 43823] v38 = *v37;
[43834, 43828, 43831] if ( (unsigned int)(v38 - 48) > 9 )
break;
[45448, 45452] ++v37;
}
[43840, 43842, 43845, 43848, 43850] optind -= (_BYTE)v38 != 0;
}
[43856] continue;
case 122:
[43783] eolchar = 0;
[43790] continue;
case 128:
[42936] v14 = 99;
[42945, 42942] if ( optarg )
[42977, 42947, 42948, 42984, 42955, 42989, 42929, 42962, 42996, 42997, 42998, 42969, 42971] v14 = check_types[_xargmatch_internal(
"--check",
optarg,
check_args,
check_types,
1LL,
argmatch_die,
1LL,
v21)];
LABEL_37:
[43008, 43010, 43012, 43015, 43003] if ( v110 && v110 != v14 )
goto LABEL_190;
[43021] v110 = v14;
[43026] continue;
case 129:
[43733] v35 = optarg;
[43740, 43743] if ( compress_program )
{
[43748] v119 = optarg;
[43745, 43753, 43726] v36 = strcmp(compress_program, optarg);
[43758] v35 = v119;
[43763, 43765] if ( v36 )
goto LABEL_186;
}
[43771] compress_program = v35;
[43778] continue;
case 130:
[43714] debug = 1;
[43721] continue;
case 131:
[43704, 43697] v112 = optarg;
[43709] continue;
case 132:
[43682, 43675, 43668, 43687] specify_nmerge(v137[0], -124, (long)optarg);
[43692] continue;
case 133:
[43615] v32 = s1;
[43620] v33 = optarg;
[43627, 43630] if ( s1 )
{
[43635] s1a = optarg;
[43632, 43640] v34 = strcmp(v32, optarg);
[43645] v33 = s1a;
[43650, 43652] if ( v34 )
goto LABEL_211;
}
[43658] s1 = v33;
[43663] continue;
case 134:
[42880, 42850, 42820, 42821, 42857, 42828, 42733, 42864, 42834, 42869, 42841, 42843, 42876, 42878] v14 = sort_types[_xargmatch_internal(
"--sort",
optarg,
sort_args,
sort_types,
1LL,
argmatch_die,
1LL,
(unsigned int)argc)];
LABEL_34:
[42898, 42885, 42903] v139[0] = v14;
[42911] v139[1] = 0;
[42890, 42885, 42919] set_ordering(v139, (long)v126, 2);
[42924] continue;
case 135:
[43588, 43595, 43600, 43605, 43581] v116 = specify_nthreads(v137[0], -121, (long)optarg);
[43610] continue;
default:
goto LABEL_162;
}
}
[42624, 42628] if ( argc <= (int)v16 )
break;
[42634] v18 = v16 + 1;
[42637] v19 = v3[v16];
[42641] optind = v18;
[42651, 42647] v15[v12++] = (long)v19;
}
[46268] while ( 1 )
{
[46274] if ( v112 )
{
[46280, 46283] if ( v12 )
goto LABEL_161;
[46309, 46317, 46289, 46294, 46301] v97 = xfopen(v112, "r");
[46320, 46314] readtokens0_init(v137);
[46336, 46341] v98 = v112;
[46328, 46331, 46325, 46343] if ( !(unsigned char)readtokens0(v97, v137) )
goto LABEL_210;
[46336, 46352, 46349] xfclose(v97, v112);
[46357, 46366] if ( !v137[0] )
goto LABEL_209;
[46372, 46375] free(v15);
[46380] v3 = (const char **)v137[0];
[46388] v15 = (long *)v137[1];
[46412, 46396, 46405, 46399] if ( v137[0] )
{
[46435] while ( 1 )
{
[46435] v99 = (const char *)v15[v12];
[46439, 46442, 46445, 46450, 46452] if ( !strcmp(v99, "-") )
break;
[46416] ++v12;
[46424, 46420] if ( !*v99 )
goto LABEL_208;
[46426, 46429] if ( v3 == (const char **)v12 )
goto LABEL_45;
}
[46481, 46457, 46462, 46454] v100 = quotearg_style(4LL, v99);
[46472, 46467, 46484, 46479] v101 = dcgettext(0LL, "when reading file names from stdin, no file name of %s allowed", 5);
[46499, 46502, 46504, 46489, 46492, 46494] error(2, 0, v101, v100);
LABEL_208:
[46540, 46509, 46514, 46519, 46521] v102 = quotearg_n_style_colon(0LL, 3LL, v112);
[46538, 46531, 46526, 46543] v103 = dcgettext(0LL, "%s:%lu: invalid zero-length file name", 5);
[46564, 46566, 46548, 46551, 46554, 46556, 46559] error(2, 0, v103, v102, v12);
LABEL_209:
[46576, 46600, 46571, 46581] v104 = quotearg_style(4LL, v112);
[46586, 46603, 46598, 46591] v105 = dcgettext(0LL, "no input from %s", 5);
[46611, 46613] v98 = 0LL;
[46608, 46618, 46621, 46623] error(2, 0, v105, v104);
LABEL_210:
[46633, 46628, 46652] v106 = quotearg_style(4LL, v98);
[46650, 46643, 46638, 46655] v107 = dcgettext(0LL, "cannot read file names from %s", 5);
[46660, 46663, 46665, 46670, 46673, 46675] error(2, 0, v107, v106);
LABEL_211:
[46680, 46692, 46685, 46694] v108 = dcgettext(0LL, "multiple random sources specified", 5);
[46699, 46701, 46706, 46709, 46711] error(2, 0, v108);
LABEL_212:
[46730, 46723, 46716] badfieldspec((long)optarg, "field number is zero");
[46735] JUMPOUT(0xB68FLL);
}
}
LABEL_45:
[43081] v22 = keylist;
[43088, 43091] if ( keylist )
{
[43097, 43099] LODWORD(v3) = 0;
do
{
[43104, 43108, 43237, 43240, 43245, 43247] while ( default_key_compare(v22) && !v26[3].m128i_i8[7] )
{
[43114, 43123] v26[2] = _mm_load_si128(&v127);
[43135, 43127] v23 = v135;
[43143] v26[3].m128i_i8[0] = v128;
[43146, 43154] v26[3].m128i_i8[1] = v129;
[43157, 43165] v26[3].m128i_i8[6] = v134;
[43168, 43176] v26[3].m128i_i8[2] = v130;
[43179, 43187] v26[3].m128i_i8[4] = v132;
[43198, 43190] v26[3].m128i_i8[5] = v133;
[43201] v24 = v136;
[43209] v26[3].m128i_i8[7] = v23;
[43212] v26[3].m128i_i8[8] = v24;
[43215] v25 = v131;
[43223] v26[3].m128i_i8[3] = v131;
[43226] v22 = v26[4].m128i_i64[0];
[43230] v3 = (const char **)(v25 | (unsigned int)v3);
[43232, 43235] if ( !v22 )
goto LABEL_51;
}
[43253] v27 = v26[3].m128i_u8[3];
[43257] v22 = v26[4].m128i_i64[0];
[43261] v3 = (const char **)(v27 | (unsigned int)v3);
}
[43266, 43263] while ( v22 );
LABEL_51:
[43268] v28 = 0;
}
else
{
[44512, 44505, 44500, 44510] if ( default_key_compare((long)v126) )
{
[44518] check_ordering_compatibility();
[44530, 44523] if ( !debug )
{
[45149, 45141] reverse = v135;
[45155] goto LABEL_62;
}
[44536] v3 = 0LL;
[44538, 44541] v28 = 0;
LABEL_53:
[43289, 43294] if ( v110 )
goto LABEL_196;
[43306, 43300] if ( v113 )
goto LABEL_194;
[43331, 43336, 43341, 43312, 43344, 43318, 43324] if ( !v117 || !setlocale(3, &LC4) )
{
[44593, 44605, 44598, 44591] v56 = dcgettext(0LL, "failed to set locale", 5);
[44610, 44617, 44619, 44621, 44624, 44626, 44631] error(0, 0, "%s", v56);
}
[43357, 43350] if ( hard_LC_COLLATE )
{
[43370, 43363, 43365] v29 = setlocale(3, 0LL);
[43378, 43397, 43375] v30 = quote(v29);
[43400, 43395, 43388, 43383] v31 = dcgettext(0LL, "text ordering performed using %s sorting rules", 5);
[43405, 43408, 43410, 43412, 43415, 43417] error(0, 0, v31, v30);
}
else
{
[44560, 44553, 44546, 44548] v55 = dcgettext(0LL, "text ordering performed using simple byte comparison", 5);
[44576, 44579, 44581, 44586, 44565, 44572, 44574] error(0, 0, "%s", v55);
}
[43427, 43422, 43431] key_warnings(v126, v28);
goto LABEL_60;
}
[44678] v28 = 1;
[44673, 44684] insertkey((long)v126);
[44689, 44697] v3 = (const char **)v131;
}
[43271] check_ordering_compatibility();
[43283, 43276] if ( debug )
goto LABEL_53;
LABEL_60:
[43444, 43436] reverse = v135;
[43450, 43452] if ( (_BYTE)v3 )
[43459, 43454] random_md5_state_init(s1);
LABEL_62:
[43464, 43472] if ( !temp_dir_count )
{
[44339, 44334, 44327] v52 = getenv("TMPDIR");
[44345, 44342] if ( !v52 )
[45136, 45129] v52 = "/tmp";
[44356, 44351] add_temp_dir((long)v52);
}
[43481, 43478] if ( !v12 )
{
[44288] v12 = 1LL;
[44293, 44285] free(v15);
[44298, 44308, 44303] v15 = (long *)xmalloc(8LL);
[44322, 44318, 44311] *v15 = (long)"-";
}
[43497, 43494, 43487] if ( sort_size )
{
[44256, 44262] v51 = 34LL * (unsigned int)nmerge;
[44269] if ( v51 < sort_size )
[44266, 44269] v51 = sort_size;
[44280, 44273] sort_size = v51;
}
[43508, 43503] if ( !v110 )
break;
[43514, 43518] if ( v12 <= 1 )
{
[43530, 43524] if ( !v113 )
{
[44640, 44636, 44645] v57 = check((char *)*v15, v110);
[44656, 44650, 44653] exit(v57 ^ 1);
}
[43548] opts_9304 = v110;
[43536, 43554, 43541] incompatible_options((long)&opts_9304);
goto LABEL_70;
}
[46234, 46210, 46205, 46215] v15 = (long *)quotearg_style(4LL, v15[1]);
[46232, 46225, 46220, 46237] v96 = dcgettext(0LL, "extra operand %s not allowed with -%c", 5);
[46242, 46248, 46251, 46253, 46256, 46261, 46263] error(2, 0, v96, v15, (unsigned int)v110);
}
[44361, 44364, 44367] check_inputs((const char **)v15, v12);
[44377, 44372] check_output(v113);
[44385, 44382] if ( v13 )
{
[44984, 44994, 44981, 44989] v65 = (__m128i *)xcalloc(v12, 16LL);
[45026, 44997, 45029, 45031, 45001, 45004, 45037, 45008, 45041, 45013, 45016, 45020, 45023] if ( (v65 >= (__m128i *)&v15[v12] || v15 >= &v65[v12 - 1].m128i_i64[1]) && v12 - 1 > 0x16 )
{
[45050, 45047] v66 = 0LL;
do
{
[45059] v67 = (__m128)_mm_loadu_si128((const __m128i *)&v15[v66]);
[45065] v65[v66].m128i_i64[0] = v67.m128_u64[0];
[45070] _mm_storeh_ps((double *)v65[v66 + 1].m128i_i64, v67);
[45075] v66 += 2LL;
}
[45079, 45082, 45052, 45055] while ( 2 * (v12 >> 1) != v66 );
[45091, 45095] if ( (v12 & 1) != 0 )
[45097, 45101, 45105, 45084, 45087] v65[v12 & 0xFFFFFFFFFFFFFFFELL].m128i_i64[0] = v15[v12 & 0xFFFFFFFFFFFFFFFELL];
}
else
{
[45478, 45481, 45483, 45457, 45466] for ( i = 0LL; i != v12; ++i )
{
[45459] v78 = v15[i];
[45463] v79 = i;
[45474, 45470] v65[v79].m128i_i64[0] = v78;
}
}
[45124, 45109, 45114, 45117, 45119] merge(v65, 0LL, v12, v113);
}
else
{
[44397, 44391] if ( !v116 )
{
[44707, 44702] v58 = num_processors(2LL);
[44712] v59 = 8LL;
[44721] if ( v58 <= 8 )
[44721, 44717] v59 = v58;
[44730, 44725] v116 = v59;
}
[44432, 44419, 44429] v53 = v116;
[44435] if ( v116 > 0xFFFFFFFFFFFFFFLL )
[44435] v53 = 0xFFFFFFFFFFFFFFLL;
[44416, 44403, 44439, 44408, 44413] sort((char **)v15, v12, v113, v53);
}
[44451, 44933, 44457, 44938, 44941, 44465, 44474, 44444, 44926] if ( have_read_stdin && (unsigned int)rpl_fclose(stdin) == -1 )
{
[44961, 44954, 44947, 44956] v64 = dcgettext(0LL, "close failed", 5);
[44976, 44973, 44966] sort_die(v64, "-");
}
[44480, 44487] return 0;
[44489, 44490, 44491, 44493, 44495, 44497, 44499] }
// B68A: control flows out of bounds to B68F
// A7E8: variable 'v21' is possibly undefined
// A860: variable 'v26' is possibly undefined
// B315: variable 'v20' is possibly undefined
// B407: variable 'v84' is possibly undefined
// B450: variable 'v119' is possibly undefined
// 7A08: using guessed type char opts_9304;
// 7A1C: using guessed type int nmerge;
// 7A20: using guessed type int tab;
// 7A30: using guessed type char eolchar;
// 7C00: using guessed type char debug;
// 7C10: using guessed type long keylist;
// 7C18: using guessed type char have_read_stdin;
// 7C19: using guessed type char unique;
// 7C1A: using guessed type char stable;
// 7C1B: using guessed type char reverse;
// 7C28: using guessed type long temp_dir_count;
// 7C38: using guessed type long sort_size;
// 8060: using guessed type char hard_LC_TIME;
// 8061: using guessed type char hard_LC_COLLATE;
// 8062: using guessed type char thousands_sep_ignored;
// 8064: using guessed type int thousands_sep;
// 8068: using guessed type char decimal_point;
// B780: using guessed type char *sort_args[6];
// B7C0: using guessed type char *check_args[3];
// BC30: using guessed type __int128 LC125;
// D020: using guessed type long quote(_QWORD);
// D070: using guessed type long xmalloc(_QWORD);
// D0A8: using guessed type long quotearg_n_style_colon(_QWORD, _QWORD, _QWORD);
// D0F8: using guessed type long rpl_fclose(_QWORD);
// D1C8: using guessed type long quotearg_style(_QWORD, _QWORD);
// D308: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
// D310: using guessed type long xnmalloc(_QWORD, _QWORD);
// D368: using guessed type long posix2_version(void);
// D370: using guessed type long set_program_name(_QWORD);
// D388: using guessed type long hard_locale(_QWORD);
// D3E0: using guessed type long _xargmatch_internal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// D3E8: using guessed type long num_processors(_QWORD);
// D3F0: using guessed type long xcalloc(_QWORD, _QWORD);
// D400: using guessed type long version_etc(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// D408: using guessed type long readtokens0_init(_QWORD);
// D410: using guessed type long readtokens0(_QWORD, _QWORD);
// A360: using guessed type __m128i var_258[2];
// nfuncs=230 queued=106 decompiled=106 lumina nreq=0 worse=0 better=0
// ALL OK, 106 function(s) have been successfully decompiled
|
long compare(unsigned char **a1, unsigned char **a2)
[23798] {
unsigned char *v3; // rax
int v4; // eax
unsigned int v5; // [rsp+1Ch] [rbp-14h]
unsigned int v6; // [rsp+1Ch] [rbp-14h]
unsigned char *v7; // [rsp+20h] [rbp-10h]
unsigned char *n; // [rsp+28h] [rbp-8h]
[23810, 23814, 23818, 23825, 23828, 23798, 23802, 23803, 23806] if ( keylist )
{
[23841, 23844, 23849, 23830, 23834, 23838] v5 = keycompare(a1, a2);
[23876, 23878, 23852, 23856, 23858, 23865, 23867, 23869] if ( v5 || unique || stable )
[23880, 23883] return v5;
}
[23892, 23900] v7 = a1[1] - 1;
[23916, 23908] n = a2[1] - 1;
[23896, 23925, 23892, 23920] if ( a1[1] == (unsigned char *)&loc_1 )
{
[23938, 23908, 23940, 23943, 23912, 23927, 23932, 23935] v6 = -(a2[1] != (unsigned char *)&loc_1);
}
[23912, 23948, 23953, 23908] else if ( a2[1] == (unsigned char *)&loc_1 )
{
[23962, 23955] v6 = 1;
}
[23976, 23974, 23967] else if ( hard_LC_COLLATE )
{
[24001, 23908, 24005, 24008, 23978, 24011, 23982, 24016, 23986, 24019, 23892, 23990, 23993, 23997] v6 = xmemcoll0(*a1, a1[1], *a2, a2[1]);
}
else
{
[23892, 24021] v3 = a1[1] - 1;
[24025, 24029] if ( n <= v7 )
[23904, 23908, 24029] v3 = a2[1] - 1;
[24034, 24037, 24041, 24044, 24048, 24051, 24054, 24057, 24062] v6 = memcmp(*a1, *a2, (size_t)v3);
[24065, 24069] if ( !v6 )
{
[24075, 24079, 24071] if ( v7 < n )
[24097] v4 = -1;
else
[24081, 24085, 24089, 24092, 24095] v4 = v7 != n;
[24102] v6 = v4;
}
}
[24112, 24105, 24114] if ( reverse )
[24121, 24116, 24119] return -v6;
else
[24123] return v6;
[24126, 24127] }
// B369: using guessed type char hard_LC_COLLATE;
// B7C0: using guessed type char reverse;
// B7C1: using guessed type char stable;
// B7C2: using guessed type char unique;
// B7C8: using guessed type long keylist;
// F060: using guessed type long xmemcoll0(_QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000005E40) ----------------------------------------------------
char * write_line(void **a1, FILE *a2, char *a3)
[24128] {
char *v3; // rax
char *v4; // rax
char *result; // rax
char *v6; // rax
char v8; // [rsp+2Fh] [rbp-21h]
char *v9; // [rsp+30h] [rbp-20h]
char *ptr; // [rsp+38h] [rbp-18h]
char *n; // [rsp+40h] [rbp-10h]
char *v12; // [rsp+48h] [rbp-8h]
[24128, 24132, 24133, 24136, 24140, 24144, 24148, 24152, 24156, 24159] ptr = (char *)*a1;
[24163, 24171, 24167] n = (char *)a1[1];
[24175, 24179, 24183, 24186, 24159] v12 = &n[(_QWORD)*a1];
[24195, 24201, 24208, 24210, 24190] if ( a3 || !debug )
{
[24355, 24362, 24347, 24351] *(v12 - 1) = eolchar;
[24384, 24389, 24393, 24364, 24368, 24372, 24376, 24381] if ( n != (char *)fwrite_unlocked(ptr, 1uLL, (size_t)n, a2) )
{
[24402, 24395] v6 = gettext("write failed");
[24417, 24420, 24407, 24410, 24414] sort_die(v6, a3);
}
[24425, 24429] result = v12 - 1;
[24433, 24436, 24429] *(v12 - 1) = 0;
}
else
{
[24216, 24220, 24224] v9 = (char *)*a1;
[24331, 24323, 24327] while ( v9 < v12 )
{
[24226] v3 = v9++;
[24241, 24234, 24238, 24230] v8 = *v3;
[24248, 24241, 24244] if ( *v3 == 9 )
{
[24250, 24254] v8 = 62;
}
[24256, 24260, 24264] else if ( v9 == v12 )
{
[24266] v8 = 10;
}
[24288, 24291, 24270, 24274, 24278, 24281, 24283] if ( fputc_unlocked(v8, a2) == -1 )
{
[24300, 24293] v4 = gettext("write failed");
[24305, 24308, 24312, 24315, 24318] sort_die(v4, 0LL);
}
}
[24337, 24340, 24333, 24345] return (char *)debug_line((long)a1);
}
[24437, 24438] return result;
[24439] }
// B320: using guessed type char eolchar;
// B7D8: using guessed type char debug;
//----- (0000000000005F78) ----------------------------------------------------
long check(char *a1, char a2)
[24440] {
size_t v2; // rdx
long v3; // r12
long v4; // rbx
char *v5; // rax
char *v6; // rax
unsigned char v8; // [rsp+1Eh] [rbp-D2h]
_BYTE v9[9]; // [rsp+1Fh] [rbp-D1h]
long v10; // [rsp+28h] [rbp-C8h]
unsigned long v11; // [rsp+30h] [rbp-C0h]
FILE *v12; // [rsp+38h] [rbp-B8h]
long v13; // [rsp+40h] [rbp-B0h]
unsigned long v14; // [rsp+48h] [rbp-A8h]
long v15; // [rsp+58h] [rbp-98h]
void *ptr[4]; // [rsp+60h] [rbp-90h] BYREF
void *v17[2]; // [rsp+80h] [rbp-70h] BYREF
long v18; // [rsp+90h] [rbp-60h]
char v19[24]; // [rsp+C0h] [rbp-30h] BYREF
unsigned long v20; // [rsp+D8h] [rbp-18h]
[24448, 24450, 24451, 24482, 24458, 24465, 24467, 24440, 24473, 24444, 24445] v20 = __readfsqword(0x28u);
[24486, 24488, 24495, 24502, 24505, 24510] v12 = xfopen(a1, "r");
[24517] v9[8] = 0;
[24528] v10 = 0LL;
[24553, 24546, 24539] v13 = keylist;
[24560, 24563, 24565, 24568, 24571, 24574] *(_QWORD *)v9 = unique == 0;
[24560, 24580] v9[0] = unique == 0;
[24587] v8 = 1;
[24594] v2 = sort_size;
[24611] if ( sort_size < (unsigned long)merge_buffer_size )
[24608, 24601, 24611] v2 = merge_buffer_size;
[24624, 24627, 24619, 24615] initbuf((long)v17, 32LL, v2);
[24632, 24643] ptr[0] = 0LL;
[25318, 25325, 25329, 25332, 25335, 25340, 25342, 25311] while ( (unsigned char)fillbuf(v17, v12, a1) )
{
[24648, 24652, 24660, 24655] v11 = buffer_linelim(v17);
[24675, 24678, 24681, 24688, 24691, 24667, 24671] v14 = -32 * v18 + v11;
[24737, 24706, 24740, 24730, 24712, 24743, 24748, 24750, 24719, 24756, 24757, 24726, 24698] if ( *(_QWORD *)&v9[1] && v9[0] <= (int)compare((unsigned char **)ptr, (unsigned char **)(v11 - 32)) )
{
LABEL_6:
[24760, 24780, 24773, 24767] if ( a2 == 99 )
{
[24803, 24810, 24814, 24827, 24784, 24817, 24791, 24824, 24795, 24798] v15 = ((long)(buffer_linelim(v17) - (v11 - 32)) >> 5) + v10;
[24834, 24838, 24845, 24848, 24851, 24856] v3 = umaxtostr(v15, v19);
[24859] v4 = program_name;
[24873, 24866] v5 = gettext("%s: %s:%s: disorder: ");
[24898, 24901, 24904, 24907, 24878, 24912, 24881, 24888, 24895] fprintf(stderr, v5, v4, a1, v3);
[24924, 24917] v6 = gettext("standard error");
[24929, 24932, 24939, 24784, 24946, 24949, 24952] write_line((void **)(v11 - 32), stderr, v6);
}
[24957] v8 = 0;
[24964] break;
}
[25013] while ( 1 )
{
[25013] v11 -= 32LL;
[25035, 25028, 25021] if ( v11 <= v14 )
break;
[24994, 24997, 25000, 24969, 25005, 25007, 24976, 24983, 24987] if ( v9[0] <= (int)compare((unsigned char **)v11, (unsigned char **)(v11 - 32)) )
goto LABEL_6;
}
[25041, 25037] v10 += v18;
[25048, 25066, 25059, 25055] if ( *(_QWORD *)&v9[1] < *(_QWORD *)(v11 + 8) )
{
[25068] while ( 1 )
{
[25068] *(_QWORD *)&v9[1] *= 2LL;
[25075, 25083] if ( !*(_QWORD *)&v9[1] )
break;
[25112, 25105, 25123, 25116] if ( *(_QWORD *)&v9[1] >= *(_QWORD *)(v11 + 8) )
goto LABEL_15;
}
[25096, 25092, 25085, 25103] *(_QWORD *)&v9[1] = *(_QWORD *)(v11 + 8);
LABEL_15:
[25132, 25125, 25135] free(ptr[0]);
[25155, 25147, 25140, 25150] ptr[0] = (void *)xmalloc(*(_QWORD *)&v9[1]);
}
[25190, 25193, 25162, 25196, 25169, 25173, 25180, 25183] memcpy(ptr[0], *(const void **)v11, *(_QWORD *)(v11 + 8));
[25208, 25201, 25212] ptr[1] = *(void **)(v11 + 8);
[25219, 25227] if ( v13 )
{
[25254, 25257, 25260, 25229, 25263, 25266, 25236, 25243, 25247] ptr[2] = (char *)ptr[0] + *(_QWORD *)(v11 + 16) - *(_QWORD *)v11;
[25284, 25288, 25295, 25298, 25301, 25270, 25304, 25307, 25277] ptr[3] = (char *)ptr[0] + *(_QWORD *)(v11 + 24) - *(_QWORD *)v11;
}
}
[25348, 25355, 25362, 25365, 25368] xfclose(v12, a1);
[25377, 25380, 25373] free(v17[0]);
[25392, 25385, 25395] free(ptr[0]);
[25411, 25420, 25422, 25427, 25400, 25407] return v8;
[25434, 25435, 25437, 25438] }
// B328: using guessed type long merge_buffer_size;
// B7A0: using guessed type long sort_size;
// B7C2: using guessed type char unique;
// B7C8: using guessed type long keylist;
// EE90: using guessed type long xmalloc(_QWORD);
// F038: using guessed type long umaxtostr(_QWORD, _QWORD);
// 5F78: using guessed type char var_30[24];
//----- (000000000000635F) ----------------------------------------------------
long open_input_files(long a1, unsigned long a2, long *a3)
[25439] {
struct _IO_FILE *v3; // rax
int i; // [rsp+24h] [rbp-Ch]
long v7; // [rsp+28h] [rbp-8h]
[25472, 25443, 25444, 25475, 25447, 25480, 25451, 25483, 25455, 25487, 25459, 25463, 25467, 25439] *a3 = xnmalloc(a2, 8LL);
[25497, 25490, 25494] v7 = *a3;
[25698, 25508, 25701, 25703, 25707, 25713, 25501, 25694] for ( i = 0; a2 > i; ++i )
{
[25603, 25608, 25610, 25614, 25617, 25621, 25624, 25627, 25634, 25637, 25513, 25516, 25518, 25522, 25525, 25529, 25532, 25536, 25539, 25541, 25544, 25546, 25550, 25553, 25557, 25560, 25564, 25568, 25570, 25572, 25575, 25577, 25581, 25584, 25588, 25591, 25595, 25598] v3 = *(_QWORD *)(16LL * i + a1 + 8) && *(_BYTE *)(*(_QWORD *)(16LL * i + a1 + 8) + 12LL)
? (struct _IO_FILE *)open_temp(*(_QWORD *)(16LL * i + a1 + 8))
: stream_open(*(const char **)(16LL * i + a1), "r");
[25642, 25645, 25648, 25656, 25660, 25663] *(_QWORD *)(8LL * i + v7) = v3;
[25666, 25669, 25671, 25679, 25683, 25686, 25689, 25692] if ( !*(_QWORD *)(8LL * i + v7) )
break;
}
[25721, 25716, 25719] return i;
[25722] }
// F078: using guessed type long xnmalloc(_QWORD, _QWORD);
//----- (000000000000647B) ----------------------------------------------------
unsigned long mergefps(
long a1,
unsigned long a2,
unsigned long a3,
FILE *a4,
char *a5,
FILE **a6)
{
unsigned long v6; // rax
_QWORD *v7; // rax
_QWORD *v8; // rcx
long v9; // rdx
_QWORD *v10; // rax
_QWORD *v11; // rcx
long v12; // rdx
_QWORD *v13; // rdx
_QWORD *v14; // rax
long v15; // rbx
long v16; // rbx
long v17; // rbx
unsigned long v22; // [rsp+18h] [rbp-F8h]
int v24; // [rsp+3Ch] [rbp-D4h]
void **p_ptr; // [rsp+40h] [rbp-D0h]
unsigned long v26; // [rsp+48h] [rbp-C8h]
unsigned long v27; // [rsp+50h] [rbp-C0h]
unsigned long j; // [rsp+50h] [rbp-C0h]
unsigned long k; // [rsp+50h] [rbp-C0h]
unsigned long m; // [rsp+50h] [rbp-C0h]
unsigned long ii; // [rsp+50h] [rbp-C0h]
unsigned long jj; // [rsp+50h] [rbp-C0h]
unsigned long i; // [rsp+58h] [rbp-B8h]
unsigned long kk; // [rsp+58h] [rbp-B8h]
unsigned long v35; // [rsp+60h] [rbp-B0h]
unsigned long v36; // [rsp+68h] [rbp-A8h]
long v37; // [rsp+70h] [rbp-A0h]
_QWORD *v38; // [rsp+78h] [rbp-98h]
_QWORD *v39; // [rsp+80h] [rbp-90h]
_QWORD *v40; // [rsp+88h] [rbp-88h]
unsigned long *v41; // [rsp+90h] [rbp-80h]
long v42; // [rsp+98h] [rbp-78h]
unsigned long v43; // [rsp+A0h] [rbp-70h]
long v44; // [rsp+A8h] [rbp-68h]
unsigned long v45; // [rsp+B0h] [rbp-60h]
unsigned long v46; // [rsp+B8h] [rbp-58h]
unsigned long v47; // [rsp+C0h] [rbp-50h]
long v48; // [rsp+C8h] [rbp-48h]
void *ptr; // [rsp+D0h] [rbp-40h] BYREF
size_t n; // [rsp+D8h] [rbp-38h]
long v51; // [rsp+E0h] [rbp-30h]
long v52; // [rsp+E8h] [rbp-28h]
unsigned long v53; // [rsp+F8h] [rbp-18h]
v22 = a3;
v53 = __readfsqword(0x28u);
v38 = (_QWORD *)xnmalloc(a3, 56LL);
p_ptr = 0LL;
v26 = 0LL;
v39 = (_QWORD *)xnmalloc(v22, 8LL);
v40 = (_QWORD *)xnmalloc(v22, 8LL);
v41 = (unsigned long *)xnmalloc(v22, 8LL);
v42 = keylist;
ptr = 0LL;
v27 = 0LL;
while ( v27 < v22 )
{
v6 = merge_buffer_size;
if ( sort_size / v22 >= merge_buffer_size )
v6 = sort_size / v22;
initbuf((long)&v38[7 * v27], 32LL, v6);
if ( (unsigned char)fillbuf(&v38[7 * v27], a6[v27], *(char **)(16 * v27 + a1)) )
{
v48 = buffer_linelim(&v38[7 * v27]);
v39[v27] = v48 - 32;
v40[v27] = -32LL * v38[7 * v27 + 2] + v48;
++v27;
}
else
{
xfclose(a6[v27], *(char **)(16 * v27 + a1));
if ( v27 < a2 )
{
--a2;
zaptemp(*(const char **)(16 * v27 + a1));
}
free((void *)v38[7 * v27]);
--v22;
for ( i = v27; i < v22; ++i )
{
v7 = (_QWORD *)(16 * (i + 1) + a1);
v8 = (_QWORD *)(a1 + 16 * i);
v9 = v7[1];
*v8 = *v7;
v8[1] = v9;
a6[i] = a6[i + 1];
}
}
}
for ( j = 0LL; j < v22; ++j )
v41[j] = j;
for ( k = 1LL; k < v22; ++k )
{
if ( (int)compare((unsigned char **)v39[v41[k - 1]], (unsigned char **)v39[v41[k]]) > 0 )
{
v47 = v41[k - 1];
v41[k - 1] = v41[k];
v41[k] = v47;
k = 0LL;
}
}
while ( v22 )
{
v43 = v39[*v41];
if ( unique )
{
if ( p_ptr && (unsigned int)compare((unsigned char **)p_ptr, (unsigned char **)v43) )
{
p_ptr = 0LL;
write_line(&ptr, a4, a5);
}
if ( !p_ptr )
{
p_ptr = &ptr;
if ( v26 < *(_QWORD *)(v43 + 8) )
{
while ( v26 )
{
v26 *= 2LL;
if ( v26 >= *(_QWORD *)(v43 + 8) )
goto LABEL_30;
}
v26 = *(_QWORD *)(v43 + 8);
LABEL_30:
free(ptr);
ptr = (void *)xmalloc(v26);
}
n = *(_QWORD *)(v43 + 8);
memcpy(ptr, *(const void **)v43, n);
if ( v42 )
{
v51 = (long)ptr + *(_QWORD *)(v43 + 16) - *(_QWORD *)v43;
v52 = (long)ptr + *(_QWORD *)(v43 + 24) - *(_QWORD *)v43;
}
}
}
else
{
write_line((void **)v43, a4, a5);
}
if ( v43 <= v40[*v41] )
{
if ( (unsigned char)fillbuf(&v38[7 * *v41], a6[*v41], *(char **)(16 * *v41 + a1)) )
{
v44 = buffer_linelim(&v38[7 * *v41]);
v39[*v41] = v44 - 32;
v40[*v41] = -32LL * v38[7 * *v41 + 2] + v44;
goto LABEL_52;
}
for ( m = 1LL; m < v22; ++m )
{
if ( v41[m] > *v41 )
--v41[m];
}
--v22;
xfclose(a6[*v41], *(char **)(16 * *v41 + a1));
if ( a2 > *v41 )
{
--a2;
zaptemp(*(const char **)(16 * *v41 + a1));
}
free((void *)v38[7 * *v41]);
for ( ii = *v41; ii < v22; ++ii )
{
a6[ii] = a6[ii + 1];
v10 = (_QWORD *)(16 * (ii + 1) + a1);
v11 = (_QWORD *)(a1 + 16 * ii);
v12 = v10[1];
*v11 = *v10;
v11[1] = v12;
v13 = &v38[7 * ii + 7];
v14 = &v38[7 * ii];
v15 = v13[1];
*v14 = *v13;
v14[1] = v15;
v16 = v13[3];
v14[2] = v13[2];
v14[3] = v16;
v17 = v13[5];
v14[4] = v13[4];
v14[5] = v17;
v14[6] = v13[6];
v39[ii] = v39[ii + 1];
v40[ii] = v40[ii + 1];
}
for ( jj = 0LL; jj < v22; ++jj )
v41[jj] = v41[jj + 1];
}
else
{
v39[*v41] = v43 - 32;
LABEL_52:
v35 = 1LL;
v36 = v22;
v37 = 1LL;
v45 = *v41;
while ( v35 < v36 )
{
v24 = compare((unsigned char **)v39[v45], (unsigned char **)v39[v41[v37]]);
if ( v24 >= 0 && (v24 || v45 >= v41[v37]) )
v35 = v37 + 1;
else
v36 = v37;
v37 = (v35 + v36) >> 1;
}
v46 = v35 - 1;
for ( kk = 0LL; kk < v46; ++kk )
v41[kk] = v41[kk + 1];
v41[v46] = v45;
}
}
if ( unique && p_ptr )
{
write_line(&ptr, a4, a5);
free(ptr);
}
xfclose(a4, a5);
free(a6);
free(v38);
free(v41);
free(v40);
free(v39);
return __readfsqword(0x28u) ^ v53;
}
// B328: using guessed type long merge_buffer_size;
// B7A0: using guessed type long sort_size;
// B7C2: using guessed type char unique;
// B7C8: using guessed type long keylist;
// EE90: using guessed type long xmalloc(_QWORD);
// F078: using guessed type long xnmalloc(_QWORD, _QWORD);
//----- (000000000000720F) ----------------------------------------------------
unsigned long mergefiles(long a1, unsigned long a2, unsigned long a3, FILE *a4, char *a5)
[29199] {
char *v5; // rbx
char *v6; // rax
FILE **v11; // [rsp+38h] [rbp-28h] BYREF
unsigned long v12; // [rsp+40h] [rbp-20h]
unsigned long v13; // [rsp+48h] [rbp-18h]
[29216, 29220, 29224, 29228, 29199, 29232, 29203, 29204, 29207, 29208, 29241, 29212] v13 = __readfsqword(0x28u);
[29251, 29255, 29259, 29262, 29265, 29270, 29245, 29247] v12 = open_input_files(a1, a3, (long *)&v11);
[29282, 29284, 29289, 29274, 29278] if ( v12 < a3 && v12 <= 1 )
{
[29291, 29295, 29299, 29302, 29306, 29309] v5 = *(char **)(16 * v12 + a1);
[29312, 29319] v6 = gettext("open failed");
[29330, 29324, 29327] sort_die(v6, v5);
}
[29347, 29351, 29355, 29359, 29362, 29365, 29335, 29368, 29339, 29343] mergefps(a1, a2, v12, a4, a5, v11);
[29377, 29381, 29390, 29392, 29397, 29373] return v12;
[29401, 29402, 29403] }
//----- (00000000000072DC) ----------------------------------------------------
unsigned char * mergelines(unsigned char **a1, unsigned long a2, unsigned char **a3)
[29404] {
unsigned char *v3; // rdx
unsigned char *result; // rax
unsigned char *v5; // rdx
unsigned char *v6; // rdx
unsigned char *v7; // rdx
unsigned char *v8; // rdx
unsigned char *v9; // rdx
unsigned char **v11; // [rsp+18h] [rbp-28h]
unsigned long v12; // [rsp+28h] [rbp-18h]
long v13; // [rsp+30h] [rbp-10h]
unsigned char **v14; // [rsp+38h] [rbp-8h]
[29408, 29409, 29412, 29416, 29404] v11 = a1;
[29420, 29424, 29428, 29432, 29435] v12 = a2 >> 1;
[29443, 29435, 29447, 29439] v13 = a2 - (a2 >> 1);
[29472, 29451, 29455, 29459, 29462, 29465, 29469] v14 = &a1[-4 * (a2 >> 1)];
do
{
[29505, 29476, 29480, 29484, 29488, 29492, 29495, 29498, 29503] while ( (int)compare(a3 - 4, v14 - 4) <= 0 )
{
[29507] a3 -= 4;
[29512] v11 -= 4;
[29528] v3 = a3[1];
[29521, 29525, 29517, 29532] *v11 = *a3;
[29535] v11[1] = v3;
[29539] result = a3[2];
[29543] v5 = a3[3];
[29547] v11[2] = result;
[29551] v11[3] = v5;
[29560, 29555, 29565, 29567] if ( !--v12 )
[29565] return result;
}
[29569] v14 -= 4;
[29574] v11 -= 4;
[29590] v6 = v14[1];
[29594, 29579, 29587, 29583] *v11 = *v14;
[29597] v11[1] = v6;
[29605] v7 = v14[3];
[29601, 29609] v11[2] = v14[2];
[29613] v11[3] = v7;
[29617] --v13;
}
[29627, 29622] while ( v13 );
do
{
[29633] a3 -= 4;
[29638] v11 -= 4;
[29654] v8 = a3[1];
[29658, 29643, 29651, 29647] *v11 = *a3;
[29661] v11[1] = v8;
[29665] result = a3[2];
[29669] v9 = a3[3];
[29673] v11[2] = result;
[29677] v11[3] = v9;
[29681] --v12;
}
[29691, 29686] while ( v12 );
[29693] return result;
[29694] }
//----- (00000000000073FF) ----------------------------------------------------
unsigned char * sequential_sort(
unsigned char **a1,
unsigned long a2,
unsigned char **a3,
unsigned char a4)
{
unsigned char *result; // rax
unsigned char **v5; // rsi
unsigned char **v6; // rcx
unsigned char *v7; // rdx
unsigned char *v8; // rdx
unsigned char **v9; // rsi
unsigned char **v10; // rcx
unsigned char *v11; // rdx
unsigned char *v12; // rdx
unsigned char **v13; // rsi
unsigned char *v14; // rdx
unsigned char *v15; // rdx
unsigned char **v16; // rsi
unsigned char *v17; // rdx
unsigned char *v18; // rdx
unsigned char **v19; // rsi
unsigned char *v20; // rdx
unsigned char *v21; // rdx
long v23; // rcx
unsigned char **v24; // rsi
unsigned char *v25; // rdx
unsigned char *v26; // rdx
unsigned long v30; // [rsp+40h] [rbp-20h]
if ( a2 == 2 )
{
result = (unsigned char *)((int)compare(a1 - 4, a1 - 8) > 0);
if ( a4 )
{
v5 = &a1[4 * ~(_DWORD)result];
v6 = a3 - 4;
v7 = v5[1];
*v6 = *v5;
v6[1] = v7;
v8 = v5[3];
v6[2] = v5[2];
v6[3] = v8;
v9 = &a1[4 * (int)result - 8];
v10 = a3 - 8;
v11 = v9[1];
*v10 = *v9;
v10[1] = v11;
result = v9[2];
v12 = v9[3];
v10[2] = result;
v10[3] = v12;
}
else if ( (_DWORD)result )
{
v13 = a3 - 4;
v14 = *(a1 - 3);
*v13 = *(a1 - 4);
v13[1] = v14;
v15 = *(a1 - 1);
v13[2] = *(a1 - 2);
v13[3] = v15;
v16 = a1 - 4;
v17 = *(a1 - 7);
*v16 = *(a1 - 8);
v16[1] = v17;
v18 = *(a1 - 5);
v16[2] = *(a1 - 6);
v16[3] = v18;
v19 = a1 - 8;
v20 = *(a3 - 3);
*v19 = *(a3 - 4);
v19[1] = v20;
result = *(a3 - 2);
v21 = *(a3 - 1);
v19[2] = result;
v19[3] = v21;
}
}
else
{
v30 = a2 >> 1;
if ( a4 )
v23 = 0x1FFFFFFFFFFFFFFCLL * v30;
else
v23 = 0LL;
sequential_sort(&a1[-4 * (a2 >> 1)], a2 - (a2 >> 1), &a3[v23], a4);
if ( v30 <= 1 )
{
if ( a4 != 1 )
{
v24 = a3 - 4;
v25 = *(a1 - 3);
*v24 = *(a1 - 4);
v24[1] = v25;
v26 = *(a1 - 1);
v24[2] = *(a1 - 2);
v24[3] = v26;
}
}
else
{
sequential_sort(a1, v30, a3, a4 == 0);
}
if ( a4 )
return mergelines(a3, a2, a1);
else
return mergelines(a1, a2, a3);
}
return result;
}
//----- (000000000000767F) ----------------------------------------------------
long merge_tree_init(unsigned long a1, long a2, long a3)
[30335] {
long v5; // [rsp+28h] [rbp-8h]
[30370, 30339, 30340, 30343, 30375, 30347, 30379, 30351, 30367, 30383, 30355, 30359, 30363, 30335] v5 = xmalloc(a1 << 8);
[30387, 30391] *(_QWORD *)(v5 + 24) = 0LL;
[30407, 30403, 30411, 30399] *(_QWORD *)(v5 + 16) = *(_QWORD *)(v5 + 24);
[30423, 30419, 30427, 30415] *(_QWORD *)(v5 + 8) = *(_QWORD *)(v5 + 16);
[30443, 30435, 30439, 30431] *(_QWORD *)v5 = *(_QWORD *)(v5 + 8);
[30450, 30446] *(_QWORD *)(v5 + 32) = 0LL;
[30458, 30466, 30462] *(_QWORD *)(v5 + 48) = a2;
[30474, 30482, 30470, 30478] *(_QWORD *)(v5 + 40) = *(_QWORD *)(v5 + 48);
[30490, 30486] *(_QWORD *)(v5 + 56) = 0LL;
[30498, 30502] *(_DWORD *)(v5 + 80) = 0;
[30513, 30509] *(_BYTE *)(v5 + 84) = 0;
[30530, 30533, 30517, 30521, 30525] pthread_mutex_init((pthread_mutex_t *)(v5 + 88), 0LL);
[30561, 30565, 30538, 30571, 30542, 30574, 30577, 30549, 30553, 30557] init_node(v5, v5 + 128, a3, a1, a2, 0);
[30586, 30582] return v5;
[30587] }
// EE90: using guessed type long xmalloc(_QWORD);
//----- (000000000000777C) ----------------------------------------------------
void merge_tree_destroy(long a1, char *a2)
[30588] {
long v3; // [rsp+10h] [rbp-10h]
char *i; // [rsp+18h] [rbp-8h]
[30592, 30593, 30596, 30600, 30604, 30608, 30612, 30615, 30588] v3 = 2 * a1;
[30658, 30627, 30662, 30665, 30645, 30650, 30619, 30654, 30623] for ( i = a2; v3--; i += 128 )
[30640, 30633, 30629, 30637] pthread_mutex_destroy((pthread_mutex_t *)(i + 88));
[30679, 30674, 30667, 30671] free(a2);
[30680, 30681] }
//----- (00000000000077DA) ----------------------------------------------------
long init_node(long a1, long a2, long a3, unsigned long a4, long a5, char a6)
[30682] {
unsigned long v6; // rax
long v7; // rax
long inited; // rax
long v12; // [rsp+20h] [rbp-60h]
unsigned long v13; // [rsp+40h] [rbp-40h]
unsigned long v14; // [rsp+48h] [rbp-38h]
long v15; // [rsp+50h] [rbp-30h]
long v16; // [rsp+58h] [rbp-28h]
[30720, 30690, 30714, 30724, 30694, 30698, 30702, 30706, 30710, 30682, 30717, 30686, 30687] if ( a6 )
[30730, 30726, 30734] v6 = *(_QWORD *)(a1 + 40);
else
[30736, 30740] v6 = *(_QWORD *)(a1 + 48);
[30744, 30752, 30755, 30748] v13 = v6 >> 1;
[30763, 30755, 30767, 30759] v14 = v6 - (v6 >> 1);
[30785, 30789, 30792, 30771, 30775, 30779, 30782] v15 = -32 * a5 + a3;
[30817, 30796, 30800, 30804, 30807, 30810, 30814] v16 = -32LL * (v6 >> 1) + v15;
[30825, 30821] if ( a6 )
[30827, 30835, 30831] v7 = a1 + 16;
else
[30841, 30837] v7 = a1 + 24;
[30849, 30860, 30845, 30853] v12 = a2 + 128;
[30864, 30876, 30868, 30872] *(_QWORD *)(a2 + 16) = v15;
[30880, 30892, 30884, 30888] *(_QWORD *)a2 = *(_QWORD *)(a2 + 16);
[30903, 30899, 30895] *(_QWORD *)(a2 + 24) = v16;
[30919, 30907, 30915, 30911] *(_QWORD *)(a2 + 8) = *(_QWORD *)(a2 + 24);
[30923, 30931, 30927] *(_QWORD *)(a2 + 32) = v7;
[30943, 30939, 30935] *(_QWORD *)(a2 + 40) = v13;
[30955, 30947, 30951] *(_QWORD *)(a2 + 48) = v14;
[30963, 30967, 30959] *(_QWORD *)(a2 + 56) = a1;
[30978, 30981, 30985, 30971, 30975] *(_DWORD *)(a2 + 80) = *(_DWORD *)(a1 + 80) + 1;
[30992, 30988] *(_BYTE *)(a2 + 84) = 0;
[31009, 31012, 30996, 31000, 31004] pthread_mutex_init((pthread_mutex_t *)(a2 + 88), 0LL);
[31017, 31022] if ( a4 <= 1 )
{
[31163, 31159] *(_QWORD *)(a2 + 64) = 0LL;
[31171, 31175] *(_QWORD *)(a2 + 72) = 0LL;
}
else
{
[31059, 31051, 31055] *(_QWORD *)(a2 + 64) = v12;
[31075, 31079, 31083, 31089, 31092, 31063, 31095, 31067, 31071] inited = init_node(a2, v12, v15, a4 >> 1, a5, 1);
[31104, 31108, 31112, 31116, 31120, 31100] *(_QWORD *)(a2 + 72) = inited;
[31136, 31043, 31128, 31142, 31047, 31145, 31148, 31153, 31028, 31124, 31157, 31032, 31035, 31132, 31039] return init_node(a2, inited, v16, a4 - (a4 >> 1), a5, 0);
}
[31187, 31183] return v12;
[31188] }
//----- (00000000000079D5) ----------------------------------------------------
_BOOL8 compare_nodes(long a1, long a2)
[31189] {
[31232, 31201, 31235, 31205, 31237, 31209, 31213, 31225, 31217, 31189, 31221, 31193, 31194, 31228, 31197] if ( *(_DWORD *)(a1 + 80) == *(_DWORD *)(a2 + 80) )
[31267, 31287, 31239, 31271, 31243, 31275, 31278, 31247, 31281, 31251, 31284, 31255, 31259, 31263] return *(_QWORD *)(a1 + 40) + *(_QWORD *)(a1 + 48) < *(_QWORD *)(a2 + 40) + *(_QWORD *)(a2 + 48);
else
[31296, 31300, 31303, 31305, 31308, 31289, 31293] return *(_DWORD *)(a1 + 80) < *(_DWORD *)(a2 + 80);
[31312, 31311] }
//----- (0000000000007A51) ----------------------------------------------------
int lock_node(long a1)
[31313] {
[31329, 31333, 31336, 31341, 31342, 31313, 31314, 31317, 31321, 31325] return pthread_mutex_lock((pthread_mutex_t *)(a1 + 88));
[31343] }
//----- (0000000000007A70) ----------------------------------------------------
int unlock_node(long a1)
[31344] {
[31360, 31364, 31367, 31372, 31373, 31344, 31345, 31348, 31352, 31356] return pthread_mutex_unlock((pthread_mutex_t *)(a1 + 88));
[31374] }
//----- (0000000000007A8F) ----------------------------------------------------
int queue_destroy(long a1)
[31375] {
[31395, 31398, 31401, 31375, 31379, 31380, 31383, 31387, 31391] heap_free(*(_QWORD *)a1);
[31417, 31410, 31414, 31406] pthread_cond_destroy((pthread_cond_t *)(a1 + 48));
[31426, 31430, 31433, 31438, 31439, 31422] return pthread_mutex_destroy((pthread_mutex_t *)(a1 + 8));
[31440] }
// F0A0: using guessed type long heap_free(_QWORD);
//----- (0000000000007AD1) ----------------------------------------------------
int queue_init(long a1, long a2)
[31441] {
[31457, 31490, 31461, 31465, 31468, 31471, 31441, 31445, 31446, 31478, 31449, 31483, 31453, 31486] *(_QWORD *)a1 = heap_alloc(compare_nodes, 2 * a2);
[31493, 31497, 31501, 31506, 31509] pthread_mutex_init((pthread_mutex_t *)(a1 + 8), 0LL);
[31522, 31527, 31530, 31535, 31536, 31514, 31518] return pthread_cond_init((pthread_cond_t *)(a1 + 48), 0LL);
[31537] }
// F0B0: using guessed type long heap_alloc(_QWORD, _QWORD);
//----- (0000000000007B32) ----------------------------------------------------
int queue_insert(long a1, long a2)
[31538] {
[31554, 31558, 31562, 31566, 31569, 31538, 31542, 31543, 31546, 31550] pthread_mutex_lock((pthread_mutex_t *)(a1 + 8));
[31585, 31588, 31591, 31574, 31578, 31581] heap_insert(*(_QWORD *)a1, a2);
[31600, 31596] *(_BYTE *)(a2 + 84) = 1;
[31608, 31615, 31604, 31612] pthread_cond_signal((pthread_cond_t *)(a1 + 48));
[31620, 31624, 31628, 31631, 31636, 31637] return pthread_mutex_unlock((pthread_mutex_t *)(a1 + 8));
[31638] }
// F0C0: using guessed type long heap_insert(_QWORD, _QWORD);
//----- (0000000000007B97) ----------------------------------------------------
long queue_pop(long a1)
[31639] {
long v2; // [rsp+18h] [rbp-8h]
[31651, 31655, 31659, 31663, 31671, 31666, 31639, 31643, 31644, 31647] pthread_mutex_lock((pthread_mutex_t *)(a1 + 8));
[31715] while ( 1 )
{
[31715, 31700, 31704, 31707, 31710] v2 = heap_remove_top(*(_QWORD *)a1);
[31724, 31719] if ( v2 )
break;
[31681, 31685, 31689, 31692, 31695, 31673, 31677] pthread_cond_wait((pthread_cond_t *)(a1 + 48), (pthread_mutex_t *)(a1 + 8));
}
[31737, 31730, 31734, 31726] pthread_mutex_unlock((pthread_mutex_t *)(a1 + 8));
[31746, 31749, 31742] lock_node(v2);
[31754, 31758] *(_BYTE *)(v2 + 84) = 0;
[31762, 31766] return v2;
[31767] }
// F0D8: using guessed type long heap_remove_top(_QWORD);
//----- (0000000000007C18) ----------------------------------------------------
char * write_unique(long a1, FILE *a2, char *a3)
[31768] {
char *result; // rax
long v4; // rdx
long v5; // rdx
[31776, 31780, 31784, 31788, 31792, 31799, 31768, 31801, 31772, 31773] if ( !unique )
[31897, 31908, 31885, 31889, 31893, 31801, 31900, 31903] return write_line((void **)a1, a2, a3);
[31810, 31813, 31815, 31819, 31826, 31829, 31834, 31803, 31836] if ( !saved_line
|| (result = (char *)compare((unsigned char **)a1, (unsigned char **)&saved_line), (_DWORD)result) )
[31842, 31845, 31838] {
[31849] v4 = *(_QWORD *)(a1 + 8);
[31856] saved_line = *(_QWORD *)a1;
[31867] qword_B388 = v4;
[31871, 31863] v5 = *(_QWORD *)(a1 + 24);
[31878] qword_B390 = *(_QWORD *)(a1 + 16);
[31897, 31900, 31885, 31903] qword_B398 = v5;
return write_line((void **)a1, a2, a3);
[31911] }
[31912] return result;
}
// B380: using guessed type long saved_line;
// B388: using guessed type long qword_B388;
// B390: using guessed type long qword_B390;
// B398: using guessed type long qword_B398;
// B7C2: using guessed type char unique;
//----- (0000000000007CA9) ----------------------------------------------------
long * mergelines_node(long *a1, unsigned long a2, FILE *a3, char *a4)
[31913] {
_QWORD *v4; // rsi
long v5; // rdx
long v6; // rdx
long v8; // rsi
long v9; // rdx
long v10; // rdx
_QWORD *v12; // rsi
long v13; // rdx
long v14; // rdx
long *result; // rax
unsigned long v22; // [rsp+20h] [rbp-30h]
_QWORD *i; // [rsp+28h] [rbp-28h]
long v24; // [rsp+30h] [rbp-20h]
long v25; // [rsp+38h] [rbp-18h]
long v26; // [rsp+48h] [rbp-8h]
[31937, 31941, 31913, 31945, 31948, 31917, 31918, 31921, 31925, 31929, 31933] v24 = *a1;
[31952, 31956, 31960] v25 = a1[1];
[31968, 31971, 31974, 31976, 31980, 31982, 31985, 31988, 31992, 31964] v22 = (a2 >> (2 * (*((_BYTE *)a1 + 80) + 1))) + 1;
[32000, 32003, 31996, 32006] if ( *((_DWORD *)a1 + 20) <= 1u )
{
[32711, 32715, 32718, 32722, 32726, 32729] while ( *a1 != a1[2] )
{
[32739, 32743, 32747, 32750, 32731, 32735] if ( a1[1] == a1[3] )
break;
[32752, 32756, 32760, 32764, 32767] if ( !v22-- )
break;
[32609, 32580, 32614, 32584, 32616, 32588, 32592, 32596, 32599, 32603, 32606] if ( (int)compare((unsigned char **)(*a1 - 32), (unsigned char **)(a1[1] - 32)) > 0 )
{
[32672, 32676, 32680, 32664, 32668] a1[1] -= 32LL;
[32706, 32684, 32688, 32692, 32696, 32700, 32703] write_unique(a1[1], a3, a4);
}
else
{
[32618, 32622, 32625, 32629, 32633] *a1 -= 32LL;
[32640, 32643, 32647, 32651, 32654, 32657, 32662, 32636] write_unique(*a1, a3, a4);
}
}
[32832, 32802, 32836, 32806, 32838, 32810, 32813, 32816, 32820, 32824, 32828, 32798] if ( (v25 - a1[1]) >> 5 == a1[6] )
{
[32899, 32902, 32884, 32888, 32891, 32895] while ( *a1 != a1[2] )
{
[32904, 32908, 32912, 32916, 32919, 32921] if ( !v22-- )
break;
[32840, 32844, 32847, 32851, 32855] *a1 -= 32LL;
[32865, 32869, 32873, 32876, 32879, 32858, 32862] write_unique(*a1, a3, a4);
}
}
[32931, 32773, 32935, 32777, 32937, 32780, 32784, 32787, 32790, 32794, 32927] else if ( (v24 - *a1) >> 5 == a1[5] )
{
[32994, 32998, 33002, 33005, 32986, 32990] while ( a1[1] != a1[3] )
{
[33007, 33011, 33015, 33019, 33022] if ( !v22-- )
break;
[32939, 32943, 32947, 32951, 32955] a1[1] -= 32LL;
[32963, 32967, 32971, 32975, 32978, 32981, 32959] write_unique(a1[1], a3, a4);
}
}
}
else
{
[32130, 32134, 32012, 32207, 32016, 32210, 32020, 32214, 32023, 32218, 32027, 32221] for ( i = *(_QWORD **)a1[4]; *a1 != a1[2]; i[3] = v6 )
{
[32227, 32231, 32235, 32239, 32242, 32223] if ( a1[1] == a1[3] )
break;
[32256, 32259, 32244, 32248, 32252] if ( !v22-- )
break;
[32032, 32066, 32036, 32068, 32040, 32044, 32048, 32051, 32055, 32058, 32061] if ( (int)compare((unsigned char **)(*a1 - 32), (unsigned char **)(a1[1] - 32)) > 0 )
{
[32136, 32140, 32144, 32148, 32152] a1[1] -= 32LL;
[32160, 32195, 32164, 32199, 32169, 32203, 32173, 32176, 32180, 32183, 32187, 32156, 32191] v4 = (_QWORD *)a1[1];
}
else
{
[32070, 32074, 32077, 32081, 32085] *a1 -= 32LL;
[32088, 32092] v4 = (_QWORD *)*a1;
}
[32095] i -= 4;
[32107] v5 = v4[1];
[32104, 32100, 32111] *i = *v4;
[32114] i[1] = v5;
[32122] v6 = v4[3];
[32126, 32118] i[2] = v4[2];
}
[32320, 32290, 32324, 32294, 32328, 32298, 32330, 32302, 32305, 32308, 32312, 32316] if ( (v25 - a1[1]) >> 5 == a1[6] )
{
[32396, 32400, 32403, 32407, 32411, 32414] while ( *a1 != a1[2] )
{
[32420, 32424, 32428, 32432, 32435, 32437] if ( !v22-- )
break;
[32332, 32336, 32339, 32343, 32347] *a1 -= 32LL;
[32354, 32350] v8 = *a1;
[32357] i -= 4;
[32369, 32354] v9 = *(_QWORD *)(*a1 + 8);
[32354, 32366, 32373, 32362] *i = *(_QWORD *)*a1;
[32376] i[1] = v9;
[32384] v10 = *(_QWORD *)(v8 + 24);
[32388, 32380] i[2] = *(_QWORD *)(v8 + 16);
[32392] i[3] = v10;
}
}
[32451, 32453, 32265, 32269, 32272, 32276, 32279, 32282, 32443, 32286, 32447] else if ( (v24 - *a1) >> 5 == a1[5] )
{
[32522, 32526, 32530, 32534, 32538, 32541] while ( a1[1] != a1[3] )
{
[32547, 32551, 32555, 32558, 32543] if ( !v22-- )
break;
[32455, 32459, 32463, 32467, 32471] a1[1] -= 32LL;
[32475, 32479] v12 = (_QWORD *)a1[1];
[32483] i -= 4;
[32495] v13 = v12[1];
[32488, 32499, 32492] *i = *v12;
[32502] i[1] = v13;
[32510] v14 = v12[3];
[32506, 32514] i[2] = v12[2];
[32518] i[3] = v14;
}
}
[32560, 32564, 32568, 32572, 32575] *(_QWORD *)a1[4] = i;
}
[33057, 33090, 33061, 33064, 33067, 33071, 33075, 33079, 33049, 33083, 33053, 33087] v26 = (v25 - a1[1]) >> 5;
[33024, 33028, 33094, 33031, 33035, 33038, 33041, 33045] a1[5] -= (v24 - *a1) >> 5;
[33113] result = a1;
[33098, 33102, 33106, 33110, 33117] a1[6] -= v26;
[33121, 33122] return result;
[33123] }
//----- (0000000000008164) ----------------------------------------------------
int queue_check_insert(long a1, long a2)
[33124] {
int result; // eax
bool v3; // al
bool v4; // al
[33152, 33155, 33124, 33157, 33128, 33129, 33132, 33136, 33140, 33144, 33148] result = *(unsigned char *)(a2 + 84) ^ 1;
[33152, 33148] if ( *(_BYTE *)(a2 + 84) != 1 )
{
[33216, 33163, 33167, 33170, 33203, 33174, 33206, 33209, 33212] if ( *(_QWORD *)a2 == *(_QWORD *)(a2 + 16) )
{
[33184, 33280, 33187, 33254, 33191, 33258, 33195, 33260, 33199, 33264, 33268, 33271, 33273, 33178, 33181, 33278] v4 = *(_QWORD *)(a2 + 8) != *(_QWORD *)(a2 + 24) && !*(_QWORD *)(a2 + 40);
[33285] result = v4;
}
else
{
[33218, 33222, 33191, 33224, 33228, 33199, 33232, 33235, 33237, 33242, 33244] v3 = *(_QWORD *)(a2 + 8) != *(_QWORD *)(a2 + 24) || !*(_QWORD *)(a2 + 48);
[33249, 33252] result = v3;
}
[33288, 33290] if ( (_BYTE)result )
[33292, 33296, 33300, 33303, 33306] return queue_insert(a1, a2);
}
[33312, 33311] return result;
[33313] }
//----- (0000000000008222) ----------------------------------------------------
int queue_check_insert_parent(long a1, long a2)
[33314] {
long v2; // rax
[33344, 33314, 33318, 33319, 33322, 33326, 33330, 33334, 33338, 33341] if ( *(_DWORD *)(a2 + 80) <= 1u )
{
[33411, 33415, 33419, 33403, 33407] v2 = *(_QWORD *)(a2 + 40) + *(_QWORD *)(a2 + 48);
[33425, 33422] if ( !v2 )
[33442, 33445, 33427, 33431, 33435, 33439] LODWORD(v2) = queue_insert(a1, *(_QWORD *)(a2 + 56));
}
else
{
[33346, 33357, 33354, 33350] lock_node(*(_QWORD *)(a2 + 56));
[33377, 33380, 33362, 33366, 33370, 33374] queue_check_insert(a1, *(_QWORD *)(a2 + 56));
[33385, 33389, 33393, 33396, 33401] LODWORD(v2) = unlock_node(*(_QWORD *)(a2 + 56));
}
[33450, 33451] return v2;
[33452] }
//----- (00000000000082AD) ----------------------------------------------------
int merge_loop(long a1, unsigned long a2, FILE *a3, char *a4)
[33453] {
long v7; // [rsp+28h] [rbp-8h]
[33473, 33477, 33453, 33457, 33458, 33461, 33493, 33465, 33469] while ( 1 )
{
[33488, 33481, 33485, 33493] v7 = queue_pop(a1);
[33504, 33497, 33506, 33501] if ( !*(_DWORD *)(v7 + 80) )
break;
[33541, 33545, 33549, 33553, 33557, 33560] mergelines_node((long *)v7, a2, a3, a4);
[33569, 33573, 33576, 33579, 33565] queue_check_insert(a1, v7);
[33584, 33588, 33592, 33595, 33598] queue_check_insert_parent(a1, v7);
[33610, 33603, 33615, 33607] unlock_node(v7);
}
[33512, 33515, 33508] unlock_node(v7);
[33539, 33520, 33524, 33621, 33528, 33531, 33534] return queue_insert(a1, v7);
[33622] }
//----- (0000000000008357) ----------------------------------------------------
void * sortlines_thread(unsigned char ***a1)
[33623] {
[33667, 33671, 33675, 33679, 33683, 33687, 33691, 33695, 33699, 33702, 33706, 33707, 33710, 33623, 33627, 33628, 33631, 33635, 33639, 33643, 33647, 33651, 33655, 33659, 33663] sortlines(
[33715, 33724, 33719] *a1,
[33725] (unsigned long)a1[1],
(unsigned long)a1[2],
(unsigned char ***)a1[3],
(long)a1[4],
(FILE *)a1[5],
(char *)a1[6]);
return 0LL;
}
//----- (00000000000083BE) ----------------------------------------------------
unsigned long sortlines(
unsigned char **a1,
unsigned long a2,
unsigned long a3,
unsigned char ***a4,
long a5,
FILE *a6,
char *a7)
{
pthread_t newthread; // [rsp+48h] [rbp-78h] BYREF
unsigned long v13; // [rsp+50h] [rbp-70h]
unsigned long v14; // [rsp+58h] [rbp-68h]
unsigned long v15; // [rsp+60h] [rbp-60h]
unsigned long v16; // [rsp+68h] [rbp-58h]
unsigned long v17; // [rsp+70h] [rbp-50h]
unsigned char **v18; // [rsp+78h] [rbp-48h]
long arg[7]; // [rsp+80h] [rbp-40h] BYREF
unsigned long v20; // [rsp+B8h] [rbp-8h]
v20 = __readfsqword(0x28u);
v13 = (unsigned long)a4[6] + (_QWORD)a4[5];
v14 = a2 >> 1;
v15 = a2 - (a2 >> 1);
arg[0] = (long)a1;
arg[1] = a2 >> 1;
arg[2] = a3;
arg[3] = (long)a4[8];
arg[4] = a5;
arg[5] = (long)a6;
arg[6] = (long)a7;
if ( a2 <= 1 || v13 <= 0x1FFFF || pthread_create(&newthread, 0LL, (void *(*)(void *))sortlines_thread, arg) )
{
v16 = (unsigned long)a4[5];
v17 = (unsigned long)a4[6];
v18 = &a1[-4 * a3];
if ( v17 > 1 )
sequential_sort(&a1[-4 * v16], v17, &v18[-4 * (v16 >> 1)], 0);
if ( v16 > 1 )
sequential_sort(a1, v16, v18, 0);
*a4 = a1;
a4[1] = &a1[-4 * v16];
a4[2] = &a1[-4 * v16];
a4[3] = (unsigned char **)((char *)a1 - 32 * v16 - 32 * v17);
queue_insert(a5, (long)a4);
merge_loop(a5, a3, a6, a7);
}
else
{
sortlines(&a1[-4 * (_QWORD)a4[5]], v15, a3, (unsigned char ***)a4[9], a5, a6, a7);
pthread_join(newthread, 0LL);
}
return __readfsqword(0x28u) ^ v20;
}
//----- (00000000000086D0) ----------------------------------------------------
unsigned long avoid_trashing_input(long a1, unsigned long a2, unsigned long a3, const char *a4)
[34512] {
char v4; // al
char v8; // [rsp+2Eh] [rbp-C2h]
bool v9; // [rsp+2Fh] [rbp-C1h]
FILE *v10; // [rsp+30h] [rbp-C0h] BYREF
long *v11; // [rsp+38h] [rbp-B8h]
unsigned long i; // [rsp+40h] [rbp-B0h]
struct stat *outstatus; // [rsp+48h] [rbp-A8h]
struct stat v14; // [rsp+50h] [rbp-A0h] BYREF
unsigned long v15; // [rsp+E8h] [rbp-8h]
[34564, 34534, 34541, 34512, 34516, 34517, 34548, 34520, 34555, 34527] v15 = __readfsqword(0x28u);
[34568, 34570] v11 = 0LL;
[34595, 35108, 35120, 34581, 35100, 35127, 34588, 35133, 35134] for ( i = a2; i < a3; ++i )
{
[34624, 34627, 34600, 34634, 34637, 34607, 34642, 34611, 34644, 34614, 34647, 34621] v9 = strcmp(*(const char **)(16 * i + a1), "-") == 0;
[34690, 34722, 34724, 34661, 34663, 34697, 34700, 34670, 34703, 34674, 34708, 34677, 34710, 34712, 34719, 34684, 34653, 34687] if ( a4 && !strcmp(a4, *(const char **)(16 * i + a1)) && !v9 )
{
[34726] v8 = 1;
[34733] goto LABEL_16;
}
[34738, 34743] outstatus = get_outstatus();
[34758, 34750] if ( !outstatus )
[35138, 35147, 35149, 34758] return __readfsqword(0x28u) ^ v15;
[34771, 34764] if ( v9 )
{
[34788, 34793, 34795, 34797, 34773, 34780, 34783] if ( fstat(0, &v14) )
goto LABEL_14;
}
[34820, 34823, 34826, 34799, 34833, 34836, 34806, 34839, 34810, 34844, 34813, 34846] else if ( stat(*(const char **)(16 * i + a1), &v14) )
{
goto LABEL_14;
}
[34848, 34885, 34855, 34888, 34891, 34862, 34866, 34869, 34871, 34878] if ( v14.st_ino != outstatus->st_ino || v14.st_dev != outstatus->st_dev )
{
LABEL_14:
[34900] v4 = 0;
goto LABEL_15;
}
[34898, 34893] v4 = 1;
LABEL_15:
[34905, 34911] v8 = v4;
LABEL_16:
[34925, 34918] if ( v8 )
{
[34939, 34931] if ( !v11 )
{
[34956, 34948, 34941, 34951] v11 = create_temp(&v10);
[35009, 35012, 34981, 35002, 35017, 34988, 35022, 34991, 34963, 34995, 34970, 35006, 34974] mergefiles(16 * i + a1, 0LL, 1uLL, v10, (char *)v11 + 13);
}
[35041, 35048, 35051, 35058, 35027, 35062, 35034, 35038] *(_QWORD *)(16 * i + a1) = (char *)v11 + 13;
[35072, 35076, 35079, 35086, 35089, 35096, 35065] *(_QWORD *)(a1 + 16 * i + 8) = v11;
}
}
[35138, 35154] return __readfsqword(0x28u) ^ v15;
[35155] }
// 885F: masking with 0x1 was optimized away because al.1 <= 0x1
//----- (0000000000008954) ----------------------------------------------------
unsigned long check_inputs(long a1, unsigned long a2)
[35156] {
char *v2; // rbx
char *v3; // rax
unsigned long result; // rax
unsigned long i; // [rsp+18h] [rbp-18h]
[35169, 35173, 35177, 35185, 35156, 35318, 35160, 35161, 35164, 35165] for ( i = 0LL; ; ++i )
{
[35323] result = i;
[35331, 35327] if ( i >= a2 )
break;
[35202, 35206, 35209, 35212, 35219, 35190, 35222, 35194, 35227, 35229] if ( strcmp(*(const char **)(8 * i + a1), "-") )
{
[35266, 35235, 35268, 35243, 35247, 35250, 35253, 35258, 35261, 35231] if ( euidaccess(*(const char **)(8 * i + a1), 4) )
{
[35270, 35274, 35282, 35286, 35289] v2 = *(char **)(8 * i + a1);
[35299, 35292] v3 = gettext("cannot read");
[35304, 35307, 35310] sort_die(v3, v2);
}
}
}
[35337, 35338, 35339] return result;
[35344, 35345, 35343] }
//----- (0000000000008A12) ----------------------------------------------------
void check_output(char *a1)
[35346] {
char *v1; // rax
int v2; // [rsp+1Ch] [rbp-4h]
[35362, 35367, 35346, 35350, 35351, 35354, 35358] if ( a1 )
{
[35393, 35398, 35369, 35403, 35376, 35379, 35383, 35388, 35390] v2 = open(a1, 524353, 438LL);
[35410, 35406] if ( v2 < 0 )
{
[35419, 35412] v1 = gettext("open failed");
[35424, 35427, 35431, 35434, 35437] sort_die(v1, a1);
}
[35457, 35442, 35445, 35450, 35452] move_fd(v2, 1);
}
[35458, 35459] }
//----- (0000000000008A84) ----------------------------------------------------
unsigned long merge(_QWORD *a1, unsigned long a2, unsigned long a3, char *a4)
[35460] {
unsigned long v4; // rax
unsigned long v5; // rax
unsigned long v6; // rax
unsigned long v7; // rax
long v8; // rax
char *v10; // rax
char *v11; // rbx
char *v12; // rax
unsigned long v13; // rax
unsigned long v14; // rax
long v18; // [rsp+10h] [rbp-A0h]
FILE **v19; // [rsp+28h] [rbp-88h] BYREF
FILE *v20; // [rsp+30h] [rbp-80h] BYREF
long v21; // [rsp+38h] [rbp-78h]
unsigned long v22; // [rsp+40h] [rbp-70h]
unsigned long v23; // [rsp+48h] [rbp-68h]
FILE *v24; // [rsp+50h] [rbp-60h]
long *v25; // [rsp+58h] [rbp-58h]
long v26; // [rsp+60h] [rbp-50h]
unsigned long v27; // [rsp+68h] [rbp-48h]
unsigned long v28; // [rsp+70h] [rbp-40h]
long *v29; // [rsp+78h] [rbp-38h]
unsigned long v30; // [rsp+80h] [rbp-30h]
long *v31; // [rsp+88h] [rbp-28h]
unsigned long v32; // [rsp+90h] [rbp-20h]
unsigned long v33; // [rsp+98h] [rbp-18h]
[35490, 35460, 35464, 35465, 35497, 35468, 35469, 35504, 35476, 35513, 35483, 35517, 35519] v33 = __readfsqword(0x28u);
[36143, 36141, 36150, 36135] while ( a3 > (unsigned int)nmerge )
{
[35524] v21 = 0LL;
[35536, 35540, 35532] v22 = 0LL;
[35748, 35750, 35757, 35761, 35764, 35742] while ( (unsigned int)nmerge <= a3 - v21 )
{
[35552, 35545, 35557, 35549] v31 = create_temp(&v20);
[35588, 35569, 35573, 35579, 35582] v4 = (unsigned int)nmerge;
[35609, 35605, 35588, 35597] if ( a2 <= (unsigned int)nmerge )
[35597, 35590] v4 = a2;
[35616, 35623, 35561, 35627, 35565, 35630, 35633, 35636, 35641, 35612] v32 = mergefiles((long)&a1[2 * v21], v4, (unsigned int)nmerge, v20, (char *)v31 + 13);
[35645] v5 = a2;
[35656] if ( v32 <= a2 )
[35656, 35652] v5 = v32;
[35661] a2 -= v5;
[35686, 35689, 35693, 35697, 35668, 35672, 35676, 35679] a1[2 * v22] = (char *)v31 + 13;
[35718, 35721, 35725, 35700, 35704, 35708, 35711] a1[2 * v22 + 1] = v31;
[35729, 35733] v21 += v32;
[35737] ++v22;
}
[35777, 35770, 35781] v26 = a3 - v21;
[35810, 35813, 35816, 35785, 35819, 35822, 35791, 35793, 35799, 35801, 35805] v27 = (unsigned int)nmerge - v22 % (unsigned int)nmerge;
[35826, 35834, 35781, 35830] if ( v27 < a3 - v21 )
{
[35840, 35848, 35844, 35852] v28 = v26 - v27 + 1;
[35856, 35860, 35868, 35863] v29 = create_temp(&v20);
[35884] v6 = a2;
[35904, 35900, 35895] if ( v28 <= a2 )
[35891, 35895] v6 = v28;
[35872, 35907, 35876, 35911, 35880, 35918, 35922, 35926, 35929, 35934] v30 = mergefiles((long)&a1[2 * v21], v6, v28, v20, (char *)v29 + 13);
[35938] v7 = a2;
[35949] if ( v30 <= a2 )
[35945, 35949] v7 = v30;
[35954] a2 -= v7;
[35969, 35972, 35979, 35982, 35986, 35990, 35961, 35965] a1[2 * v22] = (char *)v29 + 13;
[35993] v8 = v22++;
[36001, 36005, 36009, 36012, 36019, 36022, 36026, 35997] a1[2 * v8 + 1] = v29;
[36034, 36030] v21 += v30;
}
[36064, 36088, 36098, 36067, 36101, 36038, 36104, 36074, 36045, 36077, 36049, 36081, 36053, 36085, 36056, 36060, 36095] memmove(&a1[2 * v22], &a1[2 * v21], 16 * (a3 - v21));
[36113, 36109] a2 += v22;
[36120, 36128, 36124] a3 += v22 - v21;
}
[36163, 36170, 36177, 36184, 36187, 36156] avoid_trashing_input((long)a1, a2, a3, a4);
[36224] while ( 1 )
{
[36192, 36224, 36199, 36206, 36213, 36216, 36219] v23 = open_input_files((long)a1, a3, (long *)&v19);
[36232, 36228, 36239] if ( v23 == a3 )
break;
[36416, 36411] if ( v23 <= 2 )
{
[36418, 36422, 36426, 36429, 36436, 36439] v11 = (char *)a1[2 * v23];
[36449, 36442] v12 = gettext("open failed");
[36457, 36460, 36454] sort_die(v12, v11);
}
do
{
LABEL_26:
[36465] --v23;
[36512, 36481, 36515, 36518, 36488, 36521, 36491, 36494, 36501, 36470, 36505, 36474, 36509, 36478] xfclose(v19[v23], (char *)a1[2 * v23]);
[36546, 36551, 36526, 36531, 36534, 36537, 36541, 36543] v25 = maybe_create_temp(&v20, v23 > 2);
}
[36560, 36555] while ( !v25 );
[36581] v13 = a2;
[36592] if ( v23 <= a2 )
[36592, 36588] v13 = v23;
[36577, 36611, 36614, 36617, 36562, 36597, 36600, 36569, 36604, 36573] mergefps((long)a1, v13, v23, v20, (char *)v25 + 13, v19);
[36622] v14 = a2;
[36633] if ( v23 <= a2 )
[36633, 36629] v14 = v23;
[36638] v18 = a2 - v14;
[36649, 36653, 36660, 36645] *a1 = (char *)v25 + 13;
[36674, 36670, 36663] a1[1] = v25;
[36704, 36707, 36678, 36714, 36685, 36717, 36689, 36724, 36693, 36728, 36696, 36731, 36700, 36734] memmove(a1 + 2, &a1[2 * v23], 16 * (a3 - v23));
[36739] a2 = v18 + 1;
[36769, 36747, 36754, 36758, 36762] a3 = a3 - v23 + 1;
}
[36259, 36262, 36267, 36245, 36252] v24 = stream_open(a4, "w");
[36276, 36271] if ( !v24 )
{
[36357, 36362, 36364, 36367, 36369, 36374] if ( *_errno_location() != 24 || v23 <= 2 )
{
[36376, 36383] v10 = gettext("open failed");
[36388, 36391, 36398, 36401, 36404] sort_die(v10, a4);
}
goto LABEL_26;
}
[36317, 36320, 36323, 36292, 36326, 36296, 36303, 36278, 36310, 36285] mergefps((long)a1, a2, a3, v24, a4, v19);
[36352, 36331, 36332, 36333, 36779, 36337, 36346] return __readfsqword(0x28u) ^ v33;
[36786, 36787, 36788] }
// B334: using guessed type int nmerge;
//----- (0000000000008FB5) ----------------------------------------------------
unsigned long sort(char **a1, unsigned long a2, char *a3, unsigned long a4)
[36789] {
long v4; // rax
char v10; // [rsp+27h] [rbp-119h]
FILE *v11; // [rsp+28h] [rbp-118h] BYREF
FILE *v12; // [rsp+30h] [rbp-110h] BYREF
unsigned long v13; // [rsp+38h] [rbp-108h]
char *v14; // [rsp+40h] [rbp-100h]
long v15; // [rsp+48h] [rbp-F8h]
unsigned long v16; // [rsp+50h] [rbp-F0h]
long v17; // [rsp+58h] [rbp-E8h]
long *v18; // [rsp+60h] [rbp-E0h]
long v19; // [rsp+68h] [rbp-D8h]
char *v20; // [rsp+70h] [rbp-D0h]
unsigned char **v21; // [rsp+78h] [rbp-C8h]
unsigned char ***v22; // [rsp+80h] [rbp-C0h]
void *v23; // [rsp+88h] [rbp-B8h]
void *ptr; // [rsp+90h] [rbp-B0h] BYREF
long v25; // [rsp+98h] [rbp-A8h]
unsigned long v26; // [rsp+A0h] [rbp-A0h]
long v27; // [rsp+A8h] [rbp-98h]
long v28; // [rsp+B0h] [rbp-90h]
char v29; // [rsp+C0h] [rbp-80h]
char v30[104]; // [rsp+D0h] [rbp-70h] BYREF
unsigned long v31; // [rsp+138h] [rbp-8h]
[36832, 36804, 36841, 36811, 36818, 36789, 36793, 36794, 36825, 36797] v31 = __readfsqword(0x28u);
[36845, 36847] v13 = 0LL;
[36858] v10 = 0;
[36865, 36876] v27 = 0LL;
[37747, 37733, 37741] while ( a2 )
{
[36888, 36881, 36891] v20 = *a1;
[36898, 36905, 36912, 36915, 36920] v11 = xfopen(v20, "r");
[36935, 36927] if ( a4 <= 1 )
{
[37012] v15 = 48LL;
}
else
{
[36937] v16 = 1LL;
[36948, 36959] v17 = 1LL;
[36976, 36990, 36983] while ( v16 < a4 )
{
[36961] v16 *= 2LL;
[36968] ++v17;
}
[36992, 37010, 37003, 36999] v15 = 32 * v17;
}
[37033, 37030, 37023] if ( !v27 )
{
[37056, 37063, 37066, 37035, 37071, 37042, 37074, 37049] v4 = sort_buffer_size((long)&v11, 1uLL, (long)a1, a2, v15);
[37089, 37096, 37099, 37102, 37079, 37082] initbuf((long)&ptr, v15, v4);
}
[37107] v29 = 0;
[37111] ++a1;
[37127, 37119] --a2;
[37668, 37700, 37702, 37675, 37682, 37689, 37692, 37695] while ( (unsigned char)fillbuf(&ptr, v11, v20) )
{
[37185, 37157, 37161, 37193, 37132, 37196, 37199, 37136, 37168, 37138, 37202, 37140, 37175, 37178, 37148, 37150] if ( v29 && a2 && v15 + 1 < v27 - v25 - v15 * v26 )
{
[37211, 37204] v28 = v25;
[37218] break;
}
[37223] saved_line = 0LL;
[37241, 37234, 37244, 37249] v21 = (unsigned char **)buffer_linelim(&ptr);
[37282, 37284, 37256, 37291, 37260, 37262, 37294, 37264, 37272, 37274] if ( !v29 || a2 || v13 || v28 )
{
[37373] ++v13;
[37381, 37388, 37391, 37396, 37400] v14 = (char *)create_temp(&v12) + 13;
}
else
{
[37313, 37316, 37296, 37303, 37310] xfclose(v11, v20);
[37321, 37328, 37335, 37338, 37343] v12 = xfopen(a3, "w");
[37357, 37350] v14 = a3;
[37371, 37364] v10 = 1;
}
[37418, 37414, 37407] if ( v26 <= 1 )
{
[37605, 37612, 37616, 37623, 37626, 37629, 37598] write_unique((long)(v21 - 4), v12, v14);
}
else
{
[37441, 37424, 37431, 37435, 37438] queue_init((long)v30, a4);
[37473, 37446, 37478, 37453, 37460, 37467, 37470] v22 = (unsigned char ***)merge_tree_init(a4, v26, (long)v21);
[37506, 37541, 37544, 37513, 37547, 37485, 37517, 37550, 37492, 37524, 37499, 37531, 37535] sortlines(v21, a4, v26, v22 + 16, (long)v30, v12, v14);
[37573, 37576, 37579, 37555, 37559, 37566] merge_tree_destroy(a4, (char *)v22);
[37584, 37596, 37588, 37591] queue_destroy((long)v30);
}
[37634, 37641, 37648, 37651, 37654] xfclose(v12, v14);
[37666, 37659] if ( v10 )
goto LABEL_28;
}
[37728, 37708, 37715, 37722, 37725] xfclose(v11, v20);
}
LABEL_28:
[37760, 37757, 37750] free(ptr);
[37777, 37772, 37765, 37775] if ( v10 != 1 )
{
[37790, 37783] v18 = (long *)temphead;
[37797, 37804, 37809, 37812, 37817] v23 = (void *)xnmalloc(v13, 16LL);
[37824, 37835] v19 = 0LL;
[37943, 37935] while ( v18 )
{
[37858, 37861, 37868, 37837, 37872, 37844, 37848, 37851] *((_QWORD *)v23 + 2 * v19) = (char *)v18 + 13;
[37889, 37896, 37899, 37906, 37875, 37882, 37886] *((_QWORD *)v23 + 2 * v19 + 1) = v18;
[37920, 37917, 37910] v18 = (long *)*v18;
[37927] ++v19;
}
[37952, 37959, 37966, 37973, 37976, 37945] merge(v23, v13, v13, a3);
[37988, 37981, 37991] free(v23);
}
[37996] reap_all();
[38017, 38022, 38001, 38002, 38006, 38015] return __readfsqword(0x28u) ^ v31;
[38023] }
// B380: using guessed type long saved_line;
// B860: using guessed type long temphead;
// F078: using guessed type long xnmalloc(_QWORD, _QWORD);
//----- (0000000000009488) ----------------------------------------------------
long insertkey(long a1)
[38024] {
long result; // rax
long *i; // [rsp+10h] [rbp-10h]
long v3; // [rsp+18h] [rbp-8h]
[38049, 38052, 38024, 38057, 38028, 38029, 38032, 38036, 38040, 38044] v3 = xmemdup(a1, 72LL);
[38081, 38085, 38089, 38061, 38093, 38096, 38099, 38068, 38072, 38078] for ( i = &keylist; *i; i = (long *)(*i + 64) )
;
[38109, 38105, 38101] *i = v3;
[38112] result = v3;
[38116] *(_QWORD *)(v3 + 64) = 0LL;
[38124, 38125] return result;
[38126] }
// B7C8: using guessed type long keylist;
// F0F8: using guessed type long xmemdup(_QWORD, _QWORD);
//----- (00000000000094EF) ----------------------------------------------------
unsigned long badfieldspec(long a1, const char *a2)
[38127] {
long v2; // r12
char *v3; // rbx
char *v4; // rax
[38146, 38150, 38154, 38157, 38127, 38162, 38131, 38132, 38135, 38137, 38138, 38142] v2 = quote(a1);
[38169, 38172, 38165, 38177] v3 = gettext(a2);
[38187, 38180] v4 = gettext("%s: invalid field specification %s");
[38211, 38216, 38192, 38195, 38198, 38201, 38206] error(2, 0, v4, v3, v2);
[38217] return incompatible_options(2LL);
}
// EF68: using guessed type long quote(_QWORD);
//----- (000000000000954D) ----------------------------------------------------
unsigned long incompatible_options(long a1)
[38221] {
char *v1; // rax
[38244, 38221, 38225, 38226, 38229, 38233, 38237] v1 = gettext("options '-%s' are incompatible");
[38274, 38249, 38252, 38256, 38259, 38264, 38269] error(2, 0, v1, a1);
[38275] return check_ordering_compatibility();
}
//----- (0000000000009587) ----------------------------------------------------
unsigned long check_ordering_compatibility()
[38279] {
long i; // [rsp+8h] [rbp-38h]
char v2[40]; // [rsp+10h] [rbp-30h] BYREF
unsigned long v3; // [rsp+38h] [rbp-8h]
[38279, 38283, 38284, 38287, 38291, 38300] v3 = __readfsqword(0x28u);
[38304, 38497, 38306, 38501, 38313, 38506, 38317, 38493] for ( i = keylist; i; i = *(_QWORD *)(i + 64) )
{
[38402, 38405, 38408, 38411, 38413, 38415, 38418, 38322, 38326, 38330, 38333, 38337, 38341, 38344, 38346, 38350, 38354, 38357, 38359, 38363, 38367, 38370, 38373, 38377, 38381, 38385, 38389, 38391, 38394, 38398] if ( *(unsigned char *)(i + 53)
+ *(unsigned char *)(i + 52)
+ *(unsigned char *)(i + 50)
+ *(unsigned char *)(i + 54)
+ ((unsigned char)(*(_BYTE *)(i + 56) | *(_BYTE *)(i + 51)) | (*(_QWORD *)(i + 32) != 0LL)) > 1 )
{
[38424, 38420] *(_BYTE *)(i + 55) = 0;
[38432, 38440, 38428, 38436] *(_BYTE *)(i + 49) = *(_BYTE *)(i + 55);
[38451, 38443, 38455, 38447] *(_BYTE *)(i + 48) = *(_BYTE *)(i + 49);
[38466, 38469, 38472, 38458, 38462] key_to_opts(i, v2);
[38489, 38481, 38484, 38477] incompatible_options((long)v2);
}
}
[38528, 38533, 38512, 38513, 38517, 38526] return __readfsqword(0x28u) ^ v3;
[38534] }
// B7C8: using guessed type long keylist;
//----- (0000000000009687) ----------------------------------------------------
long parse_field_count(long a1, _QWORD *a2, const char *a3)
[38535] {
long v3; // r12
char *v4; // rbx
char *v5; // rax
long v8; // [rsp+28h] [rbp-28h] BYREF
long v9[4]; // [rsp+30h] [rbp-20h] BYREF
[38535, 38539, 38540, 38543, 38545, 38546, 38550, 38554, 38558, 38562, 38571, 38575, 38577, 38581, 38585, 38589, 38596, 38599, 38604, 38607] v9[1] = __readfsqword(0x28u);
[38631, 38653, 38638, 38641, 38643, 38612, 38615, 38650, 38621, 38623] switch ( (unsigned int)xstrtoumax(a1, &v8, 10LL, v9, locale) )
{
case 0u:
case 2u:
[38656, 38664, 38660] *a2 = v9[0];
[38681, 38667, 38671] if ( *a2 == v9[0] )
[38786, 38790, 38799, 38801, 38674, 38678, 38681, 38782] return v8;
goto LABEL_3;
case 1u:
case 3u:
LABEL_3:
[38683, 38687] *a2 = -1LL;
[38782, 38694] return v8;
case 4u:
[38696, 38701] if ( a3 )
{
[38715, 38707, 38710, 38703] v3 = quote(a1);
[38722, 38725, 38718, 38730] v4 = gettext(a3);
[38740, 38733] v5 = gettext("%s: invalid count at start of %s");
[38754, 38759, 38764, 38769, 38745, 38748, 38751] error(2, 0, v5, v4, v3);
}
[38779, 38774] return 0LL;
default:
[38782] return v8;
}
[38806, 38810, 38811, 38813, 38814] }
// EF58: using guessed type long xstrtoumax(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// EF68: using guessed type long quote(_QWORD);
//----- (000000000000979F) ----------------------------------------------------
int sighandler(int a1)
[38815] {
[38819, 38820, 38823, 38827, 38830, 38815] cleanup();
[38835, 38843, 38838, 38845] signal(a1, 0LL);
[38850, 38853, 38855, 38860, 38861] return raise(a1);
[38862] }
//----- (00000000000097CF) ----------------------------------------------------
_BYTE * set_ordering(_BYTE *a1, long a2, int a3)
[38863] {
[38882, 39146, 39149, 38863, 39151, 38867, 38868, 38871, 38875, 38879] while ( 2 )
{
[39146, 39142] if ( *a1 )
{
[38887, 38919, 38891, 38894, 38926, 38897, 38929, 38931, 38900, 38941, 38903, 38938, 38909, 38911] switch ( *a1 )
{
case 'M':
[39081, 39077] *(_BYTE *)(a2 + 54) = 1;
[39085] goto LABEL_21;
case 'R':
[39097, 39101] *(_BYTE *)(a2 + 51) = 1;
[39105] goto LABEL_21;
case 'V':
[39121, 39117] *(_BYTE *)(a2 + 56) = 1;
[39125] goto LABEL_21;
case 'b':
[38944, 38954, 38948, 38950] if ( !a3 || a3 == 2 )
[38960, 38956] *(_BYTE *)(a2 + 48) = 1;
[38968, 38970, 38964, 38974] if ( a3 == 1 || a3 == 2 )
[38984, 38980] *(_BYTE *)(a2 + 49) = 1;
[38988] goto LABEL_21;
case 'd':
[38993, 39004, 38997] *(_QWORD *)(a2 + 32) = nondictionary;
[39008] goto LABEL_21;
case 'f':
[39010, 39021, 39014] *(_QWORD *)(a2 + 40) = fold_toupper;
[39025] goto LABEL_21;
case 'g':
[39027, 39031] *(_BYTE *)(a2 + 52) = 1;
[39035] goto LABEL_21;
case 'h':
[39041, 39037] *(_BYTE *)(a2 + 53) = 1;
[39045] goto LABEL_21;
case 'i':
[39055, 39058, 39051, 39047] if ( !*(_QWORD *)(a2 + 32) )
[39064, 39060, 39071] *(_QWORD *)(a2 + 32) = nonprinting;
[39075] goto LABEL_21;
case 'n':
[39091, 39087] *(_BYTE *)(a2 + 50) = 1;
[39095] goto LABEL_21;
case 'r':
[39107, 39115, 39111] *(_BYTE *)(a2 + 55) = 1;
LABEL_21:
[39137] ++a1;
continue;
default:
[39131, 39127] return a1;
}
}
[39161, 39157] return a1;
}
[39162] }
// B4A0: using guessed type _BYTE nonprinting[256];
// B5A0: using guessed type _BYTE nondictionary[256];
// B6A0: using guessed type _BYTE fold_toupper[256];
//----- (00000000000098FB) ----------------------------------------------------
_QWORD * key_init(_QWORD *a1)
[39163] {
[39168, 39171, 39175, 39179, 39183, 39188, 39193, 39163, 39196, 39167] memset(a1, 0, 0x48uLL);
[39201, 39205] a1[2] = -1LL;
[39217, 39213] return a1;
[39218] }
//----- (0000000000009933) ----------------------------------------------------
int main(int argc, const char **argv, const char **envp)
[39219] {
bool v3; // al
int v4; // eax
const char **v5; // rcx
unsigned long v6; // rax
bool v7; // al
_BOOL4 v8; // eax
_BOOL4 v9; // edx
int v10; // eax
unsigned long v11; // rax
int v12; // eax
char *v13; // rax
long v15; // rax
long v16; // rax
char *v17; // rax
char *v18; // rax
char *v19; // rax
long v20; // rbx
char *v21; // rax
char *v22; // rax
long v23; // rbx
char *v24; // rax
char *v25; // rax
long v26; // rbx
char *v27; // rax
long v28; // rbx
char *v29; // rax
long v30; // rbx
char *v31; // rax
long v32; // rbx
char *v33; // rax
char v34; // al
char *v35; // rax
char *v36; // rax
long v37; // rbx
char *v38; // rax
char *v39; // rax
const char *v40; // rax
long v41; // rax
long v42; // rbx
char *v43; // rax
unsigned char v44; // al
long v45; // rax
unsigned long v46; // rax
char *v47; // rax
char v49; // [rsp+1Fh] [rbp-331h]
char v50; // [rsp+20h] [rbp-330h]
char v51; // [rsp+21h] [rbp-32Fh]
bool v52; // [rsp+22h] [rbp-32Eh]
bool v53; // [rsp+23h] [rbp-32Dh]
bool v54; // [rsp+24h] [rbp-32Ch]
char v55; // [rsp+25h] [rbp-32Bh]
bool v56; // [rsp+26h] [rbp-32Ah]
bool v57; // [rsp+27h] [rbp-329h]
int v58; // [rsp+28h] [rbp-328h]
int v59; // [rsp+2Ch] [rbp-324h]
_QWORD *v60; // [rsp+30h] [rbp-320h]
_QWORD *v61; // [rsp+30h] [rbp-320h]
long n; // [rsp+30h] [rbp-320h]
_BYTE *v63; // [rsp+38h] [rbp-318h]
_BYTE *v64; // [rsp+38h] [rbp-318h]
_BYTE *v65; // [rsp+38h] [rbp-318h]
_BYTE *v66; // [rsp+38h] [rbp-318h]
_BYTE *v67; // [rsp+38h] [rbp-318h]
char *v68; // [rsp+40h] [rbp-310h]
unsigned long v69; // [rsp+48h] [rbp-308h]
unsigned long v70; // [rsp+50h] [rbp-300h]
_QWORD *ptr; // [rsp+58h] [rbp-2F8h]
char *v72; // [rsp+60h] [rbp-2F0h]
char *s1; // [rsp+68h] [rbp-2E8h]
unsigned long i; // [rsp+70h] [rbp-2E0h]
unsigned long j; // [rsp+70h] [rbp-2E0h]
char *k; // [rsp+78h] [rbp-2D8h]
unsigned long m; // [rsp+80h] [rbp-2D0h]
unsigned long ii; // [rsp+88h] [rbp-2C8h]
struct lconv *v79; // [rsp+90h] [rbp-2C0h]
const char *v80; // [rsp+98h] [rbp-2B8h]
FILE *v81; // [rsp+A0h] [rbp-2B0h]
char *v82; // [rsp+B0h] [rbp-2A0h]
unsigned long v83; // [rsp+B8h] [rbp-298h]
_QWORD *v84; // [rsp+C8h] [rbp-288h]
long v85[10]; // [rsp+D0h] [rbp-280h] BYREF
long v86[6]; // [rsp+120h] [rbp-230h] BYREF
char v87; // [rsp+150h] [rbp-200h]
char v88; // [rsp+151h] [rbp-1FFh]
char v89; // [rsp+152h] [rbp-1FEh]
char v90; // [rsp+153h] [rbp-1FDh]
char v91; // [rsp+154h] [rbp-1FCh]
char v92; // [rsp+155h] [rbp-1FBh]
char v93; // [rsp+156h] [rbp-1FAh]
char v94; // [rsp+157h] [rbp-1F9h]
char v95; // [rsp+158h] [rbp-1F8h]
int longind[2]; // [rsp+170h] [rbp-1E0h] BYREF
_QWORD *v97; // [rsp+178h] [rbp-1D8h]
struct sigaction v98; // [rsp+290h] [rbp-C0h] BYREF
char v99[2]; // [rsp+336h] [rbp-1Ah] BYREF
unsigned long v100; // [rsp+338h] [rbp-18h]
[39237, 39243, 39250, 39219, 39259, 39223, 39224, 39227, 39229, 39230] v100 = __readfsqword(0x28u);
[39265, 39263] v49 = 0;
[39272] v58 = 0;
[39282] v50 = 0;
[39289] v51 = 0;
[39296] v68 = 0LL;
[39307] v52 = 0;
[39314] v69 = 0LL;
[39325] v70 = 0LL;
[39336, 39343, 39348, 39351, 39354] v56 = getenv("POSIXLY_CORRECT") != 0LL;
[39360, 39365] v59 = posix2_version();
[39393, 39395, 39400, 39402, 39371, 39381, 39383] v3 = v59 <= 200111 || v59 > 200808;
[39413, 39407] v53 = v3;
[39420] v72 = 0LL;
[39431] s1 = 0LL;
[39449, 39442, 39452, 39455] set_program_name(*argv);
[39460, 39467, 39472, 39477, 39480, 39483] v54 = setlocale(6, locale) != 0LL;
[39496, 39489, 39503] bindtextdomain("coreutils", "/usr/local/share/locale");
[39515, 39508] textdomain("coreutils");
[39520, 39525] initialize_exit_failure(2u);
[39530, 39540, 39535] hard_LC_COLLATE = hard_locale(3LL);
[39546, 39556, 39551] hard_LC_TIME = hard_locale(2LL);
[39562, 39567] v79 = localeconv();
[39584, 39587, 39581, 39574] decimal_point = *v79->decimal_point;
[39618, 39621, 39623, 39593, 39600, 39602, 39604, 39611, 39614] if ( !decimal_point || v79->decimal_point[1] )
[39625] decimal_point = 46;
[39649, 39632, 39639, 39643, 39646] thousands_sep = *v79->thousands_sep;
[39680, 39683, 39685, 39655, 39661, 39663, 39665, 39672, 39676] if ( thousands_sep && v79->thousands_sep[1] )
[39687] thousands_sep_ignored = 1;
[39715, 39719, 39722, 39724, 39694, 39700, 39702, 39704, 39711] if ( !thousands_sep || v79->thousands_sep[1] )
[39726] thousands_sep = 128;
[39736] have_read_stdin = 0;
[39743] inittables();
[39755, 39748] sigemptyset(&caught_signals);
[39877, 39885, 39760, 39771, 39869] for ( i = 0LL; i <= 0xA; ++i )
{
[39810, 39780, 39812, 39788, 39805, 39795, 39798, 39773] sigaction(sig_8531[i], 0LL, &v98);
[39824, 39817, 39828] if ( v98.sa_handler != (__sighandler_t)&loc_1 )
[39845, 39852, 39855, 39857, 39830, 39864, 39837] sigaddset(&caught_signals, sig_8531[i]);
}
[39894, 39887] v98.sa_handler = (__sighandler_t)sighandler;
[39915, 39908, 39901] v98.sa_mask = caught_signals;
[39936, 40068, 39943, 40072, 40076, 39950, 40083, 39957, 40090, 39964, 40094, 40098, 39971, 39978, 39985, 39992, 39999, 40006, 40010, 40017, 40024, 40028, 40032, 40039, 40046, 39922, 40050, 40054, 39929, 40061] v98.sa_flags = 0;
[40224, 40105, 40208, 40116, 40216] for ( j = 0LL; j <= 0xA; ++j )
{
[40157, 40133, 40140, 40143, 40145, 40118, 40152, 40125, 40159] if ( sigismember(&caught_signals, sig_8531[j]) )
[40161, 40193, 40198, 40168, 40201, 40203, 40176, 40183, 40186] sigaction(sig_8531[j], &v98, 0LL);
}
[40226, 40236, 40231] signal(17, 0LL);
[40248, 40241] atexit(exit_cleanup);
[40260, 40253, 40263] key_init(v86);
[40268] v86[0] = -1LL;
[40704, 40707, 40292, 40710, 40295, 40713, 40300, 40689, 40279, 40697, 40285, 40287] for ( ptr = (_QWORD *)xnmalloc(argc, 8LL); ; ptr[v6] = *v5 )
{
[40307] while ( 2 )
{
[40307] longind[0] = -1;
[40324, 40452, 40454, 40330, 40462, 40337, 40469, 40343, 40472, 40475, 40351, 40479, 40482, 40484, 40357, 40486, 40364, 40492, 40494, 40367, 40369, 40502, 40375, 40509, 40382, 40512, 40515, 40388, 40519, 40394, 40522, 40524, 40526, 40400, 40532, 40406, 40535, 40412, 40541, 40414, 40422, 40429, 40432, 40435, 40438, 40440, 40317, 40446] if ( v58 != -1
&& (!v56
|| !v70
|| v53
&& !v50
&& argc != optind
&& *argv[optind] == 45
&& argv[optind][1] == 111
&& (argv[optind][2] || argc != optind + 1)) )
{
[40580, 40550, 40582, 40587, 40557, 40563, 40566, 40573, 40543] v58 = getopt_long(argc, (char *const *)argv, "-bcCdfghik:mMno:rRsS:t:T:uVy:z", &long_options, longind);
[40600, 40593] if ( v58 != -1 )
{
[40728, 40718] if ( v58 <= 135 )
{
[40741, 40734] if ( v58 > 0 )
{
[40832, 40802, 40810, 40780, 40817, 40820, 40790, 40822, 40796, 40829] switch ( v58 )
{
case 1:
[40835] v60 = 0LL;
[40856, 40858, 40853, 40846] if ( *optarg == 43 )
{
[40961, 40966, 40864, 40870, 40876, 40878, 40884, 40886, 40894, 40901, 40904, 40907, 40910, 40912, 40914, 40920, 40922, 40930, 40937, 40940, 40943, 40947, 40950, 40953, 40956, 40959] v7 = argc != optind && *argv[optind] == 45 && (unsigned int)(argv[optind][1] - 48) <= 9;
[40979, 40973] v57 = v7;
[40986] v8 = v53;
[40993, 41000, 41002, 41009, 41012, 41014, 41016, 41021] v9 = v57 && !v56;
[41028, 41030, 41032, 41035, 40986] v53 = v9 || v53;
[41028] if ( v9 || v8 )
{
[41061, 41064, 41069, 41041, 41048, 41054] v60 = key_init(v85);
[41090, 41094, 41099, 41102, 41105, 41076, 41110, 41083] v63 = (_BYTE *)parse_field_count((long)(optarg + 1), v60, 0LL);
[41125, 41127, 41134, 41137, 41139, 41117] if ( v63 && *v63 == 46 )
[41152, 41159, 41163, 41168, 41171, 41141, 41174, 41179, 41148] v63 = (_BYTE *)parse_field_count((long)(v63 + 1), v60 + 1, 0LL);
[41186, 41193, 41196, 41199, 41201, 41208, 41212, 41215] if ( !*v60 && !v60[1] )
[41224, 41217] *v60 = -1LL;
[41248, 41255, 41260, 41231, 41263, 41266, 41239, 41241, 41274, 41276, 41271] if ( v63 && !*set_ordering(v63, (long)v60, 0) )
{
[41301, 41294] if ( v57 )
{
[41307] v10 = optind++;
[41313, 41345, 41316, 41322, 41324, 41332, 41339, 41342] v80 = argv[v10];
[41381, 41352, 41384, 41387, 41359, 41392, 41363, 41370, 41374] v64 = (_BYTE *)parse_field_count((long)(v80 + 1), v60 + 2, "invalid number after '-'");
[41407, 41399] if ( !v64 )
[41409, 41416, 41421, 41428, 41435] _assert_fail("s", "src/sort.c", 0x1161u, "main");
[41440, 41450, 41452, 41447] if ( *v64 == 46 )
[41472, 41476, 41483, 41454, 41486, 41489, 41461, 41494, 41465] v64 = (_BYTE *)parse_field_count((long)(v64 + 1), v60 + 3, "invalid number after '.'");
[41508, 41512, 41515, 41517, 41524, 41528, 41531, 41501] if ( !v60[3] && v60[2] )
[41540, 41544, 41548, 41555, 41533] --v60[2];
[41573, 41578, 41581, 41584, 41589, 41559, 41592, 41594, 41566] if ( *set_ordering(v64, (long)v60, 1) )
[41610, 41603, 41596, 41613] badfieldspec((long)v80, "stray character in field spec");
}
[41625, 41618] *((_BYTE *)v60 + 57) = 1;
[41636, 41629, 41639] insertkey((long)v60);
}
else
{
[41289, 41278] v60 = 0LL;
}
}
}
[41652, 41644] if ( !v60 )
{
[41658] v11 = v70++;
[41665, 41669, 41701, 41676, 41684, 41691, 41694] ptr[v11] = optarg;
}
[41704] continue;
case 67:
case 99:
goto LABEL_85;
case 77:
case 82:
case 86:
case 98:
case 100:
case 102:
case 103:
case 104:
case 105:
case 110:
case 114:
goto LABEL_80;
case 83:
[42980, 42986, 42989, 42995, 42997, 42999, 42973] specify_sort_size(longind[0], v58, (long)optarg);
[43004] continue;
case 84:
[43268, 43261, 43271] add_temp_dir((long)optarg);
[43276] continue;
case 107:
[42131, 42123, 42116, 42126] v61 = key_init(v85);
[42145, 42152, 42170, 42159, 42162, 42165, 42138] v65 = (_BYTE *)parse_field_count((long)optarg, v61, "invalid number at field start");
[42177, 42184, 42187, 42191, 42198, 42201, 42204] if ( !(*v61)-- )
[42220, 42213, 42206, 42223] badfieldspec((long)optarg, "field number is zero");
[42240, 42235, 42228, 42238] if ( *v65 == 46 )
{
[42242, 42274, 42277, 42249, 42282, 42253, 42260, 42264, 42271] v65 = (_BYTE *)parse_field_count((long)(v65 + 1), v61 + 1, "invalid number after '.'");
[42296, 42289] v15 = v61[1];
[42304, 42300, 42311] v61[1] = v15 - 1;
[42315, 42318] if ( !v15 )
[42320, 42337, 42334, 42327] badfieldspec((long)optarg, "character offset is zero");
}
[42368, 42371, 42342, 42349, 42352, 42355, 42357, 42364] if ( !*v61 && !v61[1] )
[42380, 42373] *v61 = -1LL;
[42401, 42406, 42409, 42412, 42417, 42387, 42394] v66 = set_ordering(v65, (long)v61, 0);
[42424, 42434, 42436, 42431] if ( *v66 == 44 )
{
[42502, 42473, 42505, 42508, 42480, 42513, 42484, 42491, 42495] v67 = (_BYTE *)parse_field_count((long)(v66 + 1), v61 + 2, "invalid number after ','");
[42520, 42527] v16 = v61[2];
[42531, 42542, 42535] v61[2] = v16 - 1;
[42546, 42549] if ( !v16 )
[42568, 42565, 42558, 42551] badfieldspec((long)optarg, "field number is zero");
[42585, 42580, 42573, 42583] if ( *v67 == 46 )
[42594, 42627, 42598, 42605, 42609, 42619, 42616, 42587, 42622] v67 = (_BYTE *)parse_field_count((long)(v67 + 1), v61 + 3, "invalid number after '.'");
[42656, 42659, 42664, 42634, 42641, 42648, 42653] v66 = set_ordering(v67, (long)v61, 1);
}
else
{
[42445, 42438] v61[2] = -1LL;
[42460, 42453, 42468] v61[3] = 0LL;
}
[42681, 42683, 42678, 42671] if ( *v66 )
[42699, 42692, 42685, 42702] badfieldspec((long)optarg, "stray character in field spec");
[42714, 42707, 42717] insertkey((long)v61);
[42722] continue;
case 109:
[42727] v51 = 1;
[42734] continue;
case 111:
[42785, 42792, 42799, 42802, 42805, 42775, 42810, 42812, 42783] if ( s1 && strcmp(s1, optarg) )
{
[42821, 42814] v17 = gettext("multiple output files specified");
[42826, 42829, 42834, 42839, 42844] error(2, 0, v17);
}
[42856, 42849] s1 = optarg;
[42863] continue;
case 115:
[42961] stable = 1;
[42968] continue;
case 116:
[43016, 43009, 43019] v55 = *optarg;
[43019] if ( !*optarg )
{
[43032, 43025, 43034, 43041] v19 = gettext("empty tab");
[43046, 43049, 43054, 43059, 43064] error(2, 0, v19);
}
[43076, 43080, 43083, 43085, 43069] if ( optarg[1] )
{
[43104, 43109, 43111, 43087, 43094, 43101] if ( !strcmp(optarg, "\\0") )
{
[43120, 43113] v55 = 0;
}
else
{
[43129, 43122, 43132, 43137] v20 = quote(optarg);
[43147, 43140] v21 = gettext("multi-character tab %s");
[43168, 43173, 43152, 43155, 43158, 43163] error(2, 0, v21, v20);
}
}
[43204, 43206, 43178, 43184, 43189, 43191, 43198] if ( tab != 128 && v55 != tab )
{
[43208, 43215] v22 = gettext("incompatible tabs");
[43233, 43238, 43220, 43223, 43228] error(2, 0, v22);
}
[43250, 43243] tab = v55;
[43256] continue;
case 117:
[43324] unique = 1;
[43331] continue;
case 121:
[43362, 43365, 43336, 43372, 43342, 43375, 43344, 43348, 43352, 43359] if ( argv[optind - 1] == optarg )
{
[43424, 43395, 43397, 43405, 43412, 43381, 43415, 43418, 43388, 43421] for ( k = optarg; (unsigned int)(*k - 48) <= 9; ++k )
;
[43426, 43432, 43439, 43442, 43444, 43447, 43450, 43452, 43454] optind -= *k != 0;
}
[43460] continue;
case 122:
[43462] eolchar = 0;
[43469] continue;
case 128:
[41843, 41836, 41846] if ( optarg )
[41921, 41891, 41924, 41862, 41894, 41866, 41868, 41901, 41871, 41906, 41877, 41910, 41848, 41884, 41917, 41855] v12 = check_types[_xargmatch_internal(
"--check",
optarg,
check_args,
"CCcgeneral-numeric",
1LL,
argmatch_die,
1LL)];
else
[41926] v12 = 99;
[41931] v58 = v12;
LABEL_85:
[41953, 41959, 41937, 41944, 41946] if ( v50 && v58 != v50 )
[41968, 41961] incompatible_options((long)"cC");
[41979, 41973] v50 = v58;
[41985] continue;
case 129:
[42016, 42019, 41990, 42022, 42027, 41997, 42029, 42000, 42002, 42009] if ( compress_program && strcmp(compress_program, optarg) )
{
[42038, 42031] v13 = gettext("multiple compress programs specified");
[42051, 42056, 42061, 42043, 42046] error(2, 0, v13);
}
[42073, 42066] compress_program = optarg;
[42080] continue;
case 130:
[42085] debug = 1;
[42092] continue;
case 131:
[42104, 42097] v72 = optarg;
[42111] continue;
case 132:
[42752, 42755, 42761, 42763, 42765, 42739, 42746] specify_nmerge(longind[0], v58, (long)optarg);
[42770] continue;
case 133:
[42885, 42892, 42895, 42898, 42868, 42903, 42905, 42876, 42878] if ( v68 && strcmp(v68, optarg) )
{
[42914, 42907] v18 = gettext("multiple random sources specified");
[42919, 42922, 42927, 42932, 42937] error(2, 0, v18);
}
[42949, 42942] v68 = optarg;
[42956] continue;
case 134:
[41755, 41729, 41762, 41732, 41767, 41738, 41771, 41709, 41745, 41778, 41716, 41782, 41752, 41785, 41723, 41727] v58 = sort_types[_xargmatch_internal(
"--sort",
optarg,
&sort_args,
"ghMnRVwaiting for %s [-d]",
&loc_1)];
LABEL_80:
v99[0] = v58;
v99[1] = 0;
[41797, 41791] set_ordering(v99, (long)v86, 2);
[41800] continue;
[41826, 41804, 41811, 41815, 41820, 41823] case 135:
[41831] v69 = specify_nthreads(longind[0], v58, (long)optarg);
continue;
[43297, 43303, 43305, 43307, 43312, 43281, 43288, 43294] default:
[43319] goto LABEL_146;
}
}
if ( v58 == -131 )
{
[40753, 40743] version_etc(stdout, "sort", "GNU coreutils", Version, "Mike Haertel", "Paul Eggert", 0LL);
exit(0);
[43488, 43525, 43495, 43499, 43532, 43501, 43535, 43508, 43540, 43481, 43515, 43518] }
[43545, 43554, 43549] if ( v58 == -130 )
usage(0);
[40769, 40775, 40759] }
[43476, 43471] LABEL_146:
usage(2);
}
[43564, 43559] }
break;
}
if ( argc <= optind )
break;
[40608, 40602, 40614] v4 = optind++;
v5 = &argv[v4];
[40635] v6 = v70++;
[40641, 40644, 40650, 40652, 40660, 40667] }
[40682, 40678, 40671] if ( v72 )
{
[40616, 40630, 40624] if ( v70 )
{
[43589, 43581] v23 = quotearg_style(4LL, *ptr);
v24 = gettext("extra operand %s");
[43591, 43598, 43601, 43604, 43609, 43614] error(0, 0, v24, v23);
[43624, 43617] v25 = gettext("file operands cannot be combined with --files0-from");
[43650, 43629, 43632, 43635, 43640, 43645] fprintf(stderr, "%s\n", v25);
[43662, 43655] usage(2);
[43684, 43687, 43692, 43667, 43670, 43677] }
[43697, 43702] v81 = xfopen(v72, "r");
readtokens0_init(longind);
[43714, 43721, 43724, 43729, 43707] if ( (unsigned char)readtokens0(v81, longind) != 1 )
[43736, 43746, 43743] {
[43776, 43779, 43781, 43751, 43758, 43765, 43768, 43771] v26 = quotearg_style(4LL, v72);
v27 = gettext("cannot read file names from %s");
[43783, 43790, 43793, 43798, 43803] error(2, 0, v27, v26);
[43813, 43806] }
[43818, 43821, 43824, 43829, 43834, 43839] xfclose(v81, v72);
if ( *(_QWORD *)longind )
[43844, 43851, 43858, 43861, 43864] {
[43876, 43869, 43879] free(ptr);
ptr = v97;
[43892, 43885, 43895] v70 = *(_QWORD *)longind;
[43907, 43900] for ( m = 0LL; m < v70; ++m )
[43921, 43914] {
[44224, 43939, 44230, 44202, 44210, 43928, 44217] if ( !strcmp((const char *)ptr[m], "-") )
{
[43969, 43972, 43944, 43979, 43982, 43951, 43987, 43989, 43959, 43966] v28 = quotearg_style(4LL, ptr[m]);
v29 = gettext("when reading file names from stdin, no file name of %s allowed");
[44032, 44006, 44013, 44016, 44019, 44022, 43991, 44027, 43998] error(2, 0, v29, v28);
[44042, 44035] }
[44068, 44047, 44050, 44053, 44058, 44063] if ( !*(_BYTE *)ptr[m] )
{
[44098, 44101, 44104, 44073, 44106, 44080, 44088, 44095] v30 = quotearg_n_style_colon(0LL, 3LL, v72);
v31 = gettext("%s:%lu: invalid zero-length file name");
[44133, 44136, 44141, 44146, 44151, 44126] error(2, 0, v31, v30, m + 1);
[44161, 44154, 44173, 44166] }
[44192, 44197, 44108, 44176, 44179, 44115, 44182, 44119, 44187] }
}
else
{
v32 = quotearg_style(4LL, v72);
v33 = gettext("no input from %s");
[44232, 44239, 44242, 44247, 44252] error(2, 0, v33, v32);
[44262, 44255] }
[44288, 44267, 44270, 44273, 44278, 44283] }
for ( n = keylist; n; n = *(_QWORD *)(n + 64) )
{
[44293, 44584, 44300, 44588, 44307, 44595, 44603] if ( default_key_compare(n) && *(_BYTE *)(n + 55) != 1 )
{
[44322, 44351, 44327, 44329, 44335, 44342, 44312, 44346, 44349, 44319] *(_QWORD *)(n + 32) = v86[4];
*(_QWORD *)(n + 40) = v86[5];
[44371, 44364, 44357] *(_BYTE *)(n + 48) = v87;
[44389, 44382, 44375] *(_BYTE *)(n + 49) = v88;
[44400, 44393, 44407] *(_BYTE *)(n + 54) = v93;
[44424, 44417, 44410] *(_BYTE *)(n + 50) = v89;
[44441, 44434, 44427] *(_BYTE *)(n + 52) = v91;
[44458, 44451, 44444] *(_BYTE *)(n + 53) = v92;
[44475, 44468, 44461] *(_BYTE *)(n + 56) = v95;
[44492, 44485, 44478] *(_BYTE *)(n + 51) = v90;
[44509, 44502, 44495] *(_BYTE *)(n + 55) = v94;
[44512, 44526, 44519] }
[44536, 44529, 44543] v52 = (unsigned char)(v52 | *(_BYTE *)(n + 51)) != 0;
}
[44577, 44546, 44553, 44557, 44563, 44566, 44568, 44571] if ( !keylist && !default_key_compare((long)v86) )
{
[44609, 44641, 44616, 44619, 44621, 44628, 44631, 44636, 44639] v49 = 1;
insertkey((long)v86);
[44643] v52 = (unsigned char)(v52 | v90) != 0;
[44657, 44650, 44660] }
[44672, 44678, 44681, 44683, 44686, 44665] check_ordering_compatibility();
if ( debug )
[44692] {
[44704, 44697, 44706] if ( v50 || s1 )
{
[44712, 44721, 44729, 44719] if ( v50 )
v34 = v50;
[44738, 44731] else
[44747, 44740] v34 = 111;
opts_8619 = v34;
[44749] incompatible_options((long)&opts_8619);
[44754] }
[44760, 44767] if ( v54 )
v54 = setlocale(3, locale) != 0LL;
[44779, 44772] if ( !v54 )
[44801, 44804, 44781, 44788, 44793, 44798] {
[44817, 44810, 44820, 44822] v35 = gettext("failed to set locale");
error(0, 0, "%s", v35);
[44824, 44831] }
[44836, 44839, 44846, 44851, 44856, 44861] if ( hard_LC_COLLATE )
{
[44873, 44866, 44875] v36 = setlocale(3, 0LL);
v37 = quote(v36);
[44882, 44877, 44887] v38 = gettext("text ordering performed using %s sorting rules");
[44900, 44892, 44895] error(0, 0, v38, v37);
[44910, 44903] }
[44931, 44936, 44941, 44915, 44918, 44921, 44926] else
{
v39 = gettext("text ordering performed using simple byte comparison");
error(0, 0, "%s", v39);
[44950, 44943] }
[44965, 44970, 44975, 44980, 44955, 44958] key_warnings(v86, v49);
}
[44992, 44999, 45001, 45004, 44985] reverse = v94;
if ( v52 )
[45016, 45009] random_md5_state_init(v68);
[45029, 45022] if ( !temp_dir_count )
[45041, 45038, 45031] {
[45056, 45053, 45046] v82 = getenv("TMPDIR");
if ( v82 )
[45065, 45058, 45070] v40 = v82;
[45085, 45077] else
[45094, 45087] v40 = "/tmp";
add_temp_dir((long)v40);
[45096] }
[45106, 45103] if ( !v70 )
{
[45119, 45111] v70 = 1LL;
free(ptr);
[45121] ptr = (_QWORD *)xmalloc(8LL);
[45139, 45132, 45142] *ptr = "-";
[45152, 45147, 45157] }
[45178, 45171, 45164] if ( sort_size )
{
[45188, 45181, 45191] v41 = sort_size;
if ( 34 * (unsigned long)(unsigned int)nmerge >= sort_size )
[45217] v41 = 34LL * (unsigned int)nmerge;
[45224, 45227, 45199, 45201, 45204, 45208, 45211, 45214] sort_size = v41;
[45193, 45227, 45199] }
[45231] if ( v50 )
{
[45245, 45238] if ( v70 > 1 )
{
[45251, 45259] v42 = quotearg_style(4LL, ptr[1]);
v43 = gettext("extra operand %s not allowed with -%c");
[45280, 45283, 45286, 45291, 45296, 45269, 45276] error(2, 0, v43, v42, (unsigned int)v50);
[45306, 45299, 45311] }
[45314, 45317, 45320, 45325, 45261, 45330, 45335] if ( s1 )
{
[45340, 45348] opts_8623 = v50;
incompatible_options((long)&opts_8623);
[45357, 45350] }
[45370, 45363] v44 = check((char *)*ptr, v50);
exit(v44 ^ 1);
[45382, 45389, 45392, 45394, 45397, 45375] }
[45408, 45402, 45405, 45410] check_inputs((long)ptr, v70);
check_output(s1);
[45415, 45422, 45429, 45432, 45435] if ( v51 )
[45440, 45450, 45447] {
[45462, 45455] v84 = (_QWORD *)xcalloc(v70, 16LL);
for ( ii = 0LL; ii < v70; ++ii )
[45475, 45480, 45483, 45488, 45468] v84[2 * ii] = ptr[ii];
[45506, 45571, 45578, 45585, 45495, 45563] merge(v84, 0LL, v70, s1);
[45508, 45540, 45543, 45515, 45547, 45554, 45523, 45557, 45560, 45530, 45533] }
[45601, 45608, 45613, 45616, 45587, 45621, 45594] else
{
if ( !v69 )
{
[45626, 45634] v83 = num_processors(2LL);
v45 = 8LL;
[45641, 45636, 45646] if ( v83 <= 8 )
[45653] v45 = v83;
[45666] v69 = v45;
[45658, 45666] }
[45674] v46 = v69;
if ( v69 >= 0xFFFFFFFFFFFFFFLL )
[45681, 45698, 45691] v46 = 0xFFFFFFFFFFFFFFLL;
[45712] sort((char **)ptr, v70, s1, v46);
[45712, 45705] }
[45734, 45741, 45748, 45720, 45755, 45758, 45727] if ( have_read_stdin && (unsigned int)rpl_fclose(stdin) == -1 )
{
[45792, 45763, 45770, 45772, 45774, 45781, 45784, 45789] v47 = gettext("close failed");
sort_die(v47, "-");
[45801, 45794] }
[45816, 45813, 45806] return 0;
}
// 99F5: masking with 0x1 was optimized away because al.1 <= 0x1
// A013: masking with 0x1 was optimized away because al.1 <= 0x1
// B320: using guessed type char eolchar;
// B330: using guessed type int tab;
// B334: using guessed type int nmerge;
// B338: using guessed type char opts_8619;
// B342: using guessed type char opts_8623;
// B360: using guessed type char decimal_point;
// B364: using guessed type int thousands_sep;
// B368: using guessed type char thousands_sep_ignored;
// B369: using guessed type char hard_LC_COLLATE;
// B36A: using guessed type char hard_LC_TIME;
// B7A0: using guessed type long sort_size;
// B7B0: using guessed type long temp_dir_count;
// B7C0: using guessed type char reverse;
// B7C1: using guessed type char stable;
// B7C2: using guessed type char unique;
// B7C3: using guessed type char have_read_stdin;
// B7C8: using guessed type long keylist;
// B7D8: using guessed type char debug;
// DA80: using guessed type _DWORD sig_8531[11];
// DFC0: using guessed type char *check_args[3];
// DFE0: using guessed type void *sort_args;
// EE10: using guessed type long quotearg_n_style_colon(_QWORD, _QWORD, _QWORD);
// EE58: using guessed type long quotearg_style(_QWORD, _QWORD);
// EE90: using guessed type long xmalloc(_QWORD);
// EF00: using guessed type long rpl_fclose(_QWORD);
// EF68: using guessed type long quote(_QWORD);
// F078: using guessed type long xnmalloc(_QWORD, _QWORD);
// F118: using guessed type long posix2_version(void);
// F120: using guessed type long set_program_name(_QWORD);
// F138: using guessed type long hard_locale(_QWORD);
// F190: using guessed type long _xargmatch_internal(_QWORD, _QWORD, _QWORD, const char *, ...);
// F1A0: using guessed type long version_etc(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// F1A8: using guessed type long readtokens0_init(_QWORD);
// F1B0: using guessed type long readtokens0(_QWORD, _QWORD);
// F1B8: using guessed type long xcalloc(_QWORD, _QWORD);
// F1C0: using guessed type long num_processors(_QWORD);
// 9933: using guessed type _QWORD var_280[10];
// nfuncs=229 queued=105 decompiled=105 lumina nreq=0 worse=0 better=0
// ALL OK, 105 function(s) have been successfully decompiled
|
long push_args(long **a1)
[29952] {
long **v1; // rbx
_QWORD *variable; // rax
_QWORD *v3; // r12
_QWORD *v4; // rax
_QWORD *v5; // r13
long v6; // rbp
long v7; // rbp
[29952, 29956, 29958, 29960, 29961, 29962, 29972] v1 = a1;
[29976, 29965] variable = find_variable((long)"BASH_ARGV");
[29981] v3 = variable;
[29984, 29987] if ( variable )
{
[29993, 29989] if ( (variable[5] & 4) != 0 )
[29999] v3 = (_QWORD *)variable[1];
else
[30152, 30155] v3 = 0LL;
}
[30010, 30003] v4 = find_variable((long)"BASH_ARGC");
[30015] v5 = v4;
[30018, 30021] if ( v4 )
{
[30027, 30023] if ( (v4[5] & 4) != 0 )
[30029] v5 = (_QWORD *)v4[1];
else
[30144, 30147] v5 = 0LL;
}
[30033] v6 = 0LL;
[30040, 30035, 30038] if ( a1 )
{
do
{
[30060] ++v6;
[30048, 30052, 30057, 30064, 30067] array_rshift(v3, 1LL, *v1[1]);
[30072] v1 = (long **)*v1;
}
[30075, 30078] while ( v1 );
}
[30080, 30083, 30099] v7 = itos(v6);
[30088, 30091, 30096, 30102] array_rshift(v5, 1LL, v7);
[30114, 30120, 30132, 30107, 30111] return sh_xfree(v7, "variables.c", 5755LL);
[30128, 30127, 30130, 30119] }
// C000: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// C100: using guessed type long itos(_QWORD);
// C5D0: using guessed type long array_rshift(_QWORD, _QWORD, _QWORD);
//----- (00000000000075D0) ----------------------------------------------------
long save_bash_argv()
[30160] {
long **v0; // rbp
[30160, 30170, 30164, 30165] v0 = (long **)list_rest_of_args();
[30176, 30173] push_args(v0);
[30184, 30185, 30181] return dispose_words(v0);
}
// C0F8: using guessed type long dispose_words(_QWORD);
// C5D8: using guessed type long list_rest_of_args(void);
//----- (00000000000075F0) ----------------------------------------------------
long init_bash_argv()
[30192] {
long result; // rax
[30192, 30196] result = bash_argv_initialized;
[30202, 30204] if ( !bash_argv_initialized )
{
[30208, 30212] result = save_bash_argv();
[30217, 30227] bash_argv_initialized = 1;
}
[30206] return result;
[30231] }
//----- (0000000000007620) ----------------------------------------------------
long get_bashargcv(long a1)
[30240] {
long result; // rax
[30240, 30256] result = a1;
[30265, 30250, 30259, 30244] if ( !(debugging_mode | variable_context | self_semaphore_11799) )
{
[30272, 30276] self_semaphore_11799 = 1;
[30291, 30286] init_bash_argv();
[30296] result = a1;
[30301, 30311] self_semaphore_11799 = 0;
}
[30267] return result;
[30315] }
// 8FC8: using guessed type int variable_context;
// 9008: using guessed type int self_semaphore_11799;
//----- (0000000000007670) ----------------------------------------------------
unsigned long pop_args()
[30320] {
_QWORD *variable; // rax
_QWORD *v1; // rbx
_QWORD *v2; // rax
_QWORD *v3; // rdi
long v4; // rax
long v5; // rbp
long v7; // [rsp+0h] [rbp-28h] BYREF
unsigned long v8; // [rsp+8h] [rbp-20h]
[30337, 30346, 30351, 30320, 30324, 30332, 30333] v8 = __readfsqword(0x28u);
[30353, 30325] variable = find_variable((long)"BASH_ARGV");
[30358] v1 = variable;
[30361, 30364] if ( variable )
{
[30370, 30366] if ( (variable[5] & 4) != 0 )
[30376] v1 = (_QWORD *)variable[1];
else
[30560, 30562] v1 = 0LL;
}
[30387, 30380] v2 = find_variable((long)"BASH_ARGC");
[30392] v3 = v2;
[30395, 30398] if ( v2 )
{
[30400, 30404] if ( (v2[5] & 4) != 0 )
[30410] v3 = (_QWORD *)v2[1];
else
[30544, 30546] v3 = 0LL;
}
[30414] v4 = array_unshift_element(v3);
[30419] v5 = v4;
[30434, 30439, 30441, 30422, 30425, 30427, 30431] if ( v4 && (unsigned int)legal_number(*(_QWORD *)(v4 + 8), &v7) )
{
[30443, 30448, 30450, 30482, 30486, 30489] for ( ; v7 > 0; --v7 )
[30466, 30469, 30474, 30478, 30456, 30461] array_shift(v1, 1LL, 1LL);
}
else
{
[30528, 30536] v7 = 0LL;
}
[30491, 30494] array_dispose_element(v5);
[30504, 30513, 30499, 30515] return __readfsqword(0x28u) ^ v8;
[30520, 30521, 30519] }
// C118: using guessed type long legal_number(_QWORD, _QWORD);
// C5F0: using guessed type long array_unshift_element(_QWORD);
// C5F8: using guessed type long array_shift(_QWORD, _QWORD, _QWORD);
// C600: using guessed type long array_dispose_element(_QWORD);
//----- (0000000000007770) ----------------------------------------------------
long stupidly_hack_special_variables(char *s2)
[30576] {
long result; // rax
[30592, 30576, 30580, 30586, 30587, 30590] if ( !sv_sorted_12692 )
{
[30660, 30665, 30672, 30648, 30655] qsort(&special_vars, 0x25uLL, 0x10uLL, (__compar_fn_t)sv_compare);
[30677, 30687] sv_sorted_12692 = 1;
}
[30594, 30597] result = find_special_var(s2);
[30602, 30605] if ( (_DWORD)result != -1 )
[30624, 30629, 30607, 30609, 30616, 30619, 30620] return ((long ( *)(char *))(&special_vars)[2 * (int)result + 1])(s2);
[30640] return result;
[30641] }
// 8FF8: using guessed type int sv_sorted_12692;
// 9880: using guessed type char *special_vars;
//----- (00000000000077F0) ----------------------------------------------------
long assign_in_env(const char **a1, int a2)
[30704] {
const char *v2; // r12
const char *v3; // rbp
long v4; // rbx
size_t v5; // rax
char *v6; // rax
char *v7; // rbp
char *v8; // r13
long v9; // rax
long new_variable; // rbx
long v11; // rdi
int v12; // eax
long v13; // rdi
char *v14; // rax
char *v16; // rax
int v17; // r15d
char **variable; // rax
long v19; // r8
int v20; // eax
long v21; // rax
long v22; // r8
char *variable_value; // rbx
const char *v24; // rax
long variable_last_nameref; // rax
int valid; // eax
const char *v27; // rax
long v28; // [rsp+8h] [rbp-40h]
long v29; // [rsp+8h] [rbp-40h]
[30721, 30724, 30725, 30726, 30704, 30708, 30710, 30712, 30715, 30717, 30719] v2 = 0LL;
[30730] v3 = *a1;
[30736, 30744, 30733] v4 = (int)assignment(*a1, 0LL);
[30747, 30741] v5 = strlen(v3);
[30752, 30768, 30764, 30757] v6 = (char *)sh_xmalloc(v5 + 1, "variables.c", 3605LL);
[30776, 30779, 30773, 30784] v7 = strcpy(v6, v3);
[30793, 30790] v8 = v7;
[30787, 30796] if ( v7[v4] != 61 )
goto LABEL_2;
[31072, 30787] v7[v4] = 0;
[31075] v16 = &v7[v4 - 1];
[31080] v17 = 0;
[31083, 31086] if ( *v16 == 43 )
{
[31088] *v16 = 0;
[31091] v17 = 1;
}
[31097, 31105, 31107, 31100] if ( !(unsigned int)legal_identifier(v7) )
{
[31424, 31427, 31431] sh_invalidid(v7);
[31456, 31436, 31439, 31444, 31451] sh_xfree(v7, "variables.c", 3622LL);
[31474] return 0LL;
}
[31113, 31116] variable = (char **)find_variable((long)v7);
[31121] v19 = (long)variable;
[31124, 31127] if ( variable )
{
[31133] v8 = *variable;
}
else
{
[31520, 31528, 31525] variable_last_nameref = find_variable_last_nameref((long)v7, 1);
[31533] v19 = variable_last_nameref;
[31536, 31539] if ( !variable_last_nameref )
{
[31685, 31687] v8 = v7;
[31680, 31690, 31695] v2 = (const char *)expand_assignment_string_to_string(&v7[v4 + 1], 0LL);
[31698] goto LABEL_2;
}
[31545] v20 = *(_DWORD *)(variable_last_nameref + 40);
[31548] v8 = v7;
[31554, 31551] if ( (v20 & 0x800) == 0 )
goto LABEL_21;
[31569, 31564] v29 = v19;
[31560, 31574] valid = valid_nameref_value(*(_QWORD *)(v19 + 8), 2LL);
[31579] v19 = v29;
[31584, 31586] if ( valid )
{
[31597, 31599] v8 = *(char **)(v29 + 8);
[31592, 31603, 31608] v2 = (const char *)expand_assignment_string_to_string(&v7[v4 + 1], 0LL);
[31611] goto LABEL_2;
}
}
[31136] v20 = *(_DWORD *)(v19 + 40);
LABEL_21:
[31145, 31140] if ( (v20 & 0x4002) == 0 )
{
[31158] v28 = v19;
[31153, 31163, 31151] v21 = expand_assignment_string_to_string(&v7[v4 + 1], 0LL);
[31168, 31171] v22 = v28;
[31176] v2 = (const char *)v21;
[31179] if ( v17 )
{
[31185, 31188] if ( !v21 )
{
[31654, 31632, 31637, 31642, 31647] v27 = (const char *)sh_xmalloc(1LL, "variables.c", 3662LL);
[31659] v22 = v28;
[31664] *v27 = 0;
[31667, 31670] v2 = v27;
}
[31200, 31205, 31225, 31194, 31197] variable_value = make_variable_value(v22, (long)v2, 1);
[31218, 31210, 31228, 31213] sh_xfree(v2, "variables.c", 3666LL);
[31233, 31236] v2 = variable_value;
}
LABEL_2:
[30809, 30812] if ( temporary_env )
{
[30802, 30821, 30818] v9 = hash_lookup((long)v8, temporary_env);
[30826] new_variable = v9;
[30832, 30829] if ( v9 )
goto LABEL_4;
}
else
{
[31248, 31264, 31253] temporary_env = hash_create(4LL);
[31258, 31261, 31271] v9 = hash_lookup((long)v8, temporary_env);
[31276] new_variable = v9;
[31288, 31282, 31279] if ( v9 )
{
LABEL_4:
[30838] v11 = *(_QWORD *)(v9 + 8);
[30842, 30845] if ( v11 )
[30859, 30852, 30847] sh_xfree(v11, "variables.c", 3678LL);
[30864, 30867] if ( v2 )
{
LABEL_7:
[30873] v12 = variable_context;
[30879] v13 = *(_QWORD *)(new_variable + 16);
[30883] *(_QWORD *)(new_variable + 8) = v2;
[30887] *(_DWORD *)(new_variable + 40) |= 0x100001u;
[30894] *(_DWORD *)(new_variable + 44) = v12;
[30897, 30900] if ( v13 )
{
[30914, 30907, 30902] sh_xfree(v13, "variables.c", 3690LL);
[30919] *(_QWORD *)(new_variable + 16) = 0LL;
}
[30929, 30935, 30932, 30927] v14 = mk_env_string(v8, v2, 0);
[30940] array_needs_making = 1;
[30950] *(_QWORD *)(new_variable + 16) = v14;
[30954, 30957] if ( a2 )
{
[31394, 31397, 31016, 31368, 31402, 31404, 31021, 31375, 31378, 31383, 31385, 31387] if ( *v8 == 80 && (!strcmp(v8, "POSIXLY_CORRECT") || !strcmp(v8, "POSIX_PEDANDTIC")) )
[31410, 31415] save_posix_options();
[31027, 31030] stupidly_hack_special_variables(v8);
[31041, 31043, 31035] if ( !echo_command_at_execute )
goto LABEL_11;
}
[30967, 30965, 30959] else if ( !echo_command_at_execute )
{
LABEL_11:
[30981, 30984, 30989, 30969, 30974] sh_xfree(v7, "variables.c", 3707LL);
[31008] return 1LL;
}
[31045, 31050, 31052, 31055, 31058] xtrace_print_assignment(v7, v2, 0LL, 1LL);
[31063] goto LABEL_11;
}
LABEL_28:
[31328, 31345, 31340, 31333] v24 = (const char *)sh_xmalloc(1LL, "variables.c", 3682LL);
[31350] *v24 = 0;
[31353] v2 = v24;
[31356] goto LABEL_7;
}
}
[31296, 31306, 31311, 31303] new_variable = make_new_variable(v8, temporary_env);
[31314, 31323, 31317] if ( v2 )
goto LABEL_7;
goto LABEL_28;
}
[31480, 31482] if ( (v20 & 2) != 0 )
[31616, 31619, 31624] err_readonly(v7);
[31488, 31493, 31500, 31503, 31508, 31510] sh_xfree(v7, "variables.c", 3651LL);
[30994] return 0LL;
[31460, 31464, 31465, 31466, 31468, 31470, 31472, 30998, 30999, 31000, 31002, 31004, 31006] }
// 8F88: using guessed type int array_needs_making;
// 8FB8: using guessed type long temporary_env;
// 8FC8: using guessed type int variable_context;
// BFF8: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// C000: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// C050: using guessed type long hash_create(_QWORD);
// C380: using guessed type long legal_identifier(_QWORD);
// C388: using guessed type long sh_invalidid(_QWORD);
// C390: using guessed type long valid_nameref_value(_QWORD, _QWORD);
// C4F0: using guessed type long assignment(_QWORD, _QWORD);
// C500: using guessed type long err_readonly(_QWORD);
// C610: using guessed type long xtrace_print_assignment(_QWORD, _QWORD, _QWORD, _QWORD);
// C618: using guessed type long expand_assignment_string_to_string(_QWORD, _QWORD);
// C620: using guessed type long save_posix_options(void);
//----- (0000000000007BE0) ----------------------------------------------------
long makunbound(char *src, long a2)
[31712] {
long v2; // rbx
long v3; // rax
long v4; // rbp
long v5; // r13
int v6; // eax
int v7; // ecx
long v8; // rdi
int v9; // eax
long v10; // rdi
const char *v11; // r12
long v12; // r14
size_t v13; // rax
char *v14; // rax
char *v15; // rax
long v16; // rax
char *v17; // rdi
size_t v19; // rax
char *v20; // rax
char *v21; // r12
[31712, 31716, 31719] if ( !a2 )
[32272] return 0xFFFFFFFFLL;
[31725, 31727, 31729, 31731, 31734, 31735, 31736, 31739] v2 = a2;
[31766] while ( 1 )
{
[31761, 31763, 31757, 31766] v3 = hash_remove(src, *(_QWORD *)(v2 + 32), 0LL);
[31771] v4 = v3;
[31777, 31774] if ( v3 )
break;
[31744] v2 = *(_QWORD *)(v2 + 24);
[31748, 31751] if ( !v2 )
[32257, 32259, 32261, 32248, 32249, 32254, 32255] return 0xFFFFFFFFLL;
}
[31779] v5 = *(_QWORD *)(v3 + 16);
[31786, 31783] if ( !v5 )
goto LABEL_21;
[31792] v6 = *(_DWORD *)(v5 + 40);
[31796, 31798] if ( (v6 & 1) != 0 )
[31800] ++array_needs_making;
[31809, 31843, 31845, 31815, 31819, 31825, 31827, 31829, 31835, 31837, 31807] if ( (v6 & 0x20) != 0
&& ((v7 = *(_DWORD *)(v5 + 44), v7 == variable_context) || localvar_unset && v7 < variable_context) )
{
[31856, 31851] if ( (v6 & 0x20000) == 0 )
{
[31858] v8 = *(_QWORD *)(v5 + 8);
[31864, 31862] if ( (v6 & 4) != 0 )
{
[32267, 32262] array_dispose(v8);
}
[31872, 31870] else if ( (v6 & 0x40) != 0 )
{
[32314, 32309] assoc_dispose(v8);
}
[31881, 31878] else if ( (v6 & 0x800) != 0 )
{
[31890, 31887] if ( v8 )
[31904, 31897, 31892, 31909] sh_xfree(v8, "variables.c", 4016LL);
}
[32281, 32278] else if ( v8 )
{
[32304, 32299, 32292, 32287] sh_xfree(v8, "variables.c", 4018LL);
}
}
[31912] v9 = *(_DWORD *)(v5 + 40);
[31916] v10 = *(_QWORD *)(v5 + 16);
[31920] *(_QWORD *)(v5 + 8) = 0LL;
[31938, 31941, 31944, 31949, 31928, 31933] *(_DWORD *)(v5 + 40) = ((v9 & 0x100001) == 1048577) | 0x1020;
[31953, 31956] if ( v10 )
{
[31970, 31963, 31958] sh_xfree(v10, "variables.c", 4026LL);
[31975] *(_QWORD *)(v5 + 16) = 0LL;
}
[31983] v11 = *(const char **)v5;
[31987] v12 = *(_QWORD *)(v2 + 32);
[31994, 31991] v13 = strlen(*(const char **)v5);
[32011, 32004, 32015, 31999] v14 = (char *)sh_xmalloc(v13 + 1, "variables.c", 4028LL);
[32026, 32020, 32023] v15 = strcpy(v14, v11);
[32034, 32036, 32039, 32031] v16 = hash_insert(v15, v12, 0LL);
[32044] v17 = *(char **)v5;
[32048] *(_QWORD *)(v16 + 16) = v5;
[32052] stupidly_hack_special_variables(v17);
[32073, 32057, 32066, 32061] sh_xfree(*(_QWORD *)(v4 + 8), "variables.c", 4032LL);
[32081, 32093, 32086, 32078] sh_xfree(v4, "variables.c", 4033LL);
[32098, 32099, 32101, 32102, 32104, 32106] return 0LL;
}
else
{
LABEL_21:
[32112, 32115] v19 = strlen(src);
[32120, 32136, 32132, 32125] v20 = (char *)sh_xmalloc(v19 + 1, "variables.c", 4040LL);
[32144, 32147, 32141, 32168] v21 = strcpy(v20, src);
[32152, 32161, 32171, 32156] sh_xfree(*(_QWORD *)(v4 + 8), "variables.c", 4042LL);
[32176, 32188, 32181, 32191] sh_xfree(v4, "variables.c", 4043LL);
[32196, 32199] dispose_variable(v5);
[32204, 32207] stupidly_hack_special_variables(v21);
[32227, 32220, 32212, 32215] sh_xfree(v21, "variables.c", 4047LL);
[32232, 32233, 32235, 32236, 32238, 32240] return 0LL;
}
[32242, 32108, 32277] }
// 8F88: using guessed type int array_needs_making;
// 8FC0: using guessed type int localvar_unset;
// 8FC8: using guessed type int variable_context;
// BFF8: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// C000: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// C040: using guessed type long assoc_dispose(_QWORD);
// C0F0: using guessed type long array_dispose(_QWORD);
// C4A0: using guessed type long hash_insert(_QWORD, _QWORD, _QWORD);
// C4C0: using guessed type long hash_remove(_QWORD, _QWORD, _QWORD);
//----- (0000000000007E40) ----------------------------------------------------
long unbind_variable(char *src)
[32320] {
long v1; // rax
char **variable_nameref; // rax
[32320, 32324, 32325, 32332, 32335] v1 = var_lookup((long)src, shell_variables);
[32368, 32371, 32340, 32343, 32376, 32345, 32379, 32349] if ( v1 && (*(_BYTE *)(v1 + 41) & 8) != 0 && (variable_nameref = (char **)find_variable_nameref((_QWORD *)v1)) != 0LL )
[32392, 32388, 32381] return makunbound(*variable_nameref, shell_variables);
else
[32362, 32358, 32351] return makunbound(src, shell_variables);
[32361, 32391] }
// 8FE8: using guessed type long shell_variables;
//----- (0000000000007E90) ----------------------------------------------------
long check_unbind_variable(char *src)
[32400] {
_QWORD *variable; // rax
int v2; // eax
char *v4; // rax
long v5; // rdx
char *v6; // rax
[32400, 32408, 32404, 32405] variable = find_variable((long)src);
[32416, 32413] if ( !variable )
[32416, 32434] return unbind_variable(src);
[32418] v2 = *((_DWORD *)variable + 10);
[32421, 32423] if ( (v2 & 2) != 0 )
{
[32489, 32482, 32475, 32477] v6 = dcgettext(0LL, "%s: cannot unset: readonly %s", 5);
[32514, 32494, 32501, 32504, 32507, 32509] internal_error(v6, src, "variable");
}
else
{
[32425, 32428] if ( (v2 & 0x2000) == 0 )
[32434] return unbind_variable(src);
[32450, 32443, 32436, 32445] v4 = dcgettext(0LL, "%s: cannot unset", 5);
[32455, 32458, 32461, 32463, 32468] internal_error(v4, src, v5);
}
[32433, 32430] return 4294967294LL;
[32473, 32474] }
// 7ECF: variable 'v5' is possibly undefined
// C348: using guessed type long internal_error(_QWORD, _QWORD, _QWORD);
//----- (0000000000007F10) ----------------------------------------------------
long unbind_nameref(char *src)
[32528] {
long v1; // rax
[32528, 32532, 32533, 32540, 32543] v1 = var_lookup((long)src, shell_variables);
[32553, 32548, 32557, 32551] if ( v1 && (*(_BYTE *)(v1 + 41) & 8) != 0 )
[32568, 32579, 32575] return makunbound(src, shell_variables);
else
[32559] return 0LL;
[32561, 32562, 32578] }
// 8FE8: using guessed type long shell_variables;
//----- (0000000000007F50) ----------------------------------------------------
long unbind_variable_noref(char *src)
[32592] {
[32612, 32615, 32592, 32596, 32597, 32604, 32607] if ( var_lookup((long)src, shell_variables) )
[32624, 32635, 32631] return makunbound(src, shell_variables);
else
[32617] return 0LL;
[32634, 32619, 32620] }
// 8FE8: using guessed type long shell_variables;
//----- (0000000000007F80) ----------------------------------------------------
unsigned long make_vers_array()
[32640] {
char *v0; // r13
long new_array_variable; // rax
long v2; // rbp
long v3; // rbx
char *v4; // rax
long v5; // rax
long v6; // rax
char v8[12]; // [rsp+4h] [rbp-64h] BYREF
char s[40]; // [rsp+10h] [rbp-58h] BYREF
unsigned long v10; // [rsp+38h] [rbp-30h]
[32640, 32649, 32652, 32654, 32655, 32656] v0 = 0LL;
[32674, 32676, 32660, 32669] v10 = __readfsqword(0x28u);
[32681, 32642] unbind_variable_noref("BASH_VERSINFO");
[32693, 32686] new_array_variable = make_new_array_variable("BASH_VERSINFO");
[32713] v2 = *(_QWORD *)(new_array_variable + 8);
[32717] v3 = new_array_variable;
[32720, 32705, 32698, 32710] _strcpy_chk(s, dist_version, 32LL);
[32733, 32730, 32725] v4 = strchr(s, 46);
[32738, 32741] if ( v4 )
{
[32743] *v4 = 0;
[32746] v0 = v4 + 1;
}
[32750, 32753, 32755, 32760, 32763] array_insert(v2, 0LL, s);
[32768, 32776, 32771, 32779] array_insert(v2, 1LL, v0);
[32784, 32796, 32799, 32791] v5 = inttostr(patch_level, v8, 12LL);
[32809, 32804, 32812, 32815] array_insert(v2, 2LL, v5);
[32832, 32835, 32827, 32820] v6 = inttostr(build_version, v8, 12LL);
[32840, 32851, 32848, 32845] array_insert(v2, 3LL, v6);
[32856, 32868, 32871, 32863] array_insert(v2, 4LL, release_status);
[32888, 32891, 32883, 32876] array_insert(v2, 5LL, "x86_64-pc-linux-gnu");
[32896] *(_DWORD *)(v3 + 40) |= 2u;
[32905, 32914, 32900, 32916] return __readfsqword(0x28u) ^ v10;
[32920, 32921, 32922, 32924, 32926] }
// C0C8: using guessed type long array_insert(_QWORD, _QWORD, _QWORD);
// C558: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// C630: using guessed type long _strcpy_chk(_QWORD, _QWORD, _QWORD);
//----- (00000000000080B0) ----------------------------------------------------
long initialize_shell_variables(char **a1, int a2)
[32944] {
char *v2; // r12
char **v3; // r13
char *v4; // rbp
int v5; // eax
long *v6; // rax
char *v7; // rsi
long *v8; // rax
long *v9; // rax
char *bash_name; // rbp
char *v11; // rax
long *v12; // rax
const char *v13; // rdi
char *v14; // rbp
long *v15; // rax
int v17; // eax
long v18; // r15
char *v19; // rbx
char v20; // al
int v21; // r14d
long *v22; // rax
long v23; // r15
int v24; // edx
int v25; // eax
int v26; // edx
size_t v27; // rax
char *v28; // rax
long *v29; // rax
_QWORD *variable; // rax
unsigned int v31; // r14d
char *v32; // rax
const char *v33; // rsi
char *v34; // r15
long function; // rax
long *v36; // rax
long *v37; // rax
char *v38; // rax
char *v40; // [rsp+8h] [rbp-50h]
size_t n; // [rsp+10h] [rbp-48h]
int v42; // [rsp+18h] [rbp-40h]
[32960, 32961, 32965, 32969, 32944, 32948, 32950, 32952, 32954, 32957, 32959] create_variable_tables();
[32977, 32974] if ( !a1 )
goto LABEL_7;
[32979] v2 = *a1;
[32987, 32990, 32983] v3 = a1 + 1;
[32979] if ( !*a1 )
goto LABEL_7;
[32992, 32995] while ( 2 )
{
[32992] while ( 2 )
{
[32992] v4 = v2;
do
{
[33009] v5 = *v4++;
[33017, 33019, 33013] if ( !v5 )
goto LABEL_6;
}
[33000, 33003] while ( v5 != 61 );
[33673, 33670] v17 = (_DWORD)v4 - (_DWORD)v2 - 1;
[33676, 33670] if ( (_DWORD)v4 - (_DWORD)v2 == 1 )
goto LABEL_6;
[33682] v18 = v17;
[33689, 33682, 33685] v19 = &v2[v17];
[33693] *v19 = 0;
[33702] v20 = *v2;
[33696, 33707, 33709, 33711] if ( !(read_but_dont_execute | a2) && v20 == 66 )
{
[34081, 34088, 34093, 34095, 34073, 34078] if ( !strncmp("BASH_FUNC_", v2, 0xAuLL) )
{
[34101] v33 = &v2[v18 - 2];
[34145, 34115, 34150, 34153, 34122, 34127, 34160, 34129, 34165, 34135, 34106, 34139, 34109, 34167] if ( *v33 == 37 && !strcmp("%%", v33) && *v4 == 40 && !strncmp("() {", v4, 4uLL) )
{
[33664, 34192, 33667, 34173] n = (int)v4 - (int)v2 - 13;
[34177, 34185, 34188, 34197] v2[n + 10] = 0;
[34200, 34177] v40 = &v2[n + 10];
[34205, 34182, 34237] v42 = strlen(v4);
[34210, 34242, 34215, 34220, 34258, 34227, 34230, 34232] v34 = (char *)sh_xmalloc(n + v42 + 2, "variables.c", 411LL);
[34247, 34252, 34255, 34261, 34264] memcpy(v34, v2 + 10, n);
[34282] v34[n] = 32;
[34274, 34279, 34287, 34291, 34296, 34299, 34269] memcpy(&v34[n + 1], v4, v42 + 1);
[34304, 34338, 34307, 34340, 34312, 34314, 34316, 34322, 34324, 34330, 34333] if ( (unsigned int)absolute_program(v2 + 10) || posixly_correct && !(unsigned int)legal_identifier(v2 + 10) )
[34361, 34346, 34358, 34351] sh_xfree(v34, "variables.c", 423LL);
else
[34720, 34704, 34709, 34712, 34715] parse_and_execute(v34, v2 + 10, 389LL);
[34369, 34366] function = find_function((long)(v2 + 10));
[34374] v23 = function;
[34377, 34380] if ( function )
{
[34386] *(_DWORD *)(function + 40) |= 0x8001u;
[34393, 34398] array_needs_making = 1;
[34408] *v40 = 37;
[34411, 34414] *v19 = 61;
}
else
{
[34728, 34731, 34725] v37 = bind_invalid_envvar_constprop_0(v2, v4);
[34736] v23 = (long)v37;
[34739, 34742] if ( !v37 )
{
[34002] last_command_exit_value = 1;
[33993, 33995, 33988, 34012] v32 = dcgettext(0LL, "error importing function definition for `%s'", 5);
[34017, 34020, 34025, 34023] report_error(v32, v2 + 10);
[34038, 34035, 34030] *v40 = 37;
goto LABEL_50;
}
[34748] *((_DWORD *)v37 + 10) |= 0x9001u;
[34769, 34767] array_needs_making = 1;
[34779] last_command_exit_value = 1;
[34760, 34755, 34789] v38 = dcgettext(0LL, "error importing function definition for `%s'", 5);
[34800, 34794, 34802, 34797] report_error(v38, v2 + 10);
[34812, 34807] *v40 = 37;
[34818, 34815] *v19 = 61;
}
LABEL_41:
[33811, 33806] if ( (*(_BYTE *)(v23 + 40) & 8) == 0 )
{
[33820] ++v3;
[33824, 33817] v27 = strlen(v2);
[33841, 33834, 33845, 33829] v28 = (char *)sh_xmalloc(v27 + 1, "variables.c", 538LL);
[33856, 33850, 33861, 33853] *(_QWORD *)(v23 + 16) = strcpy(v28, v2);
[33865] v2 = *(v3 - 1);
[33872, 33869, 33878] if ( v2 )
continue;
goto LABEL_7;
}
LABEL_6:
[33021] v2 = *v3++;
[33032, 33025, 33029] if ( v2 )
continue;
goto LABEL_7;
}
}
goto LABEL_34;
}
break;
}
[33920, 33955, 33958, 33927, 33930, 33935, 33937, 33717, 33719, 33943, 33950] if ( v20 != 83 || strcmp(v2, "SHELLOPTS") || (variable = find_variable((long)"SHELLOPTS")) == 0LL )
{
LABEL_34:
[33725] v21 = 0;
goto LABEL_35;
}
[33964, 33967] v31 = *((_DWORD *)variable + 10);
[33976, 33970] *((_DWORD *)variable + 10) = v31 & 0xFFFFFFFD;
[33979, 33973, 33983] v21 = (v31 >> 1) & 1;
LABEL_35:
[33728, 33731] if ( (unsigned int)legal_identifier(v2) )
{
[33736, 33739, 33742, 33744, 33750] v22 = bind_variable_constprop_0(v2, v4);
[33755] v23 = (long)v22;
[33761, 33758] if ( v22 )
{
[33770, 33767] v24 = *((_DWORD *)v22 + 10);
[33772] v25 = v24 | 0x8003;
[33777] v26 = v24 | 0x8001;
[33786] if ( !v21 )
[33786, 33783] v25 = v26;
[33789] *(_DWORD *)(v23 + 40) = v25;
goto LABEL_40;
}
}
else
{
[33736, 33739, 33888] v29 = bind_invalid_envvar_constprop_0(v2, v4);
[33893] v23 = (long)v29;
[33896, 33899] if ( v29 )
{
[33912, 33905] *((_DWORD *)v29 + 10) |= 0x9001u;
LABEL_40:
[33793] array_needs_making = 1;
[33803] *v19 = 61;
goto LABEL_41;
}
}
LABEL_50:
[34048] ++v3;
[34052] *v19 = 61;
[34055] v2 = *(v3 - 1);
[34059, 34068, 34062] if ( v2 )
continue;
break;
}
LABEL_7:
[33034] set_pwd();
[33053, 33046, 33039] set_if_not("_", (char *)dollar_vars[0]);
[33058, 33077] dollar_dollar_pid = getpid();
[33083, 33070, 33063] set_if_not("PATH", "/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.");
[33088, 33102, 33095] set_if_not("TERM", "dumb");
[33113, 33115, 33107] if ( interactive_shell )
{
[34600, 34593, 34586] set_if_not("PS1", primary_prompt);
[34624, 34619, 34612, 34605] set_if_not("PS2", secondary_prompt);
}
[33121] if ( HIDWORD(current_user[0]) )
[33128, 33135, 34450, 33142, 34455, 33145] set_if_not("PS4", "+ ");
else
[33128, 33151, 33135] bind_variable_constprop_0("PS4", "+ ");
[33170, 33163, 33156, 33175] v6 = bind_variable_constprop_0("IFS", " \t\n");
[33178, 33175] setifs(v6);
[33183] set_machine_vars();
[33195, 33188, 33198] if ( interactive_shell )
{
[33200, 33214, 33207] v7 = "600";
[33231] if ( !posixly_correct )
[33228, 33231] v7 = "60";
[33235, 33221] v8 = set_if_not("MAILCHECK", v7);
[33240] *((_DWORD *)v8 + 10) |= 0x10u;
}
[33244] initialize_shell_level();
[33249] set_ppid();
[33254] set_argv0();
[33273, 33266, 33259] v9 = bind_variable_constprop_0("OPTIND", "1");
[33280, 33278] *((_DWORD *)v9 + 10) |= 0x10u;
[33284] getopts_reset(0LL);
[33296, 33289, 33303] bind_variable_constprop_0("OPTERR", "1");
[33315, 33308] sh_opterr = 1;
[33325, 34470] if ( login_shell == 1 && !posixly_correct )
[34481, 34476] set_home_var();
[33331, 33343] bash_name = get_bash_name();
[33336, 33346, 33349] bind_variable_constprop_0("BASH", bash_name);
[33369, 33354, 33366, 33359] sh_xfree(bash_name, "variables.c", 626LL);
[33374] set_shell_var();
[33379] v11 = (char *)shell_version_string();
[33384, 33394, 33391] bind_variable_constprop_0("BASH_VERSION", v11);
[33399] make_vers_array();
[33411, 33414] if ( command_execution_string )
[33416, 33404, 33423] bind_variable_constprop_0("BASH_EXECUTION_STRING", command_execution_string);
[33435, 33428] v12 = find_variable((long)"POSIXLY_CORRECT");
[33440, 33443, 34629, 33449, 34636, 33453, 34641, 34644, 34650] if ( (v12 || (v12 = find_variable((long)"POSIX_PEDANTIC")) != 0LL) && *((char *)v12 + 41) < 0 )
[34440, 34437, 34445] sv_strict_posix(*v12);
[33465, 33459, 33467] if ( remember_on_history )
{
[33482, 33475, 33469] v13 = "~/.sh_history";
[33491] if ( !posixly_correct )
[33489, 33491] v13 = "~/.bash_history";
[33497, 33509, 33495] v14 = (char *)bash_tilde_expand(v13, 0LL);
[33512, 33515, 33502] set_if_not("HISTFILE", v14);
[33520, 33532, 33525, 33535] sh_xfree(v14, "variables.c", 660LL);
}
[33540] seedrand();
[33545] seedrand32();
[33556, 33550, 33558] if ( interactive_shell )
{
[34493, 34486] v36 = find_variable((long)"IGNOREEOF");
[34498, 34690, 34501, 34507, 34669, 34511, 34676, 34681, 34684] if ( (v36 || (v36 = find_variable((long)"ignoreeof")) != 0LL) && *((char *)v36 + 41) < 0 )
[34656, 34659, 34664] sv_ignoreeof(*v36);
[34531, 34537, 34539, 34517, 34523, 34525] if ( interactive_shell && remember_on_history )
{
[34552, 34545] sv_history_control((long)"HISTCONTROL");
[34564, 34557] sv_histignore();
[34576, 34569, 34581] sv_histtimefmt((long)"HISTTIMEFORMAT");
}
}
[33564] uidset();
[33576, 33569, 33583] set_if_not(
"BASH_LOADABLES_PATH",
"/usr/local/lib/bash:/usr/lib/bash:/opt/local/lib/bash:/usr/pkg/lib/bash:/opt/pkg/lib/bash:.");
[33595, 33588] v15 = find_variable((long)"BASH_XTRACEFD");
[33600, 33609, 33603, 33605] if ( v15 && *((char *)v15 + 41) < 0 )
[34424, 34427, 34432] sv_xtracefd(*v15);
[33622, 33615] sv_shcompat((long)"BASH_COMPAT");
[33634, 33627] sv_funcnest((long)"FUNCNEST");
[33653, 33639] return initialize_dynamic_variables();
[33643, 33644, 33645, 33647, 33649, 33651] }
// 8F88: using guessed type int array_needs_making;
// BFB8: using guessed type long dollar_vars[10];
// BFE0: using guessed type int dollar_dollar_pid;
// BFF8: using guessed type long sh_xmalloc(_QWORD, _QWORD, _QWORD);
// C000: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// C078: using guessed type long report_error(_QWORD, _QWORD);
// C238: using guessed type _QWORD current_user[5];
// C290: using guessed type long seedrand(void);
// C2B8: using guessed type long setifs(_QWORD);
// C380: using guessed type long legal_identifier(_QWORD);
// C3A8: using guessed type long getopts_reset(_QWORD);
// C650: using guessed type long shell_version_string(void);
// C668: using guessed type long bash_tilde_expand(_QWORD, _QWORD);
// C670: using guessed type long seedrand32(void);
// C688: using guessed type long absolute_program(_QWORD);
// C6A0: using guessed type long parse_and_execute(_QWORD, _QWORD, _QWORD);
//----- (0000000000008810) ----------------------------------------------------
long unbind_global_variable(char *src)
[34832] {
long v1; // rax
char **variable_nameref; // rax
[34832, 34836, 34837, 34844, 34847] v1 = var_lookup((long)src, global_variables);
[34880, 34883, 34852, 34855, 34888, 34857, 34891, 34861] if ( v1 && (*(_BYTE *)(v1 + 41) & 8) != 0 && (variable_nameref = (char **)find_variable_nameref((_QWORD *)v1)) != 0LL )
[34904, 34900, 34893] return makunbound(*variable_nameref, shell_variables);
else
[34874, 34870, 34863] return makunbound(src, global_variables);
[34873, 34903] }
// 8FE8: using guessed type long shell_variables;
// 8FF0: using guessed type long global_variables;
//----- (0000000000008860) ----------------------------------------------------
long unbind_global_variable_noref(char *src)
[34912] {
[34912, 34916, 34917, 34924, 34927, 34932, 34935] if ( var_lookup((long)src, global_variables) )
[34944, 34955, 34951] return makunbound(src, global_variables);
else
[34937] return 0LL;
[34954, 34939, 34940] }
// 8FF0: using guessed type long global_variables;
//----- (0000000000008890) ----------------------------------------------------
long dispose_temporary_env(long a1)
[34960] {
long v2; // rdi
_QWORD *v3; // rax
long v4; // r12
long v5; // rdi
int v6; // edx
long v7; // rbx
char *v8; // rdi
long result; // rax
[34978, 34967, 34969, 34970, 34973] v2 = 1LL;
[34979, 34982] if ( temporary_env )
[34984, 34987] v2 = (unsigned int)(*(_DWORD *)(temporary_env + 12) + 1);
[34990] v3 = (_QWORD *)strvec_create(v2);
[34995] v4 = temporary_env;
[35005] tvlist_ind = 0;
[35015] tempvar_list = (long)v3;
[35022] *v3 = 0LL;
[35032] temporary_env = 0LL;
[35002, 35043, 35029] hash_flush(v4, a1);
[35048, 35051] hash_dispose(v4);
[35056] v5 = tempvar_list;
[35063] v6 = tvlist_ind;
[35070, 35063] *(_QWORD *)(tempvar_list + 8LL * tvlist_ind) = 0LL;
[35078] array_needs_making = 1;
[35088, 35090] if ( v6 > 0 )
{
[35092, 35094] v7 = 0LL;
do
{
[35104] v8 = *(char **)(v5 + 8 * v7++);
[35112, 35108] stupidly_hack_special_variables(v8);
[35123, 35117] v5 = tempvar_list;
}
[35130] while ( tvlist_ind > (int)v7 );
}
[35132] result = strvec_dispose();
[35139] tempvar_list = 0LL;
[35150] tvlist_ind = 0;
[35137] return result;
[35160, 35138, 35162] }
// 8F88: using guessed type int array_needs_making;
// 8FB8: using guessed type long temporary_env;
// BFD0: using guessed type int tvlist_ind;
// BFD8: using guessed type long tempvar_list;
// C178: using guessed type long strvec_create(_QWORD);
// C4D0: using guessed type long hash_flush(_QWORD, _QWORD);
// C4D8: using guessed type long hash_dispose(_QWORD);
// C6A8: using guessed type long strvec_dispose(void);
//----- (0000000000008960) ----------------------------------------------------
void dispose_used_env_vars()
[35168] {
[35168, 35180, 35172] if ( temporary_env )
{
[35193, 35186, 35182] dispose_temporary_env((long)propagate_temp_var);
[35202, 35198] maybe_make_export_env();
}
[35216] }
// 8FB8: using guessed type long temporary_env;
//----- (00000000000089A0) ----------------------------------------------------
long merge_temporary_env()
[35232] {
long ( *v0)(long); // rdi
long result; // rax
[35232, 35244, 35236] if ( temporary_env )
{
[35252, 35246] v0 = push_posix_temp_var;
[35268] if ( !posixly_correct )
[35259, 35268, 35261] v0 = push_temp_var;
[35272] return dispose_temporary_env((long)v0);
}
[35280] return result;
}
// 89A0: using guessed type long merge_temporary_env();
// 8FB8: using guessed type long temporary_env;
//----- (00000000000089E0) ----------------------------------------------------
long merge_function_temporary_env()
[35296] {
long result; // rax
[35296, 35300, 35308] if ( temporary_env )
[35317, 35310] return dispose_temporary_env((long)push_temp_var);
[35328] return result;
}
// 89E0: using guessed type long merge_function_temporary_env();
// 8FB8: using guessed type long temporary_env;
//----- (0000000000008A10) ----------------------------------------------------
long push_posix_tempvar_internal(long a1, char a2)
[35344] {
int v3; // ebx
char v4; // r12
const char *v5; // rdi
long v6; // rbx
long v7; // rdx
long *v8; // rbx
long v9; // rax
int v10; // eax
long v11; // rdi
long v12; // rdi
long *v14; // rax
int v15; // edx
int v16; // eax
[35361, 35362, 35350, 35352, 35355, 35356, 35359] v3 = *(_DWORD *)(a1 + 40);
[35369, 35365] v4 = (posixly_correct != 0) & a2;
[35372, 35375] if ( (v3 & 0x20) != 0 )
{
[35377] v5 = *(const char **)a1;
[35648, 35655, 35660, 35662, 35380, 35383] if ( *v5 == 45 && !strcmp(v5, "-") )
{
[35672, 35668] set_current_options(*(_QWORD *)(a1 + 8));
[35677] set_shellopts();
[35600, 35594, 35682] return dispose_variable(a1);
}
}
[35400, 35395, 35397, 35389] if ( (v3 & 0x100000) != 0 && v4 )
{
[35688, 35692, 35701, 35696] v14 = bind_variable(*(char **)a1, *(char **)(a1 + 8), 544);
[35706] v8 = v14;
[35712, 35709] if ( !v14 )
[35600, 35594, 35712] return dispose_variable(a1);
[35718] v15 = *((_DWORD *)v14 + 11);
[35721, 35724] v16 = *(_DWORD *)(a1 + 40) | *((_DWORD *)v14 + 10);
[35727] *((_DWORD *)v8 + 10) = v16;
[35730, 35732] if ( !v15 )
[35738, 35743] *((_DWORD *)v8 + 10) = v16 & 0xFFCFFFFF;
[35746] goto LABEL_14;
}
[35418, 35412, 35406] if ( (v3 & 0x300000) != 3145728 )
{
[35584, 35588] stupidly_hack_special_variables(*(char **)a1);
[35600, 35594, 35588] return dispose_variable(a1);
}
[35424] v6 = shell_variables;
[35434] v7 = *(_QWORD *)(shell_variables + 32);
[35431, 35438, 35440, 35446, 35449, 35611, 35452] if ( ((*(_DWORD *)(shell_variables + 12) & 4) != 0 || (*(_DWORD *)(shell_variables + 12) & 0x1C) == 16) && !v7 )
{
[35617, 35627, 35622] *(_QWORD *)(v6 + 32) = hash_create(1024LL);
[35642, 35638, 35631] v7 = *(_QWORD *)(shell_variables + 32);
}
[35458, 35462, 35466, 35469, 35471, 35476] v8 = bind_variable_internal(*(char **)a1, *(char **)(a1 + 8), v7, 0, 0);
[35479] v9 = shell_variables;
[35489, 35486] if ( v8 )
[35491, 35494] *((_DWORD *)v8 + 11) = *(_DWORD *)(shell_variables + 8);
[35504, 35497] if ( global_variables == v9 )
[35760, 35767] *(_DWORD *)(a1 + 40) &= 0xFFCFFFFF;
else
[35510] *(_DWORD *)(v9 + 12) |= 2u;
[35514, 35517] if ( v8 )
{
[35522, 35519] *((_DWORD *)v8 + 10) |= *(_DWORD *)(a1 + 40);
LABEL_14:
[35525] v10 = *(_DWORD *)(a1 + 40);
[35528, 35530] if ( (v10 & 0x44) != 0 )
{
[35532] v11 = v8[1];
[35536, 35539] if ( v11 )
{
[35553, 35546, 35541] sh_xfree(v11, "variables.c", 5375LL);
[35558] v10 = *(_DWORD *)(a1 + 40);
}
[35561] v12 = *(_QWORD *)(a1 + 8);
[35565, 35567] if ( (v10 & 4) != 0 )
[35578, 35573, 35582] v8[1] = array_copy(v12);
else
[35776, 35778, 35787, 35783] v8[1] = hash_copy(v12, 0LL);
}
}
[35600, 35593, 35594] return dispose_variable(a1);
[35597, 35598] }
// 8FE8: using guessed type long shell_variables;
// 8FF0: using guessed type long global_variables;
// C000: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// C050: using guessed type long hash_create(_QWORD);
// C308: using guessed type long set_shellopts(void);
// C520: using guessed type long hash_copy(_QWORD, _QWORD);
// C530: using guessed type long array_copy(_QWORD);
// C6B0: using guessed type long set_current_options(_QWORD);
//----- (0000000000008BD0) ----------------------------------------------------
long push_func_var(long a1)
[35792] {
[35792, 35796, 35798] return push_posix_tempvar_internal(a1, 0);
}
//----- (0000000000008BE0) ----------------------------------------------------
long push_builtin_var(long a1)
[35808] {
[35808, 35817, 35812] return push_posix_tempvar_internal(a1, 1);
}
//----- (0000000000008BF0) ----------------------------------------------------
long push_exported_var(long a1)
[35824] {
int v1; // eax
char *v3; // rdi
char *v5; // rsi
long *v6; // rax
long v7; // rdx
int v8; // edx
[35824, 35828, 35829] v1 = *(_DWORD *)(a1 + 40);
[35832, 35835] v3 = *(char **)a1;
[35840, 35852, 35838, 35846] if ( (v1 & 0x300001) != 3145729 )
{
[35854] stupidly_hack_special_variables(v3);
[35859, 35863] return dispose_variable(a1);
}
[35881, 35884, 35877] v5 = *(char **)(a1 + 8);
[35872, 35886] *(_DWORD *)(a1 + 40) = v1 & 0xFFEFFFFF;
[35896, 35889, 35900] v6 = bind_variable_internal(v3, v5, *(_QWORD *)(shell_variables + 32), 0, 0);
[35905] v7 = shell_variables;
[35912, 35919] if ( shell_variables == global_variables )
[35952, 35959] *(_DWORD *)(a1 + 40) &= ~0x200000u;
[35921, 35924] if ( !v6 )
[35859, 35924, 35863] return dispose_variable(a1);
[35926] v8 = *(_DWORD *)(v7 + 8);
[35929, 35935] *((_DWORD *)v6 + 10) |= *(_DWORD *)(a1 + 40);
[35938] *((_DWORD *)v6 + 11) = v8;
[35942, 35932, 35862] return dispose_variable(a1);
[35941] }
// 8FE8: using guessed type long shell_variables;
// 8FF0: using guessed type long global_variables;
//----- (0000000000008C80) ----------------------------------------------------
int reinit_special_variables()
[35968] {
[35968, 35972, 35976, 35983] sv_comp_wordbreaks((long)"COMP_WORDBREAKS");
[35995, 35988] sv_globignore();
[36000, 36011, 36007] return sv_opterr();
}
//----- (0000000000008CB0) ----------------------------------------------------
unsigned long set_pipestatus_array(int *a1, int a2)
[36016] {
long variable; // rax
long v3; // r12
long v4; // rax
long v5; // r13
long v6; // rbx
int v7; // eax
long v8; // r15
long v9; // r14
long v10; // rbx
long v11; // rax
long v12; // rsi
long v14; // rbx
long v15; // rax
long v16; // rax
long v17; // rbx
long v18; // rax
long v19; // rax
long v20; // rbx
char v21[12]; // [rsp+Ch] [rbp-4Ch] BYREF
unsigned long v22; // [rsp+18h] [rbp-40h]
[36042, 36043, 36047, 36016, 36056, 36020, 36022, 36024, 36027, 36061, 36029, 36031] v22 = __readfsqword(0x28u);
[36032, 36035, 36063] variable = (long)find_variable((long)"PIPESTATUS");
[36068, 36071] if ( !variable )
[36488, 36500, 36495] variable = make_new_array_variable("PIPESTATUS");
[36081, 36077] if ( (*(_BYTE *)(variable + 40) & 4) != 0 )
{
[36087] v3 = *(_QWORD *)(variable + 8);
[36100, 36105, 36108, 36091, 36094] if ( v3 && (v4 = *(_QWORD *)(v3 + 8)) != 0 )
{
[36120, 36114, 36117] if ( v4 == a2 )
{
[36512] v5 = *(_QWORD *)(v3 + 16);
[36521, 36517] if ( a2 == 1 )
{
[36527] v20 = *(_QWORD *)(v5 + 16);
[36536, 36531, 36547, 36543] sh_xfree(*(_QWORD *)(v20 + 8), "variables.c", 6388LL);
[36552, 36561, 36556] *(_QWORD *)(v20 + 8) = itos(*a1);
[36565, 36293, 36302] return __readfsqword(0x28u) ^ v22;
}
goto LABEL_9;
}
[36114, 36126] if ( v4 <= a2 )
{
[36132] v5 = *(_QWORD *)(v3 + 16);
LABEL_9:
[36137, 36140] if ( v4 <= 0 )
{
[36570, 36572] v7 = 0;
}
else
{
[36146, 36155, 36148] v6 = 0LL;
do
{
[36160] v5 = *(_QWORD *)(v5 + 16);
[36176, 36169, 36164, 36172] sh_xfree(*(_QWORD *)(v5 + 8), "variables.c", 6403LL);
[36186, 36181, 36191] *(_QWORD *)(v5 + 8) = itos(a1[v6]);
[36195] v7 = ++v6;
}
[36202, 36198, 36207] while ( *(_QWORD *)(v3 + 8) > v6 );
}
[36209, 36212] if ( a2 > v7 )
{
[36218, 36221] v8 = v7;
[36218, 36228] v9 = v7 + 1LL;
[36232, 36226, 36235, 36214] v10 = v9 + (unsigned int)(a2 - 1 - v7);
[36257] while ( 1 )
{
[36249, 36257, 36244, 36254] v11 = inttostr(a1[v8], v21, 12LL);
[36262] v12 = v8;
[36268] v8 = v9;
[36265, 36274, 36271] array_insert(v3, v12, v11);
[36288, 36282, 36284, 36279] if ( v10 == v9 )
break;
[36240] ++v9;
}
}
[36282, 36293] return __readfsqword(0x28u) ^ v22;
}
[36400, 36403] array_flush(v3);
[36408, 36411] if ( a2 > 0 )
{
[36424, 36417, 36419] v17 = 0LL;
do
{
[36432, 36442, 36445, 36437] v18 = inttostr(a1[v17], v21, 12LL);
[36456, 36450, 36459, 36453] array_insert(v3, v17, v18);
[36464, 36467] v19 = v17++;
}
[36474, 36476, 36413, 36471] while ( a2 - 1 != v19 );
}
}
[36328, 36331] else if ( a2 > 0 )
{
[36344, 36337, 36339] v14 = 0LL;
do
{
[36352, 36362, 36357, 36365] v15 = inttostr(a1[v14], v21, 12LL);
[36376, 36370, 36379, 36373] array_insert(v3, v14, v15);
[36384, 36387] v16 = v14++;
}
[36394, 36396, 36333, 36391] while ( a2 - 1 != v16 );
}
}
[36308, 36293] return __readfsqword(0x28u) ^ v22;
[36320, 36322, 36312, 36313, 36314, 36316, 36318] }
// C000: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// C0C8: using guessed type long array_insert(_QWORD, _QWORD, _QWORD);
// C100: using guessed type long itos(_QWORD);
// C558: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// C560: using guessed type long array_flush(_QWORD);
//----- (0000000000008EF0) ----------------------------------------------------
long save_pipestatus_array()
[36592] {
_QWORD *variable; // rax
long v1; // rdi
[36592, 36596, 36600, 36607] variable = find_variable((long)"PIPESTATUS");
[36612, 36615, 36617, 36621, 36623, 36627, 36630] if ( variable && (variable[5] & 4) != 0 && (v1 = variable[1]) != 0 )
[36636] return array_copy(v1);
else
[36648] return 0LL;
[36632, 36650, 36654] }
// 8EF0: using guessed type long save_pipestatus_array();
// C530: using guessed type long array_copy(_QWORD);
//----- (0000000000008F30) ----------------------------------------------------
_QWORD * restore_pipestatus_array(long a1)
[36656] {
_QWORD *result; // rax
long v3; // rdi
[36656, 36660, 36661, 36664, 36671] result = find_variable((long)"PIPESTATUS");
[36681, 36676, 36685, 36679] if ( result && (result[5] & 4) != 0 )
{
[36687] v3 = result[1];
[36691, 36694] if ( v3 )
{
[36696] result[1] = a1;
[36701] return (_QWORD *)array_dispose(v3);
}
}
[36700] return result;
[36712, 36713] }
// C0F0: using guessed type long array_dispose(_QWORD);
//----- (0000000000008F70) ----------------------------------------------------
unsigned long set_pipestatus_from_exit(int a1)
[36720] {
[36720, 36724] v_12816 = a1;
[36730] return set_pipestatus_array_constprop_0();
}
// 8F80: using guessed type int v_12816;
//----- (000000000000986C) ----------------------------------------------------
void make_local_variable_cold()
{
BUG();
}
//----- (0000000000009875) ----------------------------------------------------
void set_var_read_only_cold()
{
BUG();
}
// nfuncs=399 queued=238 decompiled=238 lumina nreq=0 worse=0 better=0
// ALL OK, 238 function(s) have been successfully decompiled
|
long push_args(long ***a1)
[42275] {
long v1; // rax
long v2; // rax
long v5; // [rsp+20h] [rbp-30h]
long *variable; // [rsp+28h] [rbp-28h]
long v7; // [rsp+30h] [rbp-20h]
long *v8; // [rsp+38h] [rbp-18h]
long v9; // [rsp+40h] [rbp-10h]
long v10; // [rsp+48h] [rbp-8h]
[42275, 42279, 42280, 42283, 42287, 42291, 42298, 42303] variable = find_variable((long)"BASH_ARGV");
[42307, 42312, 42314, 42318, 42321, 42324, 42326] if ( variable && (variable[5] & 4) != 0 )
[42328, 42332, 42336] v1 = variable[1];
else
[42338] v1 = 0LL;
[42343] v7 = v1;
[42354, 42347, 42359] v8 = find_variable((long)"BASH_ARGC");
[42368, 42370, 42374, 42377, 42380, 42382, 42363] if ( v8 && (v8[5] & 4) != 0 )
[42384, 42388, 42392] v2 = v8[1];
else
[42394] v2 = 0LL;
[42399] v9 = v2;
[42419, 42403, 42411, 42407] v5 = 0LL;
[42465, 42470] while ( a1 )
{
[42432, 42436, 42441, 42444, 42421, 42425, 42429] array_rshift(v7, 1LL, *a1[1]);
[42456, 42449, 42453] a1 = (long ***)*a1;
[42460] ++v5;
}
[42472, 42476, 42484, 42479] v10 = itos(v5);
[42496, 42501, 42504, 42488, 42492] array_rshift(v9, 1LL, v10);
[42528, 42533, 42534, 42509, 42513, 42518, 42525] return sh_xfree(v10, "variables.c", 5755LL);
[42535] }
// E280: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// E418: using guessed type long itos(_QWORD);
// E750: using guessed type long array_rshift(_QWORD, _QWORD, _QWORD);
//----- (000000000000A628) ----------------------------------------------------
unsigned long pop_args()
[42536] {
long v0; // rax
long v1; // rax
long v3; // [rsp+8h] [rbp-38h] BYREF
long *variable; // [rsp+10h] [rbp-30h]
long v5; // [rsp+18h] [rbp-28h]
long *v6; // [rsp+20h] [rbp-20h]
long v7; // [rsp+28h] [rbp-18h]
long v8; // [rsp+30h] [rbp-10h]
unsigned long v9; // [rsp+38h] [rbp-8h]
[42536, 42540, 42541, 42544, 42548, 42557] v9 = __readfsqword(0x28u);
[42561, 42570, 42563, 42575] variable = find_variable((long)"BASH_ARGV");
[42593, 42596, 42598, 42579, 42584, 42586, 42590] if ( variable && (variable[5] & 4) != 0 )
[42600, 42604, 42608] v0 = variable[1];
else
[42610] v0 = 0LL;
[42615] v5 = v0;
[42626, 42619, 42631] v6 = find_variable((long)"BASH_ARGC");
[42635, 42640, 42642, 42646, 42649, 42652, 42654] if ( v6 && (v6[5] & 4) != 0 )
[42656, 42660, 42664] v1 = v6[1];
else
[42666] v1 = 0LL;
[42671] v7 = v1;
[42687, 42682, 42675, 42679] v8 = array_unshift_element(v1);
[42721, 42691, 42723, 42696, 42698, 42702, 42706, 42710, 42713, 42716] if ( !v8 || !(unsigned int)legal_number(*(_QWORD *)(v8 + 8), &v3) )
[42733, 42725] v3 = 0LL;
[42776, 42769, 42773] while ( v3 > 0 )
{
[42752, 42735, 42739, 42744, 42749] array_shift(v5, 1LL, 1LL);
[42761, 42765, 42757] --v3;
}
[42785, 42778, 42782] array_dispose_element(v8);
[42790, 42791, 42795, 42804, 42806, 42811] return __readfsqword(0x28u) ^ v9;
[42812] }
// E360: using guessed type long legal_number(_QWORD, _QWORD);
// E758: using guessed type long array_unshift_element(_QWORD);
// E760: using guessed type long array_shift(_QWORD, _QWORD, _QWORD);
// E768: using guessed type long array_dispose_element(_QWORD);
//----- (000000000000A73D) ----------------------------------------------------
long sv_compare(const char **a1, const char **a2)
[42813] {
unsigned int v3; // [rsp+1Ch] [rbp-4h]
[42817, 42818, 42850, 42821, 42853, 42856, 42825, 42859, 42829, 42861, 42863, 42833, 42837, 42840, 42843, 42813, 42846] v3 = **a1 - **a2;
[42866, 42870] if ( !v3 )
[42883, 42886, 42889, 42892, 42897, 42872, 42876, 42879] return (unsigned int)strcmp(*a1, *a2);
[42900, 42903] return v3;
[42904] }
//----- (000000000000A799) ----------------------------------------------------
long find_special_var(const char *a1)
[42905] {
unsigned int i; // ebx
int v2; // eax
int v3; // r12d
[42912, 43040, 42916, 43047, 42920, 43051, 42925, 43054, 43037, 43027, 43060, 43030, 42905, 42906, 42909, 43033, 42911] for ( i = 0; (&special_vars)[2 * (int)i]; ++i )
{
[42961, 42954, 42958, 42951] v2 = *a1;
[42944, 42948, 42927, 42930, 42964, 42934, 42966, 42937] v3 = *(&special_vars)[2 * (int)i] - v2;
[42944, 42948, 42927, 42934, 42969, 42972] if ( *(&special_vars)[2 * (int)i] == v2 )
[42977, 43010, 42981, 42984, 42991, 42995, 42999, 43002, 43005, 42974] v3 = strcmp((&special_vars)[2 * (int)i], a1);
[43016, 43013] if ( !v3 )
[43018, 43020] return i;
[43025, 43022] if ( v3 > 0 )
break;
}
[43068] return 0xFFFFFFFFLL;
[43072, 43073, 43075, 43076] }
// C1E0: using guessed type char *special_vars;
//----- (000000000000A845) ----------------------------------------------------
long stupidly_hack_special_variables(const char *a1)
[43077] {
long result; // rax
[43077, 43081, 43082, 43085, 43089, 43093, 43099, 43101] if ( !sv_sorted_11627 )
{
[43110, 43115, 43120, 43127, 43103] qsort(&special_vars, 0x25uLL, 0x10uLL, (__compar_fn_t)sv_compare);
[43132] sv_sorted_11627 = 1;
}
[43146, 43149, 43142] result = find_special_var(a1);
[43161, 43154, 43157] if ( (_DWORD)result != -1 )
[43168, 43172, 43175, 43182, 43186, 43190, 43193, 43163, 43166] return ((long ( *)(const char *))*(&off_C1E8 + 2 * (int)result))(a1);
[43195, 43196] return result;
[43197] }
// B9D4: using guessed type int sv_sorted_11627;
// C1E0: using guessed type char *special_vars;
// C1E8: using guessed type long ( *off_C1E8)();
//----- (000000000000A8BE) ----------------------------------------------------
int reinit_special_variables()
[43198] {
[43202, 43203, 43206, 43213, 43198] sv_comp_wordbreaks((long)"COMP_WORDBREAKS");
[43225, 43218] sv_globignore((long)"GLOBIGNORE");
[43242, 43243, 43237, 43230] return sv_opterr();
[43244] }
//----- (000000000000A8ED) ----------------------------------------------------
long sv_ifs()
[43245] {
long *variable; // [rsp+18h] [rbp-8h]
[43268, 43273, 43245, 43249, 43250, 43253, 43257, 43261] variable = find_variable((long)"IFS");
[43277, 43281, 43284, 43289, 43290] return setifs(variable);
[43291] }
// E2D0: using guessed type long setifs(_QWORD);
//----- (000000000000A91C) ----------------------------------------------------
long sv_path()
[43292] {
[43296, 43297, 43300, 43304, 43308, 43313, 43314, 43292] return phash_flush();
[43315] }
// A91C: using guessed type long sv_path();
// E770: using guessed type long phash_flush(void);
//----- (000000000000A934) ----------------------------------------------------
long sv_mail(long a1)
[43316] {
[43328, 43332, 43336, 43340, 43343, 43345, 43316, 43320, 43321, 43324] if ( *(_BYTE *)(a1 + 4) == 67 )
[43352, 43347] return reset_mail_timer();
[43354] free_mail_files();
[43364, 43365, 43359] return remember_mail_dates();
[43366] }
// E778: using guessed type long reset_mail_timer(void);
// E780: using guessed type long free_mail_files(void);
// E788: using guessed type long remember_mail_dates(void);
//----- (000000000000A967) ----------------------------------------------------
unsigned long sv_funcnest(long a1)
[43367] {
long v2; // [rsp+18h] [rbp-18h] BYREF
long *variable; // [rsp+20h] [rbp-10h]
unsigned long v4; // [rsp+28h] [rbp-8h]
[43392, 43367, 43371, 43372, 43375, 43379, 43383] v4 = __readfsqword(0x28u);
[43396, 43398, 43402, 43405, 43410] variable = find_variable(a1);
[43419, 43414] if ( variable )
{
[43456, 43458, 43433, 43437, 43441, 43445, 43448, 43451] if ( (unsigned int)legal_number(variable[1], &v2) )
[43472, 43476] funcnest_max = v2;
else
[43460, 43470] funcnest_max = 0;
}
else
{
[43421, 43431] funcnest_max = 0;
}
[43496, 43498, 43503, 43482, 43483, 43487] return __readfsqword(0x28u) ^ v4;
[43504] }
// E360: using guessed type long legal_number(_QWORD, _QWORD);
//----- (000000000000A9F1) ----------------------------------------------------
long sv_execignore(long a1)
[43505] {
[43521, 43525, 43528, 43533, 43534, 43505, 43509, 43510, 43513, 43517] return setup_exec_ignore(a1);
[43535] }
// E798: using guessed type long setup_exec_ignore(_QWORD);
//----- (000000000000AA10) ----------------------------------------------------
long sv_globignore(long a1)
[43536] {
long result; // rax
[43552, 43536, 43540, 43541, 43544, 43548] result = privileged_mode;
[43560, 43558] if ( !privileged_mode )
[43569, 43562, 43566] return setup_glob_ignore(a1);
[43574, 43575] return result;
[43576] }
// E7A8: using guessed type long setup_glob_ignore(_QWORD);
//----- (000000000000AA39) ----------------------------------------------------
long * sv_comp_wordbreaks(long a1)
[43577] {
long *result; // rax
[43585, 43589, 43593, 43597, 43600, 43577, 43581, 43582] result = find_variable(a1);
[43609, 43605, 43614] if ( !result )
[43616] return (long *)reset_completer_word_break_chars();
[43621, 43622] return result;
[43623] }
// E7B0: using guessed type long reset_completer_word_break_chars(void);
//----- (000000000000AA68) ----------------------------------------------------
long sv_terminal()
[43624] {
long result; // rax
long string_value; // rax
[43624, 43628, 43629, 43632, 43636, 43640] result = interactive_shell;
[43648, 43646] if ( interactive_shell )
{
[43650] result = no_line_editing;
[43656, 43658] if ( !no_line_editing )
{
[43667, 43660] string_value = get_string_value((long)"TERM");
[43672, 43675] return rl_reset_terminal(string_value);
}
}
[43680, 43681] return result;
[43682] }
// AA68: using guessed type long sv_terminal();
// E7C0: using guessed type long rl_reset_terminal(_QWORD);
//----- (000000000000AAA3) ----------------------------------------------------
long * sv_hostfile(long a1)
[43683] {
long *result; // rax
[43683, 43687, 43688, 43691, 43695, 43699, 43703, 43706] result = find_variable(a1);
[43720, 43715, 43711] if ( !result )
[43722, 43727] return (long *)clear_hostname_list();
[43729] hostname_list_initialized = 0;
[43739, 43740] return result;
[43741] }
// E7C8: using guessed type long clear_hostname_list(void);
//----- (000000000000AADE) ----------------------------------------------------
unsigned long sv_histsize(long a1)
[43742] {
long v1; // rax
int v3; // [rsp+14h] [rbp-1Ch]
int v4; // [rsp+14h] [rbp-1Ch]
long v5; // [rsp+18h] [rbp-18h] BYREF
_BYTE *string_value; // [rsp+20h] [rbp-10h]
unsigned long v7; // [rsp+28h] [rbp-8h]
[43746, 43747, 43750, 43754, 43758, 43767, 43742] v7 = __readfsqword(0x28u);
[43777, 43780, 43785, 43771, 43773] string_value = (_BYTE *)get_string_value(a1);
[43809, 43789, 43794, 43800, 43804, 43807] if ( string_value && *string_value )
{
[43815, 43819, 43823, 43826, 43829, 43834, 43836] if ( (unsigned int)legal_number(string_value, &v5) )
{
[43842, 43846] v3 = v5;
[43849, 43853, 43855, 43859, 43863, 43866, 43868] if ( (int)v5 < 0 && *(_BYTE *)(a1 + 4) == 83 )
{
[43875, 43870] unstifle_history();
}
[43880, 43884, 43888, 43891, 43893] else if ( *(_BYTE *)(a1 + 4) == 83 )
{
[43898, 43900, 43895] stifle_history((unsigned int)v5);
[43905, 43910] v4 = where_history();
[43913, 43922, 43919] if ( v4 < history_lines_this_session )
[43924, 43933, 43927] history_lines_this_session = v4;
}
[43939, 43935] else if ( (int)v5 >= 0 )
{
[43948, 43941] v1 = get_string_value((long)"HISTFILE");
[43953, 43956, 43959, 43961, 43964] history_truncate_file(v1, (unsigned int)v3);
[43969, 43978, 43975] if ( v3 < history_lines_in_file )
[43980, 43989, 43983] history_lines_in_file = v3;
}
}
}
[44002, 44004, 43991, 43995, 43999] else if ( *(_BYTE *)(a1 + 4) == 83 )
{
[44011, 44006] unstifle_history();
}
[44035, 44014, 44015, 44019, 44028, 44030] return __readfsqword(0x28u) ^ v7;
[44036] }
// E360: using guessed type long legal_number(_QWORD, _QWORD);
// E7D8: using guessed type long unstifle_history(void);
// E7E0: using guessed type long stifle_history(_QWORD);
// E7E8: using guessed type long where_history(void);
// E7F8: using guessed type long history_truncate_file(_QWORD, _QWORD);
//----- (000000000000AC05) ----------------------------------------------------
long sv_histignore(long a1)
[44037] {
[44065, 44066, 44037, 44041, 44042, 44045, 44049, 44053, 44057, 44060] return setup_history_ignore(a1);
[44067] }
// E808: using guessed type long setup_history_ignore(_QWORD);
//----- (000000000000AC24) ----------------------------------------------------
unsigned long sv_history_control(long a1)
[44068] {
int v2; // [rsp+14h] [rbp-1Ch] BYREF
_BYTE *string_value; // [rsp+18h] [rbp-18h]
char *s1; // [rsp+20h] [rbp-10h]
unsigned long v5; // [rsp+28h] [rbp-8h]
[44068, 44072, 44073, 44076, 44080, 44084, 44093] v5 = __readfsqword(0x28u);
[44097, 44099] history_control = 0;
[44121, 44113, 44116, 44109] string_value = (_BYTE *)get_string_value(a1);
[44130, 44136, 44140, 44143, 44145, 44125] if ( string_value && *string_value )
{
[44158, 44151] v2 = 0;
[44431] while ( 1 )
{
[44416, 44420, 44423, 44426, 44431, 44412] s1 = (char *)extract_colon_unit(string_value, &v2);
[44440, 44435, 44446] if ( !s1 )
break;
[44193, 44163, 44198, 44167, 44200, 44170, 44175, 44177, 44179, 44183, 44190] if ( *s1 == 105 && !strcmp(s1, "ignorespace") )
{
[44208, 44217, 44202, 44211] history_control |= 1u;
}
[44257, 44226, 44259, 44229, 44234, 44236, 44238, 44242, 44249, 44252, 44222] else if ( *s1 == 105 && !strcmp(s1, "ignoredups") )
{
[44267, 44276, 44261, 44270] history_control |= 2u;
}
[44290, 44292, 44294, 44298, 44305, 44308, 44278, 44313, 44282, 44315, 44285] else if ( *s1 == 105 && !strcmp(s1, "ignoreboth") )
{
[44323, 44332, 44317, 44326] history_control |= 3u;
}
[44354, 44361, 44364, 44334, 44369, 44338, 44371, 44341, 44346, 44348, 44350] else if ( *s1 == 101 && !strcmp(s1, "erasedups") )
{
[44379, 44373, 44382] history_control |= 4u;
}
[44388, 44392, 44397, 44404, 44407] sh_xfree(s1, "variables.c", 6190LL);
}
}
[44449, 44453, 44462, 44464, 44469] return __readfsqword(0x28u) ^ v5;
[44470] }
// E280: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// E818: using guessed type long extract_colon_unit(_QWORD, _QWORD);
//----- (000000000000ADB7) ----------------------------------------------------
long sv_histchars(long a1)
[44471] {
long result; // rax
long v2; // [rsp+18h] [rbp-8h]
[44483, 44487, 44491, 44494, 44471, 44475, 44476, 44479] result = get_string_value(a1);
[44499] v2 = result;
[44508, 44503] if ( result )
{
[44514, 44517, 44510] history_expansion_char = *(_BYTE *)result;
[44523, 44527] result = *(unsigned char *)result;
[44530, 44532] if ( (_BYTE)result )
{
[44538, 44542, 44534] result = *(unsigned char *)(v2 + 1);
[44545, 44547] if ( (_BYTE)result )
{
[44553, 44557, 44549] history_subst_char = *(_BYTE *)(v2 + 1);
[44571, 44563, 44567] result = *(unsigned char *)(v2 + 2);
[44576, 44574] if ( (_BYTE)result )
{
[44578, 44582] result = *(unsigned char *)(v2 + 2);
[44592, 44586, 44582] history_comment_char = *(_BYTE *)(v2 + 2);
}
}
}
}
else
{
[44594] history_expansion_char = 33;
[44601] history_subst_char = 94;
[44608] history_comment_char = 35;
}
[44616, 44615] return result;
[44617] }
//----- (000000000000AE4A) ----------------------------------------------------
_BOOL8 sv_histtimefmt(long a1)
[44618] {
_BOOL8 result; // rax
long *variable; // [rsp+18h] [rbp-8h]
[44641, 44646, 44618, 44622, 44623, 44626, 44630, 44634, 44638] variable = find_variable(a1);
[44650, 44655, 44657, 44664, 44666] if ( variable && !history_comment_char )
[44668] history_comment_char = 35;
[44680, 44675, 44683] result = variable != 0LL;
[44680, 44686] history_write_timestamps = variable != 0LL;
[44692, 44693] return result;
[44694] }
//----- (000000000000AE97) ----------------------------------------------------
void sv_tz(long a1)
[44695] {
long *variable; // [rsp+18h] [rbp-8h]
[44707, 44711, 44715, 44718, 44723, 44695, 44699, 44700, 44703] variable = find_variable(a1);
[44738, 44741, 44744, 44746, 44727, 44732, 44734] if ( variable && (variable[5] & 1) != 0 )
{
[44748, 44758] array_needs_making = 1;
}
[44760, 44765] else if ( !variable )
{
[44767] array_needs_making = 1;
}
[44777, 44785, 44783] if ( array_needs_making )
{
[44787] maybe_make_export_env();
[44792, 44797] tzset();
}
[44798, 44799] }
// B8B8: using guessed type int array_needs_making;
//----- (000000000000AF00) ----------------------------------------------------
long sv_ignoreeof(long a1)
[44800] {
_BOOL4 v1; // eax
char *v2; // rax
int v3; // eax
long *variable; // [rsp+10h] [rbp-10h]
char *nptr; // [rsp+18h] [rbp-8h]
[44800, 44804, 44805, 44808, 44812, 44816] eof_encountered = 0;
[44838, 44833, 44826, 44830] variable = find_variable(a1);
[44867, 44842, 44847, 44849, 44853, 44857, 44860, 44862] v1 = variable && variable[1];
[44874] ignoreeof = v1;
[44880, 44885] if ( variable )
[44891, 44895, 44887] v2 = (char *)variable[1];
else
[44897] v2 = 0LL;
[44902] nptr = v2;
[44906, 44911] if ( v2 )
{
[44928, 44931, 44936, 44938, 44913, 44917, 44920, 44922, 44924] if ( *v2 && (unsigned int)all_digits(v2) )
[44944, 44947, 44940, 44952] v3 = atoi(nptr);
else
[44954] v3 = 10;
[44959] eof_encountered_limit = v3;
}
[44970, 44971, 44965] return set_shellopts();
[44972] }
// E728: using guessed type long set_shellopts(void);
// E858: using guessed type long all_digits(_QWORD);
//----- (000000000000AFAD) ----------------------------------------------------
long sv_optind()
[44973] {
const char *variable_value; // rax
int v2; // [rsp+1Ch] [rbp-14h]
long *variable; // [rsp+20h] [rbp-10h]
[44996, 45001, 44973, 44977, 44978, 44981, 44985, 44989] variable = find_variable((long)"OPTIND");
[45010, 45005] if ( variable )
[45016, 45019, 45012, 45024] variable_value = (const char *)get_variable_value((long)variable);
else
[45026] variable_value = 0LL;
[45031, 45035, 45040, 45042, 45046, 45049, 45051] if ( variable_value && *variable_value )
{
[45057, 45060, 45053, 45065] v2 = atoi(variable_value);
[45072, 45074, 45068, 45078] if ( v2 < 0 || v2 == 1 )
[45080, 45087] v2 = 0;
}
else
{
[45096, 45089] v2 = 0;
}
[45099, 45102, 45104, 45109, 45110] return getopts_reset((unsigned int)v2);
[45111] }
// AFAD: using guessed type long sv_optind();
// E2D8: using guessed type long getopts_reset(_QWORD);
//----- (000000000000B038) ----------------------------------------------------
int sv_opterr()
[45112] {
int result; // eax
char *nptr; // [rsp+18h] [rbp-8h]
[45120, 45124, 45128, 45135, 45140, 45112, 45116, 45117] nptr = (char *)get_string_value((long)"OPTERR");
[45155, 45158, 45160, 45144, 45149, 45151] if ( nptr && *nptr )
[45169, 45162, 45166, 45174] result = atoi(nptr);
else
[45176] result = 1;
[45181] LODWORD(sh_opterr) = result;
[45187, 45188] return result;
[45189] }
//----- (000000000000B086) ----------------------------------------------------
long sv_strict_posix(long a1)
[45190] {
_BOOL4 v1; // eax
long *variable; // [rsp+18h] [rbp-8h]
[45218, 45190, 45194, 45195, 45198, 45202, 45206, 45210, 45213] variable = find_variable(a1);
[45222, 45227, 45229, 45233, 45237, 45240, 45242, 45247] v1 = variable && variable[1];
[45254] posixly_correct = v1;
[45266, 45268, 45260] posix_initialize(v1);
[45273, 45281, 45279] if ( interactive_shell )
[45289, 45283, 45291] posix_readline_initialize(posixly_correct);
[45296, 45301, 45302] return set_shellopts();
[45303] }
// E728: using guessed type long set_shellopts(void);
// E870: using guessed type long posix_initialize(_QWORD);
// E878: using guessed type long posix_readline_initialize(_QWORD);
//----- (000000000000B0F8) ----------------------------------------------------
long sv_locale(_BYTE *a1)
[45304] {
long result; // rax
int v2; // [rsp+14h] [rbp-Ch]
long string_value; // [rsp+18h] [rbp-8h]
[45312, 45316, 45320, 45324, 45327, 45332, 45304, 45308, 45309] string_value = get_string_value((long)a1);
[45345, 45347, 45351, 45355, 45358, 45360, 45336, 45340, 45343] if ( *a1 == 76 && a1[1] == 65 )
{
[45376, 45362, 45366, 45370, 45373] result = set_lang(a1, string_value);
[45384, 45381] v2 = result;
}
else
{
[45386, 45390, 45394, 45397, 45400] result = set_locale_var(a1, string_value);
[45405] v2 = result;
}
[45408, 45412] if ( !v2 )
{
[45414] result = posixly_correct;
[45420, 45422] if ( posixly_correct )
[45424, 45429] return set_exit_status(1LL);
}
[45434, 45435] return result;
[45436] }
// E880: using guessed type long set_lang(_QWORD, _QWORD);
// E888: using guessed type long set_locale_var(_QWORD, _QWORD);
// E890: using guessed type long set_exit_status(_QWORD);
//----- (000000000000B17D) ----------------------------------------------------
unsigned long set_pipestatus_array(int *a1, int a2)
[45437] {
int k; // ebx
int j; // ebx
int i; // ebx
long variable; // [rsp+18h] [rbp-48h]
long v7; // [rsp+20h] [rbp-40h]
long v8; // [rsp+20h] [rbp-40h]
long v9; // [rsp+28h] [rbp-38h]
long v10; // [rsp+30h] [rbp-30h]
long v11; // [rsp+30h] [rbp-30h]
long v12; // [rsp+30h] [rbp-30h]
char v13[12]; // [rsp+3Ch] [rbp-24h] BYREF
unsigned long v14; // [rsp+48h] [rbp-18h]
[45441, 45442, 45445, 45446, 45450, 45454, 45457, 45466, 45437] v14 = __readfsqword(0x28u);
[45472, 45484, 45470, 45479] variable = (long)find_variable((long)"PIPESTATUS");
[45488, 45493] if ( !variable )
[45507, 45502, 45495] variable = make_new_array_variable("PIPESTATUS");
[45511, 45515, 45518, 45521, 45523] if ( (*(_DWORD *)(variable + 40) & 4) != 0 )
{
[45529, 45533, 45537] v9 = *(_QWORD *)(variable + 8);
[45541, 45546, 45548, 45552, 45556, 45559] if ( v9 && *(_QWORD *)(v9 + 8) )
{
[45665, 45667, 45671, 45649, 45653, 45657, 45660, 45662] if ( *(_QWORD *)(v9 + 8) == a2 && a2 == 1 )
{
[45673, 45681, 45677, 45685] v7 = *(_QWORD *)(*(_QWORD *)(v9 + 16) + 16LL);
[45697, 45702, 45709, 45712, 45689, 45693] sh_xfree(*(_QWORD *)(v7 + 8), "variables.c", 6388LL);
[45728, 45733, 45737, 45741, 45717, 45721, 45723, 45725] *(_QWORD *)(v7 + 8) = itos(*a1);
}
[45762, 45746, 45750, 45754, 45757, 45759] else if ( *(_QWORD *)(v9 + 8) > a2 )
{
[45968, 45971, 45964] array_flush(v9);
[46051, 46054, 46057, 46059, 45976, 45981] for ( i = 0; i < a2; ++i )
{
[46017, 45986, 46020, 46025, 45994, 45998, 46001, 46003, 46005, 46009, 46014, 45983] v12 = inttostr(a1[i], v13, 12LL);
[46029, 46032, 46036, 46040, 46043, 46046] array_insert(v9, i, v12);
}
}
else
{
[45768, 45772, 45776] v8 = *(_QWORD *)(v9 + 16);
[45865, 45868, 45871, 45875, 45780, 45879, 45785, 45882, 45884] for ( j = 0; j < *(_QWORD *)(v9 + 8); ++j )
{
[45795, 45787, 45791] v8 = *(_QWORD *)(v8 + 16);
[45799, 45803, 45807, 45812, 45819, 45822] sh_xfree(*(_QWORD *)(v8 + 8), "variables.c", 6403LL);
[45857, 45827, 45861, 45830, 45838, 45842, 45845, 45847, 45849, 45852] *(_QWORD *)(v8 + 8) = itos(a1[j]);
}
[45960, 45962, 45957] while ( j < a2 )
{
[45920, 45889, 45923, 45928, 45897, 45901, 45904, 45906, 45908, 45912, 45917, 45886] v11 = inttostr(a1[j], v13, 12LL);
[45954, 45932, 45935, 45939, 45943, 45946, 45949] array_insert(v9, j++, v11);
}
}
}
else
{
[45636, 45639, 45642, 45644, 45561, 45566] for ( k = 0; k < a2; ++k )
{
[45568, 45602, 45571, 45605, 45610, 45579, 45583, 45586, 45588, 45590, 45594, 45599] v10 = inttostr(a1[k], v13, 12LL);
[45614, 45617, 45621, 45625, 45628, 45631] array_insert(v9, k, v10);
}
}
}
[46082, 46062, 46066, 46075, 46077] return __readfsqword(0x28u) ^ v14;
[46088, 46086, 46087] }
// E280: using guessed type long sh_xfree(_QWORD, _QWORD, _QWORD);
// E3A0: using guessed type long inttostr(_QWORD, _QWORD, _QWORD);
// E3B8: using guessed type long array_insert(_QWORD, _QWORD, _QWORD);
// E418: using guessed type long itos(_QWORD);
// E898: using guessed type long array_flush(_QWORD);
//----- (000000000000B409) ----------------------------------------------------
long save_pipestatus_array()
[46089] {
long *variable; // [rsp+0h] [rbp-10h]
[46113, 46089, 46093, 46094, 46097, 46101, 46108] variable = find_variable((long)"PIPESTATUS");
[46146, 46117, 46149, 46122, 46124, 46128, 46131, 46134, 46136, 46138, 46142] if ( variable && (variable[5] & 4) != 0 && variable[1] )
[46178, 46158, 46162, 46166, 46169, 46174] return array_copy(variable[1]);
else
[46156, 46151] return 0LL;
[46182, 46183] }
// B409: using guessed type long save_pipestatus_array();
// E5D0: using guessed type long array_copy(_QWORD);
//----- (000000000000B468) ----------------------------------------------------
long * restore_pipestatus_array(long a1)
[46184] {
long *result; // rax
long v2; // [rsp+10h] [rbp-10h]
long v3; // [rsp+18h] [rbp-8h]
[46184, 46188, 46189, 46192, 46196, 46200, 46207] result = find_variable((long)"PIPESTATUS");
[46212] v2 = (long)result;
[46216, 46221] if ( result )
{
[46227, 46230, 46223] result = (long *)(result[5] & 4);
[46233, 46235] if ( (_DWORD)result )
{
[46241, 46237] result = *(long **)(v2 + 8);
[46248, 46245] if ( result )
{
[46258, 46250, 46254] v3 = *(_QWORD *)(v2 + 8);
[46266, 46270, 46262] *(_QWORD *)(v2 + 8) = a1;
[46281, 46274, 46286, 46278] return (long *)array_dispose(v3);
}
}
}
[46289] return result;
[46290] }
// E4F8: using guessed type long array_dispose(_QWORD);
//----- (000000000000B4D3) ----------------------------------------------------
unsigned long set_pipestatus_from_exit(int a1)
[46291] {
[46306, 46309, 46291, 46295, 46296, 46299, 46303] v_11751 = a1;
[46315, 46320, 46327, 46332, 46333] return set_pipestatus_array(&v_11751, 1);
[46334] }
// B8C0: using guessed type int v_11751;
//----- (000000000000B4FF) ----------------------------------------------------
unsigned long sv_xtracefd(long a1)
[46335] {
char *v1; // rax
char *v2; // rax
unsigned int fd; // [rsp+14h] [rbp-3Ch]
char *endptr; // [rsp+18h] [rbp-38h] BYREF
long *variable; // [rsp+20h] [rbp-30h]
char *nptr; // [rsp+28h] [rbp-28h]
FILE *v8; // [rsp+30h] [rbp-20h]
unsigned long v9; // [rsp+38h] [rbp-18h]
[46339, 46340, 46343, 46344, 46348, 46352, 46361, 46335] v9 = __readfsqword(0x28u);
[46371, 46374, 46379, 46365, 46367] variable = find_variable(a1);
[46435, 46404, 46408, 46412, 46383, 46417, 46419, 46388, 46423, 46426, 46428, 46430] if ( variable && (nptr = (char *)variable[1]) != 0LL && *nptr )
{
[46464, 46440, 46444, 46448, 46453, 46456, 46459] fd = strtol(nptr, &endptr, 10);
[46498, 46467, 46500, 46471, 46475, 46477, 46481, 46484, 46486, 46488, 46491, 46493] if ( nptr == endptr || *endptr || !(unsigned int)sh_validfd(fd) )
{
[46601, 46605, 46612, 46597] v2 = gettext("%s: %s: invalid value for trace file descriptor");
[46624, 46627, 46630, 46633, 46638, 46617, 46620] internal_error(v2);
}
else
{
[46502, 46505, 46512, 46514, 46519] v8 = fdopen(fd, "w");
[46528, 46523] if ( v8 )
{
[46595, 46578, 46582, 46585, 46588, 46590] xtrace_set(fd, v8);
}
else
{
[46538, 46530, 46545, 46534] v1 = gettext("%s: %s: cannot open as FILE");
[46560, 46563, 46566, 46571, 46576, 46550, 46553, 46557] internal_error(v1);
}
}
}
else
{
[46395, 46390] xtrace_reset();
}
[46656, 46658, 46663, 46643, 46647] return __readfsqword(0x28u) ^ v9;
[46667, 46668, 46669] }
// E5B0: using guessed type long internal_error(_QWORD);
// E8A0: using guessed type long xtrace_reset(void);
// E8B0: using guessed type long sh_validfd(_QWORD);
// E8C0: using guessed type long xtrace_set(_QWORD, _QWORD);
//----- (000000000000B64E) ----------------------------------------------------
long sv_shcompat(long a1, long a2)
[46670] {
char *v3; // rdi
int v5; // [rsp+14h] [rbp-1Ch]
long *variable; // [rsp+20h] [rbp-10h]
unsigned char *v7; // [rsp+28h] [rbp-8h]
[46690, 46693, 46698, 46670, 46674, 46675, 46678, 46682, 46686] variable = find_variable(a1);
[46752, 46755, 46757, 46759, 46733, 46702, 46737, 46769, 46707, 46741, 46774, 46746, 46748] if ( !variable || (v7 = (unsigned char *)variable[1]) == 0LL || !*v7 )
{
[46709] shell_compatibility_level = 52;
[46724, 46719] return set_compatibility_opts(a1, a2);
}
[46849, 46853, 46856, 46859, 46862, 46865, 46868, 46871, 46876, 46878, 46880, 46884, 46888, 46891, 46893, 46779, 46784, 46787, 46791, 46794, 46797, 46800, 46803, 46806, 46809, 46814, 46816, 46822, 46826, 46830, 46833, 46835, 46837, 46842, 46845] if ( ((*_ctype_b_loc())[*v7] & 0x800) != 0 && v7[1] == 46 && ((*_ctype_b_loc())[v7[2]] & 0x800) != 0 && !v7[3] )
{
[46895, 46899, 46902, 46905, 46908, 46911, 46915, 46919, 46922, 46925, 46928, 46931, 46934, 46936, 46939, 46941, 46943, 46945, 46948, 46950, 46953] v5 = 10 * ((char)*v7 - 48) + (char)v7[2] - 48;
}
else
{
[46976, 46979, 46982, 46985, 46988, 46993, 46995, 46997, 47002, 47005, 47009, 47013, 47016, 47019, 47022, 47025, 47028, 47031, 47036, 47038, 47040, 47044, 47048, 47051, 47053, 46958, 46963, 46966, 46970, 46973] if ( ((*_ctype_b_loc())[*v7] & 0x800) == 0 || ((*_ctype_b_loc())[v7[1]] & 0x800) == 0 || v7[2] )
goto LABEL_15;
[47105, 47108, 47110, 47113, 47055, 47059, 47062, 47065, 47068, 47071, 47075, 47079, 47082, 47085, 47088, 47091, 47094, 47096, 47099, 47101, 47103] v5 = 10 * ((char)*v7 - 48) + (char)v7[1] - 48;
}
[47185, 47179, 47181, 47175] if ( v5 <= 30 || v5 > 52 )
{
LABEL_15:
[47145, 47126, 47119] v3 = gettext("%s: %s: compatibility value out of range");
[47145, 47148, 47153] internal_error(v3);
[47158] shell_compatibility_level = 52;
[47168, 47138, 47173, 47142, 47131, 47134] return set_compatibility_opts(v3, a1);
}
[47187, 47190] shell_compatibility_level = v5;
[47201, 47196] return set_compatibility_opts(a1, a2);
[47202] }
// E5B0: using guessed type long internal_error(_QWORD);
// E8D0: using guessed type long set_compatibility_opts(_QWORD, _QWORD);
//----- (000000000000B863) ----------------------------------------------------
long sv_childmax(long a1)
[47203] {
unsigned int v1; // eax
char *nptr; // [rsp+18h] [rbp-8h]
[47203, 47207, 47208, 47211, 47215, 47219, 47223, 47226, 47231] nptr = (char *)get_string_value(a1);
[47235, 47240, 47242, 47246, 47249, 47251] if ( nptr && *nptr )
[47257, 47265, 47260, 47253] v1 = atoi(nptr);
else
[47267] v1 = 0;
[47272, 47275, 47278, 47280, 47285, 47286] return set_maxchild(v1);
[47287] }
// E8E0: using guessed type long set_maxchild(_QWORD);
// nfuncs=392 queued=232 decompiled=232 lumina nreq=0 worse=0 better=0
// ALL OK, 232 function(s) have been successfully decompiled
|
long long pred_name_common(unsigned long a0, char *a1, unsigned long a2) {
[608] void* v2; // rsi
[608] unsigned int v3; // ebx
[608]
[608] strip_trailing_slashes(a1);
[629, 632, 635] a1 = base_name();
[640, 624, 643] v3 = fnmatch(a1, v2, a2);
[657, 649, 654] return free(a1);
[673, 674, 675, 677, 679, 659, 664, 666, 669] }
|
void pred_name_common(unsigned long long a0, char *a1, unsigned long a2) {
[3043] char v0; // [bp-0x11]
[3043] void* v1; // [bp-0x10]
[3043] unsigned long long v3; // rax
[3043]
[3043] v1 = base_name(a0);
[3073, 3078] strip_trailing_slashes(v1);
[3089, 3082, 3086] v0 = !fnmatch(a1, v1, a2);
[3121, 3111, 3116, 3118] free(v1);
[3124, 3128, 3131] v3 = v0;
[3136] return;
[3140, 3141] }
|
int key_base_type_match(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
[1552] unsigned long v0; // [bp-0x50]
[1552] unsigned long v1; // [bp-0x48]
[1552] unsigned int *v5; // rbp
[1552] void* v6; // rax
[1552] char *v8; // rdi
[1552] unsigned long long v9; // rax
[1552] unsigned int v10; // r12d
[1552]
[1552] v5 = a1;
[1569, 1576, 1577, 1565, 1567] v6 = xstrdup(a2);
[1601, 1604, 1580, 1581, 1585, 1594, 1599] v1 = v6;
[1619, 1609, 1612] v8 = strsep(&v1, ",");
[1626, 1612, 1631] if (v8) {
while (*(v8)) {
v9 = sshkey_type_from_name();
[1648] if (v9 != *(v5)) {
[1656, 1653] v8 = strsep(&v1, ",");
[1673, 1668, 1569] if (!v8)
[1676, 1679] break;
[1676, 1679] } else {
v10 = 1;
[1800] break;
[1806] }
}
}
if (!*(v8) || !v8 || v9 != *(v5)) {
v10 = 0;
v0 = a2;
sshlog("monitor.c", "key_base_type_match", 0x363, 0x0, 0x2, 0x0, "%s key type %s is not in permitted list %s", a0, sshkey_ssh_name(v5));
}
free(v6);
return v10;
}
|
int key_base_type_match(unsigned long a0, unsigned int *a1, unsigned long long a2) {
[11786] unsigned long long v0; // [bp-0x78]
[11786] unsigned long v1; // [bp-0x70]
[11786] unsigned long v2; // [bp-0x68]
[11786] unsigned long v3; // [bp-0x60]
[11786] unsigned int v4; // [bp-0x2c]
[11786] unsigned long v5; // [bp-0x28]
[11786] char *v6; // [bp-0x20]
[11786] void* v7; // [bp-0x18]
[11786]
[11786] v7 = xstrdup(a2);
[11832, 11837] v4 = 0;
[11841] v5 = v7;
[11848, 11852] for (v6 = strsep(&v5, ","); v6; v6 = strsep(&v5, ",")) {
[11875, 11860, 11940, 11926, 11931, 11916, 11870, 11935] if (!*(v6))
[11946, 11949, 11942, 11951] break;
[11942, 11946, 11949, 11951] if (sshkey_type_from_name(v6) == *(a1)) {
[11888, 11897, 11893, 11901, 11881, 11899, 11885] v4 = 1;
[11903] break;
[11910] }
}
if (!v4) {
v3 = a2;
v2 = sshkey_ssh_name(a1);
v1 = a0;
v0 = "%s key type %s is not in permitted list %s";
sshlog("monitor.c", "key_base_type_match", 0x363, 0x0, 0x2, 0x0);
}
free(v7);
return v4;
}
|
void terminal_free_buffer(unsigned long long *a0) {
[0] void* v1; // rbp
[0] unsigned long long v2[2]; // rbx
[0] void* v3; // rdi
[0] unsigned long long v4; // rax
[0]
[0] v1 = *(a0);
[0, 1, 2, 6] if (!*(a0))
return;
[80, 84, 85, 86] *(a0) = 0;
[14] v3 = v2[0];
[21] if (v2[0]) {
v2 = v1;
[30] do {
[40] free(v3);
[40] v3 = v2[1];
[45] v2 = &v2[1];
[49] } while (v3);
[40] }
v4 = free(v2);
return;
}
|
void terminal_free_buffer(unsigned long long *a0) {
[3319] unsigned long long *v0; // [bp-0x18]
[3319] void* v1; // [bp-0x10]
[3319] unsigned long long v3; // rax
[3319] unsigned long long v4; // rax
[3319]
[3319] v3 = *(a0);
[3331, 3335, 3339, 3319, 3323, 3324, 3327] if (*(a0)) {
v1 = *(a0);
[3347, 3351, 3354] *(a0) = 0;
[3362, 3358] for (v0 = v1; *(v0); v0 += 1) {
[3394, 3399, 3369, 3403, 3373, 3406, 3409] free(*(v0));
[3379, 3383, 3386, 3389] }
v4 = free(v1);
[3411, 3415, 3418] }
return;
}
|
void print_type(unsigned long a0) {
[4256] char v0; // [bp-0x58]
[4256] char v1; // [bp-0x10]
[4256] unsigned long long v3; // rdx
[4256] unsigned long long *v4; // fs
[4256] unsigned long long v5; // rax
[4256]
[4256] v3 = "tun";
[4256, 4257] if (a0 != 1) {
[4288, 4284, 4277, 4264, 4282, 4268] v3 = "tap";
[4290] if (a0 != 2) {
[4297, 4301] __snprintf_chk(&v0, 0x40, 0x1, 0x40, "UNKNOWN:%hhu", a0);
[4352, 4384, 4355, 4359, 4364, 4369, 4376, 4381] v3 = &v0;
[4389] }
}
print_string("type", "type %s ", v3);
v5 = *(&v1) ^ v4[5];
return;
}
|
void print_type(unsigned long a0, unsigned long a1) {
[6294] unsigned long v0; // [bp-0x70]
[6294] unsigned long long v1; // [bp-0x60]
[6294] char v2; // [bp-0x58]
[6294] char v3; // [bp-0x10]
[6294] unsigned long long *v5; // fs
[6294] unsigned long long v6; // rax
[6294]
[6294] v0 = a0;
[6306, 6294, 6298, 6299, 6302] v1 = &v2;
[6310, 6312, 6315, 6324, 6328, 6330, 6334] if (a1 == 1) {
[6338, 6342] v1 = "tun";
[6344, 6351] } else if (a1 == 2) {
[6361, 6357] v1 = "tap";
[6370, 6363] } else {
snprintf(&v2, 0x40, "UNKNOWN:%hhu", a1);
[6401, 6406, 6376, 6380, 6384, 6386, 6393, 6398] }
print_string(0x4, "type", "type %s ", v1);
v6 = *(&v3) ^ v5[5];
return;
}
|
unsigned long e2fsck_move_ext3_journal(long *a1)
[13712] {
long v1; // rbx
long v2; // r12
long v3; // rsi
char v4; // al
long v6; // rdx
int v7; // eax
__m128i v8; // xmm0
__m128i v9; // xmm1
int v10; // eax
__m128i v11; // xmm2
char **v12; // r15
const char *v13; // rdx
size_t v14; // rax
long v15; // rax
long v16; // rsi
long v17; // rax
long v18; // rsi
unsigned int v19; // ebp
int v20; // eax
const char *v21; // [rsp+0h] [rbp-158h]
unsigned int v22; // [rsp+18h] [rbp-140h] BYREF
char v23[4]; // [rsp+1Ch] [rbp-13Ch] BYREF
long v24[14]; // [rsp+20h] [rbp-138h] BYREF
char v25[4]; // [rsp+90h] [rbp-C8h] BYREF
int v26; // [rsp+94h] [rbp-C4h]
int v27; // [rsp+A4h] [rbp-B4h]
short v28; // [rsp+AAh] [rbp-AEh]
__m128i s1; // [rsp+B8h] [rbp-A0h] BYREF
__m128i v30; // [rsp+C8h] [rbp-90h] BYREF
__m128i v31; // [rsp+D8h] [rbp-80h] BYREF
long v32; // [rsp+E8h] [rbp-70h]
int v33; // [rsp+F0h] [rbp-68h]
int v34; // [rsp+FCh] [rbp-5Ch]
unsigned long v35; // [rsp+118h] [rbp-40h]
[13728, 13729, 13736, 13712, 13716, 13718, 13720, 13722, 13724, 13725] v1 = *a1;
[13739, 13748] v35 = __readfsqword(0x28u);
[13766] v2 = *(_QWORD *)(v1 + 32);
[13770, 13763, 13756, 13758] clear_problem_context(v24);
[13779, 13775] if ( (*((_BYTE *)a1 + 76) & 1) == 0 )
{
[13781] v3 = *(unsigned int *)(v2 + 224);
[13789, 13791] if ( (_DWORD)v3 )
{
[13793, 13826, 13829, 13798, 13803, 13805, 13807, 13815, 13818, 13821] if ( (unsigned int)ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v2 + 92))
&& !ext2fs_read_inode(v1, v3, v25) )
{
[13831] v4 = *(_BYTE *)(v2 + 253);
[13954, 13956, 13958, 13928, 13961, 13976, 13966, 13840, 13936, 13842, 13969, 13844, 13846, 13974, 13944, 13949] if ( (!v4 || v4 == 1 && memcmp(&s1, (const void *)(v2 + 268), 0x3CuLL)) && (unsigned int)fix_problem(a1, 45LL) )
{
[13982] v6 = v32;
[13990] v7 = v34;
[13997] *(_BYTE *)(v2 + 253) = 1;
[14010] v8 = _mm_loadu_si128(&s1);
[14019] v9 = _mm_loadu_si128(&v30);
[14028] *(_QWORD *)(v2 + 316) = v6;
[14036] LODWORD(v6) = v33;
[14043] *(_DWORD *)(v2 + 328) = v7;
[14051] v10 = v26;
[14058] v11 = _mm_loadu_si128(&v31);
[14067] *(_DWORD *)(v2 + 324) = v6;
[14075] *(_DWORD *)(v2 + 332) = v10;
[14083] *(__m128i *)(v2 + 268) = v8;
[14092] *(__m128i *)(v2 + 284) = v9;
[14101] *(__m128i *)(v2 + 300) = v11;
[14006, 14110] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v1 + 16));
[14122, 14115] *(_DWORD *)(v1 + 16) &= ~0x200u;
}
[13857, 14145, 13859, 14151, 13868, 14156, 14128, 13874, 14132, 13848, 14137, 14142] if ( *(_DWORD *)(v2 + 224) != 8 && v28 == 1 && !ext2fs_check_if_mounted(a1[2], v23) && (v23[0] & 1) == 0 )
{
[14162, 14167] v12 = journal_names;
[14186, 14179, 14174] v13 = ".journal";
[14195] while ( 1 )
{
[14195] v21 = v13;
[14192, 14199] v14 = strlen(v13);
[14209, 14241, 14212, 14215, 14249, 14219, 14222, 14227, 14232, 14235, 14204, 14237] if ( !ext2fs_lookup(v1, 2LL, v21, v14, 0LL, &v22) && *(_DWORD *)(v2 + 224) == v22 )
break;
[14251] v13 = v12[1];
[14255] ++v12;
[14264, 14259, 14262] if ( !v13 )
[13880, 13897, 13888, 14262] return __readfsqword(0x28u) ^ v35;
}
[14273, 14269] if ( *v12 )
{
[14287, 14290, 14282, 14279] if ( !ext2fs_read_bitmaps(v1) )
{
[14310] v24[12] = (long)*v12;
[14307, 14318, 14323, 14325, 14296, 14299, 14302] if ( (unsigned int)fix_problem(a1, 40LL) )
{
[14338, 14341, 14346, 14349, 14353, 14331, 14334] v15 = ext2fs_unlink(v1, 2LL, *v12, v22, 0LL);
[14361, 14358] if ( v15 )
goto LABEL_27;
[14370, 14378, 14375, 14367] v15 = ext2fs_write_inode(v1, 8LL, v25);
[14386, 14383] if ( v15 )
goto LABEL_27;
[14392] *(_DWORD *)(v2 + 224) = 8;
[14404, 14407] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v1 + 16));
[14412] v16 = v22;
[14422] *(_DWORD *)(v1 + 16) &= ~0x200u;
[14429] v17 = a1[105];
[14436] v28 = 0;
[14446] v27 = v17;
[14416, 14419, 14453] v15 = ext2fs_write_inode(v1, v16, v25);
[14458, 14461] if ( v15 )
{
LABEL_27:
[14544, 14547, 14552] v24[0] = v15;
[14557, 14541] fix_problem(a1, 41LL);
[14569, 14562] *(_WORD *)(*(_QWORD *)(v1 + 32) + 58LL) &= ~1u;
[14579, 14574, 14566] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v1 + 16));
}
else
{
[14463] v18 = v22;
[14471, 14467, 14480, 14463] v19 = ext2fs_group_of_ino_isra_0(*(_QWORD *)(v1 + 32), v22);
[14482, 14476] ext2fs_unmark_inode_bitmap2(*(_QWORD *)(v1 + 80), v18);
[14490, 14487] ext2fs_mark_ib_dirty_isra_0((_DWORD *)(v1 + 16));
[14497, 14500, 14495] v20 = ext2fs_bg_free_inodes_count(v1, v19);
[14505, 14507, 14510, 14513] ext2fs_bg_free_inodes_count_set(v1, v19, (unsigned int)(v20 + 1));
[14520, 14523, 14518] ext2fs_group_desc_csum_set(v1, v19);
[14528, 14532, 14536] ++*(_DWORD *)(*(_QWORD *)(v1 + 32) + 16LL);
}
}
}
}
}
}
}
}
[13888, 13903] return __readfsqword(0x28u) ^ v35;
[13920, 13910, 13911, 13912, 13914, 13916, 13918] }
// 3D00: using guessed type char *journal_names[4];
// 4B88: using guessed type long ext2fs_unmark_inode_bitmap2(_QWORD, _QWORD);
// 4BA0: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 4BB0: using guessed type long ext2fs_unlink(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C18: using guessed type long ext2fs_read_bitmaps(_QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4CD8: using guessed type long ext2fs_write_inode(_QWORD, _QWORD, _QWORD);
// 4D38: using guessed type long ext2fs_check_if_mounted(_QWORD, _QWORD);
// 4D48: using guessed type long ext2fs_lookup(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 4D50: using guessed type long ext2fs_bg_free_inodes_count(_QWORD, _QWORD);
// 4D58: using guessed type long ext2fs_bg_free_inodes_count_set(_QWORD, _QWORD, _QWORD);
// 4D60: using guessed type long ext2fs_group_desc_csum_set(_QWORD, _QWORD);
// 3590: using guessed type char var_13C[4];
//----- (0000000000003900) ----------------------------------------------------
long e2fsck_fix_ext3_journal_hint(_QWORD *a1)
[14592] {
long v1; // rbp
const char *devname; // rax
char *v4; // r12
long v5; // rdi
_QWORD v6[14]; // [rsp+0h] [rbp-158h] BYREF
struct stat v7; // [rsp+70h] [rbp-E8h] BYREF
char v8[40]; // [rsp+100h] [rbp-58h] BYREF
unsigned long v9; // [rsp+128h] [rbp-30h]
[14592, 14596, 14598, 14600, 14601, 14602, 14605, 14612, 14621] v9 = __readfsqword(0x28u);
[14634, 14629, 14631] v1 = *(_QWORD *)(*a1 + 32LL);
[14658, 14667, 14638, 14641, 14646, 14648, 14650] if ( (unsigned int)ext2fs_has_feature_journal_needs_recovery_isra_0(*(_DWORD *)(v1 + 92)) )
{
[14696, 14703, 14706, 14711, 14713] if ( !(unsigned int)uuid_is_null(v1 + 208) )
{
[14729, 14715, 14723, 14726] uuid_unparse(v1 + 208, v8);
[14744, 14741, 14734, 14751] devname = (const char *)blkid_get_devname(a1[17], "UUID", v8);
[14756] v4 = (char *)devname;
[14762, 14759] if ( devname )
{
[14787, 14795, 14764, 14769, 14772, 14777, 14779, 14781] if ( stat(devname, &v7) >= 0 && v7.st_rdev != *(_DWORD *)(v1 + 228) )
{
[14800, 14803, 14797] clear_problem_context(v6);
[14819, 14827] v6[10] = v7.st_rdev;
[14816, 14832, 14837, 14839, 14808, 14811] if ( (unsigned int)fix_problem(a1, 51LL) )
{
[14864, 14872] v5 = *a1;
[14875] *(_DWORD *)(v1 + 228) = v7.st_rdev;
[14881, 14890, 14885] ext2fs_mark_super_dirty_isra_0((_DWORD *)(v5 + 16));
}
}
[14841, 14844, 14849] free(v4);
}
}
}
[14680, 14673] return 0LL;
[14688, 14682, 14683, 14684, 14686] }
// 4BC0: using guessed type long fix_problem(_QWORD, _QWORD);
// 4C60: using guessed type long clear_problem_context(_QWORD);
// 4C78: using guessed type long uuid_is_null(_QWORD);
// 4CB0: using guessed type long uuid_unparse(_QWORD, _QWORD);
// 4CB8: using guessed type long blkid_get_devname(_QWORD, _QWORD, _QWORD);
// nfuncs=173 queued=98 decompiled=98 lumina nreq=0 worse=0 better=0
// ALL OK, 98 function(s) have been successfully decompiled
|
unsigned long e2fsck_move_ext3_journal(long a1)
[20921] {
int v1; // eax
unsigned int v2; // eax
int v3; // eax
int v4; // eax
unsigned int v6; // [rsp+14h] [rbp-12Ch] BYREF
int v7; // [rsp+18h] [rbp-128h] BYREF
unsigned int v8; // [rsp+1Ch] [rbp-124h]
long bitmaps; // [rsp+20h] [rbp-120h]
const char **i; // [rsp+28h] [rbp-118h]
long v11; // [rsp+30h] [rbp-110h]
long v12; // [rsp+38h] [rbp-108h]
long v13[14]; // [rsp+40h] [rbp-100h] BYREF
char v14[4]; // [rsp+B0h] [rbp-90h] BYREF
int v15; // [rsp+B4h] [rbp-8Ch]
int v16; // [rsp+C4h] [rbp-7Ch]
short v17; // [rsp+CAh] [rbp-76h]
_BYTE v18[68]; // [rsp+D8h] [rbp-68h] BYREF
int v19; // [rsp+11Ch] [rbp-24h]
unsigned long v20; // [rsp+138h] [rbp-8h]
[20929, 20936, 20943, 20952, 20921, 20925, 20926] v20 = __readfsqword(0x28u);
[20965, 20968, 20972, 20956, 20958] v11 = *(_QWORD *)(*(_QWORD *)a1 + 32LL);
[20986, 20979, 20989] v12 = *(_QWORD *)a1;
[21003, 20996, 21006] clear_problem_context(v13);
[21011, 21018, 21021, 21024, 21026, 21032, 21039, 21045, 21047, 21053, 21060, 21063, 21068, 21070, 21076, 21083, 21089, 21096, 21103, 21105, 21108, 21113, 21116] if ( (*(_DWORD *)(a1 + 76) & 1) == 0
&& *(_DWORD *)(v11 + 224)
&& ext2fs_has_feature_journal(v11)
&& !ext2fs_read_inode(v12, *(unsigned int *)(v11 + 224), v14) )
{
[21122, 21129, 21136, 21138, 21140, 21147, 21154, 21156, 21162, 21169, 21176, 21183, 21187, 21192, 21195, 21198, 21203, 21205, 21211, 21218, 21225, 21230, 21233, 21238, 21240] if ( (!*(_BYTE *)(v11 + 253) || *(_BYTE *)(v11 + 253) == 1 && memcmp(v18, (const void *)(v11 + 268), 0x3CuLL))
&& (unsigned int)fix_problem(a1, 45LL, v13) )
{
[21281, 21253, 21259, 21278, 21266, 21270, 21275, 21246] memcpy((void *)(v11 + 268), v18, 0x3CuLL);
[21296, 21289, 21286] *(_DWORD *)(v11 + 328) = v19;
[21315, 21308, 21302] *(_DWORD *)(v11 + 332) = v15;
[21328, 21321] *(_BYTE *)(v11 + 253) = 1;
[21345, 21342, 21335] ext2fs_mark_super_dirty(v12);
[21357, 21350] v1 = *(_DWORD *)(v12 + 16);
[21360] BYTE1(v1) &= ~2u;
[21363, 21372, 21365] *(_DWORD *)(v12 + 16) = v1;
}
[21382, 21388, 21391, 21397, 21401, 21405, 21375] if ( *(_DWORD *)(v11 + 224) != 8 && v17 == 1 )
{
[21440, 21411, 21418, 21422, 21429, 21432, 21435] bitmaps = ext2fs_check_if_mounted(*(_QWORD *)(a1 + 16), &v7);
[21472, 21447, 21455, 21461, 21467, 21470] if ( !bitmaps && (v7 & 1) == 0 )
{
[21602, 21478, 21610, 21485, 21617, 21492, 21620, 21623, 21629] for ( i = (const char **)journal_names; *i; ++i )
{
[21504, 21507, 21501, 21494] v2 = strlen(*i);
[21538, 21541, 21512, 21514, 21547, 21549, 21521, 21554, 21524, 21557, 21562, 21531] bitmaps = ext2fs_lookup(v12, 2LL, *i, v2, 0LL, &v6);
[21600, 21569, 21577, 21579, 21586, 21592, 21598] if ( !bitmaps && *(_DWORD *)(v11 + 224) == v6 )
break;
}
[21632, 21642, 21645, 21639] if ( *i )
{
[21666, 21658, 21651, 21661] bitmaps = ext2fs_read_bitmaps(v12);
[21673, 21681] if ( !bitmaps )
{
[21697, 21694, 21687] v13[12] = (long)*i;
[21731, 21733, 21704, 21711, 21718, 21723, 21726] if ( (unsigned int)fix_problem(a1, 40LL, v13) )
{
[21762, 21768, 21739, 21773, 21776, 21745, 21781, 21752, 21755] bitmaps = ext2fs_unlink(v12, 2LL, *i, v6, 0LL);
[21788, 21796] if ( bitmaps )
goto LABEL_26;
[21824, 21829, 21802, 21809, 21816, 21821] bitmaps = ext2fs_write_inode(v12, 8LL, v14);
[21836, 21844] if ( bitmaps )
goto LABEL_26;
[21857, 21850] *(_DWORD *)(v11 + 224) = 8;
[21874, 21867, 21877] ext2fs_mark_super_dirty(v12);
[21889, 21882] v3 = *(_DWORD *)(v12 + 16);
[21892] BYTE1(v3) &= ~2u;
[21904, 21897, 21895] *(_DWORD *)(v12 + 16) = v3;
[21907] v17 = 0;
[21920, 21913, 21927] v16 = *(_QWORD *)(a1 + 840);
[21952, 21955, 21960, 21930, 21936, 21943, 21950] bitmaps = ext2fs_write_inode(v12, v6, v14);
[21975, 21967] if ( bitmaps )
{
LABEL_26:
[22160, 22153] v13[0] = bitmaps;
[22181, 22186, 22189, 22167, 22174] fix_problem(a1, 41LL, v13);
[22209, 22216, 22220, 22223, 22194, 22201, 22205] *(_WORD *)(*(_QWORD *)(v12 + 32) + 58LL) &= ~1u;
[22242, 22234, 22227, 22237] ext2fs_mark_super_dirty(v12);
}
else
{
[21987, 21994, 21996, 21999, 22004, 21981] v8 = ext2fs_group_of_ino(v12, v6);
[22016, 22023, 22027, 22029, 22032, 22010] ext2fs_unmark_inode_bitmap2(*(_QWORD *)(v12 + 80), v6);
[22044, 22037, 22047] ext2fs_mark_ib_dirty(v12);
[22052, 22058, 22065, 22067, 22070] v4 = ext2fs_bg_free_inodes_count(v12, v8);
[22084, 22091, 22093, 22096, 22075, 22078] ext2fs_bg_free_inodes_count_set(v12, v8, (unsigned int)(v4 + 1));
[22114, 22116, 22119, 22101, 22107] ext2fs_group_desc_csum_set(v12, v8);
[22144, 22124, 22131, 22135, 22138, 22141] ++*(_DWORD *)(*(_QWORD *)(v12 + 32) + 16LL);
}
}
}
}
}
}
}
[22279, 22281, 22286, 22266, 22270] return __readfsqword(0x28u) ^ v20;
[22287] }
// 5B80: using guessed type char *journal_names[4];
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
// 6848: using guessed type long ext2fs_unlink(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 6850: using guessed type long ext2fs_read_inode(_QWORD, _QWORD, _QWORD);
// 6898: using guessed type long ext2fs_unmark_inode_bitmap2(_QWORD, _QWORD);
// 68A0: using guessed type long ext2fs_mark_ib_dirty(_QWORD);
// 68A8: using guessed type long ext2fs_read_bitmaps(_QWORD);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68F8: using guessed type long ext2fs_write_inode(_QWORD, _QWORD, _QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// 69C8: using guessed type long ext2fs_check_if_mounted(_QWORD, _QWORD);
// 69D8: using guessed type long ext2fs_lookup(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// 69E0: using guessed type long ext2fs_group_of_ino(_QWORD, _QWORD);
// 69E8: using guessed type long ext2fs_bg_free_inodes_count(_QWORD, _QWORD);
// 69F0: using guessed type long ext2fs_bg_free_inodes_count_set(_QWORD, _QWORD, _QWORD);
// 69F8: using guessed type long ext2fs_group_desc_csum_set(_QWORD, _QWORD);
//----- (0000000000005710) ----------------------------------------------------
long e2fsck_fix_ext3_journal_hint(_QWORD *a1)
[22288] {
long v2; // [rsp+10h] [rbp-140h]
char *file; // [rsp+18h] [rbp-138h]
char v4[80]; // [rsp+20h] [rbp-130h] BYREF
__dev_t st_rdev; // [rsp+70h] [rbp-E0h]
struct stat v6; // [rsp+90h] [rbp-C0h] BYREF
char v7[40]; // [rsp+120h] [rbp-30h] BYREF
unsigned long v8; // [rsp+148h] [rbp-8h]
[22310, 22319, 22288, 22292, 22293, 22296, 22303] v8 = __readfsqword(0x28u);
[22339, 22323, 22325, 22332, 22335] v2 = *(_QWORD *)(*a1 + 32LL);
[22372, 22346, 22378, 22381, 22353, 22386, 22356, 22388, 22361, 22363, 22365] if ( !ext2fs_has_feature_journal(v2) || (unsigned int)uuid_is_null(v2 + 208) )
[22395, 22390] return 0LL;
[22400, 22407, 22414, 22418, 22421, 22424] uuid_unparse(v2 + 208, v7);
[22436, 22443, 22447, 22454, 22457, 22429, 22462] file = (char *)blkid_get_devname(a1[17], "UUID", v7);
[22477, 22469] if ( !file )
[22484, 22479] return 0LL;
[22496, 22503, 22506, 22509, 22514, 22516, 22489] if ( stat(file, &v6) >= 0 )
{
[22563, 22565, 22568, 22543, 22550, 22557] if ( v6.st_rdev != *(_DWORD *)(v2 + 228) )
{
[22577, 22570, 22580] clear_problem_context(v4);
[22592, 22585] st_rdev = v6.st_rdev;
[22626, 22628, 22599, 22606, 22613, 22618, 22621] if ( (unsigned int)fix_problem(a1, 51LL, v4) )
{
[22646, 22637, 22630, 22639] *(_DWORD *)(v2 + 228) = v6.st_rdev;
[22665, 22659, 22652, 22662] ext2fs_mark_super_dirty(*a1);
}
}
[22680, 22677, 22670] free(file);
[22690, 22694, 22703, 22705, 22685] return 0LL;
}
else
{
[22528, 22525, 22518] free(file);
[22538, 22533] return 0LL;
}
[22710, 22711] }
// 67C8: using guessed type long ext2fs_mark_super_dirty(_QWORD);
// 68D8: using guessed type long clear_problem_context(_QWORD);
// 68E0: using guessed type long uuid_is_null(_QWORD);
// 6900: using guessed type long uuid_unparse(_QWORD, _QWORD);
// 6908: using guessed type long blkid_get_devname(_QWORD, _QWORD, _QWORD);
// 6918: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// nfuncs=174 queued=93 decompiled=93 lumina nreq=0 worse=0 better=0
// ALL OK, 93 function(s) have been successfully decompiled
|
long long compare_occurs(void* a0, void* a1) {
[224] unsigned long long *v1; // rbp
[224] unsigned long long *v2; // rbx
[224] unsigned long long v3; // rax
[224]
[224] v1 = a0;
[224, 228, 229] v2 = a1;
[232, 233] v3 = compare_words(a0, a1);
[236] if (!v3) {
if (*(v1) < *(v2))
[248, 252, 245] v3 = 4294967295;
[272] else
v3 = *(v1) > *(v2);
[257, 260, 261, 262, 254] }
return v3;
}
|
long long compare_occurs(unsigned long long *a0, unsigned long long *a1) {
[2895] unsigned int v0; // [bp-0xc]
[2895] unsigned long long v2; // rax
[2895]
[2895] v0 = compare_words(a0, a1);
[2929, 2934] if (v0) {
v2 = v0;
[2994, 2997, 2998] } else if (*(a0) < *(a1)) {
[2960, 2947, 2950, 2954, 2957, 2943] v2 = 4294967295;
[2987] } else {
v2 = !(*(a0) <= *(a1));
[2976, 2979, 2982, 2962, 2966, 2969, 2973] }
return v2;
}
|
void _rs_rekey(void* a0) {
[3392] void* v1; // rbx
[3392] struct_2 *v2; // rax
[3392] void* v3; // rdx
[3392] struct_1 *v4; // rax
[3392]
[3392] v1 = a0;
[3392, 3393] chacha_encrypt_bytes(rsx, rsx + 64, rsx + 64);
[3396, 3403, 3407, 3410] v2 = rsx;
[3415] if (a0) {
if (rsx + 64 >= a0 + 16) {
[3438, 3435, 3422, 3431] LABEL_400d7d:
v2->field_40 = v2->field_40 ^ *(v1);
[3457, 3462, 3466, 3453] v2->field_50 = v2->field_50 ^ v1[16];
[3470, 3475, 3480, 3484] v2->field_60 = v2->field_60 ^ v1[32];
[3488, 3492] v2->field_61 = v2->field_61 ^ v1[33];
[3499, 3495] v2->field_62 = v2->field_62 ^ v1[34];
[3506, 3502] v2->field_63 = v2->field_63 ^ v1[35];
[3513, 3509] v2->field_64 = v2->field_64 ^ v1[36];
[3520, 3516] v2->field_65 = v2->field_65 ^ v1[37];
[3523, 3527] v2->field_66 = v2->field_66 ^ v1[38];
[3530, 3534] v2->field_67 = v2->field_67 ^ v1[39];
[3537, 3541, 3544] } else {
if (!(a0 < rsx + 80))
[3440, 3444, 3447] goto LABEL_400d7d;
[3440, 3444, 3447] v3 = 0;
[3600] do {
[3608] *(64 + rsx + v3) = *(64 + rsx + v3) ^ *((a0 + v3));
[3392, 3393, 3608, 3612] v3 += 1;
[3616] } while (v3 != 40);
[3608, 3624, 3620] }
}
_rs_init(rsx + 64);
v4 = rs;
*((rsx + 96)) = 0;
*((rsx + 64)) = 0;
*((rsx + 80)) = 0;
*(rs) = 984;
return;
}
|
void _rs_rekey(void* a0, unsigned long long a1) {
[5142] void* v0; // [bp-0x18]
[5142] unsigned long long v1; // [bp-0x10]
[5142] unsigned long long v3; // rax
[5142] unsigned long long *v4; // rax
[5142]
[5142] chacha_encrypt_bytes(rsx, rsx + 64, rsx + 64, 0x400);
[5187, 5190, 5195, 5198, 5142, 5143, 5146, 5150, 5154, 5158, 5165, 5169, 5176, 5180] if (a0) {
if (a1 > 40)
[5220, 5221, 5222, 5225, 5226, 5229, 5237, 5210, 5215] v3 = 40;
[5220, 5221, 5222, 5225, 5226, 5229, 5237, 5210, 5215] else
v3 = a1;
[5220, 5221, 5222, 5225, 5226, 5229, 5237, 5210, 5215] v1 = v3;
[5225] for (v0 = 0; v0 < v1; v0 += 1) {
[5229, 5296, 5301, 5305, 5309] *(64 + v0 + rsx) = *(64 + v0 + rsx) ^ *((v0 + a0));
[5250, 5253, 5257, 5260, 5264, 5268, 5271, 5274, 5281, 5283, 5287, 5290, 5294, 5239, 5246] }
}
_rs_init(rsx + 64, 0x28);
memset(rsx + 64, 0x0, 0x28);
v4 = rs;
*(rs) = 984;
return;
}
|
void add_listen_addr(unsigned int *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3) {
[5616] unsigned int *v1; // rbp
[5616] unsigned long long v2; // rax
[5616] void* v3; // rbx
[5616] unsigned long long v4; // rax
[5616] unsigned long long v5; // rcx
[5616] unsigned long long v6; // rax
[5616]
[5616] v1 = a0;
[5616, 5618, 5621, 5623, 5626, 5627] if (a3 <= 0) {
[5635, 5637, 5630, 5631] v2 = *(a0);
[5639] v3 = 0;
[5641] if (*(a0)) {
while (true) {
[5648] v5 = *((8 + v1 + 0x4 * v3));
[5648] v3 += 1;
[5652, 5655, 5658, 5661] v6 = add_one_listen_addr(v1, a1, a2, v5);
[5665] if (*(a0) <= v3)
[5673, 5670] break;
[5673, 5670] }
}
return;
[5680, 5681, 5683, 5685, 5675, 5679] } else {
v4 = add_one_listen_addr(a0, a1, a2, a3);
[7744, 5696, 7746, 5700, 7749, 5701, 5702, 5704, 5706, 7759, 7766] return;
[7744, 5696, 7746, 5700, 7749, 5701, 5702, 5704, 5706, 7759, 7766] }
}
|
void add_listen_addr(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long a3) {
[6889] unsigned int v0; // [bp-0xc]
[6889] unsigned long long v2; // rax
[6889] unsigned long long v3; // rax
[6889]
[6889] if (a3 > 0) {
[6913, 6916, 6920, 6889, 6893, 6894, 6897, 6901, 6905, 6909] v2 = add_one_listen_addr(a0, a1, a2, a3);
[6922, 6925, 6929, 6933, 6937, 6940] } else {
v0 = 0;
[6947] while (true) {
[6991] v3 = *(a0);
[6995, 6991] if (v0 >= *(a0))
[7000, 6997] break;
[7000, 6997] add_one_listen_addr(a0, a1, a2, *((a0 + v0 * 4 + 8)));
[6979, 6982, 6956, 6960, 6963, 6967, 6971, 6975] v0 += 1;
[6987, 6991, 6995, 6997, 7000] }
}
return;
}
|
void process_queued_listen_addrs(long a1)
[5712] {
unsigned int v1; // r12d
long v2; // rax
long v3; // rbx
[5712, 5714, 5715, 5718, 5719, 5721, 5723] if ( !*(_DWORD *)a1 )
{
[5725] *(_DWORD *)a1 = 1;
[5731] *(_DWORD *)(a1 + 8) = 22;
}
[5745, 5738] if ( *(_DWORD *)(a1 + 1060) == -1 )
[5747] *(_DWORD *)(a1 + 1060) = 0;
[5763, 5757, 5765] if ( *(_DWORD *)(a1 + 1040) )
{
[5770, 5767] v1 = 0;
do
{
[5776] v2 = v1++;
[5786, 5790, 5797, 5782] v3 = *(_QWORD *)(a1 + 1032) + 24 * v2;
[5801, 5804, 5808, 5779, 5811] add_listen_addr((_DWORD *)a1, *(const char **)v3, *(const char **)(v3 + 16), *(unsigned int *)(v3 + 8));
[5816, 5819] free(*(void **)v3);
[5824, 5828] free(*(void **)(v3 + 16));
}
[5840, 5833] while ( *(_DWORD *)(a1 + 1040) > v1 );
}
[5849, 5842] free(*(void **)(a1 + 1032));
[5855] *(_QWORD *)(a1 + 1032) = 0LL;
[5866] *(_DWORD *)(a1 + 1040) = 0;
[5876, 5877, 5854, 5879] }
//----- (0000000000001700) ----------------------------------------------------
void * format_listen_addrs_isra_0(const char **a1, long *a2)
{
void *result; // rax
long v3; // r15
const char *v4; // r8
unsigned int v5; // eax
void *v6; // r14
const char *v7; // r8
const char *v8; // rax
const char *v9; // r9
void *ptr; // [rsp+8h] [rbp-470h] BYREF
char serv[32]; // [rsp+10h] [rbp-468h] BYREF
char host[1032]; // [rsp+30h] [rbp-448h] BYREF
unsigned long v13; // [rsp+438h] [rbp-40h]
v13 = __readfsqword(0x28u);
result = (void *)xstrdup(&LC27);
v3 = *a2;
ptr = result;
if ( v3 )
{
do
{
while ( 1 )
{
v5 = getnameinfo(*(const struct sockaddr **)(v3 + 24), *(_DWORD *)(v3 + 16), host, 0x401u, serv, 0x20u, 3);
if ( !v5 )
break;
v8 = (const char *)ssh_gai_strerror(v5);
sshlog("servconf.c", "format_listen_addrs", 2838LL, 0LL, 2LL, 0LL, "getnameinfo: %.100s", v8);
v3 = *(_QWORD *)(v3 + 40);
if ( !v3 )
return ptr;
}
v6 = ptr;
v9 = *a1;
if ( *(_DWORD *)(v3 + 4) == 10 )
{
v7 = " rdomain ";
if ( !v9 )
{
v9 = (const char *)&LC27;
v7 = (const char *)&LC27;
}
xasprintf(&ptr, "listenaddress [%s]:%s%s%s\n%s", host, serv, v7, v9, (const char *)ptr);
}
else
{
v4 = " rdomain ";
if ( !v9 )
{
v9 = (const char *)&LC27;
v4 = (const char *)&LC27;
}
xasprintf(&ptr, "listenaddress %s:%s%s%s\n%s", host, serv, v4, v9, (const char *)ptr);
}
free(v6);
v3 = *(_QWORD *)(v3 + 40);
}
while ( v3 );
return ptr;
}
return result;
}
// C308: using guessed type long xstrdup(_QWORD);
// C348: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C3D8: using guessed type long ssh_gai_strerror(_QWORD);
// C3E0: using guessed type long xasprintf(_QWORD, const char *, ...);
//----- (00000000000018C0) ----------------------------------------------------
long dump_cfg_oct_constprop_0()
{
const char *v0; // rax
long v1; // rcx
v0 = lookup_opcode_name(88);
return _printf_chk(1LL, "%s 0%o\n", v0, v1);
}
// 18E5: variable 'v1' is possibly undefined
// C3B8: using guessed type long _printf_chk(_QWORD, const char *, ...);
//----- (00000000000018F0) ----------------------------------------------------
long initialize_server_options(long a1)
[6384] {
long v2; // rdi
long result; // rax
[6384, 6388, 6391] v2 = a1 + 8;
[6401, 6395, 6399] *(_QWORD *)(v2 + 7864) = 0LL;
[6432, 6435, 6412, 6415, 6419, 6423, 6426] memset(
(void *)(v2 & 0xFFFFFFFFFFFFFFF8LL),
0,
8 * ((unsigned long)((unsigned int)a1 - (v2 & 0xFFFFFFF8) + 7880) >> 3));
[6438] *(_QWORD *)a1 = 0LL;
[6445, 6455] *(_QWORD *)(a1 + 1056) = 0xFFFFFFFF00000000LL;
[6462] result = 0xFFFFFFFFLL;
[6467] *(_QWORD *)(a1 + 1032) = 0LL;
[6478] *(_DWORD *)(a1 + 1040) = 0;
[6488] *(_QWORD *)(a1 + 1048) = 0LL;
[6499] *(_QWORD *)(a1 + 1064) = 0LL;
[6510] *(_DWORD *)(a1 + 1088) = 0;
[6520] *(_DWORD *)(a1 + 1104) = 0;
[6530] *(_DWORD *)(a1 + 1168) = -1;
[6540] *(_QWORD *)(a1 + 1304) = 0LL;
[6551] *(_QWORD *)(a1 + 1360) = 0LL;
[6562] *(_QWORD *)(a1 + 7808) = -1LL;
[6573] *(_DWORD *)(a1 + 7816) = -1;
[6583] *(_DWORD *)(a1 + 1388) = 0;
[6593] *(_DWORD *)(a1 + 1400) = 0;
[6603] *(_DWORD *)(a1 + 1416) = 0;
[6613] *(_DWORD *)(a1 + 1432) = 0;
[6623] *(_DWORD *)(a1 + 1448) = 0;
[6633] *(_QWORD *)(a1 + 7664) = 0LL;
[6644] *(_QWORD *)(a1 + 7672) = -1LL;
[6655] *(_QWORD *)(a1 + 7680) = 0xFFFFFFFFLL;
[6662] *(_OWORD *)(a1 + 1112) = 0LL;
[6669] *(_OWORD *)(a1 + 1136) = -1LL;
[6676] *(_OWORD *)(a1 + 1152) = -1LL;
[6683] *(_OWORD *)(a1 + 1312) = -1LL;
[6690] *(_OWORD *)(a1 + 1328) = -1LL;
[6697] *(_OWORD *)(a1 + 1344) = -1LL;
[6704] *(_OWORD *)(a1 + 1368) = -1LL;
[6711] *(_OWORD *)(a1 + 7632) = -1LL;
[6718] *(_OWORD *)(a1 + 7648) = -1LL;
[6725] *(_DWORD *)(a1 + 7600) = 0;
[6735] *(_DWORD *)(a1 + 7616) = 0;
[6745] *(_QWORD *)(a1 + 7728) = 0LL;
[6756] *(_QWORD *)(a1 + 7696) = 0LL;
[6767] *(_QWORD *)(a1 + 7704) = -1LL;
[6778] *(_QWORD *)(a1 + 7712) = 0LL;
[6789] *(_QWORD *)(a1 + 7864) = 0LL;
[6800] *(_QWORD *)(a1 + 1176) = 0LL;
[6811] *(_QWORD *)(a1 + 1200) = -1LL;
[6822] *(_QWORD *)(a1 + 1224) = 0LL;
[6833] *(_QWORD *)(a1 + 1232) = -1LL;
[6844] *(_QWORD *)(a1 + 1240) = -1LL;
[6855] *(_QWORD *)(a1 + 1248) = 0xFFFFFFFFLL;
[6862] *(_QWORD *)(a1 + 1256) = 0LL;
[6873] *(_QWORD *)(a1 + 1264) = -1LL;
[6884] *(_QWORD *)(a1 + 1288) = 0LL;
[6895] *(_DWORD *)(a1 + 1296) = -1;
[6905] *(_QWORD *)(a1 + 7824) = 0LL;
[6916] *(_DWORD *)(a1 + 1384) = -1;
[6926] *(_QWORD *)(a1 + 7848) = -1LL;
[6937] *(_DWORD *)(a1 + 7872) = -1;
[6947] *(_OWORD *)(a1 + 7744) = 0LL;
[6954] *(_OWORD *)(a1 + 7760) = 0LL;
[6961] *(_OWORD *)(a1 + 7776) = 0LL;
[6968] *(_OWORD *)(a1 + 7792) = 0LL;
[6975] *(_OWORD *)(a1 + 1184) = -1LL;
[6982] *(_OWORD *)(a1 + 1208) = 0LL;
[6989] *(_OWORD *)(a1 + 1272) = 0LL;
[6996] return result;
}
//----- (0000000000001B60) ----------------------------------------------------
void derelativise_path(const char *a1)
[7008] {
__uid_t v1; // eax
char *v2; // r12
int *v3; // rax
char *v4; // rax
long v5; // rdx
const char *v6; // rcx
long v7; // [rsp+8h] [rbp-1030h] BYREF
char buf[24]; // [rsp+10h] [rbp-1028h] BYREF
[7008, 7012, 7014, 7016, 7048, 7023, 7056, 7058, 7028, 7039] unsigned long v9; // [rsp+1018h] [rbp-20h]
[7032, 7066, 7068, 7061]
[7216, 7228, 7231, 7223] v9 = __readfsqword(0x28u);
[7074] if ( !strcasecmp(a1, "none") )
[7092, 7082, 7084, 7079] {
[7104, 7112, 7089, 7121, 7095, 7100, 7102] xstrdup("none");
[7137, 7130] }
[7144, 7149, 7154, 7157, 7162, 7165] else
{
[7170, 7175, 7178, 7180, 7187, 7167] v1 = getuid();
[7192, 7195] v2 = (char *)tilde_expand_filename(a1, v1);
[7200, 7205] if ( !(unsigned int)path_absolute(v2) )
{
[7241] if ( getcwd(buf, 0x1000uLL) )
[7248, 7246] {
[7297, 7267, 7268, 7302, 7275, 7280, 7253, 7287, 7256, 7288, 7262, 7295] xasprintf(&v7, "%s/%s", buf, v2);
[7123, 7303] free(v2);
[7133, 7135] }
else
{
v3 = _errno_location();
v4 = strerror(*v3);
sshfatal("servconf.c", "derelativise_path", 744LL, 1LL, 1LL, 0LL, "getcwd: %s", v4);
servconf_add_hostkey((long)"servconf.c", (unsigned int)"derelativise_path", v5, v6);
}
}
}
}
// 1C87: variable 'v5' is possibly undefined
// 1C87: variable 'v6' is possibly undefined
// C2B0: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C308: using guessed type long xstrdup(_QWORD);
// C3E0: using guessed type long xasprintf(_QWORD, const char *, ...);
// C3F8: using guessed type long tilde_expand_filename(_QWORD, _QWORD);
// C400: using guessed type long path_absolute(_QWORD);
//----- (0000000000001C90) ----------------------------------------------------
void servconf_add_hostkey(long a1, unsigned int a2, long a3, const char *a4)
[7312] {
void *v5; // rax
void *v6; // rbp
[7328, 7331, 7353, 7334, 7335, 7336, 7339, 7312, 7316, 7318, 7321, 7323, 7326]
[7363, 7370, 7344, 7377, 7346, 7349, 7352, 7356, 7384] derelativise_path(a4);
[7393, 7402, 7389, 7390] v6 = v5;
[7394, 7395, 7396, 7398, 7400] opt_array_append2(a1, a2, "HostKey", a3 + 1072, a3 + 1080, a3 + 1088);
free(v6);
}
// 1CB9: variable 'v5' is possibly undefined
// C420: using guessed type long opt_array_append2(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000001CF0) ----------------------------------------------------
int fill_default_server_options(long a1)
[7408] {
void *v1; // rbp
void *v2; // rbp
void *v3; // rbp
void *v4; // rbp
void *v5; // rbp
void *v6; // rbp
void *v7; // rbp
void *v8; // rbp
void *v9; // rbp
void *v10; // rbp
void *v11; // rbp
unsigned int v12; // ebp
long v13; // r14
long v14; // r12
char *v15; // r13
_QWORD *v16; // rax
unsigned int v17; // ebp
long v18; // r14
long v19; // r12
char *v20; // r13
char *v21; // rbp
long v22; // rax
bool v23; // zf
[7427, 7430, 7408, 7412, 7414, 7416, 7418, 7419, 7420] if ( *(_DWORD *)(a1 + 7704) == -1 )
[7432] *(_DWORD *)(a1 + 7704) = 0;
[7448, 7442, 7450] if ( !*(_DWORD *)(a1 + 1088) )
{
[9734, 9712, 9715, 9718, 9725, 9727] servconf_add_hostkey((long)"[default]", 0, a1, "/usr/local/etc/ssh_host_rsa_key");
[9761, 9739, 9742, 9745, 9747, 9754] servconf_add_hostkey((long)"[default]", 0, a1, "/usr/local/etc/ssh_host_ecdsa_key");
[9793, 9766, 9769, 9772, 9774, 9781, 9788] servconf_add_hostkey((long)"[default]", 0, a1, "/usr/local/etc/ssh_host_ed25519_key");
}
[7456, 7458, 7460] if ( !*(_DWORD *)a1 )
{
[7462] *(_DWORD *)a1 = 1;
[7468] *(_DWORD *)(a1 + 8) = 22;
}
[7482, 7475] if ( *(_DWORD *)(a1 + 1060) == -1 )
[7484] *(_DWORD *)(a1 + 1060) = 0;
[7502, 7494] if ( !*(_QWORD *)(a1 + 1048) )
[9872, 9874, 9876, 9878, 9881, 9886] add_listen_addr((_DWORD *)a1, 0LL, 0LL, 0LL);
[7508, 7516] if ( *(_QWORD *)(a1 + 1120) )
{
[7522, 7530] if ( *(_QWORD *)(a1 + 1128) )
goto LABEL_13;
}
else
{
[9808, 9815] v22 = xstrdup("/var/run/sshd.pid");
[9820] v23 = *(_QWORD *)(a1 + 1128) == 0LL;
[9828] *(_QWORD *)(a1 + 1120) = v22;
[9841, 9835] if ( !v23 )
goto LABEL_13;
}
[9848, 9867, 9860, 9855] *(_QWORD *)(a1 + 1128) = xstrdup("/usr/local/etc/moduli");
LABEL_13:
[7536, 7543] if ( *(_DWORD *)(a1 + 1136) == -1 )
[7545] *(_DWORD *)(a1 + 1136) = 120;
[7562, 7555] if ( *(_DWORD *)(a1 + 1140) == -1 )
[7564] *(_DWORD *)(a1 + 1140) = 2;
[7581, 7574] if ( *(_DWORD *)(a1 + 1144) == -1 )
[7583] *(_DWORD *)(a1 + 1144) = 1;
[7600, 7593] if ( *(_DWORD *)(a1 + 1148) == -1 )
[7602] *(_DWORD *)(a1 + 1148) = 0;
[7619, 7612] if ( *(_DWORD *)(a1 + 1152) == -1 )
[7621] *(_DWORD *)(a1 + 1152) = 1;
[7638, 7631] if ( *(_DWORD *)(a1 + 1156) == -1 )
[7640] *(_DWORD *)(a1 + 1156) = 1;
[7657, 7650] if ( *(_DWORD *)(a1 + 1160) == -1 )
[7659] *(_DWORD *)(a1 + 1160) = 0;
[7676, 7669] if ( *(_DWORD *)(a1 + 1164) == -1 )
[7678] *(_DWORD *)(a1 + 1164) = 10;
[7688, 7695] if ( *(_DWORD *)(a1 + 1168) == -1 )
[7697] *(_DWORD *)(a1 + 1168) = 1;
[7715, 7707] if ( !*(_QWORD *)(a1 + 1176) )
[9896, 9915, 9908, 9903] *(_QWORD *)(a1 + 1176) = xstrdup("/usr/bin/xauth");
[7728, 7721] if ( *(_DWORD *)(a1 + 1184) == -1 )
[7730] *(_DWORD *)(a1 + 1184) = 1;
[7747, 7740] if ( *(_DWORD *)(a1 + 1188) == -1 )
[7749] *(_DWORD *)(a1 + 1188) = 1;
[7766, 7759] if ( *(_DWORD *)(a1 + 1192) == -1 )
[7768] *(_DWORD *)(a1 + 1192) = 1;
[7785, 7778] if ( *(_DWORD *)(a1 + 1196) == -1 )
[7787] *(_DWORD *)(a1 + 1196) = 1;
[7804, 7797] if ( *(_DWORD *)(a1 + 1244) == -1 )
[7806] *(_DWORD *)(a1 + 1244) = 2;
[7816, 7823] if ( *(_DWORD *)(a1 + 1248) == -1 )
[7825] *(_DWORD *)(a1 + 1248) = 3;
[7842, 7835] if ( *(_DWORD *)(a1 + 1264) == -1 )
[7844] *(_DWORD *)(a1 + 1264) = 0;
[7861, 7854] if ( *(_DWORD *)(a1 + 1268) == -1 )
[7863] *(_DWORD *)(a1 + 1268) = 0;
[7880, 7873] if ( *(_DWORD *)(a1 + 1296) == -1 )
[7882] *(_DWORD *)(a1 + 1296) = 1;
[7899, 7892] if ( *(_DWORD *)(a1 + 1312) == -1 )
[7901] *(_DWORD *)(a1 + 1312) = 0;
[7918, 7911] if ( *(_DWORD *)(a1 + 1316) == -1 )
[7920] *(_DWORD *)(a1 + 1316) = 0;
[7937, 7930] if ( *(_DWORD *)(a1 + 1320) == -1 )
[7939] *(_DWORD *)(a1 + 1320) = 1;
[7956, 7949] if ( *(_DWORD *)(a1 + 1324) == -1 )
[7958] *(_DWORD *)(a1 + 1324) = 1;
[7968, 7975] if ( *(_DWORD *)(a1 + 1328) == -1 )
[7977] *(_DWORD *)(a1 + 1328) = 0;
[7994, 7987] if ( *(_DWORD *)(a1 + 1332) == -1 )
[7996] *(_DWORD *)(a1 + 1332) = 0;
[8013, 8006] if ( *(_DWORD *)(a1 + 1336) == -1 )
[8015] *(_DWORD *)(a1 + 1336) = 1;
[8032, 8025] if ( *(_DWORD *)(a1 + 1340) == -1 )
[8034] *(_DWORD *)(a1 + 1340) = 1;
[8051, 8044] if ( *(_DWORD *)(a1 + 1344) == -1 )
[8053] *(_DWORD *)(a1 + 1344) = 1;
[8070, 8063] if ( *(_DWORD *)(a1 + 1348) == -1 )
[8072] *(_DWORD *)(a1 + 1348) = 1;
[8089, 8082] if ( *(_DWORD *)(a1 + 1352) == -1 )
[8091] *(_DWORD *)(a1 + 1352) = 0;
[8108, 8101] if ( *(_DWORD *)(a1 + 1356) == -1 )
{
[8110] *(_DWORD *)(a1 + 1356) = 0;
[8120] *(_QWORD *)(a1 + 1360) = 0LL;
}
[8138, 8131] if ( *(_DWORD *)(a1 + 1368) == -1 )
[8140] *(_DWORD *)(a1 + 1368) = 2;
[8158, 8150] if ( *(_QWORD *)(a1 + 7808) == -1LL )
[8160] *(_QWORD *)(a1 + 7808) = 0LL;
[8178, 8171] if ( *(_DWORD *)(a1 + 7816) == -1 )
[8180] *(_DWORD *)(a1 + 7816) = 0;
[8197, 8190] if ( *(_DWORD *)(a1 + 1372) == -1 )
[8199] *(_DWORD *)(a1 + 1372) = 3;
[8216, 8209] if ( *(_DWORD *)(a1 + 1376) == -1 )
[8218] *(_DWORD *)(a1 + 1376) = 3;
[8235, 8228] if ( *(_DWORD *)(a1 + 1380) == -1 )
[8237] *(_DWORD *)(a1 + 1380) = 1;
[8254, 8247] if ( *(_DWORD *)(a1 + 1232) == -1 )
[8256] *(_DWORD *)(a1 + 1232) = 0;
[8273, 8266] if ( *(_DWORD *)(a1 + 7640) == -1 )
[8275] *(_DWORD *)(a1 + 7640) = 100;
[8292, 8285] if ( *(_DWORD *)(a1 + 7636) == -1 )
[8294] *(_DWORD *)(a1 + 7636) = 30;
[8304, 8311] if ( *(_DWORD *)(a1 + 7632) == -1 )
[8313] *(_DWORD *)(a1 + 7632) = 10;
[8330, 8323] if ( *(_DWORD *)(a1 + 7644) == -1 )
[8332] *(_DWORD *)(a1 + 7644) = 0x7FFFFFFF;
[8349, 8342] if ( *(_DWORD *)(a1 + 7648) == -1 )
[8351] *(_DWORD *)(a1 + 7648) = 32;
[8368, 8361] if ( *(_DWORD *)(a1 + 7652) == -1 )
[8370] *(_DWORD *)(a1 + 7652) = 128;
[8387, 8380] if ( *(_DWORD *)(a1 + 7656) == -1 )
[8389] *(_DWORD *)(a1 + 7656) = 6;
[8406, 8399] if ( *(_DWORD *)(a1 + 7660) == -1 )
[8408] *(_DWORD *)(a1 + 7660) = 10;
[8425, 8418] if ( *(_DWORD *)(a1 + 7672) == -1 )
[8427] *(_DWORD *)(a1 + 7672) = 0;
[8444, 8437] if ( *(_DWORD *)(a1 + 7676) == -1 )
[8446] *(_DWORD *)(a1 + 7676) = 0;
[8456, 8463] if ( *(_DWORD *)(a1 + 7680) == -1 )
[8465] *(_DWORD *)(a1 + 7680) = 3;
[8481, 8475, 8483] if ( !*(_DWORD *)(a1 + 7684) )
{
[9632, 9635, 9638, 9645, 9616, 9652, 9623, 9659, 9630] opt_array_append("[default]", 0LL, "AuthorizedKeysFiles", a1 + 7688, a1 + 7684, ".ssh/authorized_keys");
[9664, 9698, 9667, 9670, 9672, 9679, 9686, 9693] opt_array_append("[default]", 0LL, "AuthorizedKeysFiles", a1 + 7688, a1 + 7684, ".ssh/authorized_keys2");
}
[8496, 8489] if ( *(_DWORD *)(a1 + 7708) == -1 )
[8498] *(_DWORD *)(a1 + 7708) = 0;
[8515, 8508] if ( *(_DWORD *)(a1 + 1200) == -1 )
[8517] *(_DWORD *)(a1 + 1200) = 72;
[8534, 8527] if ( *(_DWORD *)(a1 + 1204) == -1 )
[8536] *(_DWORD *)(a1 + 1204) = 32;
[8546, 8554] if ( !*(_QWORD *)(a1 + 7824) )
[9920, 9939, 9932, 9927] *(_QWORD *)(a1 + 7824) = xstrdup(&LC27);
[8560, 8567] if ( *(_DWORD *)(a1 + 1236) == -1 )
[8569] *(_DWORD *)(a1 + 1236) = 127;
[8586, 8579] if ( *(_DWORD *)(a1 + 1240) == -1 )
[8588] *(_DWORD *)(a1 + 1240) = 0;
[8605, 8598] if ( *(_DWORD *)(a1 + 7848) == -1 )
[8607] *(_DWORD *)(a1 + 7848) = 2;
[8624, 8617] if ( *(_DWORD *)(a1 + 1384) == -1 )
[8626] *(_DWORD *)(a1 + 1384) = 0;
[8643, 8636] if ( *(_DWORD *)(a1 + 7852) == -1 )
[8645] *(_DWORD *)(a1 + 7852) = 0;
[8663, 8655] if ( !*(_QWORD *)(a1 + 7864) )
[9952, 9971, 9964, 9959] *(_QWORD *)(a1 + 7864) = xstrdup("internal");
[8676, 8669] if ( *(_DWORD *)(a1 + 7872) == -1 )
[8678] *(_DWORD *)(a1 + 7872) = 1024;
[8688, 8691] assemble_algorithms(a1);
[8696, 8703] if ( use_privsep == -1 )
[8705] use_privsep = 1;
[8715] v1 = *(void **)(a1 + 1120);
[8722, 8730, 8732, 8725] if ( option_clear_or_none((const char *)v1) )
{
[9584, 9587] free(v1);
[9592, 9603] *(_QWORD *)(a1 + 1120) = 0LL;
}
[8738] v2 = *(void **)(a1 + 1176);
[8745, 8755, 8748, 8753] if ( option_clear_or_none((const char *)v2) )
{
[9552, 9555] free(v2);
[9560, 9571] *(_QWORD *)(a1 + 1176) = 0LL;
}
[8761] v3 = *(void **)(a1 + 7664);
[8768, 8776, 8778, 8771] if ( option_clear_or_none((const char *)v3) )
{
[9520, 9523] free(v3);
[9528, 9539] *(_QWORD *)(a1 + 7664) = 0LL;
}
[8784] v4 = *(void **)(a1 + 7760);
[8801, 8794, 8799, 8791] if ( option_clear_or_none((const char *)v4) )
{
[9488, 9491] free(v4);
[9496, 9507] *(_QWORD *)(a1 + 7760) = 0LL;
}
[8807] v5 = *(void **)(a1 + 7752);
[8824, 8817, 8822, 8814] if ( option_clear_or_none((const char *)v5) )
{
[9456, 9459] free(v5);
[9464, 9475] *(_QWORD *)(a1 + 7752) = 0LL;
}
[8830] v6 = *(void **)(a1 + 7864);
[8840, 8837, 8845, 8847] if ( option_clear_or_none((const char *)v6) )
{
[9424, 9427] free(v6);
[9432, 9443] *(_QWORD *)(a1 + 7864) = 0LL;
}
[8853] v7 = *(void **)(a1 + 7784);
[8868, 8860, 8870, 8863] if ( option_clear_or_none((const char *)v7) )
{
[9392, 9395] free(v7);
[9400, 9411] *(_QWORD *)(a1 + 7784) = 0LL;
}
[8876] v8 = *(void **)(a1 + 7696);
[8883, 8891, 8886, 8893] if ( option_clear_or_none((const char *)v8) )
{
[9360, 9363] free(v8);
[9368, 9379] *(_QWORD *)(a1 + 7696) = 0LL;
}
[8899] v9 = *(void **)(a1 + 7744);
[8914, 8906, 8916, 8909] if ( option_clear_or_none((const char *)v9) )
{
[9328, 9331] free(v9);
[9336, 9347] *(_QWORD *)(a1 + 7744) = 0LL;
}
[8922] v10 = *(void **)(a1 + 1064);
[8929, 8939, 8932, 8937] if ( option_clear_or_none((const char *)v10) )
{
[9296, 9299] free(v10);
[9304, 9315] *(_QWORD *)(a1 + 1064) = 0LL;
}
[8945] v11 = *(void **)(a1 + 1112);
[8952, 8960, 8962, 8955] if ( option_clear_or_none((const char *)v11) )
{
[9264, 9267] free(v11);
[9272, 9283] *(_QWORD *)(a1 + 1112) = 0LL;
}
[8968, 8976, 8974] if ( *(_DWORD *)(a1 + 1088) )
{
[8978] v12 = 0;
do
{
[8980] v13 = *(_QWORD *)(a1 + 1072);
[8987] while ( 1 )
{
[8987] v14 = v12;
[8987, 8990] v15 = *(char **)(v13 + 8LL * v12);
[8994, 9002, 8997, 9004] if ( option_clear_or_none(v15) )
break;
[9009, 9006, 9015] if ( *(_DWORD *)(a1 + 1088) <= ++v12 )
goto LABEL_164;
}
[9091] ++v12;
[9088, 9094] free(v15);
[9106, 9099] *(_QWORD *)(*(_QWORD *)(a1 + 1072) + 8 * v14) = 0LL;
}
[9120, 9114, 9126] while ( *(_DWORD *)(a1 + 1088) > v12 );
}
LABEL_164:
[9017] LODWORD(v16) = *(_DWORD *)(a1 + 1104);
[9025, 9023] if ( !(_DWORD)v16 )
{
LABEL_169:
[9073, 9066] if ( *(_DWORD *)(a1 + 7832) != 1 )
[9073, 9075] return (int)v16;
goto LABEL_175;
}
[9027] v17 = 0;
do
{
[9029] v18 = *(_QWORD *)(a1 + 1096);
[9036] while ( 1 )
{
[9036] v19 = v17;
[9036, 9039] v20 = *(char **)(v18 + 8LL * v17);
[9043, 9046] LODWORD(v16) = option_clear_or_none(v20);
[9051, 9053] if ( (_DWORD)v16 )
break;
[9064, 9058, 9055] if ( *(_DWORD *)(a1 + 1104) <= ++v17 )
goto LABEL_169;
}
[9139] ++v17;
[9136, 9142] free(v20);
[9147] v16 = *(_QWORD **)(a1 + 1096);
[9154] v16[v19] = 0LL;
}
[9168, 9162] while ( v17 < *(_DWORD *)(a1 + 1104) );
[9181, 9174] if ( *(_DWORD *)(a1 + 7832) == 1 )
{
LABEL_175:
[9197, 9183] v21 = **(char ***)(a1 + 7840);
[9200, 9203, 9190] LODWORD(v16) = strcmp(v21, "any");
[9208, 9210] if ( !(_DWORD)v16 )
{
[9216, 9219] free(v21);
[9224] v16 = *(_QWORD **)(a1 + 7840);
[9231] *v16 = 0LL;
[9238] *(_DWORD *)(a1 + 7832) = 0;
}
}
[9075] return (int)v16;
[9248, 9249, 9250, 9252, 9254, 9256, 9076, 9077, 9079, 9081, 9083] }
// C308: using guessed type long xstrdup(_QWORD);
// C430: using guessed type long opt_array_append(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002700) ----------------------------------------------------
void servconf_add_hostcert(long a1, unsigned int a2, long a3, const char *a4)
[9984] {
void *v5; // rax
void *v6; // rbp
[9984, 9988, 9990, 9993, 9995, 9998, 10001, 10002, 10003, 10006, 10010, 10045]
[10048, 10018, 10025, 10032, 10035, 10038, 10015] derelativise_path(a4);
[10057, 10066] v6 = v5;
[10053, 10060, 10061, 10062, 10064] opt_array_append(a1, a2, "HostCertificate", a3 + 1096, a3 + 1104, v5);
free(v6);
}
// 273D: variable 'v5' is possibly undefined
// C430: using guessed type long opt_array_append(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (0000000000002760) ----------------------------------------------------
unsigned long process_permitopen(long a1, long a2)
[10080] {
[10080, 10114, 10084, 10085, 10088, 10089, 10092, 10096, 10102, 10109] process_permitopen_list(a1, 66, *(const char ***)(a2 + 7712), *(_DWORD *)(a2 + 7720));
[10146, 10119, 10125, 10128, 10135, 10139] return process_permitopen_list(a1, 67, *(const char ***)(a2 + 7728), *(_DWORD *)(a2 + 7736));
[10144, 10145] }
//----- (00000000000027B0) ----------------------------------------------------
void * get_connection_info(long a1, int a2, unsigned int a3)
[10160] {
[10160, 10164, 10167, 10169, 10171] if ( !a1 || !a2 )
[10264] return &ci_21326;
[10176, 10179, 10184, 10187, 10173, 10174] qword_8148 = auth_get_canonical_hostname(a1, a3);
[10202, 10194] qword_8150 = ssh_remote_ipaddr(a1);
[10209, 10217, 10199] qword_8158 = ssh_local_ipaddr(a1);
[10224, 10232, 10214] dword_8160 = ssh_local_port(a1);
[10243, 10244, 10229, 10238] qword_8168 = ssh_packet_rdomain_in(a1);
[10258, 10251] return &ci_21326;
[10271] }
// 8148: using guessed type long qword_8148;
// 8150: using guessed type long qword_8150;
// 8158: using guessed type long qword_8158;
// 8160: using guessed type int dword_8160;
// 8168: using guessed type long qword_8168;
// C438: using guessed type long auth_get_canonical_hostname(_QWORD, _QWORD);
// C440: using guessed type long ssh_remote_ipaddr(_QWORD);
// C448: using guessed type long ssh_local_ipaddr(_QWORD);
// C450: using guessed type long ssh_local_port(_QWORD);
// C458: using guessed type long ssh_packet_rdomain_in(_QWORD);
//----- (0000000000002820) ----------------------------------------------------
unsigned long load_server_config(char *s, long a2)
[10272] {
const char *v3; // rbp
FILE *v4; // rax
long v5; // rdx
long v6; // rcx
FILE *v7; // r12
int v8; // eax
char *v9; // rbp
size_t v10; // rax
unsigned int v11; // eax
unsigned int v12; // eax
long v13; // rax
__off_t st_size; // rsi
unsigned int v16; // eax
long v17; // rax
long v18; // rax
long v19; // rax
long v20; // rcx
const char *v21; // [rsp+0h] [rbp-F0h]
long v22; // [rsp+0h] [rbp-F0h]
char *sa; // [rsp+8h] [rbp-E8h] BYREF
size_t n; // [rsp+10h] [rbp-E0h] BYREF
struct stat buf; // [rsp+18h] [rbp-D8h] BYREF
unsigned long v26; // [rsp+B0h] [rbp-40h]
[10272, 10368, 10276, 10278, 10311, 10313, 10314, 10284, 10317, 10318, 10287, 10292, 10294, 10299] v3 = s;
[10325, 10334] v26 = __readfsqword(0x28u);
[10344, 10342, 10351] sa = 0LL;
[10359] n = 0LL;
[10304, 10369, 10376, 10377, 10379, 10301] sshlog("servconf.c", "load_server_config", 2502LL, 1LL, 6LL, 0LL, "filename %s", v21);
[10384, 10394, 10387] v4 = fopen(s, "r");
[10402, 10405] if ( !v4 )
{
LABEL_13:
[10883, 10886] perror(v3);
[10896, 10891] exit(1);
}
[10411] v7 = v4;
[10400, 10414, 10417, 10387, 10399] sshbuf_reset(a2, "r", v5, v6, v22);
[10425, 10422] v8 = fileno(v7);
[10465, 10435, 10437, 10442, 10444, 10450, 10455, 10458, 10430] if ( !fstat(v8, &buf) )
{
[10680] st_size = buf.st_size;
[10688, 10685] if ( buf.st_size > 0 )
{
[10697, 10694] v16 = sshbuf_allocate(a2);
[10704, 10702] if ( v16 )
{
[10712, 10710] v17 = ssh_err(v16);
[10752, 10723, 10759, 10728, 10761, 10733, 10766, 10736, 10743, 10744, 10717, 10751] v11 = sshfatal("servconf.c", "load_server_config", 2511LL, 1LL, 1LL, v17, "allocate", st_size);
LABEL_11:
[10768, 10770] v18 = ssh_err(v11);
[10785, 10820, 10790, 10822, 10793, 10800, 10805, 10806, 10775, 10779, 10813] v12 = sshfatal("servconf.c", "load_server_config", 2521LL, 1LL, 1LL, v18, "sshbuf_put");
LABEL_12:
[10827, 10829] v19 = ssh_err(v12);
[10852, 10855, 10862, 10863, 10834, 10868, 10869, 10840, 10876, 10845, 10878] sshfatal("servconf.c", "load_server_config", 2525LL, 1LL, 1LL, v19, "sshbuf_put_u8", v20);
goto LABEL_13;
}
}
}
[10529, 10534, 10538, 10520, 10523, 10526] while ( getline(&sa, &n, v7) != -1 )
{
[10472] v9 = sa;
[10482, 10487, 10476, 10479] v3 = &v9[strspn(sa, " \t\r")];
[10490, 10493] v10 = strlen(v3);
[10504, 10498, 10507, 10501] v11 = sshbuf_put(a2, v3, v10);
[10512, 10514] if ( v11 )
goto LABEL_11;
}
[10544, 10540] free(sa);
[10554, 10549, 10551] v12 = sshbuf_put_u8(a2, 0LL);
[10561, 10559] if ( v12 )
goto LABEL_12;
[10570, 10567] fclose(v7);
[10578, 10575] v13 = sshbuf_len(a2);
[10625, 10627, 10597, 10598, 10605, 10618, 10610, 10583, 10617, 10586, 10591] sshlog("servconf.c", "load_server_config", 2527LL, 1LL, 6LL, 0LL, "done config len = %zu", v13);
[10657, 10632, 10633, 10634, 10642, 10651] return __readfsqword(0x28u) ^ v26;
[10664, 10665, 10666, 10668, 10670, 10672, 10674] }
// 288B: variable 'v21' is possibly undefined
// 28B1: variable 'v5' is possibly undefined
// 28B1: variable 'v6' is possibly undefined
// 28B1: variable 'v22' is possibly undefined
// 2A7E: variable 'v20' is possibly undefined
// C2B0: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C2F0: using guessed type long ssh_err(_QWORD);
// C348: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C468: using guessed type long sshbuf_reset(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// C490: using guessed type long sshbuf_put(_QWORD, _QWORD, _QWORD);
// C4A0: using guessed type long sshbuf_put_u8(_QWORD, _QWORD);
// C4B0: using guessed type long sshbuf_len(_QWORD);
// C4B8: using guessed type long sshbuf_allocate(_QWORD);
//----- (0000000000002AA0) ----------------------------------------------------
long process_server_config_line_depth(
unsigned int *a1,
char *a2,
const char *a3,
int a4,
long p_s2,
char **a6,
char *a7,
long a8,
const char *a9)
{
char *v9; // r14
unsigned long v10; // r12
size_t v12; // rax
size_t v13; // r13
char *v14; // rax
char *v15; // rbp
char v16; // al
long *v17; // rcx
const char *v18; // r11
long v19; // r15
long v20; // r8
char *v21; // rax
const char *v23; // rdx
const char *v24; // rax
long v25; // r8
long v26; // rdx
unsigned int *v27; // r12
unsigned int *v28; // r13
const char *v29; // rax
long v30; // rdx
long v31; // rcx
long v32; // r8
const char *v33; // rax
void *v34; // r9
char *v35; // rbx
size_t v36; // rax
const char *v37; // rax
const char *v38; // r13
const char *v39; // rax
char **v40; // r13
const char *v41; // rsi
unsigned int v42; // eax
unsigned int *v43; // r14
const char *v44; // rax
unsigned int v45; // eax
const char *v46; // rax
const char *v47; // r12
const char *v48; // rdi
long v49; // rax
const char *v50; // rax
unsigned int v51; // eax
const char **v52; // rax
int matched; // eax
char *v54; // rax
const char *v55; // rax
const char *v56; // r12
int v57; // eax
const char *v58; // rax
const char *v59; // r13
const char *v60; // rax
const char *v61; // r13
char *v62; // r12
size_t v63; // rax
int v64; // r8d
const char *v65; // r12
int v66; // eax
size_t v67; // r13
char *v68; // rax
const char *v69; // r13
const char *v70; // rax
long v71; // rdx
long v72; // rcx
long v73; // r8
const char *v74; // rax
long v75; // rax
const char *v76; // rax
const char *v77; // r15
char v78; // al
char *v79; // r8
const char *v80; // rsi
int v81; // eax
char *v82; // rdx
char **v83; // rbp
char *v84; // rax
char *v85; // rax
int v86; // r9d
long *v87; // rax
long v88; // rax
const char *v89; // rcx
int v90; // r9d
const char *v91; // rax
unsigned int v92; // r13d
const char *v93; // rax
long v94; // rdx
long v95; // rcx
long v96; // r8
__uid_t v97; // eax
void *v98; // rax
unsigned int v99; // edx
void *v100; // rdi
const char *v101; // rax
const char *v102; // rax
const char *v103; // rdi
char v104; // al
const char *v105; // rax
unsigned int v106; // eax
unsigned int v107; // eax
const char *v108; // rax
const char *v109; // r13
unsigned int v110; // r13d
unsigned int *v111; // r14
const char *v112; // rax
unsigned int *v113; // r14
const char *v114; // rax
const char *v115; // rdi
char v116; // al
const char *v117; // rax
const char *v118; // rax
int v119; // eax
char *v120; // rax
char *v121; // r12
const char *v122; // rax
const char *v123; // r12
const char *v124; // rdi
long v125; // rax
const char *v126; // rax
__uid_t v127; // eax
const char *v128; // rax
const char *v129; // rdi
char v130; // al
const char *v131; // rax
const char *v132; // rdi
char v133; // al
unsigned int v134; // r12d
const char *v135; // rax
const char *v136; // r13
const char *v137; // rax
int v138; // eax
const char *v139; // rax
long v140; // rdx
long v141; // rcx
long v142; // r8
long v143; // rbx
unsigned int *v144; // r13
long v145; // rsi
long v146; // rdx
long v147; // rcx
long v148; // r8
const char *v149; // rax
long v150; // rbx
long v151; // rax
char *v152; // rdi
long v153; // rdx
long v154; // rcx
size_t j; // rbx
long v156; // r8
unsigned int v157; // eax
unsigned int *v158; // r12
unsigned int *v159; // r14
const char *v160; // rax
unsigned int *v161; // r12
unsigned int *v162; // r14
const char *v163; // rax
const char *v164; // rax
char *v165; // rax
const char *v166; // rax
const char *v167; // rax
char *v168; // rbx
long v169; // rdx
long v170; // rcx
long v171; // r8
int v172; // ebx
long v173; // rdx
long v174; // rcx
long v175; // r8
const char *v176; // rax
const char *v177; // rax
unsigned int v178; // eax
unsigned int v179; // eax
long v180; // rdx
_QWORD *v181; // rax
char *v182; // rdi
int v183; // ebx
const char *i; // rax
long v185; // rdx
long v186; // rcx
long v187; // r8
char *v188; // rax
const char *v189; // rax
const char *v190; // rbp
const char *v191; // rax
char *v192; // rax
const char *v193; // rax
const char *v194; // rax
char *v195; // rax
char *v196; // rax
int *v197; // rax
char *v198; // rax
const char *v199; // rax
const char *v200; // rdx
int v201; // ecx
long v202; // r8
char **v203; // r9
unsigned int v204; // [rsp+C0h] [rbp-314h]
const char *v205; // [rsp+C4h] [rbp-310h]
unsigned int v206; // [rsp+F0h] [rbp-2E4h]
const char *v207; // [rsp+F4h] [rbp-2E0h]
unsigned int v208; // [rsp+110h] [rbp-2C4h]
const char *v209; // [rsp+114h] [rbp-2C0h]
unsigned int v210; // [rsp+140h] [rbp-294h]
const char *v211; // [rsp+144h] [rbp-290h]
const char *v212; // [rsp+15Ch] [rbp-278h]
const char *v213; // [rsp+164h] [rbp-270h]
unsigned int v214; // [rsp+170h] [rbp-264h]
const char *v215; // [rsp+174h] [rbp-260h]
const char *v216; // [rsp+17Ch] [rbp-258h]
const char *v217; // [rsp+184h] [rbp-250h]
long v218; // [rsp+18Ch] [rbp-248h]
const char *v219; // [rsp+194h] [rbp-240h]
unsigned int v220; // [rsp+1A0h] [rbp-234h]
const char *v221; // [rsp+1A4h] [rbp-230h]
const char *v222; // [rsp+1ACh] [rbp-228h]
const char *v223; // [rsp+1B4h] [rbp-220h]
unsigned int v224; // [rsp+1C0h] [rbp-214h]
const char *v225; // [rsp+1C4h] [rbp-210h]
unsigned int v226; // [rsp+1D0h] [rbp-204h]
const char *v227; // [rsp+1D4h] [rbp-200h]
unsigned int v228; // [rsp+1E0h] [rbp-1F4h]
const char *v229; // [rsp+1E4h] [rbp-1F0h]
unsigned int v230; // [rsp+1F0h] [rbp-1E4h]
const char *v231; // [rsp+1F4h] [rbp-1E0h]
const char *v232; // [rsp+1FCh] [rbp-1D8h]
const char *v233; // [rsp+204h] [rbp-1D0h]
char *v234; // [rsp+20Ch] [rbp-1C8h]
const char *v235; // [rsp+214h] [rbp-1C0h]
char *v236; // [rsp+21Ch] [rbp-1B8h]
const char *v237; // [rsp+224h] [rbp-1B0h]
unsigned int v238; // [rsp+230h] [rbp-1A4h]
const char *v239; // [rsp+234h] [rbp-1A0h]
unsigned int v240; // [rsp+240h] [rbp-194h]
const char *v241; // [rsp+244h] [rbp-190h]
const char *v242; // [rsp+24Ch] [rbp-188h]
const char *v243; // [rsp+254h] [rbp-180h]
const char *v244; // [rsp+25Ch] [rbp-178h]
const char *v245; // [rsp+264h] [rbp-170h]
unsigned int v246; // [rsp+270h] [rbp-164h]
const char *v247; // [rsp+274h] [rbp-160h]
char **v248; // [rsp+27Ch] [rbp-158h]
long *v249; // [rsp+284h] [rbp-150h]
long v250; // [rsp+28Ch] [rbp-148h]
unsigned int v253; // [rsp+29Ch] [rbp-138h]
int v254; // [rsp+29Ch] [rbp-138h]
char *v255; // [rsp+29Ch] [rbp-138h]
char *v256; // [rsp+29Ch] [rbp-138h]
unsigned int *p_endptr; // [rsp+2A4h] [rbp-130h]
const char *v258; // [rsp+2ACh] [rbp-128h]
int *v259; // [rsp+2B4h] [rbp-120h]
unsigned int v260; // [rsp+2B4h] [rbp-120h]
long v261[2]; // [rsp+2BCh] [rbp-118h] BYREF
const char *v262; // [rsp+2CCh] [rbp-108h] BYREF
unsigned int v263; // [rsp+2D4h] [rbp-100h]
int v264; // [rsp+2D8h] [rbp-FCh]
char *s2; // [rsp+2DCh] [rbp-F8h] BYREF
const char *v266; // [rsp+2E4h] [rbp-F0h] BYREF
unsigned int v267; // [rsp+2ECh] [rbp-E8h] BYREF
int v268; // [rsp+2F0h] [rbp-E4h] BYREF
char *s; // [rsp+2F4h] [rbp-E0h] BYREF
char *v270; // [rsp+2FCh] [rbp-D8h] BYREF
void *ptr; // [rsp+304h] [rbp-D0h] BYREF
char *endptr; // [rsp+30Ch] [rbp-C8h] BYREF
long v273; // [rsp+314h] [rbp-C0h] BYREF
const char **v274; // [rsp+31Ch] [rbp-B8h] BYREF
const char **v275; // [rsp+324h] [rbp-B0h] BYREF
long v276; // [rsp+32Ch] [rbp-A8h]
unsigned long v277; // [rsp+394h] [rbp-40h]
int v278; // [rsp+3C4h] [rbp-10h]
v9 = (char *)a1;
v10 = (unsigned long)a2;
HIDWORD(v250) = a4;
v258 = a7;
v277 = __readfsqword(0x28u);
LODWORD(s2) = 0;
HIDWORD(v266) = 0;
v274 = 0LL;
v267 = 0;
v12 = strlen(a2);
if ( !v12 )
goto LABEL_19;
v13 = v12 - 1;
if ( v12 != 1 )
{
do
{
if ( !strchr(LC105, a2[v13]) )
break;
a2[v13--] = 0;
}
while ( v13 );
}
if ( (s = a2, v14 = (char *)strdelim(&s), (v15 = v14) == 0LL)
|| (v16 = *v14) == 0 && ((v21 = (char *)strdelim(&s), (v15 = v21) == 0LL) || (v16 = *v21) == 0)
|| v16 == 35 )
{
LABEL_19:
LODWORD(v19) = 0;
return (unsigned int)v19;
}
if ( !s || !*s )
{
v180 = 1302LL;
LABEL_434:
LODWORD(v19) = -1;
sshlog("servconf.c", "process_server_config_line_depth", v180, 0LL, 2LL, 0LL, v242, v243, v244);
return (unsigned int)v19;
}
v263 = parse_token(v15, a3, HIDWORD(v250), (_DWORD *)&v266 + 1);
LODWORD(v19) = argv_split(s, &v267, &v274, 1LL);
if ( (_DWORD)v19 )
{
LABEL_439:
v180 = 1311LL;
v244 = (const char *)v246;
v243 = v247;
v242 = "%s line %d: invalid quotes";
goto LABEL_434;
}
v268 = v267;
v275 = v274;
if ( p_s2 )
{
v20 = *(unsigned int *)p_s2;
if ( !(_DWORD)v20 )
goto LABEL_14;
}
else
{
LODWORD(s2) = 1;
v20 = 1LL;
p_s2 = (long)&s2;
}
if ( (v263 & 0xFFFFFFF7) == 65 )
{
LABEL_23:
v23 = (const char *)v263;
switch ( v263 )
{
case 0u:
LODWORD(v19) = -1;
goto LABEL_16;
case 1u:
p_endptr = a1 + 1926;
a6 = &multistate_flag;
goto LABEL_61;
case 2u:
if ( a1[1] )
goto LABEL_28;
if ( *a1 > 0xFF )
goto LABEL_545;
v177 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v177;
if ( !v177 || !*v177 )
goto LABEL_544;
p_s2 = *a1;
*a1 = p_s2 + 1;
a1[p_s2 + 2] = a2port(v177);
v9 = (char *)a1[*a1 + 1];
if ( (int)v9 > 0 )
goto LABEL_29;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1357LL,
0LL,
1LL,
0LL,
"%s line %d: Badly formatted port number.",
a3,
HIDWORD(v250));
LABEL_413:
s2 = (char *)argv_next((char *)&v262 + 4, &ptr, v23, v17, v20);
v178 = log_level_number(s2);
HIDWORD(v261[0]) = v178;
if ( v178 == -1 )
goto LABEL_522;
if ( *(_DWORD *)p_s2 && *((_DWORD *)v9 + 312) == -1 )
*((_DWORD *)v9 + 312) = v178;
goto LABEL_29;
case 3u:
v176 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v176;
if ( !v176 || !*v176 )
goto LABEL_586;
if ( *(_DWORD *)p_s2 )
servconf_add_hostkey((long)a3, HIDWORD(v250), (long)a1, v176);
goto LABEL_29;
case 4u:
v43 = a1 + 284;
v261[0] = (long)&v275;
v117 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
goto LABEL_248;
case 5u:
p_endptr = a1 + 285;
a6 = &multistate_permitrootlogin;
goto LABEL_61;
case 6u:
v270 = (char *)argv_next(&v268, &v275, v263, v17, v20);
v179 = log_facility_number(v270);
HIDWORD(s2) = v179;
if ( v179 == -1 )
goto LABEL_535;
if ( a1[311] == -1 )
a1[311] = v179;
goto LABEL_29;
case 7u:
goto LABEL_413;
case 8u:
v134 = a1[313];
if ( !v134 )
{
v261[0] = (long)&v275;
while ( 1 )
{
v135 = (const char *)argv_next(&v268, v261[0], v23, v17, v20);
v270 = (char *)v135;
v136 = v135;
if ( !v135 )
goto LABEL_29;
if ( !*v135 )
break;
if ( !strcasecmp(v135, "none") && (v134 || v268 > 0) )
goto LABEL_490;
++v134;
if ( *(_DWORD *)p_s2 )
opt_array_append(a3, HIDWORD(v250), v15, a1 + 314, a1 + 313, v136);
}
LABEL_454:
v26 = 1743LL;
goto LABEL_31;
}
v183 = 0;
v261[0] = (long)&v275;
for ( i = (const char *)argv_next(&v268, &v275, v263, v17, v20);
;
i = (const char *)argv_next(&v268, v261[0], v185, v186, v187) )
{
v270 = (char *)i;
if ( !i )
goto LABEL_29;
if ( !*i )
goto LABEL_454;
if ( !strcasecmp(i, "none") && (v183 || v268 > 0) )
break;
++v183;
}
LABEL_490:
v26 = 1750LL;
goto LABEL_31;
case 9u:
p_endptr = a1 + 329;
a6 = &multistate_flag;
goto LABEL_61;
case 0xAu:
p_endptr = a1 + 330;
a6 = &multistate_flag;
goto LABEL_61;
case 0xBu:
p_endptr = a1 + 331;
a6 = &multistate_flag;
goto LABEL_61;
case 0xCu:
p_endptr = a1 + 332;
a6 = &multistate_flag;
goto LABEL_61;
case 0xDu:
p_endptr = a1 + 336;
a6 = &multistate_flag;
goto LABEL_61;
case 0xEu:
p_endptr = a1 + 337;
a6 = &multistate_flag;
goto LABEL_61;
case 0xFu:
v261[0] = (long)&v275;
v167 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v167;
v168 = (char *)v167;
if ( !v167 || !*v167 )
goto LABEL_585;
if ( !strchr(v167, 91) )
{
v188 = strchr(v168, 58);
endptr = v188;
if ( v188 )
{
if ( strchr(v188 + 1, 58) )
{
endptr = v168;
v172 = 0;
LABEL_383:
ptr = 0LL;
v270 = (char *)argv_next(&v268, v261[0], v169, v170, v171);
if ( !v270 )
{
LABEL_387:
queue_listen_addr_isra_0((long *)a1 + 129, a1 + 260, (long)endptr, (long)ptr, v172);
goto LABEL_29;
}
if ( strcmp(v270, "rdomain") )
goto LABEL_519;
ptr = (void *)argv_next(&v268, v261[0], v173, v174, v175);
if ( !ptr )
goto LABEL_519;
if ( (unsigned int)valid_rdomain(ptr) )
goto LABEL_387;
LABEL_518:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1406LL,
0LL,
1LL,
0LL,
"%s line %d: bad routing domain",
v235,
HIDWORD(v234));
LABEL_519:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1403LL,
0LL,
1LL,
0LL,
"%s line %d: bad ListenAddress syntax",
v231,
v230);
LABEL_520:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1917LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s spec.",
v227,
v226,
v15);
goto LABEL_521;
}
}
}
ptr = 0LL;
endptr = (char *)hpdelim(&v270);
if ( endptr )
{
endptr = (char *)cleanhostname(endptr);
if ( v270 )
{
v172 = a2port(v270);
if ( v172 <= 0 )
goto LABEL_524;
}
else
{
v172 = 0;
}
goto LABEL_383;
}
goto LABEL_516;
case 0x10u:
p_endptr = a1 + 265;
a6 = &multistate_addressfamily;
goto LABEL_61;
case 0x11u:
p_endptr = a1 + 288;
a6 = &multistate_flag;
goto LABEL_61;
case 0x12u:
p_endptr = a1 + 289;
a6 = &multistate_flag;
goto LABEL_61;
case 0x13u:
p_endptr = a1 + 286;
a6 = &multistate_ignore_rhosts;
goto LABEL_61;
case 0x14u:
p_endptr = a1 + 290;
a6 = &multistate_flag;
goto LABEL_61;
case 0x15u:
v43 = a1 + 291;
goto LABEL_73;
case 0x16u:
p_endptr = a1 + 292;
a6 = &multistate_flag;
goto LABEL_61;
case 0x17u:
p_endptr = a1 + 296;
a6 = &multistate_flag;
goto LABEL_61;
case 0x18u:
p_endptr = a1 + 298;
a6 = &multistate_flag;
goto LABEL_61;
case 0x19u:
p_endptr = a1 + 338;
a6 = &multistate_flag;
goto LABEL_61;
case 0x1Au:
p_endptr = a1 + 299;
a6 = &multistate_flag;
goto LABEL_61;
case 0x1Bu:
v164 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v164;
v10 = (unsigned long)v164;
if ( !v164 || !*v164 )
goto LABEL_573;
HIDWORD(s2) = 0;
endptr = 0LL;
if ( !strcmp(v164, "yes") )
{
HIDWORD(s2) = 1;
}
else if ( strcmp((const char *)v10, "no") )
{
HIDWORD(s2) = 1;
endptr = (char *)xstrdup(v10);
}
if ( *(_DWORD *)p_s2 && a1[339] == -1 )
{
a1[339] = HIDWORD(s2);
v165 = endptr;
endptr = 0LL;
*((_QWORD *)a1 + 170) = v165;
}
free(endptr);
goto LABEL_29;
case 0x1Cu:
p_endptr = a1 + 343;
a6 = &multistate_tcpfwd;
goto LABEL_61;
case 0x1Du:
p_endptr = a1 + 342;
a6 = &multistate_compression;
goto LABEL_61;
case 0x1Eu:
v261[0] = (long)&v275;
v166 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v166;
v10 = (unsigned long)v166;
if ( !v166 || !*v166 )
goto LABEL_517;
if ( !strcmp(v166, "default") )
{
v273 = 0LL;
goto LABEL_369;
}
if ( (unsigned int)scan_scaled(v10, &v273) != -1 )
{
if ( v273 && v273 <= 15 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1692LL,
0LL,
1LL,
0LL,
"%.200s line %d: %s too small",
a3,
HIDWORD(v250),
v15);
LABEL_463:
if ( (int)a1[1908] <= (int)a1[1910] && a1[1909] - 1 <= 0x63 )
goto LABEL_29;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1914LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s spec.",
a3,
HIDWORD(v250),
v15);
LABEL_466:
if ( (unsigned int)v266 <= 0x80 && HIDWORD(s2) <= 0x20 )
{
LABEL_468:
if ( *(_DWORD *)p_s2 )
{
a1[1912] = HIDWORD(s2);
a1[1913] = (unsigned int)v266;
}
goto LABEL_29;
}
LABEL_258:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1938LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s spec.",
a3,
HIDWORD(v250),
v15);
LABEL_259:
v120 = (char *)argv_next((char *)&v262 + 4, &ptr, v23, v17, v20);
s2 = v120;
v121 = v120;
if ( !v120 || !*v120 )
{
while ( 1 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1949LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v243,
HIDWORD(v242),
v15);
LABEL_502:
v192 = "<NONE>";
LABEL_500:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1858LL,
0LL,
1LL,
0LL,
"%s line %d: Bad SSH2 KexAlgorithms '%s'.",
v247,
v246,
v192);
}
}
if ( !strcmp(v120, "none") )
{
HIDWORD(v261[0]) = 0x7FFFFFFF;
}
else
{
v191 = (const char *)atoi_err(v121, (char *)v261 + 4);
if ( v191 )
{
v48 = "servconf.c";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1955LL,
0LL,
1LL,
0LL,
"%s line %d: %s integer value %s.",
v247,
v246,
v15,
v191);
LABEL_497:
derelativise_path(v48);
LABEL_84:
*((_QWORD *)v9 + 983) = v49;
LABEL_29:
if ( SHIDWORD(v232) > 0 )
{
v219 = v15;
v26 = 2467LL;
v218 = v220;
v217 = v221;
v216 = "%.200s line %d: keyword %s extra arguments at end of line";
LABEL_31:
LODWORD(v19) = -1;
sshlog("servconf.c", "process_server_config_line_depth", v26, 0LL, 2LL, 0LL, v216, v217, v218, v219);
}
goto LABEL_16;
}
}
if ( *(_DWORD *)p_s2 )
a1[1911] = HIDWORD(v261[0]);
goto LABEL_29;
}
LABEL_369:
if ( *(_DWORD *)p_s2 && *((_QWORD *)a1 + 976) == -1LL )
*((_QWORD *)a1 + 976) = v273;
if ( !v268 )
goto LABEL_16;
v43 = a1 + 1954;
if ( !strcmp(*v275, "none") )
{
argv_next(&v268, v261[0], v23, v17, v20);
goto LABEL_29;
}
LABEL_247:
v117 = (const char *)argv_next(&v268, v261[0], v23, v17, v20);
LABEL_248:
v270 = (char *)v117;
if ( v117 && *v117 )
{
v45 = convtime(v117);
HIDWORD(s2) = v45;
if ( v45 != -1 )
{
if ( !*(_DWORD *)p_s2 || *v43 != -1 )
goto LABEL_29;
goto LABEL_77;
}
LABEL_512:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1369LL,
0LL,
1LL,
0LL,
"%s line %d: invalid time value.",
v247,
v246);
}
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1366LL,
0LL,
1LL,
0LL,
"%s line %d: missing time value.",
v243,
HIDWORD(v242));
LABEL_514:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2258LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
HIDWORD(v250),
v15);
LABEL_515:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2002LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v247,
v246,
v15);
LABEL_516:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1389LL,
0LL,
1LL,
0LL,
"%s line %d: bad address:port usage",
v243,
HIDWORD(v242));
LABEL_517:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1682LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v239,
v238,
v15);
goto LABEL_518;
}
goto LABEL_551;
case 0x1Fu:
v161 = a1 + 348;
v162 = a1 + 347;
goto LABEL_346;
case 0x20u:
v161 = a1 + 352;
v162 = a1 + 350;
LABEL_346:
while ( 2 )
{
v163 = (const char *)argv_next(&v268, &v275, v23, v17, v20);
v270 = (char *)v163;
if ( !v163 )
goto LABEL_29;
if ( *v163 && (unsigned int)match_user(0LL, 0LL, 0LL, v163) != -1 )
{
if ( *(_DWORD *)p_s2 )
opt_array_append(a3, HIDWORD(v250), v15, v161, v162, v270);
continue;
}
goto LABEL_549;
}
case 0x21u:
v158 = a1 + 356;
v159 = a1 + 354;
goto LABEL_341;
case 0x22u:
v158 = a1 + 360;
v159 = a1 + 358;
LABEL_341:
while ( 2 )
{
v160 = (const char *)argv_next(&v268, &v275, v23, v17, v20);
v270 = (char *)v160;
if ( !v160 )
goto LABEL_29;
if ( *v160 )
{
if ( *(_DWORD *)p_s2 )
opt_array_append(a3, HIDWORD(v250), v15, v158, v159, v160);
continue;
}
goto LABEL_548;
}
case 0x23u:
p_endptr = a1 + 287;
a6 = &multistate_flag;
goto LABEL_61;
case 0x24u:
v131 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v131;
v132 = v131;
if ( !v131 )
goto LABEL_546;
v133 = *v131;
if ( !v133 )
goto LABEL_546;
if ( v133 != 45 )
{
if ( v133 == 43 || v133 == 94 )
++v132;
if ( !(unsigned int)ciphers_valid(v132) )
goto LABEL_528;
}
if ( !*((_QWORD *)v9 + 151) )
*((_QWORD *)v9 + 151) = xstrdup(v270);
goto LABEL_29;
case 0x25u:
v128 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v128;
v129 = v128;
if ( !v128 )
goto LABEL_570;
v130 = *v128;
if ( !v130 )
goto LABEL_570;
if ( v130 != 45 )
{
if ( v130 == 43 || v130 == 94 )
++v129;
if ( !(unsigned int)mac_valid(v129) )
{
v194 = v270;
if ( !v270 )
goto LABEL_531;
while ( 1 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1844LL,
0LL,
1LL,
0LL,
"%s line %d: Bad SSH2 mac spec '%s'.",
a3,
HIDWORD(v250),
v194);
LABEL_528:
v195 = s2;
if ( !s2 )
v195 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1831LL,
0LL,
1LL,
0LL,
"%s line %d: Bad SSH2 cipher spec '%s'.",
v247,
v246,
v195);
LABEL_531:
v194 = "<NONE>";
}
}
}
if ( !*((_QWORD *)v9 + 152) )
*((_QWORD *)v9 + 152) = xstrdup(v270);
goto LABEL_29;
case 0x26u:
v9 = (char *)(a1 + 280);
goto LABEL_145;
case 0x27u:
v9 = (char *)(a1 + 282);
goto LABEL_145;
case 0x28u:
p_endptr = a1 + 308;
a6 = &multistate_gatewayports;
goto LABEL_61;
case 0x29u:
p_endptr = a1 + 324;
a6 = &multistate_flag;
goto LABEL_61;
case 0x2Au:
v113 = a1 + 326;
goto LABEL_236;
case 0x2Bu:
v9 = (char *)(a1 + 294);
goto LABEL_145;
case 0x2Cu:
if ( a1[362] > 0xFF )
goto LABEL_538;
v261[0] = (long)&v275;
v139 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v139;
v10 = (unsigned long)v139;
if ( !v139 || !*v139 )
goto LABEL_537;
if ( !*(_DWORD *)p_s2 )
{
v270 = (char *)argv_next(&v268, v261[0], v140, v141, v142);
goto LABEL_29;
}
v143 = a1[362];
if ( (_DWORD)v143 )
{
v144 = a1 + 364;
while ( strcmp((const char *)v10, *(const char **)v144) )
{
v144 += 2;
if ( &a1[2 * (unsigned int)(v143 - 1) + 366] == v144 )
goto LABEL_328;
}
LABEL_521:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1879LL,
0LL,
1LL,
0LL,
"%s line %d: Subsystem '%s' already defined.",
v223,
HIDWORD(v222),
(const char *)v10);
LABEL_522:
v193 = v232;
if ( !v232 )
goto LABEL_525;
while ( 1 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1732LL,
0LL,
1LL,
0LL,
"%.200s line %d: unsupported log level '%s'",
v219,
HIDWORD(v218),
v193);
LABEL_524:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1395LL,
0LL,
1LL,
0LL,
"%s line %d: bad port number",
v215,
v214);
LABEL_525:
v193 = "<NONE>";
}
}
LABEL_328:
v145 = v261[0];
*(_QWORD *)&a1[2 * v143 + 364] = xstrdup(v10);
v149 = (const char *)argv_next(&v268, v145, v146, v147, v148);
v270 = (char *)v149;
if ( v149 && *v149 )
{
v150 = a1[362];
v151 = xstrdup(v149);
v152 = v270;
*(_QWORD *)&v9[8 * v150 + 3504] = v151;
endptr = (char *)xstrdup(v152);
for ( j = strlen(endptr) + 1; ; strlcat(endptr, v270, j) )
{
v270 = (char *)argv_next(&v268, v261[0], v153, v154, v156);
if ( !v270 )
break;
j += strlen(v270) + 1;
endptr = (char *)xreallocarray(endptr, 1LL, j);
strlcat(endptr, " ", j);
}
v157 = *((_DWORD *)v9 + 362);
*(_QWORD *)&v9[8 * v157 + 5552] = endptr;
*((_DWORD *)v9 + 362) = v157 + 1;
goto LABEL_29;
}
goto LABEL_552;
case 0x2Du:
v137 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v137;
if ( !v137 || !*v137 )
goto LABEL_550;
v138 = _isoc99_sscanf(v137, "%d:%d:%d", a1 + 1908, a1 + 1909, a1 + 1910);
if ( v138 == 3 )
goto LABEL_463;
if ( v138 != 1 )
goto LABEL_520;
a1[1910] = a1[1908];
goto LABEL_29;
case 0x2Eu:
v43 = a1 + 1914;
goto LABEL_73;
case 0x2Fu:
v43 = a1 + 1915;
goto LABEL_73;
case 0x30u:
v9 = (char *)(a1 + 1916);
goto LABEL_145;
case 0x31u:
p_endptr = a1 + 1918;
a6 = &multistate_flag;
goto LABEL_61;
case 0x32u:
p_endptr = a1 + 316;
a6 = &multistate_flag;
goto LABEL_61;
case 0x33u:
p_endptr = a1 + 317;
a6 = &multistate_flag;
goto LABEL_61;
case 0x34u:
v113 = a1 + 318;
goto LABEL_236;
case 0x35u:
v113 = a1 + 320;
goto LABEL_236;
case 0x36u:
goto LABEL_259;
case 0x37u:
v118 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v118;
if ( !v118 || !*v118 )
goto LABEL_533;
v119 = _isoc99_sscanf(v118, "%d:%d", (char *)&s2 + 4, &v266);
if ( v119 == 1 )
{
if ( HIDWORD(s2) <= 0x20 )
goto LABEL_468;
}
else if ( v119 == 2 )
{
goto LABEL_466;
}
goto LABEL_258;
case 0x38u:
v43 = a1 + 1919;
v261[0] = (long)&v275;
goto LABEL_247;
case 0x39u:
v43 = a1 + 1920;
goto LABEL_73;
case 0x3Au:
v92 = a1[1921];
v261[0] = (long)&v275;
v93 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
while ( 2 )
{
v270 = (char *)v93;
if ( !v93 )
goto LABEL_29;
if ( *v93 )
{
v97 = getuid();
v98 = (void *)tilde_expand_filename(v270, v97);
v99 = *(_DWORD *)p_s2;
ptr = v98;
v100 = v98;
if ( v99 && !v92 )
{
opt_array_append(a3, HIDWORD(v250), v15, v9 + 7688, v9 + 7684, v98);
v100 = ptr;
}
free(v100);
v93 = (const char *)argv_next(&v268, v261[0], v94, v95, v96);
continue;
}
break;
}
v26 = 1984LL;
goto LABEL_31;
case 0x3Bu:
p_endptr = a1 + 333;
a6 = &multistate_flag;
goto LABEL_61;
case 0x3Cu:
p_endptr = a1 + 334;
a6 = &multistate_flag;
goto LABEL_61;
case 0x3Du:
p_endptr = a1 + 335;
a6 = &multistate_flag;
goto LABEL_61;
case 0x3Eu:
v261[0] = (long)&v275;
while ( 2 )
{
v60 = (const char *)argv_next(&v268, v261[0], v23, v17, v20);
v270 = (char *)v60;
v61 = v60;
if ( !v60 )
goto LABEL_29;
if ( *v60 && !strchr(v60, 61) )
{
if ( *(_DWORD *)p_s2 )
opt_array_append(a3, HIDWORD(v250), v15, a1 + 1902, a1 + 1900, v61);
continue;
}
goto LABEL_547;
}
case 0x3Fu:
goto LABEL_107;
case 0x40u:
v55 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v55;
v56 = v55;
if ( !v55 || !*v55 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2056LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
HIDWORD(v250),
v15);
goto LABEL_581;
}
HIDWORD(s2) = -1;
v57 = strcmp("no", v55);
if ( !v57 )
{
HIDWORD(s2) = 0;
goto LABEL_507;
}
if ( !strcmp("point-to-point", v56) )
{
v57 = 1;
goto LABEL_507;
}
if ( !strcmp("ethernet", v56) )
goto LABEL_577;
if ( !strcmp("yes", v56) )
goto LABEL_506;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2065LL,
0LL,
1LL,
0LL,
"%s line %d: bad %s argument %s",
a3,
HIDWORD(v250),
v15,
v56);
LABEL_107:
v10 = a1[1904];
while ( 1 )
{
v58 = (const char *)argv_next((char *)v261 + 4, &s, v23, v17, v20);
v262 = v58;
v59 = v58;
if ( !v58 )
goto LABEL_29;
if ( !*v58 || !strchr(v58, 61) )
goto LABEL_574;
if ( *(_DWORD *)p_s2 && !(_DWORD)v10 )
{
if ( lookup_setenv_in_list(v59, *((_QWORD *)a1 + 953), a1[1904]) )
sshlog(
"servconf.c",
"process_server_config_line_depth",
2043LL,
0LL,
6LL,
0LL,
"%s line %d: ignoring duplicate env name \"%.64s\"",
v245,
HIDWORD(v244),
v262);
else
opt_array_append(v245, HIDWORD(v244), v15, a1 + 1906, a1 + 1904, v262);
}
}
case 0x41u:
v10 = (unsigned int)s2;
if ( (_DWORD)s2 )
goto LABEL_576;
v52 = 0LL;
if ( (*a7 & 4) == 0 )
v52 = (const char **)a6;
matched = (unsigned int)match_cfg_line((const char **)&s, HIDWORD(v250), v52);
HIDWORD(s2) = matched;
if ( matched < 0 )
goto LABEL_575;
if ( (*a7 & 4) == 0 )
LODWORD(v10) = matched;
v54 = s;
*(_DWORD *)p_s2 = v10;
*(_DWORD *)a7 &= ~8u;
if ( v54 && *v54 )
goto LABEL_29;
goto LABEL_28;
case 0x42u:
case 0x43u:
v27 = a1 + 1930;
v28 = a1 + 1928;
if ( v263 == 67 )
{
v27 = a1 + 1934;
v28 = a1 + 1932;
}
v261[0] = (long)&v275;
v29 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v29;
v9 = (char *)v29;
if ( !v29 || !*v29 )
goto LABEL_582;
v253 = *v27;
if ( !strcmp(v29, "any") || !strcmp(v9, "none") )
{
if ( *(_DWORD *)p_s2 && !v253 )
{
*v27 = 1;
v181 = (_QWORD *)xcalloc(1LL, 8LL);
v182 = v270;
*(_QWORD *)v28 = v181;
*v181 = xstrdup(v182);
}
goto LABEL_29;
}
while ( 1 )
{
if ( v263 == 67 && !strchr(v9, 58) )
{
xasprintf(&ptr, "*:%s", v9);
}
else
{
ptr = (void *)xstrdup(v9);
endptr = (char *)hpdelim(&v270);
if ( !endptr )
goto LABEL_584;
endptr = (char *)cleanhostname(endptr);
}
if ( !v270 || (int)permitopen_port() < 0 )
goto LABEL_583;
v34 = ptr;
if ( *(_DWORD *)p_s2 && !v253 )
{
opt_array_append(a3, HIDWORD(v250), v15, v28, v27, ptr);
v34 = ptr;
}
free(v34);
v33 = (const char *)argv_next(&v268, v261[0], v30, v31, v32);
v270 = (char *)v33;
v9 = (char *)v33;
if ( !v33 || !*v33 )
goto LABEL_29;
}
case 0x44u:
v35 = s;
if ( !s || !*s )
goto LABEL_534;
if ( (_DWORD)v20 && !*((_QWORD *)a1 + 962) )
{
v36 = strspn(s, " \t\r\n");
*((_QWORD *)a1 + 962) = xstrdup(&v35[v36]);
}
goto LABEL_28;
case 0x45u:
v101 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v101;
if ( !v101 || !*v101 )
goto LABEL_514;
if ( *(_DWORD *)p_s2 && !*((_QWORD *)a1 + 968) )
*((_QWORD *)a1 + 968) = xstrdup(v101);
goto LABEL_29;
case 0x47u:
p_endptr = a1 + 345;
a6 = &multistate_flag;
goto LABEL_61;
case 0x48u:
v91 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v91;
if ( !v91 || !*v91 )
goto LABEL_572;
if ( *(_DWORD *)p_s2 )
servconf_add_hostcert((long)a3, HIDWORD(v250), (long)a1, v91);
goto LABEL_29;
case 0x49u:
v10 = (unsigned int)s2;
if ( (_DWORD)s2 )
goto LABEL_556;
s2 = 0LL;
v262 = v15;
v40 = (char **)a7;
v259 = &v268;
v261[0] = (long)&v275;
v264 = v19;
goto LABEL_153;
case 0x4Au:
v9 = (char *)(a1 + 1938);
goto LABEL_145;
case 0x4Bu:
v9 = (char *)(a1 + 1940);
LABEL_145:
v74 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v74;
if ( !v74 || !*v74 )
goto LABEL_563;
if ( *(_DWORD *)p_s2 && !*(_QWORD *)v9 )
{
derelativise_path(v74);
*(_QWORD *)v9 = v75;
}
goto LABEL_29;
case 0x4Cu:
v126 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v126;
if ( !v126 || !*v126 )
goto LABEL_515;
if ( *(_DWORD *)p_s2 && !*((_QWORD *)a1 + 973) )
{
v127 = getuid();
*((_QWORD *)a1 + 973) = tilde_expand_filename(v270, v127);
}
goto LABEL_29;
case 0x4Du:
p_s2 = (long)(a1 + 1948);
goto LABEL_123;
case 0x4Eu:
v111 = a1 + 1950;
goto LABEL_230;
case 0x4Fu:
v102 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v102;
v103 = v102;
if ( !v102 )
goto LABEL_571;
v104 = *v102;
if ( !v104 )
goto LABEL_571;
if ( v104 != 45 )
{
if ( v104 == 43 || v104 == 94 )
++v103;
if ( !(unsigned int)kex_names_valid(v103) )
goto LABEL_499;
}
if ( !*((_QWORD *)v9 + 153) )
*((_QWORD *)v9 + 153) = xstrdup(v270);
goto LABEL_29;
case 0x50u:
v113 = a1 + 322;
LABEL_236:
v114 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v114;
v115 = v114;
if ( !v114 || (v116 = *v114) == 0 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1514LL,
0LL,
1LL,
0LL,
"%s line %d: Missing argument.",
a3,
HIDWORD(v250));
LABEL_533:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1926LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v247,
v246,
v15);
LABEL_534:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2245LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
HIDWORD(v250),
v15);
LABEL_535:
v196 = s2;
if ( !s2 )
goto LABEL_539;
while ( 1 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1721LL,
0LL,
1LL,
0LL,
"%.200s line %d: unsupported log facility '%s'",
v247,
v246,
v196);
LABEL_537:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1871LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v243,
HIDWORD(v242),
v15);
LABEL_538:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1866LL,
0LL,
1LL,
0LL,
"%s line %d: too many subsystems defined.",
v239,
v238);
LABEL_539:
v196 = "<NONE>";
}
}
if ( v116 != 45 )
{
if ( v116 == 43 || v116 == 94 )
++v115;
if ( !(unsigned int)sshkey_names_valid2(v115, 1LL) )
goto LABEL_559;
}
if ( *(_DWORD *)p_s2 && !*(_QWORD *)v113 )
*(_QWORD *)v113 = xstrdup(v270);
goto LABEL_29;
case 0x51u:
v70 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v70;
if ( !v70 || !*v70 )
goto LABEL_543;
HIDWORD(s2) = parse_ipqos(v70);
if ( HIDWORD(s2) == -1 )
goto LABEL_542;
v270 = (char *)argv_next(&v268, &v275, v71, v72, v73);
if ( v270 )
{
LODWORD(v266) = parse_ipqos(v270);
if ( (_DWORD)v266 == -1 )
{
LABEL_541:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2299LL,
0LL,
1LL,
0LL,
"%s line %d: Bad %s value: %s",
v245,
HIDWORD(v244),
v15,
v262);
LABEL_542:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2293LL,
0LL,
1LL,
0LL,
"%s line %d: Bad %s value: %s",
v239,
v238,
v15,
(const char *)a6);
LABEL_543:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2290LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v233,
HIDWORD(v232),
v15);
LABEL_544:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1353LL,
0LL,
1LL,
0LL,
"%s line %d: missing port number.",
v229,
v228);
LABEL_545:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1349LL,
0LL,
1LL,
0LL,
"%s line %d: too many ports.",
v225,
v224);
LABEL_546:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1827LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v221,
v220,
v15);
LABEL_547:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2023LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid environment name.",
v217,
HIDWORD(v216));
LABEL_548:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1810LL,
0LL,
1LL,
0LL,
"%s line %d: empty %s pattern",
v213,
HIDWORD(v212),
v15);
LABEL_549:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1790LL,
0LL,
1LL,
0LL,
"%s line %d: invalid %s pattern: \"%s\"",
v211,
v210,
v15,
v222);
LABEL_550:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1904LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v209,
v208,
v15);
LABEL_551:
v197 = _errno_location();
v198 = strerror(*v197);
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1688LL,
0LL,
1LL,
0LL,
"%.200s line %d: Bad %s number '%s': %s",
v207,
v206,
v15,
v212,
v198);
LABEL_552:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1884LL,
0LL,
1LL,
0LL,
"%s line %d: Missing subsystem command.",
v205,
v204);
LABEL_553:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1419LL,
0LL,
1LL,
0LL,
"%s line %d: missing argument.",
a3,
HIDWORD(v250));
LABEL_554:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2418LL,
0LL,
1LL,
0LL,
"%.200s line %d: Invalid %s algorithm \"%s\".",
v247,
v246,
v15,
s2);
LABEL_555:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2415LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v241,
v240,
v15);
LABEL_556:
v235 = v18;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2073LL,
0LL,
1LL,
0LL,
"Include directive not supported as a command-line option");
LABEL_557:
v15 = v236;
LABEL_558:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2369LL,
0LL,
1LL,
0LL,
"%s line %d: \"any\" must appear alone in %s",
v235,
HIDWORD(v234),
v15);
LABEL_559:
v199 = v244;
if ( !v244 )
goto LABEL_561;
while ( 1 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1519LL,
0LL,
1LL,
0LL,
"%s line %d: Bad key types '%s'.",
v231,
v230,
v199);
LABEL_561:
v199 = "<NONE>";
}
}
}
else
{
LODWORD(v266) = HIDWORD(s2);
}
if ( *(_DWORD *)p_s2 )
{
a1[300] = HIDWORD(s2);
a1[301] = (unsigned int)v266;
}
goto LABEL_29;
case 0x52u:
if ( !s || !*s )
goto LABEL_565;
v255 = s;
v67 = strspn(s, " \t\r\n");
if ( strchr(&v255[v67], 13) )
goto LABEL_564;
v68 = strchr(a2, 35);
v270 = v68;
if ( v68 )
{
*v68 = 0;
rtrim(a2);
}
if ( *(_DWORD *)p_s2 && !*((_QWORD *)a1 + 978) )
{
v69 = &s[v67];
if ( !strcasecmp(v69, "none") )
*((_QWORD *)a1 + 978) = xstrdup(&LC27);
else
*((_QWORD *)a1 + 978) = xstrdup(v69);
}
goto LABEL_28;
case 0x53u:
p_s2 = (long)(a1 + 1942);
LABEL_123:
v62 = s;
v254 = v20;
v63 = strspn(s, " \t\r\n");
v64 = v254;
v65 = &v62[v63];
if ( *v65 != 47 )
{
v66 = strcasecmp(v65, "none");
v64 = v254;
if ( v66 )
goto LABEL_505;
}
if ( v64 && !*((_QWORD *)a1 + 971) )
*(_QWORD *)p_s2 = xstrdup(v65);
goto LABEL_28;
case 0x54u:
v111 = a1 + 1944;
LABEL_230:
v112 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v112;
if ( v112 && *v112 )
{
if ( *(_DWORD *)p_s2 && !*(_QWORD *)v111 )
*(_QWORD *)v111 = xstrdup(v112);
goto LABEL_29;
}
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2347LL,
0LL,
1LL,
0LL,
"%s line %d: missing %s argument.",
a3,
HIDWORD(v250),
v15);
goto LABEL_512;
case 0x55u:
v107 = a1[1958];
HIDWORD(s2) = 0;
LODWORD(v266) = 0;
if ( v107 )
{
v256 = v15;
v10 = (unsigned long)&v268;
p_s2 = (long)"any";
while ( 1 )
{
v189 = (const char *)argv_next(&v268, &v275, v23, v17, v20);
v270 = (char *)v189;
v190 = v189;
if ( !v189 )
break;
if ( !strcmp(v189, "any") )
{
if ( a1[1958] )
goto LABEL_557;
HIDWORD(s2) = 1;
}
else
{
if ( HIDWORD(s2) )
goto LABEL_566;
if ( (unsigned int)auth2_methods_valid(v190, 0LL) )
{
v15 = v256;
LABEL_486:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2378LL,
0LL,
1LL,
0LL,
"%s line %d: invalid %s method list.",
a3,
HIDWORD(v250),
v15);
}
}
LODWORD(v266) = 1;
}
v15 = v256;
}
else
{
v10 = (unsigned long)(a1 + 1958);
v261[0] = (long)&v275;
while ( 1 )
{
v108 = (const char *)argv_next(&v268, v261[0], v23, v17, v20);
v270 = (char *)v108;
v109 = v108;
if ( !v108 )
break;
if ( !strcmp(v108, "any") )
{
if ( a1[1958] )
goto LABEL_558;
HIDWORD(s2) = 1;
}
else
{
if ( HIDWORD(s2) )
goto LABEL_567;
if ( (unsigned int)auth2_methods_valid(v109, 0LL) )
goto LABEL_486;
}
v110 = *(_DWORD *)p_s2;
LODWORD(v266) = 1;
if ( v110 )
opt_array_append(a3, HIDWORD(v250), v15, a1 + 1960, a1 + 1958, v270);
}
}
if ( (_DWORD)v266 )
goto LABEL_29;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2389LL,
0LL,
1LL,
0LL,
"%s line %d: no %s specified",
a3,
HIDWORD(v250),
v15);
goto LABEL_439;
case 0x56u:
v122 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v122;
v123 = v122;
if ( !v122 || !*v122 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1450LL,
0LL,
1LL,
0LL,
"%s line %d: missing socket name.",
a3,
HIDWORD(v250));
return process_server_config_line(
(unsigned int *)"servconf.c",
"process_server_config_line_depth",
v200,
v201,
v202,
v203,
a7);
}
if ( !*(_DWORD *)p_s2 || *((_QWORD *)a1 + 139) )
goto LABEL_29;
v124 = v122;
if ( strcmp(v122, "SSH_AUTH_SOCK") )
goto LABEL_587;
v125 = xstrdup(v123);
goto LABEL_271;
case 0x57u:
p_endptr = a1 + 297;
a6 = &multistate_flag;
goto LABEL_61;
case 0x58u:
v105 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v105;
if ( !v105 || !*v105 )
goto LABEL_504;
v106 = strtol(v105, &endptr, 8);
HIDWORD(s2) = v106;
if ( v270 != endptr && v106 <= 0x1FF )
{
if ( *(_DWORD *)p_s2 )
a1[309] = v106;
goto LABEL_29;
}
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2402LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s.",
a3,
HIDWORD(v250),
v15);
LABEL_504:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2397LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v247,
v246,
v15);
LABEL_505:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2334LL,
0LL,
1LL,
0LL,
"%.200s line %d: %s must be an absolute path",
a3,
HIDWORD(v250),
v15);
LABEL_506:
v57 = 3;
goto LABEL_507;
case 0x59u:
p_endptr = a1 + 310;
a6 = &multistate_flag;
goto LABEL_61;
case 0x5Au:
p_endptr = a1 + 344;
a6 = &multistate_tcpfwd;
goto LABEL_61;
case 0x5Bu:
v50 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v50;
if ( !v50 || !*v50 )
goto LABEL_555;
v51 = ssh_digest_alg_by_name(v50);
HIDWORD(s2) = v51;
if ( v51 == -1 )
goto LABEL_554;
if ( *(_DWORD *)p_s2 )
a1[1962] = v51;
goto LABEL_29;
case 0x5Cu:
p_endptr = a1 + 346;
a6 = &multistate_flag;
goto LABEL_61;
case 0x5Du:
p_endptr = a1 + 1963;
a6 = &multistate_flag;
LABEL_61:
v39 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v39;
v9 = (char *)v39;
if ( !v39 || !*v39 )
goto LABEL_553;
v10 = (unsigned long)a6;
HIDWORD(s2) = -1;
v40 = 0LL;
v41 = *a6;
if ( !*a6 )
goto LABEL_424;
v258 = (const char *)p_s2;
LODWORD(p_s2) = 0;
v40 = a6;
while ( strcasecmp(v9, v41) )
{
p_s2 = (unsigned int)(p_s2 + 1);
v10 = (unsigned long)&a6[2 * p_s2];
v41 = *(const char **)v10;
if ( !*(_QWORD *)v10 )
goto LABEL_424;
}
v42 = *(_DWORD *)(v10 + 8);
p_s2 = (long)v258;
HIDWORD(s2) = v42;
if ( v42 != -1 )
{
if ( *(_DWORD *)v258 && *p_endptr == -1 )
*p_endptr = v42;
goto LABEL_29;
}
LABEL_424:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1429LL,
0LL,
1LL,
0LL,
"%s line %d: unsupported option \"%s\".",
a3,
HIDWORD(v250),
v9);
LABEL_425:
while ( 2 )
{
ssh__compat_globfree(p_endptr);
free(s2);
while ( 1 )
{
LABEL_153:
v76 = (const char *)argv_next(a3, a6, v23, v17, v20);
v266 = v76;
v77 = v76;
if ( !v76 )
{
v15 = (char *)v258;
LODWORD(v19) = HIDWORD(v259);
if ( HIDWORD(v261[0]) )
goto LABEL_29;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2162LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing filename argument",
v247,
v246,
v258);
LABEL_489:
v26 = 2079LL;
goto LABEL_31;
}
if ( !*v76 )
goto LABEL_489;
++HIDWORD(v261[0]);
v78 = *v76;
if ( v78 == 47 || v78 == 126 )
{
s2 = (char *)xstrdup(v77);
v79 = s2;
}
else
{
xasprintf(&s2, "%s/%s", "/usr/local/etc", v77);
v79 = s2;
}
v19 = *v249;
v260 = *(_DWORD *)p_s2;
if ( !*v249 )
break;
v15 = 0LL;
v10 = (unsigned long)v79;
if ( *(_DWORD *)p_s2 )
{
do
{
if ( !strcmp(*(const char **)v19, (const char *)v10) )
{
if ( *(_QWORD *)(v19 + 8) )
{
v90 = 8;
if ( (*(_DWORD *)v40 & 8) == 0 )
v90 = 0;
parse_server_config_depth(
(unsigned int *)v9,
*(const char **)(v19 + 8),
*(_QWORD *)(v19 + 16),
(const char *)v249,
v248,
v90,
p_s2,
v278 + 1);
v10 = (unsigned long)s2;
}
v15 = (_BYTE *)(lookup_opcode_name + 1);
*(_DWORD *)p_s2 = v260;
}
v19 = *(_QWORD *)(v19 + 24);
}
while ( v19 );
}
else
{
do
{
if ( !strcmp(*(const char **)v19, (const char *)v10) )
{
if ( *(_QWORD *)(v19 + 8) )
{
parse_server_config_depth(
(unsigned int *)v9,
*(const char **)(v19 + 8),
*(_QWORD *)(v19 + 16),
(const char *)v249,
v248,
(*(_DWORD *)v40 & 8) == 0 ? 4 : 8,
p_s2,
v278 + 1);
v10 = (unsigned long)s2;
}
*(_DWORD *)p_s2 = 0;
v15 = (_BYTE *)(lookup_opcode_name + 1);
}
v19 = *(_QWORD *)(v19 + 24);
}
while ( v19 );
}
v79 = (char *)v10;
if ( !(_DWORD)v15 )
break;
free((void *)v10);
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
2118LL,
0LL,
6LL,
0LL,
"%s line %d: new include %s",
v247,
v246,
v79);
v80 = 0LL;
p_endptr = (unsigned int *)&endptr;
v81 = ssh__compat_glob(s2, 0LL, 0LL, &endptr);
if ( !v81 )
goto LABEL_169;
v82 = s2;
if ( v81 != -3 )
{
LABEL_581:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2122LL,
0LL,
1LL,
0LL,
"%s line %d: include \"%s\" glob failed",
v247,
v246,
v82);
LABEL_582:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2201LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
HIDWORD(v250),
v15);
LABEL_583:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2232LL,
0LL,
1LL,
0LL,
"%s line %d: %s bad port number",
a3,
HIDWORD(v250),
v15);
LABEL_584:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2225LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing host",
v247,
v246,
v15);
LABEL_585:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1378LL,
0LL,
1LL,
0LL,
"%s line %d: missing address",
v243,
HIDWORD(v242));
LABEL_586:
v124 = "servconf.c";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1438LL,
0LL,
1LL,
0LL,
"%s line %d: missing file name.",
v239,
v238);
LABEL_587:
derelativise_path(v124);
LABEL_271:
*((_QWORD *)v9 + 139) = v125;
goto LABEL_29;
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
2129LL,
0LL,
6LL,
0LL,
"%s line %d: no match for %s",
v247,
v246,
s2);
v80 = (_BYTE *)&loc_28;
v83 = (char **)xcalloc(1LL, 40LL);
v84 = strdup(s2);
v83[3] = 0LL;
*v83 = v84;
v85 = (char *)v249[1];
v83[4] = v85;
*(_QWORD *)v85 = v83;
v15 = (char *)(v83 + 3);
v249[1] = (long)v15;
LABEL_169:
if ( (unsigned long)endptr < 0x80000000 )
{
v10 = (unsigned long)v249;
v15 = 0LL;
if ( !endptr )
continue;
while ( 1 )
{
v250 = (int)v15;
sshlog(
"servconf.c",
"process_server_config_line_depth",
2139LL,
0LL,
6LL,
0LL,
"%s line %d: including %s",
v247,
v246,
*(const char **)(v276 + 8LL * (int)v15));
v19 = xcalloc(1LL, 40LL);
*(_QWORD *)v19 = strdup(s2);
*(_QWORD *)(v19 + 8) = strdup(*(const char **)(v276 + 8LL * (int)v15));
v88 = sshbuf_new();
*(_QWORD *)(v19 + 16) = v88;
if ( !v88 )
break;
load_server_config(*(char **)(v19 + 8), v88);
v86 = *(_DWORD *)v40 & 8;
if ( v86 )
{
v86 = 8;
}
else if ( !v260 )
{
v86 = 4;
}
parse_server_config_depth(
(unsigned int *)v9,
*(const char **)(v19 + 8),
*(_QWORD *)(v19 + 16),
(const char *)v249,
v248,
v86,
p_s2,
v278 + 1);
*(_DWORD *)p_s2 = v260;
*(_QWORD *)(v19 + 24) = 0LL;
v87 = (long *)v249[1];
*(_QWORD *)(v19 + 32) = v87;
*v87 = v19;
v249[1] = v19 + 24;
v15 = (char *)(unsigned int)((_DWORD)v15 + 1);
if ( (int)v15 >= (int)endptr )
goto LABEL_425;
}
v245 = v89;
sshfatal("servconf.c", "process_server_config_line_depth", 2145LL, 1LL, 1LL, 0LL, "sshbuf_new failed");
LABEL_563:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1471LL,
0LL,
1LL,
0LL,
"%s line %d: missing file name.",
v245,
HIDWORD(v244));
LABEL_564:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2313LL,
0LL,
1LL,
0LL,
"%.200s line %d: Invalid %s argument",
v241,
v240,
v15);
LABEL_565:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2309LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v237,
HIDWORD(v236),
v15);
LABEL_566:
v15 = v234;
LABEL_567:
v80 = "process_server_config_line_depth";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2375LL,
0LL,
1LL,
0LL,
"%s line %d: \"any\" must appear alone in %s",
v233,
HIDWORD(v232),
v15);
}
break;
}
sshfatal("servconf.c", "process_server_config_line_depth", 2137LL, 1LL, 1LL, 0LL, "too many glob results", v80);
goto LABEL_569;
case 0x5Eu:
v249 = v17;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2430LL,
0LL,
1LL,
0LL,
"%s line %d: setting RDomain not supported on this platform.",
a3,
HIDWORD(v250));
goto LABEL_421;
case 0x5Fu:
HIDWORD(s2) = 0;
v261[0] = (long)&v275;
do
{
LABEL_56:
v37 = (const char *)argv_next(&v268, v261[0], v23, v17, v20);
v270 = (char *)v37;
v38 = v37;
if ( !v37 )
{
if ( *(_DWORD *)p_s2 && a1[328] == -1 )
a1[328] = HIDWORD(s2);
goto LABEL_29;
}
}
while ( !strcasecmp(v37, "none") );
if ( !strcasecmp(v38, "touch-required") )
{
HIDWORD(s2) |= 1u;
goto LABEL_56;
}
if ( !strcasecmp(v38, "verify-required") )
{
HIDWORD(s2) |= 2u;
goto LABEL_56;
}
LODWORD(v19) = -1;
sshlog(
"servconf.c",
"process_server_config_line_depth",
1552LL,
0LL,
2LL,
0LL,
"%s line %d: unsupported %s option %s",
a3,
HIDWORD(v250),
v15,
v38);
goto LABEL_16;
case 0x60u:
v46 = (const char *)argv_next(&v268, &v275, v263, v17, v20);
v270 = (char *)v46;
v47 = v46;
if ( !v46 || !*v46 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2276LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
HIDWORD(v250),
v15);
LABEL_499:
v192 = s2;
if ( !s2 )
goto LABEL_502;
goto LABEL_500;
}
if ( !*(_DWORD *)p_s2 || *((_QWORD *)a1 + 983) )
goto LABEL_29;
v48 = v46;
if ( strcasecmp(v46, "internal") )
goto LABEL_497;
v49 = xstrdup(v47);
goto LABEL_84;
case 0x61u:
v43 = a1 + 1968;
LABEL_73:
v270 = (char *)argv_next(&v268, &v275, v263, v17, v20);
v44 = (const char *)atoi_err(v270, (char *)&s2 + 4);
if ( !v44 )
{
if ( !*(_DWORD *)p_s2 || *v43 != -1 )
goto LABEL_29;
v45 = HIDWORD(s2);
LABEL_77:
*v43 = v45;
goto LABEL_29;
}
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1614LL,
0LL,
1LL,
0LL,
"%s line %d: %s integer value %s.",
a3,
HIDWORD(v250),
v15,
v44);
goto LABEL_541;
case 0x62u:
case 0x63u:
case 0x64u:
v24 = "Unsupported";
v25 = 3LL;
if ( v263 != 100 )
{
v24 = "Deprecated";
v25 = 3 * (unsigned int)(v263 == 99) + 3;
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
2453LL,
0LL,
v25,
0LL,
"%s line %d: %s option %s",
a3,
HIDWORD(v250),
v24,
v15);
LABEL_28:
argv_consume(&v268);
goto LABEL_29;
default:
LABEL_421:
v245 = v23;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2462LL,
0LL,
1LL,
0LL,
"%s line %d: Missing handler for opcode %s (%d)",
v247,
v246,
v15,
(unsigned int)v259);
break;
}
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
1322LL,
0LL,
7LL,
0LL,
"%s:%d setting %s %s",
v241,
v240,
v15,
a9);
v20 = *(unsigned int *)p_s2;
if ( (_DWORD)v20 )
goto LABEL_23;
LABEL_14:
if ( (BYTE4(v266) & 2) != 0 )
{
v20 = 0LL;
goto LABEL_23;
}
if ( !a6 )
{
LABEL_569:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1325LL,
0LL,
1LL,
0LL,
"%s line %d: Directive '%s' is not allowed within a Match block",
a3,
HIDWORD(v250),
v15);
LABEL_570:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1840LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v247,
v246,
v15);
LABEL_571:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1853LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v243,
HIDWORD(v242),
v15);
LABEL_572:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1460LL,
0LL,
1LL,
0LL,
"%s line %d: missing file name.",
v239,
v238);
LABEL_573:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1653LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
v235,
HIDWORD(v234),
v15);
LABEL_574:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2037LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid environment.",
v231,
v230);
LABEL_575:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2174LL,
0LL,
1LL,
0LL,
"%s line %d: Bad Match condition",
v227,
v226);
LABEL_576:
v221 = (const char *)v10;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2169LL,
0LL,
1LL,
0LL,
"Match directive not supported as a command-line option");
LABEL_577:
v57 = 2;
LABEL_507:
if ( *(_DWORD *)p_s2 )
{
if ( *((_DWORD *)v9 + 1927) == -1 )
*((_DWORD *)v9 + 1927) = v57;
}
goto LABEL_29;
}
LABEL_16:
argv_free(v274, v267);
return (unsigned int)v19;
}
// 2D56: variable 'v232' is possibly undefined
// 2D71: variable 'v220' is possibly undefined
// 2D79: variable 'v221' is possibly undefined
// 2D94: variable 'v216' is possibly undefined
// 2D94: variable 'v217' is possibly undefined
// 2D94: variable 'v218' is possibly undefined
// 2D94: variable 'v219' is possibly undefined
// 2DDF: variable 'v17' is possibly undefined
// 2E52: variable 'v30' is possibly undefined
// 2E52: variable 'v31' is possibly undefined
// 2E52: variable 'v32' is possibly undefined
// 2FA8: variable 'v23' is possibly undefined
// 2FA8: variable 'v20' is possibly undefined
// 3193: variable 'v49' is possibly undefined
// 3405: variable 'v245' is possibly undefined
// 33EF: variable 'v244' is possibly undefined
// 362A: variable 'v71' is possibly undefined
// 362A: variable 'v72' is possibly undefined
// 362A: variable 'v73' is possibly undefined
// 36C5: variable 'v75' is possibly undefined
// 378B: variable 'v249' is possibly undefined
// 3806: variable 'v248' is possibly undefined
// 3869: variable 'v247' is possibly undefined
// 385A: variable 'v246' is possibly undefined
// 3BC9: variable 'v94' is possibly undefined
// 3BC9: variable 'v95' is possibly undefined
// 3BC9: variable 'v96' is possibly undefined
// 4138: variable 'v125' is possibly undefined
// 4567: variable 'v146' is possibly undefined
// 4567: variable 'v147' is possibly undefined
// 4567: variable 'v148' is possibly undefined
// 4615: variable 'v153' is possibly undefined
// 4615: variable 'v154' is possibly undefined
// 4615: variable 'v156' is possibly undefined
// 4A9E: variable 'v169' is possibly undefined
// 4A9E: variable 'v170' is possibly undefined
// 4A9E: variable 'v171' is possibly undefined
// 4ACE: variable 'v173' is possibly undefined
// 4ACE: variable 'v174' is possibly undefined
// 4ACE: variable 'v175' is possibly undefined
// 4E91: variable 'v259' is possibly undefined
// 4EF2: variable 'v241' is possibly undefined
// 4EE3: variable 'v240' is possibly undefined
// 5021: variable 'v242' is possibly undefined
// 5021: variable 'v243' is possibly undefined
// 512B: variable 'v140' is possibly undefined
// 512B: variable 'v141' is possibly undefined
// 512B: variable 'v142' is possibly undefined
// 518D: variable 'v185' is possibly undefined
// 518D: variable 'v186' is possibly undefined
// 518D: variable 'v187' is possibly undefined
// 58EC: variable 'v239' is possibly undefined
// 58D6: variable 'v238' is possibly undefined
// 5923: variable 'v235' is possibly undefined
// 590D: variable 'v234' is possibly undefined
// 595B: variable 'v231' is possibly undefined
// 5945: variable 'v230' is possibly undefined
// 5992: variable 'v227' is possibly undefined
// 597C: variable 'v226' is possibly undefined
// 59CA: variable 'v223' is possibly undefined
// 59B4: variable 'v222' is possibly undefined
// 5A43: variable 'v215' is possibly undefined
// 5A2D: variable 'v214' is possibly undefined
// 5D31: variable 'v233' is possibly undefined
// 5D69: variable 'v229' is possibly undefined
// 5D53: variable 'v228' is possibly undefined
// 5DA0: variable 'v225' is possibly undefined
// 5D8A: variable 'v224' is possibly undefined
// 5E45: variable 'v213' is possibly undefined
// 5E2F: variable 'v212' is possibly undefined
// 5E81: variable 'v211' is possibly undefined
// 5E72: variable 'v210' is possibly undefined
// 5EB8: variable 'v209' is possibly undefined
// 5EA2: variable 'v208' is possibly undefined
// 5F00: variable 'v207' is possibly undefined
// 5EF1: variable 'v206' is possibly undefined
// 5F38: variable 'v205' is possibly undefined
// 5F22: variable 'v204' is possibly undefined
// 5FF2: variable 'v18' is possibly undefined
// 6016: variable 'v236' is possibly undefined
// 60A3: variable 'v89' is possibly undefined
// 616E: variable 'v237' is possibly undefined
// 641A: variable 'v82' is possibly undefined
// 657F: variable 'v200' is possibly undefined
// 657F: variable 'v201' is possibly undefined
// 657F: variable 'v202' is possibly undefined
// 657F: variable 'v203' is possibly undefined
// 710: using guessed type long valid_rdomain(_QWORD);
// A6C0: using guessed type char *multistate_tcpfwd;
// A720: using guessed type char *multistate_gatewayports;
// A760: using guessed type char *multistate_compression;
// A7A0: using guessed type char *multistate_permitrootlogin;
// A800: using guessed type char *multistate_addressfamily;
// A840: using guessed type char *multistate_ignore_rhosts;
// A880: using guessed type char *multistate_flag;
// C2B0: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C308: using guessed type long xstrdup(_QWORD);
// C310: using guessed type long hpdelim(_QWORD);
// C318: using guessed type long cleanhostname(_QWORD);
// C320: using guessed type long permitopen_port(void);
// C348: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C380: using guessed type long strdelim(_QWORD);
// C3A8: using guessed type long a2port(_QWORD);
// C3E0: using guessed type long xasprintf(_QWORD, const char *, ...);
// C3F8: using guessed type long tilde_expand_filename(_QWORD, _QWORD);
// C430: using guessed type long opt_array_append(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// C4D8: using guessed type long argv_split(_QWORD, _QWORD, _QWORD, _QWORD);
// C4E0: using guessed type long argv_free(_QWORD, _QWORD);
// C4E8: using guessed type long argv_consume(_QWORD);
// C4F0: using guessed type long argv_next(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
// C4F8: using guessed type long atoi_err(_QWORD, _QWORD);
// C500: using guessed type long ssh_digest_alg_by_name(_QWORD);
// C508: using guessed type long lookup_setenv_in_list(_QWORD, _QWORD, _QWORD);
// C510: using guessed type long rtrim(_QWORD);
// C518: using guessed type long parse_ipqos(_QWORD);
// C520: using guessed type long ssh__compat_glob(_QWORD, _QWORD, _QWORD, _QWORD);
// C528: using guessed type long xcalloc(_QWORD, _QWORD);
// C538: using guessed type long sshbuf_new(void);
// C540: using guessed type long kex_names_valid(_QWORD);
// C550: using guessed type long auth2_methods_valid(_QWORD, _QWORD);
// C558: using guessed type long sshkey_names_valid2(_QWORD, _QWORD);
// C560: using guessed type long convtime(_QWORD);
// C568: using guessed type long _isoc99_sscanf(_QWORD, const char *, ...);
// C570: using guessed type long mac_valid(_QWORD);
// C578: using guessed type long ciphers_valid(_QWORD);
// C580: using guessed type long xreallocarray(_QWORD, _QWORD, _QWORD);
// C588: using guessed type long strlcat(_QWORD, _QWORD, _QWORD);
// C590: using guessed type long match_user(_QWORD, _QWORD, _QWORD, _QWORD);
// C598: using guessed type long log_level_number(_QWORD);
// C5A0: using guessed type long log_facility_number(_QWORD);
// C5A8: using guessed type long ssh__compat_globfree(_QWORD);
// C5B0: using guessed type long scan_scaled(_QWORD, _QWORD);
//----- (0000000000006580) ----------------------------------------------------
long process_server_config_line(
unsigned int *a1,
char *a2,
const char *a3,
int a4,
long a5,
char **a6,
const char *a7)
{
int v8; // [rsp+Ch] [rbp-14h] BYREF
unsigned long v9; // [rsp+10h] [rbp-10h]
v9 = __readfsqword(0x28u);
v8 = 0;
return process_server_config_line_depth(a1, a2, a3, a4, a5, a6, (char *)&v8, 0LL, a7);
}
//----- (00000000000065D0) ----------------------------------------------------
long parse_server_config_depth(
unsigned int *a1,
const char *a2,
long a3,
const char *a4,
char **a5,
int a6,
long a7,
unsigned int a8)
{
const char *v9; // rbx
long v10; // rax
long v11; // rcx
int v12; // r12d
char *v13; // r13
char *ptr; // [rsp+20h] [rbp-58h]
unsigned int v18; // [rsp+28h] [rbp-50h]
int v19; // [rsp+2Ch] [rbp-4Ch] BYREF
char *stringp; // [rsp+30h] [rbp-48h] BYREF
unsigned long v21; // [rsp+38h] [rbp-40h]
v19 = a6;
v21 = __readfsqword(0x28u);
if ( a8 > 0x10 )
sshfatal(
"servconf.c",
"parse_server_config_depth",
2694LL,
0LL,
1LL,
0LL,
"Too many recursive configuration includes",
a2);
v9 = " [checking syntax only]";
if ( (v19 & 4) == 0 )
v9 = (const char *)&LC27;
v10 = sshbuf_len(a3);
sshlog("servconf.c", "parse_server_config_depth", 2696LL, 1LL, 6LL, 0LL, "config %s len %zu%s", a2, v10, v9);
ptr = (char *)sshbuf_dup_string(a3);
stringp = ptr;
if ( ptr )
{
v12 = 1;
v18 = 0;
while ( 1 )
{
v13 = strsep(&stringp, "\n");
if ( !v13 )
break;
if ( (unsigned int)process_server_config_line_depth(a1, v13, a2, v12, a7, a5, (char *)&v19, a8, a4) )
++v18;
++v12;
}
free(ptr);
if ( !v18 )
return __readfsqword(0x28u) ^ v21;
sshfatal(
"servconf.c",
"parse_server_config_depth",
2710LL,
0LL,
1LL,
0LL,
"%s: terminating, %d bad configuration options",
a2,
v18);
}
sshfatal("servconf.c", "parse_server_config_depth", 2700LL, 1LL, 1LL, 0LL, "sshbuf_dup_string failed", v11);
return parse_server_match_testspec((long)"servconf.c", "parse_server_config_depth");
}
// 67E6: variable 'v11' is possibly undefined
// C2B0: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C348: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// C4B0: using guessed type long sshbuf_len(_QWORD);
// C5B8: using guessed type long sshbuf_dup_string(_QWORD);
//----- (00000000000067F0) ----------------------------------------------------
long parse_server_match_testspec(long a1, char *a2)
[26608] {
char *v2; // rax
const char *v3; // r12
unsigned int v4; // eax
unsigned int v5; // r14d
char *stringp; // [rsp+8h] [rbp-40h] BYREF
[26628, 26629, 26632, 26636, 26608, 26641, 26612, 26614, 26646, 26616, 26618, 26620, 26621] stringp = a2;
[26820, 26822] while ( 1 )
{
[26792, 26794] while ( 1 )
{
[26764, 26766] while ( 1 )
{
[26736, 26738] while ( 1 )
{
[26708, 26710] while ( 1 )
{
[26662] while ( 1 )
{
[26656, 26659, 26662] v2 = strsep(&stringp, ",");
[26667] v3 = v2;
[26673, 26682, 26670, 26679] if ( !v2 || !*v2 )
[27048] return 0;
[26688, 26700, 26693, 26703] if ( strncmp(v2, "addr=", 5uLL) )
break;
[26928, 26938, 26933, 26942] *(_QWORD *)(a1 + 16) = xstrdup(v3 + 5);
}
[26728, 26721, 26731, 26716] if ( strncmp(v3, "host=", 5uLL) )
break;
[26952, 26962, 26957, 26966] *(_QWORD *)(a1 + 8) = xstrdup(v3 + 5);
}
[26744, 26756, 26749, 26759] if ( strncmp(v3, "user=", 5uLL) )
break;
[26976, 26986, 26989, 26981] *(_QWORD *)a1 = xstrdup(v3 + 5);
}
[26784, 26777, 26787, 26772] if ( strncmp(v3, "laddr=", 6uLL) )
break;
[27000, 27010, 27005, 27014] *(_QWORD *)(a1 + 24) = xstrdup(v3 + 6);
}
[26800, 26812, 26805, 26815] if ( strncmp(v3, "rdomain=", 8uLL) )
break;
[27024, 27034, 27029, 27038] *(_QWORD *)(a1 + 40) = xstrdup(v3 + 8);
}
[26848, 26850, 26828, 26833, 26840, 26843] if ( strncmp(v3, "lport=", 6uLL) )
break;
[26856, 26864, 26861] v4 = a2port(v3 + 6);
[26869] *(_DWORD *)(a1 + 32) = v4;
[26872] v5 = v4;
[26875, 26878] if ( v4 == -1 )
{
[26884, 26891, 26894, 26897, 26899, 26906, 26911] _fprintf_chk(stderr, 1LL, "Invalid port '%s' in test mode specification %s\n", v3 + 6, v3);
[26916, 27055] return v5;
}
}
[27072, 27077, 27079] v5 = -1;
[27104, 27085, 27092, 27099, 27069] _fprintf_chk(stderr, 1LL, "Invalid test mode specification %s\n", v3);
[27051, 27055] return v5;
[27058, 27059, 27060, 27062, 27064, 27066, 27068] }
// C308: using guessed type long xstrdup(_QWORD);
// C3A8: using guessed type long a2port(_QWORD);
// C5D8: using guessed type long _fprintf_chk(_QWORD, _QWORD, const char *, ...);
//----- (00000000000069F0) ----------------------------------------------------
void copy_set_server_options(long a1, long a2, int a3)
[27120] {
int v4; // eax
int v6; // eax
int v7; // eax
int v8; // eax
int v9; // eax
int v10; // eax
int v11; // eax
int v12; // eax
int v13; // eax
int v14; // eax
int v15; // eax
int v16; // eax
int v17; // eax
int v18; // eax
int v19; // eax
int v20; // eax
int v21; // eax
int v22; // eax
int v23; // eax
int v24; // eax
int v25; // eax
int v26; // eax
int v27; // eax
int v28; // eax
int v29; // eax
int v30; // eax
int v31; // eax
int v32; // eax
int v33; // eax
int v34; // eax
long v35; // rax
int v36; // eax
int v37; // eax
int v38; // eax
int v39; // eax
void *v40; // rax
void *v41; // rdi
void *v42; // rax
void *v43; // rdi
void *v44; // rax
void *v45; // rdi
void *v46; // rax
void *v47; // rdi
void *v48; // rax
void *v49; // rdi
void *v50; // rax
void *v51; // rdi
void *v52; // rax
void *v53; // rdi
void *v54; // rax
void *v55; // rdi
void *v56; // rax
void *v57; // rdi
void *v58; // rax
void *v59; // rdi
void *v60; // rax
void *v61; // rdi
void *v62; // rax
void *v63; // rdi
void *v64; // rax
void *v65; // rdi
unsigned int i; // r12d
long v67; // rdx
unsigned int v68; // r12d
long v69; // rax
unsigned int v70; // edx
unsigned int j; // r12d
long v72; // rdx
unsigned int v73; // r12d
long v74; // rax
unsigned int v75; // edx
unsigned int k; // r12d
long v77; // rdx
unsigned int v78; // r12d
long v79; // rax
unsigned int v80; // edx
unsigned int m; // r12d
long v82; // rdx
unsigned int v83; // r12d
long v84; // rax
unsigned int v85; // edx
unsigned int n; // r12d
long v87; // rdx
unsigned int v88; // r12d
long v89; // rax
unsigned int v90; // edx
unsigned int ii; // r12d
long v92; // rdx
unsigned int v93; // r12d
long v94; // rax
unsigned int v95; // edx
unsigned int jj; // r12d
long v97; // rdx
unsigned int v98; // r12d
long v99; // rax
unsigned int v100; // edx
unsigned int kk; // r12d
long v102; // rdx
unsigned int v103; // r12d
long v104; // rax
unsigned int v105; // edx
unsigned int mm; // r12d
long v107; // rdx
unsigned int v108; // r12d
long v109; // rax
unsigned int v110; // edx
unsigned int nn; // r12d
long v112; // rdx
unsigned int v113; // r12d
long v114; // rax
unsigned int v115; // edx
unsigned int i1; // r12d
long v117; // rdx
unsigned int v118; // r12d
long v119; // rax
unsigned int v120; // edx
void *v121; // rax
void *v122; // r12
void *v123; // rax
void *v124; // r12
long v125; // rdx
long v126; // rdx
long v127; // rdx
long v128; // rdx
long v129; // rdx
long v130; // rdx
long v131; // rdx
long v132; // rdx
long v133; // rdx
long v134; // rdx
long v135; // rdx
[27137, 27138, 27120, 27124, 27126, 27128, 27131, 27133, 27134] v4 = *(_DWORD *)(a2 + 1344);
[27144, 27147, 27150] if ( v4 != -1 )
[27152] *(_DWORD *)(a1 + 1344) = v4;
[27158] v6 = *(_DWORD *)(a2 + 1332);
[27164, 27167] if ( v6 != -1 )
[27169] *(_DWORD *)(a1 + 1332) = v6;
[27175] v7 = *(_DWORD *)(a2 + 1296);
[27184, 27181] if ( v7 != -1 )
[27186] *(_DWORD *)(a1 + 1296) = v7;
[27192] v8 = *(_DWORD *)(a2 + 1312);
[27201, 27198] if ( v8 != -1 )
[27203] *(_DWORD *)(a1 + 1312) = v8;
[27209] v9 = *(_DWORD *)(a2 + 1316);
[27218, 27215] if ( v9 != -1 )
[27220] *(_DWORD *)(a1 + 1316) = v9;
[27226] v10 = *(_DWORD *)(a2 + 1264);
[27232, 27235] if ( v10 != -1 )
[27237] *(_DWORD *)(a1 + 1264) = v10;
[27243] v11 = *(_DWORD *)(a2 + 1268);
[27249, 27252] if ( v11 != -1 )
[27254] *(_DWORD *)(a1 + 1268) = v11;
[27260] v12 = *(_DWORD *)(a2 + 1348);
[27266, 27269] if ( v12 != -1 )
[27271] *(_DWORD *)(a1 + 1348) = v12;
[27277] v13 = *(_DWORD *)(a2 + 1140);
[27283, 27286] if ( v13 != -1 )
[27288] *(_DWORD *)(a1 + 1140) = v13;
[27294] v14 = *(_DWORD *)(a2 + 1352);
[27300, 27303] if ( v14 != -1 )
[27305] *(_DWORD *)(a1 + 1352) = v14;
[27311] v15 = *(_DWORD *)(a2 + 1144);
[27320, 27317] if ( v15 != -1 )
[27322] *(_DWORD *)(a1 + 1144) = v15;
[27328] v16 = *(_DWORD *)(a2 + 1372);
[27337, 27334] if ( v16 != -1 )
[27339] *(_DWORD *)(a1 + 1372) = v16;
[27345] v17 = *(_DWORD *)(a2 + 1376);
[27354, 27351] if ( v17 != -1 )
[27356] *(_DWORD *)(a1 + 1376) = v17;
[27362] v18 = *(_DWORD *)(a2 + 1380);
[27368, 27371] if ( v18 != -1 )
[27373] *(_DWORD *)(a1 + 1380) = v18;
[27379] v19 = *(_DWORD *)(a2 + 1384);
[27385, 27388] if ( v19 != -1 )
[27390] *(_DWORD *)(a1 + 1384) = v19;
[27396] v20 = *(_DWORD *)(a2 + 7852);
[27402, 27405] if ( v20 != -1 )
[27407] *(_DWORD *)(a1 + 7852) = v20;
[27413] v21 = *(_DWORD *)(a2 + 7708);
[27419, 27422] if ( v21 != -1 )
[27424] *(_DWORD *)(a1 + 7708) = v21;
[27430] v22 = *(_DWORD *)(a2 + 1232);
[27436, 27439] if ( v22 != -1 )
[27441] *(_DWORD *)(a1 + 1232) = v22;
[27447] v23 = *(_DWORD *)(a2 + 1240);
[27456, 27453] if ( v23 != -1 )
[27458] *(_DWORD *)(a1 + 1240) = v23;
[27464] v24 = *(_DWORD *)(a2 + 1164);
[27473, 27470] if ( v24 != -1 )
[27475] *(_DWORD *)(a1 + 1164) = v24;
[27481] v25 = *(_DWORD *)(a2 + 1160);
[27490, 27487] if ( v25 != -1 )
[27492] *(_DWORD *)(a1 + 1160) = v25;
[27498] v26 = *(_DWORD *)(a2 + 1168);
[27504, 27507] if ( v26 != -1 )
[27509] *(_DWORD *)(a1 + 1168) = v26;
[27515] v27 = *(_DWORD *)(a2 + 1184);
[27521, 27524] if ( v27 != -1 )
[27526] *(_DWORD *)(a1 + 1184) = v27;
[27532] v28 = *(_DWORD *)(a2 + 1188);
[27538, 27541] if ( v28 != -1 )
[27543] *(_DWORD *)(a1 + 1188) = v28;
[27549] v29 = *(_DWORD *)(a2 + 7660);
[27555, 27558] if ( v29 != -1 )
[27560] *(_DWORD *)(a1 + 7660) = v29;
[27566] v30 = *(_DWORD *)(a2 + 7656);
[27572, 27575] if ( v30 != -1 )
[27577] *(_DWORD *)(a1 + 7656) = v30;
[27583] v31 = *(_DWORD *)(a2 + 7680);
[27592, 27589] if ( v31 != -1 )
[27594] *(_DWORD *)(a1 + 7680) = v31;
[27600] v32 = *(_DWORD *)(a2 + 7676);
[27609, 27606] if ( v32 != -1 )
[27611] *(_DWORD *)(a1 + 7676) = v32;
[27617] v33 = *(_DWORD *)(a2 + 1200);
[27626, 27623] if ( v33 != -1 )
[27628] *(_DWORD *)(a1 + 1200) = v33;
[27634] v34 = *(_DWORD *)(a2 + 1204);
[27640, 27643] if ( v34 != -1 )
[27645] *(_DWORD *)(a1 + 1204) = v34;
[27651] v35 = *(_QWORD *)(a2 + 7808);
[27658, 27662] if ( v35 != -1 )
[27664] *(_QWORD *)(a1 + 7808) = v35;
[27671] v36 = *(_DWORD *)(a2 + 7816);
[27680, 27677] if ( v36 != -1 )
[27682] *(_DWORD *)(a1 + 7816) = v36;
[27688] v37 = *(_DWORD *)(a2 + 1248);
[27697, 27694] if ( v37 != -1 )
[27699] *(_DWORD *)(a1 + 1248) = v37;
[27705] v38 = *(_DWORD *)(a2 + 7872);
[27714, 27711] if ( v38 != -1 )
[27716] *(_DWORD *)(a1 + 7872) = v38;
[27722] v39 = *(_DWORD *)(a2 + 1236);
[27728, 27731] if ( v39 != -1 )
[27733] *(_DWORD *)(a1 + 1236) = v39;
[27739] v40 = *(void **)(a2 + 7664);
[27746, 27749] if ( v40 )
{
[27751] v41 = *(void **)(a1 + 7664);
[27761, 27758] if ( v40 != v41 )
{
[27763] free(v41);
[27768, 27775] *(_QWORD *)(a1 + 7664) = *(_QWORD *)(a2 + 7664);
}
}
[27782] v42 = *(void **)(a2 + 7760);
[27792, 27789] if ( v42 )
{
[27794] v43 = *(void **)(a1 + 7760);
[27801, 27804] if ( v42 != v43 )
{
[27806] free(v43);
[27818, 27811] *(_QWORD *)(a1 + 7760) = *(_QWORD *)(a2 + 7760);
}
}
[27825] v44 = *(void **)(a2 + 7752);
[27832, 27835] if ( v44 )
{
[27837] v45 = *(void **)(a1 + 7752);
[27844, 27847] if ( v44 != v45 )
{
[27849] free(v45);
[27861, 27854] *(_QWORD *)(a1 + 7752) = *(_QWORD *)(a2 + 7752);
}
}
[27868] v46 = *(void **)(a2 + 7768);
[27875, 27878] if ( v46 )
{
[27880] v47 = *(void **)(a1 + 7768);
[27890, 27887] if ( v46 != v47 )
{
[27892] free(v47);
[27904, 27897] *(_QWORD *)(a1 + 7768) = *(_QWORD *)(a2 + 7768);
}
}
[27911] v48 = *(void **)(a2 + 7776);
[27921, 27918] if ( v48 )
{
[27923] v49 = *(void **)(a1 + 7776);
[27930, 27933] if ( v48 != v49 )
{
[27935] free(v49);
[27947, 27940] *(_QWORD *)(a1 + 7776) = *(_QWORD *)(a2 + 7776);
}
}
[27954] v50 = *(void **)(a2 + 7784);
[27961, 27964] if ( v50 )
{
[27966] v51 = *(void **)(a1 + 7784);
[27976, 27973] if ( v50 != v51 )
{
[27978] free(v51);
[27990, 27983] *(_QWORD *)(a1 + 7784) = *(_QWORD *)(a2 + 7784);
}
}
[27997] v52 = *(void **)(a2 + 7792);
[28004, 28007] if ( v52 )
{
[28009] v53 = *(void **)(a1 + 7792);
[28016, 28019] if ( v52 != v53 )
{
[28021] free(v53);
[28033, 28026] *(_QWORD *)(a1 + 7792) = *(_QWORD *)(a2 + 7792);
}
}
[28040] v54 = *(void **)(a2 + 7800);
[28050, 28047] if ( v54 )
{
[28052] v55 = *(void **)(a1 + 7800);
[28059, 28062] if ( v54 != v55 )
{
[28064] free(v55);
[28076, 28069] *(_QWORD *)(a1 + 7800) = *(_QWORD *)(a2 + 7800);
}
}
[28083] v56 = *(void **)(a2 + 1272);
[28090, 28093] if ( v56 )
{
[28095] v57 = *(void **)(a1 + 1272);
[28105, 28102] if ( v56 != v57 )
{
[28107] free(v57);
[28112, 28119] *(_QWORD *)(a1 + 1272) = *(_QWORD *)(a2 + 1272);
}
}
[28126] v58 = *(void **)(a2 + 1304);
[28136, 28133] if ( v58 )
{
[28138] v59 = *(void **)(a1 + 1304);
[28145, 28148] if ( v58 != v59 )
{
[28150] free(v59);
[28162, 28155] *(_QWORD *)(a1 + 1304) = *(_QWORD *)(a2 + 1304);
}
}
[28169] v60 = *(void **)(a2 + 1288);
[28176, 28179] if ( v60 )
{
[28181] v61 = *(void **)(a1 + 1288);
[28188, 28191] if ( v60 != v61 )
{
[28193] free(v61);
[28205, 28198] *(_QWORD *)(a1 + 1288) = *(_QWORD *)(a2 + 1288);
}
}
[28212] v62 = *(void **)(a2 + 1064);
[28219, 28222] if ( v62 )
{
[28224] v63 = *(void **)(a1 + 1064);
[28234, 28231] if ( v62 != v63 )
{
[28236] free(v63);
[28248, 28241] *(_QWORD *)(a1 + 1064) = *(_QWORD *)(a2 + 1064);
}
}
[28255] v64 = *(void **)(a2 + 1360);
[28265, 28262] if ( v64 )
{
[28267] v65 = *(void **)(a1 + 1360);
[28274, 28277] if ( v64 != v65 )
{
[28279] free(v65);
[28291, 28284] *(_QWORD *)(a1 + 1360) = *(_QWORD *)(a2 + 1360);
}
}
[28305, 28298, 28308] if ( *(_DWORD *)(a2 + 7684) )
{
[28320, 28323, 28325, 28358, 28338, 28310, 28317, 28351] for ( i = 0; *(_DWORD *)(a1 + 7684) > i; ++i )
{
[28335] v67 = i;
[28328, 28346, 28342] free(*(void **)(*(_QWORD *)(a1 + 7688) + 8 * v67));
}
[28367] v68 = 0;
[28360, 28370] free(*(void **)(a1 + 7688));
[28386, 28381, 28375] v69 = xcalloc(*(unsigned int *)(a2 + 7684), 8LL);
[28391] *(_QWORD *)(a1 + 7688) = v69;
[28398] v70 = *(_DWORD *)(a2 + 7684);
[28412, 28404, 28406] if ( v70 )
{
[29799] while ( 1 )
{
[29799] v125 = v68++;
[29826, 29802, 29806, 29810, 29817, 29821] *(_QWORD *)(v69 + 8 * v125) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 7688) + 8 * v125));
[29829] v70 = *(_DWORD *)(a2 + 7684);
[29840, 29835, 29838] if ( v70 <= v68 )
break;
[29792] v69 = *(_QWORD *)(a1 + 7688);
}
}
[28416] *(_DWORD *)(a1 + 7684) = v70;
}
[28428, 28422, 28430] if ( *(_DWORD *)(a2 + 1388) )
{
[28458, 28432, 28438, 28471, 28441, 28443, 28445, 28478] for ( j = 0; *(_DWORD *)(a1 + 1388) > j; ++j )
{
[28455] v72 = j;
[28448, 28466, 28462] free(*(void **)(*(_QWORD *)(a1 + 1392) + 8 * v72));
}
[28487] v73 = 0;
[28480, 28490] free(*(void **)(a1 + 1392));
[28506, 28501, 28495] v74 = xcalloc(*(unsigned int *)(a2 + 1388), 8LL);
[28511] *(_QWORD *)(a1 + 1392) = v74;
[28518] v75 = *(_DWORD *)(a2 + 1388);
[28532, 28524, 28526] if ( v75 )
{
[29855] while ( 1 )
{
[29855] v126 = v73++;
[29858, 29862, 29866, 29873, 29877, 29882] *(_QWORD *)(v74 + 8 * v126) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 1392) + 8 * v126));
[29885] v75 = *(_DWORD *)(a2 + 1388);
[29896, 29891, 29894] if ( v75 <= v73 )
break;
[29848] v74 = *(_QWORD *)(a1 + 1392);
}
}
[28536] *(_DWORD *)(a1 + 1388) = v75;
}
[28550, 28548, 28542] if ( *(_DWORD *)(a2 + 1400) )
{
[28578, 28552, 28558, 28591, 28561, 28563, 28565, 28598] for ( k = 0; *(_DWORD *)(a1 + 1400) > k; ++k )
{
[28575] v77 = k;
[28568, 28586, 28582] free(*(void **)(*(_QWORD *)(a1 + 1408) + 8 * v77));
}
[28607] v78 = 0;
[28600, 28610] free(*(void **)(a1 + 1408));
[28626, 28621, 28615] v79 = xcalloc(*(unsigned int *)(a2 + 1400), 8LL);
[28631] *(_QWORD *)(a1 + 1408) = v79;
[28638] v80 = *(_DWORD *)(a2 + 1400);
[28652, 28644, 28646] if ( v80 )
{
[29911] while ( 1 )
{
[29911] v127 = v78++;
[29922, 29929, 29933, 29938, 29914, 29918] *(_QWORD *)(v79 + 8 * v127) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 1408) + 8 * v127));
[29941] v80 = *(_DWORD *)(a2 + 1400);
[29952, 29947, 29950] if ( v80 <= v78 )
break;
[29904] v79 = *(_QWORD *)(a1 + 1408);
}
}
[28656] *(_DWORD *)(a1 + 1400) = v80;
}
[28670, 28668, 28662] if ( *(_DWORD *)(a2 + 1416) )
{
[28672, 28678, 28711, 28681, 28683, 28685, 28718, 28698] for ( m = 0; *(_DWORD *)(a1 + 1416) > m; ++m )
{
[28695] v82 = m;
[28688, 28706, 28702] free(*(void **)(*(_QWORD *)(a1 + 1424) + 8 * v82));
}
[28727] v83 = 0;
[28720, 28730] free(*(void **)(a1 + 1424));
[28746, 28741, 28735] v84 = xcalloc(*(unsigned int *)(a2 + 1416), 8LL);
[28751] *(_QWORD *)(a1 + 1424) = v84;
[28758] v85 = *(_DWORD *)(a2 + 1416);
[28772, 28764, 28766] if ( v85 )
{
[29967] while ( 1 )
{
[29967] v128 = v83++;
[29985, 29989, 29994, 29970, 29974, 29978] *(_QWORD *)(v84 + 8 * v128) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 1424) + 8 * v128));
[29997] v85 = *(_DWORD *)(a2 + 1416);
[30008, 30003, 30006] if ( v85 <= v83 )
break;
[29960] v84 = *(_QWORD *)(a1 + 1424);
}
}
[28776] *(_DWORD *)(a1 + 1416) = v85;
}
[28790, 28788, 28782] if ( *(_DWORD *)(a2 + 1432) )
{
[28801, 28803, 28805, 28838, 28818, 28792, 28798, 28831] for ( n = 0; *(_DWORD *)(a1 + 1432) > n; ++n )
{
[28815] v87 = n;
[28808, 28826, 28822] free(*(void **)(*(_QWORD *)(a1 + 1440) + 8 * v87));
}
[28847] v88 = 0;
[28840, 28850] free(*(void **)(a1 + 1440));
[28866, 28861, 28855] v89 = xcalloc(*(unsigned int *)(a2 + 1432), 8LL);
[28871] *(_QWORD *)(a1 + 1440) = v89;
[28878] v90 = *(_DWORD *)(a2 + 1432);
[28892, 28884, 28886] if ( v90 )
{
[30023] while ( 1 )
{
[30023] v129 = v88++;
[30050, 30026, 30030, 30034, 30041, 30045] *(_QWORD *)(v89 + 8 * v129) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 1440) + 8 * v129));
[30053] v90 = *(_DWORD *)(a2 + 1432);
[30064, 30059, 30062] if ( v90 <= v88 )
break;
[30016] v89 = *(_QWORD *)(a1 + 1440);
}
}
[28896] *(_DWORD *)(a1 + 1432) = v90;
}
[28910, 28908, 28902] if ( *(_DWORD *)(a2 + 7600) )
{
[28938, 28912, 28919, 28922, 28951, 28925, 28958, 28927] for ( ii = 0; *(_DWORD *)(a1 + 7600) > ii; ++ii )
{
[28935] v92 = ii;
[28928, 28946, 28942] free(*(void **)(*(_QWORD *)(a1 + 7608) + 8 * v92));
}
[28967] v93 = 0;
[28960, 28970] free(*(void **)(a1 + 7608));
[28986, 28981, 28975] v94 = xcalloc(*(unsigned int *)(a2 + 7600), 8LL);
[28991] *(_QWORD *)(a1 + 7608) = v94;
[28998] v95 = *(_DWORD *)(a2 + 7600);
[29004, 29006, 29012] if ( v95 )
{
[30079] while ( 1 )
{
[30079] v130 = v93++;
[30082, 30086, 30090, 30097, 30101, 30106] *(_QWORD *)(v94 + 8 * v130) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 7608) + 8 * v130));
[30109] v95 = *(_DWORD *)(a2 + 7600);
[30120, 30115, 30118] if ( v95 <= v93 )
break;
[30072] v94 = *(_QWORD *)(a1 + 7608);
}
}
[29016] *(_DWORD *)(a1 + 7600) = v95;
}
[29032, 29029, 29022] if ( *(_DWORD *)(a2 + 7616) )
{
[29079, 29034, 29066, 29041, 29044, 29047, 29049, 29086] for ( jj = 0; *(_DWORD *)(a1 + 7616) > jj; ++jj )
{
[29063] v97 = jj;
[29056, 29074, 29070] free(*(void **)(*(_QWORD *)(a1 + 7624) + 8 * v97));
}
[29095] v98 = 0;
[29088, 29098] free(*(void **)(a1 + 7624));
[29114, 29109, 29103] v99 = xcalloc(*(unsigned int *)(a2 + 7616), 8LL);
[29119] *(_QWORD *)(a1 + 7624) = v99;
[29126] v100 = *(_DWORD *)(a2 + 7616);
[29140, 29132, 29134] if ( v100 )
{
[30135] while ( 1 )
{
[30135] v131 = v98++;
[30146, 30153, 30157, 30162, 30138, 30142] *(_QWORD *)(v99 + 8 * v131) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 7624) + 8 * v131));
[30165] v100 = *(_DWORD *)(a2 + 7616);
[30176, 30171, 30174] if ( v100 <= v98 )
break;
[30128] v99 = *(_QWORD *)(a1 + 7624);
}
}
[29144] *(_DWORD *)(a1 + 7616) = v100;
}
[29160, 29157, 29150] if ( *(_DWORD *)(a2 + 7832) )
{
[29207, 29162, 29194, 29169, 29172, 29175, 29177, 29214] for ( kk = 0; *(_DWORD *)(a1 + 7832) > kk; ++kk )
{
[29191] v102 = kk;
[29184, 29202, 29198] free(*(void **)(*(_QWORD *)(a1 + 7840) + 8 * v102));
}
[29223] v103 = 0;
[29216, 29226] free(*(void **)(a1 + 7840));
[29242, 29237, 29231] v104 = xcalloc(*(unsigned int *)(a2 + 7832), 8LL);
[29247] *(_QWORD *)(a1 + 7840) = v104;
[29254] v105 = *(_DWORD *)(a2 + 7832);
[29260, 29262, 29268] if ( v105 )
{
[30191] while ( 1 )
{
[30191] v132 = v103++;
[30209, 30213, 30218, 30194, 30198, 30202] *(_QWORD *)(v104 + 8 * v132) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 7840) + 8 * v132));
[30221] v105 = *(_DWORD *)(a2 + 7832);
[30232, 30227, 30230] if ( v105 <= v103 )
break;
[30184] v104 = *(_QWORD *)(a1 + 7840);
}
}
[29272] *(_DWORD *)(a1 + 7832) = v105;
}
[29288, 29285, 29278] if ( *(_DWORD *)(a2 + 7720) )
{
[29335, 29290, 29322, 29296, 29299, 29301, 29303, 29342] for ( mm = 0; *(_DWORD *)(a1 + 7720) > mm; ++mm )
{
[29319] v107 = mm;
[29312, 29330, 29326] free(*(void **)(*(_QWORD *)(a1 + 7712) + 8 * v107));
}
[29351] v108 = 0;
[29344, 29354] free(*(void **)(a1 + 7712));
[29370, 29365, 29359] v109 = xcalloc(*(unsigned int *)(a2 + 7720), 8LL);
[29375] *(_QWORD *)(a1 + 7712) = v109;
[29382] v110 = *(_DWORD *)(a2 + 7720);
[29396, 29388, 29390] if ( v110 )
{
[30247] while ( 1 )
{
[30247] v133 = v108++;
[30274, 30250, 30254, 30258, 30265, 30269] *(_QWORD *)(v109 + 8 * v133) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 7712) + 8 * v133));
[30277] v110 = *(_DWORD *)(a2 + 7720);
[30288, 30283, 30286] if ( v110 <= v108 )
break;
[30240] v109 = *(_QWORD *)(a1 + 7712);
}
}
[29400] *(_DWORD *)(a1 + 7720) = v110;
}
[29414, 29412, 29406] if ( *(_DWORD *)(a2 + 7736) )
{
[29442, 29416, 29422, 29455, 29425, 29427, 29429, 29462] for ( nn = 0; *(_DWORD *)(a1 + 7736) > nn; ++nn )
{
[29439] v112 = nn;
[29432, 29450, 29446] free(*(void **)(*(_QWORD *)(a1 + 7728) + 8 * v112));
}
[29471] v113 = 0;
[29464, 29474] free(*(void **)(a1 + 7728));
[29490, 29485, 29479] v114 = xcalloc(*(unsigned int *)(a2 + 7736), 8LL);
[29495] *(_QWORD *)(a1 + 7728) = v114;
[29502] v115 = *(_DWORD *)(a2 + 7736);
[29508, 29510, 29516] if ( v115 )
{
[30303] while ( 1 )
{
[30303] v134 = v113++;
[30306, 30310, 30314, 30321, 30325, 30330] *(_QWORD *)(v114 + 8 * v134) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 7728) + 8 * v134));
[30333] v115 = *(_DWORD *)(a2 + 7736);
[30344, 30339, 30342] if ( v115 <= v113 )
break;
[30296] v114 = *(_QWORD *)(a1 + 7728);
}
}
[29520] *(_DWORD *)(a1 + 7736) = v115;
}
[29534, 29532, 29526] if ( *(_DWORD *)(a2 + 1252) )
{
[29536, 29542, 29575, 29545, 29547, 29549, 29582, 29562] for ( i1 = 0; *(_DWORD *)(a1 + 1252) > i1; ++i1 )
{
[29559] v117 = i1;
[29552, 29570, 29566] free(*(void **)(*(_QWORD *)(a1 + 1256) + 8 * v117));
}
[29591] v118 = 0;
[29584, 29594] free(*(void **)(a1 + 1256));
[29610, 29605, 29599] v119 = xcalloc(*(unsigned int *)(a2 + 1252), 8LL);
[29615] *(_QWORD *)(a1 + 1256) = v119;
[29622] v120 = *(_DWORD *)(a2 + 1252);
[29636, 29628, 29630] if ( v120 )
{
[30359] while ( 1 )
{
[30359] v135 = v118++;
[30370, 30377, 30381, 30386, 30362, 30366] *(_QWORD *)(v119 + 8 * v135) = xstrdup(*(_QWORD *)(*(_QWORD *)(a2 + 1256) + 8 * v135));
[30389] v120 = *(_DWORD *)(a2 + 1252);
[30400, 30395, 30398] if ( v120 <= v118 )
break;
[30352] v119 = *(_QWORD *)(a1 + 1256);
}
}
[29640] *(_DWORD *)(a1 + 1252) = v120;
}
[29649, 29646] assemble_algorithms(a1);
[29657, 29654] if ( !a3 )
{
[29659] v121 = *(void **)(a2 + 7696);
[29666] v122 = *(void **)(a1 + 7696);
[29673, 29676, 29681, 29678] if ( v121 && v121 != v122 )
{
[29666, 29683, 29686] free(*(void **)(a1 + 7696));
[29691] v122 = *(void **)(a2 + 7696);
[29698] *(_QWORD *)(a1 + 7696) = v122;
}
[29705, 29715, 29708, 29713] if ( option_clear_or_none((const char *)v122) )
{
[30408, 30411] free(v122);
[30416, 30427] *(_QWORD *)(a1 + 7696) = 0LL;
}
[29721] v123 = *(void **)(a2 + 7744);
[29728] v124 = *(void **)(a1 + 7744);
[29738, 29740, 29743, 29735] if ( v123 && v123 != v124 )
{
[29728, 29745, 29748] free(*(void **)(a1 + 7744));
[29753] v124 = *(void **)(a2 + 7744);
[29760] *(_QWORD *)(a1 + 7744) = v124;
}
[29777, 29770, 29775, 29767] if ( option_clear_or_none((const char *)v124) )
{
[30432, 30435] free(v124);
[30440] *(_QWORD *)(a1 + 7744) = 0LL;
}
}
[30455, 30451, 30452, 30453, 30457, 29783, 29784, 29785, 29787, 29789, 30459, 29791] }
// C308: using guessed type long xstrdup(_QWORD);
// C528: using guessed type long xcalloc(_QWORD, _QWORD);
//----- (0000000000007700) ----------------------------------------------------
unsigned long parse_server_config(
unsigned int *a1,
const char *a2,
long a3,
const char *a4,
char **a5,
int a6)
{
_BOOL4 v8; // [rsp+4h] [rbp-24h] BYREF
unsigned long v9; // [rsp+8h] [rbp-20h]
v9 = __readfsqword(0x28u);
v8 = a5 == 0LL;
parse_server_config_depth(a1, a2, a3, a4, a5, 8 * (a5 != 0LL), (long)&v8, 0);
if ( !a6 )
process_queued_listen_addrs((long)a1);
return __readfsqword(0x28u) ^ v9;
}
//----- (0000000000007780) ----------------------------------------------------
unsigned long parse_server_match_config(long a1, const char *a2)
[30592] {
char **v2; // r8
unsigned int v4[950]; // [rsp+0h] [rbp-1EE8h] BYREF
unsigned long v5; // [rsp+1EC8h] [rbp-20h]
[30592, 30627, 30596, 30598, 30599, 30606, 30611, 30618] v5 = __readfsqword(0x28u);
[30635, 30637, 30640, 30643, 30646, 30649] initialize_server_options((long)v4);
[30661, 30664, 30667, 30670, 30677, 30654] parse_server_config(v4, "reprocess config", cfg, a2, v2, 0);
[30690, 30682, 30684, 30687] copy_set_server_options(a1, (long)v4, 0);
[30712, 30714, 30703, 30695] return __readfsqword(0x28u) ^ v5;
[30721, 30722, 30724] }
// 77D5: variable 'v2' is possibly undefined
//----- (0000000000007810) ----------------------------------------------------
long dump_config(long a1)
[30736] {
long i; // rbp
long v3; // rdx
unsigned int v4; // r13d
long v5; // rdi
char *v6; // rbp
long v7; // rbp
long v8; // rsi
long v9; // rsi
const char *v10; // rcx
const char *v11; // rdx
long v12; // rdx
long v13; // rax
const char *v14; // rsi
unsigned int v15; // ebp
const char *v16; // rax
const char *v17; // rdx
const char *v18; // rax
long v19; // rdx
unsigned int v20; // ebp
long v21; // rdx
const char *v22; // rdx
int v23; // eax
for ( i = 0LL; *(_DWORD *)a1 > (unsigned int)i; ++i )
[30752, 30754, 30755, 30758, 30791, 30793, 30762, 30764, 30766, 30736, 30740, 30742, 30744, 30782, 30751] {
v3 = *(unsigned int *)(a1 + 4 * i + 8);
[30768] _printf_chk(1LL, "port %d\n", v3);
[30786, 30772, 30780, 30775] }
v4 = 0;
[30809, 30801, 30806] dump_cfg_fmtint(0x10u, *(_DWORD *)(a1 + 1060));
[30816, 30795] if ( *(_DWORD *)(a1 + 1056) )
[30829, 30827, 30821, 30831] {
do
{
v5 = v4++;
[30832] v6 = (char *)format_listen_addrs_isra_0(
[30850, 30854, 30835, 30870, 30839, 30873, 30843] (const char **)(*(_QWORD *)(a1 + 1048) + 16 * v5),
(long *)(*(_QWORD *)(a1 + 1048) + 16 * v5 + 8));
_printf_chk(1LL, "%s", v6);
[30875, 30859, 30867, 30862] free(v6);
[30880, 30883] }
while ( *(_DWORD *)(a1 + 1056) > v4 );
[30888, 30895] }
dump_cfg_int(4);
[30897, 30915, 30908, 30903] dump_cfg_int(21);
[30920, 30931, 30926] dump_cfg_int(46);
[30936, 30947, 30942] dump_cfg_int(47);
[30952, 30963, 30958] dump_cfg_int(56);
[30968, 30979, 30974] dump_cfg_int(57);
[30984, 30995, 30990] dump_cfg_int(97);
[31000] dump_cfg_oct_constprop_0();
[31011, 31006] dump_cfg_fmtint(5u, *(_DWORD *)(a1 + 1140));
[31016, 31022] dump_cfg_fmtint(0x13u, *(_DWORD *)(a1 + 1144));
[31033, 31027, 31038] dump_cfg_fmtint(0x23u, *(_DWORD *)(a1 + 1148));
[31049, 31043, 31054] dump_cfg_fmtint(0x32u, *(_DWORD *)(a1 + 1264));
[31065, 31059, 31070] dump_cfg_fmtint(0x33u, *(_DWORD *)(a1 + 1268));
[31081, 31075, 31086] dump_cfg_fmtint(0x29u, *(_DWORD *)(a1 + 1296));
[31097, 31091, 31102] dump_cfg_fmtint(0xDu, *(_DWORD *)(a1 + 1344));
[31113, 31107, 31118] dump_cfg_fmtint(0xEu, *(_DWORD *)(a1 + 1348));
[31129, 31123, 31134] dump_cfg_fmtint(0x11u, *(_DWORD *)(a1 + 1152));
[31145, 31139, 31150] dump_cfg_fmtint(0x12u, *(_DWORD *)(a1 + 1156));
[31161, 31155, 31166] dump_cfg_fmtint(0x14u, *(_DWORD *)(a1 + 1160));
[31177, 31171, 31182] dump_cfg_fmtint(0x16u, *(_DWORD *)(a1 + 1168));
[31193, 31187, 31198] dump_cfg_fmtint(0x17u, *(_DWORD *)(a1 + 1184));
[31209, 31203, 31214] dump_cfg_fmtint(0x57u, *(_DWORD *)(a1 + 1188));
[31225, 31219, 31230] dump_cfg_fmtint(0x18u, *(_DWORD *)(a1 + 1192));
[31241, 31235, 31246] dump_cfg_fmtint(0x1Au, *(_DWORD *)(a1 + 1196));
[31257, 31251, 31262] dump_cfg_fmtint(0x19u, *(_DWORD *)(a1 + 1352));
[31273, 31267, 31278] dump_cfg_fmtint(0x1Du, *(_DWORD *)(a1 + 1368));
[31289, 31283, 31294] dump_cfg_fmtint(0x28u, *(_DWORD *)(a1 + 1232));
[31305, 31299, 31310] dump_cfg_fmtint(0x31u, *(_DWORD *)(a1 + 7672));
[31321, 31315, 31326] dump_cfg_fmtint(0x1Cu, *(_DWORD *)(a1 + 1372));
[31337, 31331, 31342] dump_cfg_fmtint(0x47u, *(_DWORD *)(a1 + 1380));
[31353, 31347, 31358] dump_cfg_fmtint(0x5Cu, *(_DWORD *)(a1 + 1384));
[31369, 31363, 31374] dump_cfg_fmtint(0x5Au, *(_DWORD *)(a1 + 1376));
[31385, 31379, 31390] dump_cfg_fmtint(0x59u, *(_DWORD *)(a1 + 1240));
[31401, 31395, 31406] dump_cfg_fmtint(0x5Bu, *(_DWORD *)(a1 + 7848));
[31417, 31411, 31422] dump_cfg_fmtint(0x5Du, *(_DWORD *)(a1 + 7852));
[31433, 31427, 31438] dump_cfg_string(38);
[31449, 31443, 31454] dump_cfg_string(39);
[31466, 31459, 31471] dump_cfg_string(43);
[31488, 31483, 31476] dump_cfg_string(36);
[31505, 31500, 31493] dump_cfg_string(37);
[31522, 31517, 31510] dump_cfg_string(48);
[31539, 31534, 31527] dump_cfg_string(68);
[31544, 31556, 31551] dump_cfg_string(69);
[31568, 31561, 31573] dump_cfg_string(75);
[31585, 31578, 31590] dump_cfg_string(74);
[31602, 31595, 31607] dump_cfg_string(96);
[31624, 31619, 31612] dump_cfg_string(76);
[31641, 31636, 31629] v7 = 0LL;
[31658, 31653, 31646] dump_cfg_string(82);
[31682, 31685, 31689, 31663, 31670, 31675] dump_cfg_string(83);
[31691] dump_cfg_string(84);
[31696, 31708, 31703] dump_cfg_string(77);
[31720, 31713, 31725] dump_cfg_string(78);
[31737, 31730, 31742] dump_cfg_string(86);
[31754, 31747, 31759] dump_cfg_string(79);
[31776, 31771, 31764] dump_cfg_string(80);
[31793, 31788, 31781] dump_cfg_string(52);
[31810, 31805, 31798] dump_cfg_string(53);
[31827, 31822, 31815] v8 = *(_QWORD *)(a1 + 1304);
[31832, 31844, 31839] dump_cfg_string(42);
[31849] v9 = log_level_name(*(unsigned int *)(a1 + 1248), v8);
[31856, 31861] dump_cfg_string(7);
[31872, 31866, 31877, 31882] log_facility_name(*(unsigned int *)(a1 + 1244), v9);
[31885] dump_cfg_string(6);
[31896, 31890] dump_cfg_strarray_oneline(58, *(_DWORD *)(a1 + 7684), *(const char ***)(a1 + 7688));
[31906, 31901, 31909] dump_cfg_strarray(3, *(_DWORD *)(a1 + 1088));
[31920, 31914, 31932, 31925] dump_cfg_strarray(72, *(_DWORD *)(a1 + 1104));
[31937, 31955, 31948, 31943] dump_cfg_strarray(31, *(_DWORD *)(a1 + 1388));
[31960, 31978, 31971, 31966] dump_cfg_strarray(32, *(_DWORD *)(a1 + 1400));
[32001, 31994, 31989, 31983] dump_cfg_strarray(33, *(_DWORD *)(a1 + 1416));
[32024, 32017, 32012, 32006] dump_cfg_strarray(34, *(_DWORD *)(a1 + 1432));
[32040, 32035, 32029, 32047] dump_cfg_strarray(62, *(_DWORD *)(a1 + 7600));
[32058, 32052, 32070, 32063] dump_cfg_strarray(63, *(_DWORD *)(a1 + 7616));
[32081, 32075, 32093, 32086] dump_cfg_strarray_oneline(85, *(_DWORD *)(a1 + 7832), *(const char ***)(a1 + 7840));
[32104, 32098, 32116, 32109] dump_cfg_strarray_oneline(8, *(_DWORD *)(a1 + 1252), *(const char ***)(a1 + 1256));
[32121, 32139, 32132, 32127] if ( *(_DWORD *)(a1 + 1448) )
[32144, 32162, 32155, 32150] {
[32175, 32177, 32173, 32167] do
{
v10 = *(const char **)(a1 + 8 * v7 + 5552);
v11 = *(const char **)(a1 + 8 * v7++ + 1456);
[32184] _printf_chk(1LL, "subsystem %s %s\n", v11, v10);
[32200, 32210, 32202, 32195] }
[32192, 32214] while ( *(_DWORD *)(a1 + 1448) > (unsigned int)v7 );
}
[32225, 32219] _printf_chk(
1LL,
[32227, 32260, 32233, 32239, 32241, 32248, 32255] "maxstartups %d:%d:%d\n",
*(unsigned int *)(a1 + 7632),
*(unsigned int *)(a1 + 7636),
*(unsigned int *)(a1 + 7640));
_printf_chk(1LL, "persourcemaxstartups ");
v12 = *(unsigned int *)(a1 + 7644);
[32272, 32265, 32277, 32279] if ( (_DWORD)v12 == 0x7FFFFFFF )
[32284] _printf_chk(1LL, "none\n");
[32296, 32290] else
[32867, 32848, 32855, 32860, 32862] _printf_chk(1LL, "%d\n", v12);
_printf_chk(1LL, "persourcenetblocksize %d:%d\n", *(unsigned int *)(a1 + 7648), *(unsigned int *)(a1 + 7652));
[32314, 32316, 32309, 32302] v13 = *(unsigned int *)(a1 + 7708);
[32321, 32327, 32333, 32340, 32342, 32347] if ( (_DWORD)v13 )
[32352] {
[32360, 32358] if ( (_DWORD)v13 == 1 )
{
[32369, 32366] v13 = 1LL;
}
[33073, 33068] else if ( (_DWORD)v13 == 2 )
{
[32378, 32375] v13 = 2LL;
}
[32819] else
{
v14 = 0LL;
if ( (_DWORD)v13 != 3 )
[32384] goto LABEL_13;
[32386, 32389] }
}
else
{
v13 = 0LL;
}
[33061, 33063] v14 = (const char *)*((_QWORD *)&tunmode_desc + 2 * v13 + 1);
LABEL_13:
[32824, 32840, 32835, 32828] v15 = 0;
dump_cfg_string(64);
[32400, 32395] v16 = (const char *)iptos2str(*(unsigned int *)(a1 + 1200), v14);
[32409, 32402] _printf_chk(1LL, "ipqos %s ", v16);
[32420, 32414] v18 = (const char *)iptos2str(*(unsigned int *)(a1 + 1204), "ipqos %s ", v17);
[32425, 32432, 32437, 32440, 32442] _printf_chk(1LL, "%s\n", v18);
[32425, 32453, 32447] _printf_chk(1LL, "rekeylimit %llu %d\n", *(_QWORD *)(a1 + 7808), *(unsigned int *)(a1 + 7816));
[32458, 32465, 32470, 32473, 32475] _printf_chk(1LL, "permitopen");
[32480, 32487, 32493, 32495, 32502, 32507] if ( *(_DWORD *)(a1 + 7720) )
[32512, 32524, 32526, 32519] {
[32539, 32537, 32531, 32545] do
{
v19 = v15++;
_printf_chk(1LL, " %s", *(const char **)(*(_QWORD *)(a1 + 7712) + 8 * v19));
[32559] }
[32576, 32578, 32552, 32561, 32564, 32569, 32572] while ( *(_DWORD *)(a1 + 7720) > v15 );
}
[32589, 32583] else
{
_printf_chk(1LL, " any");
}
[33027, 33008, 33015, 33020, 33022] v20 = 0;
_printf_chk(1LL, "\n");
[32603, 32605, 32598] _printf_chk(1LL, "permitlisten");
[32607, 32591] if ( *(_DWORD *)(a1 + 7736) )
[32626, 32619, 32612, 32621] {
[32644, 32646, 32652, 32631, 32637] do
{
v21 = v20++;
_printf_chk(1LL, " %s", *(const char **)(*(_QWORD *)(a1 + 7728) + 8 * v21));
[32663] }
[32673, 32676, 32680, 32682, 32656, 32665, 32668] while ( *(_DWORD *)(a1 + 7736) > v20 );
}
[32693, 32687] else
{
_printf_chk(1LL, " any");
}
[32995, 32976, 32983, 32988, 32990] _printf_chk(1LL, "\n");
v22 = *(const char **)(a1 + 1360);
[32707, 32709, 32702, 32695] if ( v22 )
[32714] _printf_chk(1LL, "permituserenvironment %s\n", v22);
[32721, 32724] else
[32744, 32737, 32730, 32742] dump_cfg_fmtint(0x1Bu, *(_DWORD *)(a1 + 1356));
_printf_chk(1LL, "pubkeyauthoptions");
[33040, 33056, 33051, 33046] v23 = *(_DWORD *)(a1 + 1312);
[32761, 32763, 32756, 32749] if ( !v23 )
[32768] {
[32776, 32774] _printf_chk(1LL, " none");
v23 = *(_DWORD *)(a1 + 1312);
[32944, 32956, 32951] }
[32961, 32967] if ( (v23 & 1) != 0 )
{
[32784, 32782] _printf_chk(1LL, " touch-required");
v23 = *(_DWORD *)(a1 + 1312);
[32904, 32916, 32918, 32911] }
[32929, 32923] if ( (v23 & 2) != 0 )
_printf_chk(1LL, " verify-required");
[32786, 32788] return _printf_chk(1LL, "\n");
[32899, 32880, 32887, 32892, 32894] }
// 7EC5: variable 'v17' is possibly undefined
// C3B8: using guessed type long _printf_chk(_QWORD, const char *, ...);
// C5E8: using guessed type long log_level_name(_QWORD, _QWORD);
// C5F0: using guessed type long log_facility_name(_QWORD, _QWORD);
// C5F8: using guessed type long iptos2str(_QWORD, const char *, ...);
// nfuncs=141 queued=37 decompiled=37 lumina nreq=0 worse=0 better=0
// ALL OK, 37 function(s) have been successfully decompiled
|
long process_queued_listen_addrs(long a1)
[8145] {
unsigned int v1; // eax
long result; // rax
unsigned int i; // [rsp+14h] [rbp-Ch]
long v4; // [rsp+18h] [rbp-8h]
[8161, 8165, 8167, 8169, 8145, 8149, 8150, 8153, 8157] if ( !*(_DWORD *)a1 )
{
[8171, 8175] v1 = (*(_DWORD *)a1)++;
[8192, 8177, 8180, 8184, 8186, 8190] *(_DWORD *)(a1 + 4LL * v1 + 8) = 22;
}
[8200, 8210, 8204, 8213] if ( *(_DWORD *)(a1 + 1060) == -1 )
[8219, 8215] *(_DWORD *)(a1 + 1060) = 0;
[8354, 8229, 8236, 8337, 8341, 8345, 8351] for ( i = 0; i < *(_DWORD *)(a1 + 1040); ++i )
{
[8258, 8261, 8265, 8268, 8238, 8242, 8249, 8252, 8255] v4 = *(_QWORD *)(a1 + 1032) + 24LL * i;
[8291, 8294, 8298, 8301, 8272, 8276, 8279, 8283, 8287] add_listen_addr((unsigned int *)a1, *(const char **)v4, *(const char **)(v4 + 16), *(_DWORD *)(v4 + 8));
[8313, 8306, 8316, 8310] free(*(void **)v4);
[8321, 8329, 8332, 8325] free(*(void **)(v4 + 16));
}
[8360, 8370, 8356, 8367] free(*(void **)(a1 + 1032));
[8379, 8375] *(_QWORD *)(a1 + 1032) = 0LL;
[8390] result = a1;
[8394] *(_DWORD *)(a1 + 1040) = 0;
[8404, 8405] return result;
[8406] }
//----- (00000000000020D7) ----------------------------------------------------
unsigned long process_permitopen_list(long a1, int a2, const char **a3, unsigned int a4)
[8407] {
int v4; // eax
unsigned int i; // [rsp+2Ch] [rbp-34h]
unsigned int v9; // [rsp+30h] [rbp-30h]
int v10; // [rsp+34h] [rbp-2Ch]
void *v11; // [rsp+38h] [rbp-28h] BYREF
const char *v12; // [rsp+40h] [rbp-20h]
void *ptr; // [rsp+48h] [rbp-18h]
long v14; // [rsp+50h] [rbp-10h]
unsigned long v15; // [rsp+58h] [rbp-8h]
[8419, 8423, 8426, 8430, 8433, 8407, 8442, 8411, 8412, 8415] v15 = __readfsqword(0x28u);
[8448, 8452, 8446] if ( a2 == 66 )
[8459, 8454] v4 = 2;
else
[8461] v4 = 1;
[8466] v9 = v4;
[8472, 8474, 8469, 8479] v12 = lookup_opcode_name(a2);
[8483, 8486, 8490, 8495, 8498] channel_clear_permission(a1, 256LL, v9);
[8513, 8517, 8519, 8523, 8526, 8533, 8503, 8536, 8507, 8541, 8543] if ( a4 && (a4 != 1 || strcmp(*a3, "any")) )
{
[8577, 8579, 8549, 8553, 8555, 8559, 8562, 8569, 8572] if ( a4 == 1 && !strcmp(*a3, "none") )
{
[8581, 8584, 8588, 8590, 8593, 8598] channel_disable_admin(a1, v9);
}
else
{
[8897, 8610, 8881, 8885, 8888, 8603, 8891] for ( i = 0; i < a4; ++i )
{
[8644, 8615, 8618, 8626, 8630, 8633, 8636, 8639] v11 = (void *)xstrdup(a3[i]);
[8648, 8652] ptr = v11;
[8656, 8668, 8660, 8663] v14 = hpdelim(&v11);
[8672, 8677] if ( !v14 )
[8707, 8679, 8712, 8682, 8719, 8689, 8690, 8726, 8696, 8731, 8702] sshfatal("servconf.c", "process_permitopen_list", 923LL, 1LL, 1LL, 0LL, "missing host in %s", v12);
[8736, 8740, 8748, 8743] v14 = cleanhostname(v14);
[8768, 8773, 8776, 8780, 8752, 8756, 8759, 8761, 8765] if ( !v11 || (v10 = permitopen_port(v11), v10 < 0) )
[8834, 8805, 8810, 8782, 8815, 8785, 8822, 8792, 8793, 8829, 8799] sshfatal("servconf.c", "process_permitopen_list", 926LL, 1LL, 1LL, 0LL, "bad port number in %s", v12);
[8864, 8839, 8842, 8846, 8849, 8853, 8856, 8861] channel_add_permission(a1, 256LL, v9, v14, (unsigned int)v10);
[8873, 8876, 8869] free(ptr);
}
}
}
[8903, 8907, 8916, 8918, 8923] return __readfsqword(0x28u) ^ v15;
[8924] }
// 2295: variable 'v10' is possibly undefined
// E640: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E660: using guessed type long xstrdup(_QWORD);
// E6E8: using guessed type long channel_clear_permission(_QWORD, _QWORD, _QWORD);
// E6F0: using guessed type long channel_disable_admin(_QWORD, _QWORD);
// E6F8: using guessed type long hpdelim(_QWORD);
// E700: using guessed type long cleanhostname(_QWORD);
// E708: using guessed type long permitopen_port(_QWORD);
// E710: using guessed type long channel_add_permission(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD);
//----- (00000000000022DD) ----------------------------------------------------
unsigned long process_permitopen(long a1, long a2)
[8925] {
[8929, 8930, 8933, 8966, 8937, 8970, 8941, 8975, 8945, 8978, 8949, 8955, 8925, 8959] process_permitopen_list(a1, 66, *(const char ***)(a2 + 7712), *(_DWORD *)(a2 + 7720));
[8993, 8997, 9004, 9008, 9013, 8983, 9016, 8987, 9021, 9022] return process_permitopen_list(a1, 67, *(const char ***)(a2 + 7728), *(_DWORD *)(a2 + 7736));
[9023] }
//----- (0000000000002340) ----------------------------------------------------
void * get_connection_info(long a1, int a2, unsigned int a3)
[9024] {
[9024, 9057, 9028, 9029, 9032, 9036, 9040, 9043, 9046, 9051, 9053] if ( !a1 || !a2 )
[9066, 9059] return &ci_20626;
[9068, 9071, 9075, 9077, 9080, 9085] qword_B1A8 = auth_get_canonical_hostname(a1, a3);
[9096, 9099, 9092, 9104] qword_B1B0 = ssh_remote_ipaddr(a1);
[9115, 9123, 9118, 9111] qword_B1B8 = ssh_local_ipaddr(a1);
[9137, 9130, 9142, 9134] dword_B1C0 = ssh_local_port(a1);
[9152, 9155, 9160, 9167, 9148] qword_B1C8 = ssh_packet_rdomain_in(a1);
[9174] return &ci_20626;
[9175] }
// B1A8: using guessed type long qword_B1A8;
// B1B0: using guessed type long qword_B1B0;
// B1B8: using guessed type long qword_B1B8;
// B1C0: using guessed type int dword_B1C0;
// B1C8: using guessed type long qword_B1C8;
// E718: using guessed type long auth_get_canonical_hostname(_QWORD, _QWORD);
// E720: using guessed type long ssh_remote_ipaddr(_QWORD);
// E728: using guessed type long ssh_local_ipaddr(_QWORD);
// E730: using guessed type long ssh_local_port(_QWORD);
// E738: using guessed type long ssh_packet_rdomain_in(_QWORD);
//----- (00000000000023D8) ----------------------------------------------------
long match_cfg_line_group(const char *a1, unsigned int a2, const char *a3)
[9176] {
unsigned int v5; // [rsp+24h] [rbp-Ch]
struct passwd *v6; // [rsp+28h] [rbp-8h]
[9184, 9188, 9192, 9195, 9199, 9176, 9180, 9181] v5 = 0;
[9211, 9206] if ( a3 )
{
[9224, 9217, 9229, 9221] v6 = getpwnam(a3);
[9233, 9238] if ( v6 )
{
[9314, 9318, 9321, 9325, 9328, 9330, 9333, 9338, 9340] if ( (unsigned int)ga_init(v6->pw_name, v6->pw_gid) )
{
[9416, 9420, 9423, 9428, 9431] if ( (unsigned int)ga_match_pattern_list(a1) == 1 )
{
[9506, 9507, 9538, 9510, 9543, 9513, 9550, 9520, 9521, 9557, 9527, 9562, 9533, 9503] sshlog(
"servconf.c",
"match_cfg_line_group",
1014LL,
0LL,
5LL,
0LL,
"user %.100s matched group list %.100s at line %d",
a3,
a1,
a2);
[9578, 9571, 9567] v5 = 1;
}
else
{
[9440, 9473, 9443, 9497, 9480, 9450, 9451, 9487, 9457, 9468, 9492, 9463, 9433, 9501, 9436, 9437] sshlog(
"servconf.c",
"match_cfg_line_group",
1011LL,
0LL,
5LL,
0LL,
"user %.100s does not match group list %.100s at line %d",
a3,
a1,
a2);
}
}
else
{
[9346, 9378, 9411, 9349, 9350, 9383, 9353, 9390, 9360, 9361, 9397, 9367, 9402, 9373, 9342, 9407] sshlog(
"servconf.c",
"match_cfg_line_group",
1008LL,
0LL,
5LL,
0LL,
"Can't Match group because user %.100s not in any group at line %d",
a3,
a2);
}
}
else
{
[9281, 9250, 9251, 9288, 9258, 9259, 9276, 9295, 9265, 9300, 9271, 9240, 9305, 9244, 9309, 9247] sshlog(
"servconf.c",
"match_cfg_line_group",
1005LL,
0LL,
5LL,
0LL,
"Can't match group at line %d because user %.100s does not exist",
a2,
a3);
}
}
[9581] ga_free();
[9586, 9589] return v5;
[9590] }
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E748: using guessed type long ga_init(_QWORD, _QWORD);
// E750: using guessed type long ga_match_pattern_list(_QWORD);
// E758: using guessed type long ga_free(void);
//----- (0000000000002577) ----------------------------------------------------
long match_test_missing_fatal(const char *a1, const char *a2)
[9591] {
[9603, 9607, 9611, 9615, 9618, 9621, 9628, 9629, 9635, 9641, 9646, 9651, 9658, 9665, 9670, 9591, 9595, 9596, 9599] long v2; // rdx
sshfatal(
"servconf.c",
"match_test_missing_fatal",
1026LL,
0LL,
1LL,
0LL,
"'Match %s' in configuration but '%s' not in connection test specification.",
[9671] a1,
a2);
return match_cfg_line((const char **)"servconf.c", (long)"match_test_missing_fatal", v2);
}
// 25C7: variable 'v2' is possibly undefined
// E640: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
//----- (00000000000025CB) ----------------------------------------------------
long match_cfg_line(const char **a1, long a2, long a3)
[9675] {
const char *v3; // rsi
const char *v4; // rcx
const char *v5; // rdx
const char *v6; // rax
const char *v9; // [rsp+30h] [rbp-20h]
[9698, 9731, 9734, 9675, 9707, 9679, 9680, 9711, 9713, 9683, 9687, 9720, 9691, 9694, 9727] v9 = *a1;
[9738, 9743] if ( a3 )
{
[9832, 9825, 9829, 9821] if ( *(_QWORD *)(a3 + 24) )
[9842, 9834, 9838] v3 = *(const char **)(a3 + 24);
else
[9844] v3 = "(null)";
[9851, 9859, 9862, 9855] if ( *(_QWORD *)(a3 + 16) )
[9864, 9868, 9872] v4 = *(const char **)(a3 + 16);
else
[9874] v4 = "(null)";
[9881, 9889, 9892, 9885] if ( *(_QWORD *)(a3 + 8) )
[9898, 9902, 9894] v5 = *(const char **)(a3 + 8);
else
[9904] v5 = "(null)";
[9921, 9915, 9918, 9911] if ( *(_QWORD *)a3 )
[9930, 9923, 9927] v6 = *(const char **)a3;
else
[9939, 9932, 9947, 9943] v6 = "(null)";
[9952, 9953, 9954, 9984, 9991, 9961, 9962, 9998, 9968, 10003, 9813, 9974, 9817, 9979, 9949, 9950, 9951] sshlog(
"servconf.c",
"match_cfg_line",
1044LL,
0LL,
7LL,
0LL,
"checking match for '%s' user %s host %s addr %s laddr %s lport %d",
v9,
v6,
v5,
v4,
v3,
*(unsigned int *)(a3 + 32));
[10008, 10012] }
else
{
sshlog("servconf.c", "match_cfg_line", 1042LL, 0LL, 7LL, 0LL, "checking syntax for 'Match %s'", v9);
[9794, 9764, 9799, 9770, 9775, 9745, 9780, 9749, 9750, 9787, 9757, 9758] }
[9808, 9804] return sub_2FF1();
}
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
//----- (0000000000002FF1) ----------------------------------------------------
// positive sp value has been detected, the output may be wrong!
long sub_2FF1()
[12273] {
int matched; // eax
int v1; // eax
int v2; // eax
long v3; // rbp
const char *v5; // rax
while ( 1 )
[12285] {
*(_QWORD *)(v3 - 24) = strdelim(v3 - 32);
[12280, 12285, 12277] if ( !*(_QWORD *)(v3 - 24) || !**(_BYTE **)(v3 - 24) )
[12289, 12294, 12296, 12300, 12303, 12305] goto LABEL_3;
if ( **(_BYTE **)(v3 - 24) == 35 )
[10017, 12289, 10021, 10024, 10026] {
*(_QWORD *)(v3 - 32) = 0LL;
[10028, 10036] LABEL_3:
if ( *(_DWORD *)(v3 - 40) )
[12315, 12311] {
if ( *(_QWORD *)(v3 - 72) )
[12386, 12391] {
if ( *(_DWORD *)(v3 - 44) )
[12393, 12397] v5 = (const char *)&unk_B83A;
[12406, 12399] else
v5 = "not ";
[12408] sshlog("servconf.c", "match_cfg_line", 1202LL, 0LL, 7LL, 0LL, "match %sfound", v5);
[12416, 12453, 12423, 12424, 12460, 12430, 12465, 12436, 12470, 12441, 12446, 12415] }
**(_QWORD **)(v3 - 56) = *(_QWORD *)(v3 - 32);
[12482, 12474, 12478] return *(unsigned int *)(v3 - 44);
[12485, 12488, 12492, 12501, 12503] }
else
{
sshlog("servconf.c", "match_cfg_line", 1198LL, 0LL, 2LL, 0LL, "One or more attributes required for Match");
[12321, 12358, 12328, 12329, 12365, 12335, 12370, 12341, 12346, 12317, 12351] return 0xFFFFFFFFLL;
[12384, 12379, 12375] }
}
*(_QWORD *)(v3 - 16) = 0LL;
[10041] ++*(_DWORD *)(v3 - 40);
[10057, 10049, 10054, 10062] if ( !strcasecmp(*(const char **)(v3 - 24), "all") )
[10084, 10086, 10065, 10069, 10076, 10079] break;
*(_QWORD *)(v3 - 16) = strdelim(v3 - 32);
[10266, 10274, 10269, 10262] if ( !*(_QWORD *)(v3 - 16) || !**(_BYTE **)(v3 - 16) || **(_BYTE **)(v3 - 16) == 35 )
[10305, 10278, 10283, 10285, 10289, 10292, 10294, 10296, 10300, 10303] {
sshlog(
[10307, 10340, 10310, 10347, 10317, 10318, 10354, 10324, 10359, 10330, 10335] "servconf.c",
"match_cfg_line",
1074LL,
0LL,
2LL,
0LL,
"Missing Match criteria for %s",
*(const char **)(v3 - 24));
return 0xFFFFFFFFLL;
[10368, 10364, 10373] }
if ( !strcasecmp(*(const char **)(v3 - 24), "user") )
[10378, 10382, 10389, 10392, 10397, 10399] {
if ( *(_QWORD *)(v3 - 72) && (!*(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) || **(_QWORD **)(v3 - 72)) )
[10433, 10405, 10410, 10412, 10416, 10419, 10421, 10423, 10427, 10430] {
if ( !**(_QWORD **)(v3 - 72) )
[10457, 10451, 10454, 10447] match_test_missing_fatal("User", "user");
[10473, 10466, 10459] if ( (unsigned int)((long ( *)(_QWORD, _QWORD))match_usergroup_pattern_list)(
[10500, 10503, 10478, 10482, 10485, 10489, 10492, 10495] **(_QWORD **)(v3 - 72),
*(_QWORD *)(v3 - 16)) == 1 )
sshlog(
[10528, 10562, 10531, 10532, 10569, 10539, 10540, 10576, 10546, 10517, 10581, 10552, 10521, 10586, 10524, 10557, 10590, 10527] "servconf.c",
"match_cfg_line",
1087LL,
0LL,
5LL,
0LL,
"user %.100s matched 'User %.100s' at line %d",
**(const char ***)(v3 - 72),
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
else
*(_DWORD *)(v3 - 44) = 0;
[10512, 10505] }
else
{
*(_DWORD *)(v3 - 44) = 0;
[10442, 10435] }
}
else if ( !strcasecmp(*(const char **)(v3 - 24), "group") )
[10595, 10599, 10606, 10609, 10614, 10616] {
if ( *(_QWORD *)(v3 - 72) && (!*(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) || **(_QWORD **)(v3 - 72)) )
[10627, 10629, 10633, 10636, 10638, 10640, 10644, 10647, 10650, 10622] {
if ( !**(_QWORD **)(v3 - 72) )
[10664, 10674, 10668, 10671] match_test_missing_fatal("Group", "user");
[10690, 10683, 10676] matched = match_cfg_line_group(*(const char **)(v3 - 16), *(_DWORD *)(v3 - 60), **(const char ***)(v3 - 72));
[10695, 10699, 10702, 10705, 10709, 10711, 10714] if ( matched == -1 )
[10722, 10719] return 0xFFFFFFFFLL;
[10738, 10733] if ( !matched )
[10728, 10724, 10726] *(_DWORD *)(v3 - 44) = 0;
[10750, 10743] }
else
{
*(_DWORD *)(v3 - 44) = 0;
[10659, 10652] }
}
else if ( !strcasecmp(*(const char **)(v3 - 24), "host") )
[10755, 10759, 10766, 10769, 10774, 10776] {
if ( *(_QWORD *)(v3 - 72)
[10787, 10789, 10793, 10796, 10798, 10800, 10804, 10808, 10811, 10782] && (!*(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) || *(_QWORD *)(*(_QWORD *)(v3 - 72) + 8LL)) )
{
if ( !*(_QWORD *)(*(_QWORD *)(v3 - 72) + 8LL) )
[10833, 10825, 10836, 10829] match_test_missing_fatal("Host", "host");
[10852, 10845, 10838] if ( (unsigned int)((long ( *)(_QWORD, _QWORD))match_hostname)(
[10880, 10883, 10857, 10861, 10865, 10869, 10872, 10875] *(_QWORD *)(*(_QWORD *)(v3 - 72) + 8LL),
*(_QWORD *)(v3 - 16)) == 1 )
sshlog(
[10912, 10913, 10950, 10920, 10921, 10957, 10927, 10897, 10962, 10901, 10933, 10967, 10905, 10938, 10971, 10908, 10909, 10943] "servconf.c",
"match_cfg_line",
1112LL,
0LL,
5LL,
0LL,
"connection from %.100s matched 'Host %.100s' at line %d",
*(const char **)(*(_QWORD *)(v3 - 72) + 8LL),
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
else
*(_DWORD *)(v3 - 44) = 0;
[10892, 10885] }
else
{
*(_DWORD *)(v3 - 44) = 0;
[10820, 10813] }
}
else if ( !strcasecmp(*(const char **)(v3 - 24), "address") )
[10976, 10980, 10987, 10990, 10995, 10997] {
if ( *(_QWORD *)(v3 - 72)
[11008, 11010, 11014, 11017, 11019, 11021, 11025, 11029, 11032, 11003] && (!*(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) || *(_QWORD *)(*(_QWORD *)(v3 - 72) + 16LL)) )
{
if ( !*(_QWORD *)(*(_QWORD *)(v3 - 72) + 16LL) )
[11136, 11140, 11132, 11143] match_test_missing_fatal("Address", "addr");
[11152, 11145, 11159] v1 = ((long ( *)(_QWORD, _QWORD))addr_match_list)(
[11168, 11172, 11176, 11179, 11182, 11164] *(_QWORD *)(*(_QWORD *)(v3 - 72) + 16LL),
*(_QWORD *)(v3 - 16));
if ( v1 == 1 )
[11187, 11190] {
sshlog(
[11233, 11265, 11299, 11237, 11270, 11303, 11240, 11241, 11275, 11244, 11245, 11282, 11252, 11253, 11289, 11259, 11229, 11294] "servconf.c",
"match_cfg_line",
1126LL,
0LL,
5LL,
0LL,
"connection from %.100s matched 'Address %.100s' at line %d",
*(const char **)(*(_QWORD *)(v3 - 72) + 16LL),
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
}
else if ( v1 <= 1 )
[11192, 11195] {
if ( v1 == -2 )
[11201, 11204] return 0xFFFFFFFFLL;
[11320, 11325] if ( v1 >= -2 && (unsigned int)(v1 + 1) <= 1 )
[11206, 11209, 11215, 11218, 11221, 11227] *(_DWORD *)(v3 - 44) = 0;
[11315, 11308] }
}
else
{
if ( (unsigned int)((long ( *)(_QWORD, _QWORD))addr_match_list)(0LL, *(_QWORD *)(v3 - 16)) )
[11041, 11046, 11051, 11053, 11034, 11038] sshfatal(
[11073, 11074, 11110, 11080, 11115, 11086, 11055, 11059, 11091, 11062, 11063, 11096, 11066, 11103] "servconf.c",
"match_cfg_line",
1117LL,
0LL,
1LL,
0LL,
"Invalid Match address argument '%s' at line %d",
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
*(_DWORD *)(v3 - 44) = 0;
[11120, 11127] }
}
else if ( !strcasecmp(*(const char **)(v3 - 24), "localaddress") )
[11330, 11334, 11341, 11344, 11349, 11351] {
if ( *(_QWORD *)(v3 - 72)
[11362, 11364, 11368, 11371, 11373, 11375, 11379, 11383, 11386, 11357] && (!*(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) || *(_QWORD *)(*(_QWORD *)(v3 - 72) + 24LL)) )
{
if ( !*(_QWORD *)(*(_QWORD *)(v3 - 72) + 24LL) )
[11497, 11490, 11494, 11486] match_test_missing_fatal("LocalAddress", "laddr");
[11513, 11506, 11499] v2 = ((long ( *)(_QWORD, _QWORD))addr_match_list)(
[11522, 11526, 11530, 11533, 11536, 11518] *(_QWORD *)(*(_QWORD *)(v3 - 72) + 24LL),
*(_QWORD *)(v3 - 16));
if ( v2 == 1 )
[11544, 11541] {
sshlog(
[11648, 11587, 11619, 11653, 11591, 11624, 11657, 11594, 11595, 11629, 11598, 11599, 11636, 11606, 11607, 11643, 11613, 11583] "servconf.c",
"match_cfg_line",
1150LL,
0LL,
5LL,
0LL,
"connection from %.100s matched 'LocalAddress %.100s' at line %d",
*(const char **)(*(_QWORD *)(v3 - 72) + 24LL),
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
}
else if ( v2 <= 1 )
[11546, 11549] {
if ( v2 == -2 )
[11555, 11558] return 0xFFFFFFFFLL;
[11674, 11679] if ( v2 >= -2 && (unsigned int)(v2 + 1) <= 1 )
[11560, 11563, 11569, 11572, 11575, 11581] *(_DWORD *)(v3 - 44) = 0;
[11669, 11662] }
}
else
{
if ( (unsigned int)((long ( *)(_QWORD, _QWORD))addr_match_list)(0LL, *(_QWORD *)(v3 - 16)) )
[11392, 11395, 11400, 11405, 11407, 11388] sshfatal(
[11457, 11427, 11428, 11464, 11434, 11469, 11440, 11409, 11413, 11445, 11416, 11417, 11450, 11420] "servconf.c",
"match_cfg_line",
1139LL,
0LL,
1LL,
0LL,
"Invalid Match localaddress argument '%s' at line %d",
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
*(_DWORD *)(v3 - 44) = 0;
[11481, 11474] }
}
else if ( !strcasecmp(*(const char **)(v3 - 24), "localport") )
[11684, 11688, 11695, 11698, 11703, 11705] {
*(_DWORD *)(v3 - 36) = a2port(*(_QWORD *)(v3 - 16));
[11723, 11715, 11718, 11711] if ( *(_DWORD *)(v3 - 36) == -1 )
[11730, 11726] {
sshlog(
[11779, 11749, 11784, 11755, 11760, 11732, 11765, 11735, 11772, 11742, 11743] "servconf.c",
"match_cfg_line",
1163LL,
0LL,
2LL,
0LL,
"Invalid LocalPort '%s' on Match line",
*(const char **)(v3 - 16));
return 0xFFFFFFFFLL;
[11793, 11789, 11798] }
if ( !*(_QWORD *)(v3 - 72)
[11808, 11810, 11814, 11817, 11819, 11821, 11825, 11828, 11831, 11803] || *(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) && *(_DWORD *)(*(_QWORD *)(v3 - 72) + 32LL) == -1 )
{
*(_DWORD *)(v3 - 44) = 0;
[11840, 11833] }
else
{
if ( !*(_DWORD *)(*(_QWORD *)(v3 - 72) + 32LL) )
[11849, 11852, 11845, 11854] match_test_missing_fatal("LocalPort", "lport");
[11856, 11870, 11863] if ( *(_DWORD *)(v3 - 36) == *(_DWORD *)(*(_QWORD *)(v3 - 72) + 32LL) )
[11882, 11875, 11885, 11879] sshlog(
[11904, 11911, 11912, 11918, 11924, 11929, 11934, 11941, 11948, 11953, 11958, 11962, 11887, 11891, 11895, 11898, 11899, 11902, 11903] "servconf.c",
"match_cfg_line",
1175LL,
0LL,
5LL,
0LL,
"connection from %.100s matched 'LocalPort %d' at line %d",
*(const char **)(*(_QWORD *)(v3 - 72) + 24LL),
*(unsigned int *)(v3 - 36),
*(unsigned int *)(v3 - 60));
else
*(_DWORD *)(v3 - 44) = 0;
[11974, 11967] }
}
else
{
if ( strcasecmp(*(const char **)(v3 - 24), "rdomain") )
[12000, 11979, 11983, 11990, 11993, 11998] {
sshlog(
[12225, 12230, 12202, 12235, 12205, 12242, 12212, 12213, 12249, 12219, 12254] "servconf.c",
"match_cfg_line",
1193LL,
0LL,
2LL,
0LL,
"Unsupported Match attribute %s",
*(const char **)(v3 - 24));
return 0xFFFFFFFFLL;
[12259, 12268, 12263] }
if ( *(_QWORD *)(v3 - 72)
[12032, 12035, 12006, 12011, 12013, 12017, 12020, 12022, 12024, 12028] && (!*(_DWORD *)(*(_QWORD *)(v3 - 72) + 48LL) || *(_QWORD *)(*(_QWORD *)(v3 - 72) + 40LL)) )
{
if ( !*(_QWORD *)(*(_QWORD *)(v3 - 72) + 40LL) )
[12049, 12060, 12053, 12057] match_test_missing_fatal("RDomain", "rdomain");
[12076, 12069, 12062] if ( (unsigned int)((long ( *)(_QWORD, _QWORD, _QWORD))match_pattern_list)(
[12098, 12101, 12104, 12109, 12112, 12081, 12085, 12089, 12093] *(_QWORD *)(*(_QWORD *)(v3 - 72) + 40LL),
*(_QWORD *)(v3 - 16),
0LL) == 1 )
sshlog(
[12130, 12162, 12196, 12134, 12167, 12200, 12137, 12138, 12172, 12141, 12142, 12179, 12149, 12150, 12186, 12156, 12126, 12191] "servconf.c",
"match_cfg_line",
1190LL,
0LL,
5LL,
0LL,
"user %.100s matched 'RDomain %.100s' at line %d",
*(const char **)(*(_QWORD *)(v3 - 72) + 40LL),
*(const char **)(v3 - 16),
*(unsigned int *)(v3 - 60));
else
*(_DWORD *)(v3 - 44) = 0;
[12121, 12114] }
else
{
*(_DWORD *)(v3 - 44) = 0;
[12044, 12037] }
}
}
if ( *(int *)(v3 - 40) > 1
[10114, 10119, 10121, 10092, 10125, 10096, 10128, 10098, 10130, 10132, 10102, 10136, 10105, 10139, 10141, 10110] || (*(_QWORD *)(v3 - 16) = strdelim(v3 - 32)) != 0LL && **(_BYTE **)(v3 - 16) && **(_BYTE **)(v3 - 16) != 35 )
{
sshlog(
"servconf.c",
"match_cfg_line",
[10177, 10147, 10184, 10154, 10155, 10191, 10161, 10196, 10167, 10172, 10143] 1062LL,
0LL,
2LL,
0LL,
"'all' cannot be combined with other Match attributes");
return 0xFFFFFFFFLL;
}
else
[10201, 10210, 10205] {
if ( *(_QWORD *)(v3 - 16) && **(_BYTE **)(v3 - 16) == 35 )
*(_QWORD *)(v3 - 32) = 0LL;
**(_QWORD **)(v3 - 56) = *(_QWORD *)(v3 - 32);
[10215, 10220, 10222, 10226, 10229, 10231] return 1LL;
[10233] }
[10241, 10245, 10249] }
// 30DD: positive sp value 8 has been found
// 2FF5: variable 'v3' is possibly undefined
// E640: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E768: using guessed type long strdelim(_QWORD);
// E788: using guessed type long a2port(_QWORD);
//----- (00000000000030DE) ----------------------------------------------------
long process_server_config_line_depth(
long a1,
char *a2,
const char *a3,
unsigned int a4,
int *a5,
long a6,
_DWORD *a7,
int a8,
long *a9)
{
char *v10; // rax
unsigned int v11; // ebx
void *v12; // rax
void *v13; // rax
char *v14; // rax
char *v15; // rax
int *v16; // rax
char *v17; // rax
char *v18; // rax
char *v19; // rax
char *v20; // rax
char *v21; // rax
char *v22; // rax
char *v23; // rax
char *v24; // rax
char *v25; // rax
unsigned int v26; // ebx
unsigned int v27; // ebx
__uid_t v28; // eax
__uid_t v29; // eax
long v30; // rax
int v31; // edi
char *v32; // rax
char *v33; // rax
char *v34; // rax
int v35; // edi
long v36; // rax
int v37; // eax
_QWORD *v38; // rbx
void *v39; // rax
long v40; // rax
long v41; // rax
const char *v42; // rax
unsigned int v43; // edx
int v49; // [rsp+44h] [rbp-14Ch] BYREF
unsigned int matched; // [rsp+48h] [rbp-148h] BYREF
unsigned int v51; // [rsp+4Ch] [rbp-144h] BYREF
int v52; // [rsp+50h] [rbp-140h] BYREF
unsigned int v53; // [rsp+54h] [rbp-13Ch] BYREF
int v54; // [rsp+58h] [rbp-138h] BYREF
int m; // [rsp+5Ch] [rbp-134h]
int v56; // [rsp+60h] [rbp-130h]
_BOOL4 v57; // [rsp+64h] [rbp-12Ch]
unsigned int i; // [rsp+68h] [rbp-128h]
unsigned int v59; // [rsp+6Ch] [rbp-124h]
unsigned int v60; // [rsp+70h] [rbp-120h]
int v61; // [rsp+74h] [rbp-11Ch]
int v62; // [rsp+78h] [rbp-118h]
int v63; // [rsp+7Ch] [rbp-114h]
char *v64; // [rsp+80h] [rbp-110h] BYREF
char *s1; // [rsp+88h] [rbp-108h] BYREF
void *v66; // [rsp+90h] [rbp-100h] BYREF
void *ptr; // [rsp+98h] [rbp-F8h] BYREF
long v68; // [rsp+A0h] [rbp-F0h] BYREF
const char **v69; // [rsp+A8h] [rbp-E8h] BYREF
const char **v70; // [rsp+B0h] [rbp-E0h] BYREF
unsigned int *v71; // [rsp+B8h] [rbp-D8h]
const char *v72; // [rsp+C0h] [rbp-D0h]
_QWORD *v73; // [rsp+C8h] [rbp-C8h]
_QWORD *v74; // [rsp+D0h] [rbp-C0h]
int *v75; // [rsp+D8h] [rbp-B8h]
size_t j; // [rsp+E0h] [rbp-B0h]
char **v77; // [rsp+E8h] [rbp-A8h]
long k; // [rsp+F0h] [rbp-A0h]
const char *v79; // [rsp+F8h] [rbp-98h]
unsigned int *v80; // [rsp+100h] [rbp-90h]
unsigned int *v81; // [rsp+108h] [rbp-88h]
long v82[4]; // [rsp+110h] [rbp-80h] BYREF
long v83; // [rsp+130h] [rbp-60h]
unsigned long v84; // [rsp+178h] [rbp-18h]
v84 = __readfsqword(0x28u);
v49 = 0;
v52 = 0;
v69 = 0LL;
v53 = 0;
v59 = -1;
j = strlen(a2);
if ( !j )
return 0LL;
--j;
while ( j && strchr(s, a2[j]) )
a2[j--] = 0;
v64 = a2;
v72 = (const char *)strdelim(&v64);
if ( !v72 )
return 0LL;
if ( !*v72 )
v72 = (const char *)strdelim(&v64);
if ( !v72 || !*v72 || *v72 == 35 )
return 0LL;
if ( v64 && *v64 )
{
v71 = 0LL;
v73 = 0LL;
v60 = parse_token(v72, a3, a4, &v52);
if ( (unsigned int)argv_split(v64, &v53, &v69, 1LL) )
{
sshlog(
"servconf.c",
"process_server_config_line_depth",
1311LL,
0LL,
2LL,
0LL,
"%s line %d: invalid quotes",
a3,
a4);
return 0xFFFFFFFFLL;
}
else
{
v54 = v53;
v70 = v69;
if ( !a5 )
{
v49 = 1;
a5 = &v49;
}
if ( *a5 && v60 != 65 && v60 != 73 )
sshlog(
"servconf.c",
"process_server_config_line_depth",
1322LL,
0LL,
7LL,
0LL,
"%s:%d setting %s %s",
a3,
a4,
v72,
v64);
if ( *a5 || (v52 & 2) != 0 )
{
switch ( v60 )
{
case 0u:
goto LABEL_601;
case 1u:
v71 = (unsigned int *)(a1 + 7704);
goto LABEL_115;
case 2u:
if ( *(_DWORD *)(a1 + 4) )
goto LABEL_462;
if ( *(_DWORD *)a1 > 0xFFu )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1349LL,
0LL,
1LL,
0LL,
"%s line %d: too many ports.",
a3,
a4);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1353LL,
0LL,
1LL,
0LL,
"%s line %d: missing port number.",
a3,
a4);
v10 = s1;
v11 = (*(_DWORD *)a1)++;
*(_DWORD *)(a1 + 4LL * v11 + 8) = a2port(v10);
if ( *(int *)(a1 + 4LL * (unsigned int)(*(_DWORD *)a1 - 1) + 8) > 0 )
goto LABEL_598;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1357LL,
0LL,
1LL,
0LL,
"%s line %d: Badly formatted port number.",
a3,
a4);
LABEL_41:
v71 = (unsigned int *)(a1 + 1136);
goto LABEL_42;
case 3u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1438LL,
0LL,
1LL,
0LL,
"%s line %d: missing file name.",
a3,
a4);
if ( *a5 )
servconf_add_hostkey((long)a3, a4, a1, s1, 1u);
goto LABEL_598;
case 4u:
goto LABEL_41;
case 5u:
v71 = (unsigned int *)(a1 + 1140);
v77 = &multistate_permitrootlogin;
goto LABEL_71;
case 6u:
v81 = (unsigned int *)(a1 + 1244);
s1 = (char *)argv_next(&v54, &v70);
matched = log_facility_number(s1);
if ( matched == -1 )
{
if ( s1 )
v18 = s1;
else
v18 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1721LL,
0LL,
1LL,
0LL,
"%.200s line %d: unsupported log facility '%s'",
a3,
a4,
v18);
}
if ( *v81 == -1 )
*v81 = matched;
goto LABEL_598;
case 7u:
v80 = (unsigned int *)(a1 + 1248);
s1 = (char *)argv_next(&v54, &v70);
matched = log_level_number(s1);
if ( matched == -1 )
{
if ( s1 )
v19 = s1;
else
v19 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1732LL,
0LL,
1LL,
0LL,
"%.200s line %d: unsupported log level '%s'",
a3,
a4,
v19);
}
if ( *a5 && *v80 == -1 )
*v80 = matched;
goto LABEL_598;
case 8u:
v57 = *(_DWORD *)(a1 + 1252) == 0;
i = 0;
while ( 2 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
goto LABEL_598;
if ( *s1 )
{
if ( strcasecmp(s1, "none") || !i && v54 <= 0 )
{
++i;
if ( v57 && *a5 )
opt_array_append(a3, a4, v72, a1 + 1256, a1 + 1252, s1);
continue;
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
1750LL,
0LL,
2LL,
0LL,
"%s line %d: keyword %s \"none\" argument must appear alone.",
a3,
a4,
v72);
}
else
{
sshlog(
"servconf.c",
"process_server_config_line_depth",
1743LL,
0LL,
2LL,
0LL,
"%s line %d: keyword %s empty argument",
a3,
a4,
v72);
}
goto LABEL_601;
}
case 9u:
v71 = (unsigned int *)(a1 + 1316);
goto LABEL_115;
case 0xAu:
v71 = (unsigned int *)(a1 + 1320);
goto LABEL_115;
case 0xBu:
v71 = (unsigned int *)(a1 + 1324);
goto LABEL_115;
case 0xCu:
v71 = (unsigned int *)(a1 + 1328);
goto LABEL_115;
case 0xDu:
v71 = (unsigned int *)(a1 + 1344);
goto LABEL_115;
case 0xEu:
v71 = (unsigned int *)(a1 + 1348);
goto LABEL_115;
case 0xFu:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1378LL,
0LL,
1LL,
0LL,
"%s line %d: missing address",
a3,
a4);
if ( !strchr(s1, 91) && (ptr = strchr(s1, 58)) != 0LL && strchr((const char *)ptr + 1, 58) )
{
v56 = 0;
ptr = s1;
}
else
{
v66 = 0LL;
ptr = (void *)hpdelim(&s1);
if ( !ptr )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1389LL,
0LL,
1LL,
0LL,
"%s line %d: bad address:port usage",
a3,
a4);
ptr = (void *)cleanhostname(ptr);
if ( s1 )
{
v56 = a2port(s1);
if ( v56 <= 0 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1395LL,
0LL,
1LL,
0LL,
"%s line %d: bad port number",
a3,
a4);
}
else
{
v56 = 0;
}
}
v66 = 0LL;
s1 = (char *)argv_next(&v54, &v70);
if ( s1 )
{
if ( strcmp(s1, "rdomain") || (v66 = (void *)argv_next(&v54, &v70)) == 0LL )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1403LL,
0LL,
1LL,
0LL,
"%s line %d: bad ListenAddress syntax",
a3,
a4);
if ( !(unsigned int)valid_rdomain((long)v66) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1406LL,
0LL,
1LL,
0LL,
"%s line %d: bad routing domain",
a3,
a4);
}
queue_listen_addr(a1, (long)ptr, (long)v66, v56);
goto LABEL_598;
case 0x10u:
v71 = (unsigned int *)(a1 + 1060);
v77 = &multistate_addressfamily;
goto LABEL_71;
case 0x11u:
v71 = (unsigned int *)(a1 + 1152);
goto LABEL_115;
case 0x12u:
v71 = (unsigned int *)(a1 + 1156);
goto LABEL_115;
case 0x13u:
v71 = (unsigned int *)(a1 + 1144);
v77 = &multistate_ignore_rhosts;
goto LABEL_71;
case 0x14u:
v71 = (unsigned int *)(a1 + 1160);
goto LABEL_115;
case 0x15u:
v71 = (unsigned int *)(a1 + 1164);
goto LABEL_163;
case 0x16u:
v71 = (unsigned int *)(a1 + 1168);
goto LABEL_115;
case 0x17u:
v71 = (unsigned int *)(a1 + 1184);
goto LABEL_115;
case 0x18u:
v71 = (unsigned int *)(a1 + 1192);
goto LABEL_115;
case 0x19u:
v71 = (unsigned int *)(a1 + 1352);
goto LABEL_115;
case 0x1Au:
v71 = (unsigned int *)(a1 + 1196);
goto LABEL_115;
case 0x1Bu:
v71 = (unsigned int *)(a1 + 1356);
v73 = (_QWORD *)(a1 + 1360);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1653LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
matched = 0;
ptr = 0LL;
if ( !strcmp(s1, "yes") )
{
matched = 1;
}
else if ( !strcmp(s1, "no") )
{
matched = 0;
}
else
{
matched = 1;
ptr = (void *)xstrdup(s1);
}
if ( *a5 && *v71 == -1 )
{
*v71 = matched;
*v73 = ptr;
ptr = 0LL;
}
free(ptr);
goto LABEL_598;
case 0x1Cu:
v71 = (unsigned int *)(a1 + 1372);
v77 = &multistate_tcpfwd;
goto LABEL_71;
case 0x1Du:
v71 = (unsigned int *)(a1 + 1368);
v77 = &multistate_compression;
goto LABEL_71;
case 0x1Eu:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1682LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( !strcmp(s1, "default") )
{
v68 = 0LL;
}
else
{
if ( (unsigned int)scan_scaled(s1, &v68) == -1 )
{
v16 = _errno_location();
v17 = strerror(*v16);
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1688LL,
0LL,
1LL,
0LL,
"%.200s line %d: Bad %s number '%s': %s",
a3,
a4,
v72,
s1,
v17);
}
if ( v68 && v68 <= 15 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1692LL,
0LL,
1LL,
0LL,
"%.200s line %d: %s too small",
a3,
a4,
v72);
}
if ( *a5 && *(_QWORD *)(a1 + 7808) == -1LL )
*(_QWORD *)(a1 + 7808) = v68;
if ( !v54 )
goto LABEL_598;
if ( !strcmp(*v70, "none") )
{
argv_next(&v54, &v70);
}
else
{
v71 = (unsigned int *)(a1 + 7816);
LABEL_42:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1366LL,
0LL,
1LL,
0LL,
"%s line %d: missing time value.",
a3,
a4);
matched = convtime(s1);
if ( matched == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1369LL,
0LL,
1LL,
0LL,
"%s line %d: invalid time value.",
a3,
a4);
if ( *a5 && *v71 == -1 )
*v71 = matched;
}
goto LABEL_598;
case 0x1Fu:
v74 = (_QWORD *)(a1 + 1392);
v75 = (int *)(a1 + 1388);
goto LABEL_245;
case 0x20u:
v74 = (_QWORD *)(a1 + 1408);
v75 = (int *)(a1 + 1400);
LABEL_245:
while ( 1 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
if ( !*s1 || (unsigned int)match_user(0LL, 0LL, 0LL, s1) == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1790LL,
0LL,
1LL,
0LL,
"%s line %d: invalid %s pattern: \"%s\"",
a3,
a4,
v72,
s1);
if ( *a5 )
opt_array_append(a3, a4, v72, v74, v75, s1);
}
goto LABEL_598;
case 0x21u:
v74 = (_QWORD *)(a1 + 1424);
v75 = (int *)(a1 + 1416);
goto LABEL_254;
case 0x22u:
v74 = (_QWORD *)(a1 + 1440);
v75 = (int *)(a1 + 1432);
LABEL_254:
while ( 1 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
if ( !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1810LL,
0LL,
1LL,
0LL,
"%s line %d: empty %s pattern",
a3,
a4,
v72);
if ( *a5 )
opt_array_append(a3, a4, v72, v74, v75, s1);
}
goto LABEL_598;
case 0x23u:
v71 = (unsigned int *)(a1 + 1148);
goto LABEL_115;
case 0x24u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1827LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *s1 != 45 )
{
v20 = *s1 == 43 || *s1 == 94 ? s1 + 1 : s1;
if ( !(unsigned int)ciphers_valid(v20) )
{
if ( s1 )
v21 = s1;
else
v21 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1831LL,
0LL,
1LL,
0LL,
"%s line %d: Bad SSH2 cipher spec '%s'.",
a3,
a4,
v21);
}
}
if ( !*(_QWORD *)(a1 + 1208) )
*(_QWORD *)(a1 + 1208) = xstrdup(s1);
goto LABEL_598;
case 0x25u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1840LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *s1 != 45 )
{
v22 = *s1 == 43 || *s1 == 94 ? s1 + 1 : s1;
if ( !(unsigned int)mac_valid(v22) )
{
if ( s1 )
v23 = s1;
else
v23 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1844LL,
0LL,
1LL,
0LL,
"%s line %d: Bad SSH2 mac spec '%s'.",
a3,
a4,
v23);
}
}
if ( !*(_QWORD *)(a1 + 1216) )
*(_QWORD *)(a1 + 1216) = xstrdup(s1);
goto LABEL_598;
case 0x26u:
v73 = (_QWORD *)(a1 + 1120);
goto LABEL_104;
case 0x27u:
v73 = (_QWORD *)(a1 + 1128);
goto LABEL_104;
case 0x28u:
v71 = (unsigned int *)(a1 + 1232);
v77 = &multistate_gatewayports;
goto LABEL_71;
case 0x29u:
v71 = (unsigned int *)(a1 + 1296);
goto LABEL_115;
case 0x2Au:
v73 = (_QWORD *)(a1 + 1304);
goto LABEL_119;
case 0x2Bu:
v73 = (_QWORD *)(a1 + 1176);
goto LABEL_104;
case 0x2Cu:
if ( *(_DWORD *)(a1 + 1448) > 0xFFu )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1866LL,
0LL,
1LL,
0LL,
"%s line %d: too many subsystems defined.",
a3,
a4);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1871LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *a5 )
{
for ( i = 0; i < *(_DWORD *)(a1 + 1448); ++i )
{
if ( !strcmp(s1, *(const char **)(a1 + 8 * (i + 182LL))) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1879LL,
0LL,
1LL,
0LL,
"%s line %d: Subsystem '%s' already defined.",
a3,
a4,
s1);
}
v26 = *(_DWORD *)(a1 + 1448);
*(_QWORD *)(a1 + 8 * (v26 + 182LL)) = xstrdup(s1);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1884LL,
0LL,
1LL,
0LL,
"%s line %d: Missing subsystem command.",
a3,
a4);
v27 = *(_DWORD *)(a1 + 1448);
*(_QWORD *)(a1 + 8 * (v27 + 438LL)) = xstrdup(s1);
ptr = (void *)xstrdup(s1);
for ( j = strlen((const char *)ptr) + 1; ; strlcat(ptr, s1, j) )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
j += strlen(s1) + 1;
ptr = (void *)xreallocarray(ptr, 1LL, j);
strlcat(ptr, " ", j);
}
*(_QWORD *)(a1 + 8 * ((unsigned int)(*(_DWORD *)(a1 + 1448))++ + 694LL)) = ptr;
}
else
{
s1 = (char *)argv_next(&v54, &v70);
}
goto LABEL_598;
case 0x2Du:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1904LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
m = _isoc99_sscanf(s1, "%d:%d:%d", a1 + 7632, a1 + 7636, a1 + 7640);
if ( m != 3 )
goto LABEL_329;
if ( *(_DWORD *)(a1 + 7632) > *(_DWORD *)(a1 + 7640)
|| *(int *)(a1 + 7636) > 100
|| *(int *)(a1 + 7636) <= 0 )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1914LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s spec.",
a3,
a4,
v72);
LABEL_329:
if ( m != 1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1917LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s spec.",
a3,
a4,
v72);
*(_DWORD *)(a1 + 7640) = *(_DWORD *)(a1 + 7632);
}
goto LABEL_598;
case 0x2Eu:
v71 = (unsigned int *)(a1 + 7656);
goto LABEL_163;
case 0x2Fu:
v71 = (unsigned int *)(a1 + 7660);
goto LABEL_163;
case 0x30u:
v73 = (_QWORD *)(a1 + 7664);
goto LABEL_104;
case 0x31u:
v71 = (unsigned int *)(a1 + 7672);
goto LABEL_115;
case 0x32u:
v71 = (unsigned int *)(a1 + 1264);
goto LABEL_115;
case 0x33u:
v71 = (unsigned int *)(a1 + 1268);
goto LABEL_115;
case 0x34u:
v73 = (_QWORD *)(a1 + 1272);
goto LABEL_119;
case 0x35u:
v73 = (_QWORD *)(a1 + 1280);
goto LABEL_119;
case 0x36u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1949LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( !strcmp(s1, "none") )
{
matched = 0x7FFFFFFF;
}
else
{
v79 = (const char *)atoi_err(s1, &matched);
if ( v79 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1955LL,
0LL,
1LL,
0LL,
"%s line %d: %s integer value %s.",
a3,
a4,
v72,
v79);
}
if ( *a5 )
*(_DWORD *)(a1 + 7644) = matched;
goto LABEL_598;
case 0x37u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1926LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
m = _isoc99_sscanf(s1, "%d:%d", &matched, &v51);
if ( m == 1 )
goto LABEL_339;
if ( m == 2 )
{
if ( v51 >= 0x81 )
m = -1;
LABEL_339:
if ( matched >= 0x21 )
m = -1;
}
if ( m != 1 && m != 2 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1938LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s spec.",
a3,
a4,
v72);
if ( *a5 )
{
*(_DWORD *)(a1 + 7648) = matched;
*(_DWORD *)(a1 + 7652) = v51;
}
goto LABEL_598;
case 0x38u:
v71 = (unsigned int *)(a1 + 7676);
goto LABEL_42;
case 0x39u:
v71 = (unsigned int *)(a1 + 7680);
goto LABEL_163;
case 0x3Au:
v63 = *(_DWORD *)(a1 + 7684);
while ( 2 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
goto LABEL_598;
if ( *s1 )
{
v28 = getuid();
v66 = (void *)tilde_expand_filename(s1, v28);
if ( *a5 && !v63 )
opt_array_append(a3, a4, v72, a1 + 7688, a1 + 7684, v66);
free(v66);
continue;
}
break;
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
1984LL,
0LL,
2LL,
0LL,
"%s line %d: keyword %s empty argument",
a3,
a4,
v72);
goto LABEL_601;
case 0x3Bu:
v71 = (unsigned int *)(a1 + 1332);
goto LABEL_115;
case 0x3Cu:
v71 = (unsigned int *)(a1 + 1336);
goto LABEL_115;
case 0x3Du:
v71 = (unsigned int *)(a1 + 1340);
goto LABEL_115;
case 0x3Eu:
while ( 1 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
if ( !*s1 || strchr(s1, 61) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2023LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid environment name.",
a3,
a4);
if ( *a5 )
opt_array_append(a3, a4, v72, a1 + 7608, a1 + 7600, s1);
}
goto LABEL_598;
case 0x3Fu:
v63 = *(_DWORD *)(a1 + 7616);
while ( 1 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
if ( !*s1 || !strchr(s1, 61) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2037LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid environment.",
a3,
a4);
if ( *a5 && !v63 )
{
if ( lookup_setenv_in_list(s1, *(_QWORD *)(a1 + 7624), *(unsigned int *)(a1 + 7616)) )
sshlog(
"servconf.c",
"process_server_config_line_depth",
2043LL,
0LL,
6LL,
0LL,
"%s line %d: ignoring duplicate env name \"%.64s\"",
a3,
a4,
s1);
else
opt_array_append(a3, a4, v72, a1 + 7624, a1 + 7616, s1);
}
}
goto LABEL_598;
case 0x40u:
v71 = (unsigned int *)(a1 + 7708);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2056LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
matched = -1;
i = 0;
while ( 2 )
{
if ( *((_DWORD *)&tunmode_desc + 4 * i) != -1 )
{
if ( strcmp((&off_DEA8)[2 * i], s1) )
{
++i;
continue;
}
matched = *((_DWORD *)&tunmode_desc + 4 * i);
}
break;
}
if ( matched == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2065LL,
0LL,
1LL,
0LL,
"%s line %d: bad %s argument %s",
a3,
a4,
v72,
s1);
if ( *a5 && *v71 == -1 )
*v71 = matched;
goto LABEL_598;
case 0x41u:
goto LABEL_450;
case 0x42u:
case 0x43u:
if ( v60 == 67 )
{
v75 = (int *)(a1 + 7736);
v74 = (_QWORD *)(a1 + 7728);
}
else
{
v75 = (int *)(a1 + 7720);
v74 = (_QWORD *)(a1 + 7712);
}
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2201LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
v63 = *v75;
if ( !strcmp(s1, "any") || !strcmp(s1, "none") )
{
if ( *a5 && !v63 )
{
*v75 = 1;
*v74 = xcalloc(1LL, 8LL);
v38 = (_QWORD *)*v74;
*v38 = xstrdup(s1);
}
}
else
{
while ( s1 && *s1 )
{
if ( v60 != 67 || strchr(s1, 58) )
{
v66 = (void *)xstrdup(s1);
ptr = (void *)hpdelim(&s1);
if ( !ptr )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2225LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing host",
a3,
a4,
v72);
ptr = (void *)cleanhostname(ptr);
}
else
{
xasprintf(&v66, "*:%s", s1);
}
if ( !s1 || (v56 = permitopen_port(s1), v56 < 0) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2232LL,
0LL,
1LL,
0LL,
"%s line %d: %s bad port number",
a3,
a4,
v72);
if ( *a5 && !v63 )
opt_array_append(a3, a4, v72, v74, v75, v66);
free(v66);
s1 = (char *)argv_next(&v54, &v70);
}
}
goto LABEL_598;
case 0x44u:
if ( !v64 || !*v64 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2245LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
j = strspn(v64, " \t\r\n");
if ( *a5 && !*(_QWORD *)(a1 + 7696) )
*(_QWORD *)(a1 + 7696) = xstrdup(&v64[j]);
goto LABEL_462;
case 0x45u:
v73 = (_QWORD *)(a1 + 7744);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2258LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *a5 && !*v73 )
goto LABEL_553;
goto LABEL_598;
case 0x47u:
v71 = (unsigned int *)(a1 + 1380);
goto LABEL_115;
case 0x48u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1460LL,
0LL,
1LL,
0LL,
"%s line %d: missing file name.",
a3,
a4);
if ( *a5 )
servconf_add_hostcert((long)a3, a4, a1, s1);
goto LABEL_598;
case 0x49u:
if ( v49 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2073LL,
0LL,
1LL,
0LL,
"Include directive not supported as a command-line option");
matched = 0;
while ( 2 )
{
v66 = (void *)argv_next(&v54, &v70);
if ( !v66 )
{
if ( !matched )
{
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2162LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing filename argument",
a3,
a4,
v72);
LABEL_450:
if ( v49 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2169LL,
0LL,
1LL,
0LL,
"Match directive not supported as a command-line option");
if ( (*a7 & 4) != 0 )
v36 = 0LL;
else
v36 = a6;
matched = match_cfg_line((const char **)&v64, a4, v36);
if ( (matched & 0x80000000) != 0 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2174LL,
0LL,
1LL,
0LL,
"%s line %d: Bad Match condition",
a3,
a4);
v37 = (*a7 & 4) != 0 ? 0 : matched;
*a5 = v37;
*a7 &= ~8u;
if ( !v64 || !*v64 )
LABEL_462:
argv_consume(&v54);
}
goto LABEL_598;
}
if ( *(_BYTE *)v66 )
{
++matched;
v57 = 0;
if ( *(_BYTE *)v66 == 47 || *(_BYTE *)v66 == 126 )
s1 = (char *)xstrdup(v66);
else
xasprintf(&s1, "%s/%s", "/usr/local/etc", (const char *)v66);
v61 = *a5;
for ( k = *a9; k; k = *(_QWORD *)(k + 24) )
{
if ( !strcmp(*(const char **)k, s1) )
{
if ( *(_QWORD *)(k + 8) )
{
if ( (*a7 & 8) != 0 )
{
v31 = 8;
}
else if ( v61 )
{
v31 = 0;
}
else
{
v31 = 4;
}
parse_server_config_depth(
a1,
*(const char **)(k + 8),
*(_QWORD *)(k + 16),
a9,
a6,
v31,
a5,
a8 + 1);
}
v57 = 1;
*a5 = v61;
}
}
if ( v57 )
{
free(s1);
}
else
{
sshlog(
"servconf.c",
"process_server_config_line_depth",
2118LL,
0LL,
6LL,
0LL,
"%s line %d: new include %s",
a3,
a4,
s1);
v62 = ssh__compat_glob(s1, 0LL, 0LL, v82);
if ( v62 )
{
if ( v62 != -3 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2122LL,
0LL,
1LL,
0LL,
"%s line %d: include \"%s\" glob failed",
a3,
a4,
s1);
sshlog(
"servconf.c",
"process_server_config_line_depth",
2129LL,
0LL,
6LL,
0LL,
"%s line %d: no match for %s",
a3,
a4,
s1);
k = xcalloc(1LL, 40LL);
v32 = strdup(s1);
*(_QWORD *)k = v32;
*(_QWORD *)(k + 24) = 0LL;
*(_QWORD *)(k + 32) = a9[1];
*(_QWORD *)a9[1] = k;
a9[1] = k + 24;
}
if ( v82[0] >= 0x80000000uLL )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2137LL,
1LL,
1LL,
0LL,
"too many glob results");
for ( m = 0; m < SLODWORD(v82[0]); ++m )
{
sshlog(
"servconf.c",
"process_server_config_line_depth",
2139LL,
0LL,
6LL,
0LL,
"%s line %d: including %s",
a3,
a4,
*(const char **)(8LL * m + v83));
k = xcalloc(1LL, 40LL);
v33 = strdup(s1);
*(_QWORD *)k = v33;
v34 = strdup(*(const char **)(8LL * m + v83));
*(_QWORD *)(k + 8) = v34;
*(_QWORD *)(k + 16) = sshbuf_new();
if ( !*(_QWORD *)(k + 16) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2145LL,
1LL,
1LL,
0LL,
"sshbuf_new failed");
load_server_config(*(const char **)(k + 8), *(_QWORD *)(k + 16));
if ( (*a7 & 8) != 0 )
{
v35 = 8;
}
else if ( v61 )
{
v35 = 0;
}
else
{
v35 = 4;
}
parse_server_config_depth(a1, *(const char **)(k + 8), *(_QWORD *)(k + 16), a9, a6, v35, a5, a8 + 1);
*a5 = v61;
*(_QWORD *)(k + 24) = 0LL;
*(_QWORD *)(k + 32) = a9[1];
*(_QWORD *)a9[1] = k;
a9[1] = k + 24;
}
ssh__compat_globfree(v82);
free(s1);
}
continue;
}
break;
}
sshlog(
"servconf.c",
"process_server_config_line_depth",
2079LL,
0LL,
2LL,
0LL,
"%s line %d: keyword %s empty argument",
a3,
a4,
v72);
goto LABEL_601;
case 0x4Au:
v73 = (_QWORD *)(a1 + 7752);
goto LABEL_104;
case 0x4Bu:
v73 = (_QWORD *)(a1 + 7760);
LABEL_104:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1471LL,
0LL,
1LL,
0LL,
"%s line %d: missing file name.",
a3,
a4);
if ( *a5 )
{
if ( !*v73 )
{
v13 = derelativise_path(s1);
*v73 = v13;
if ( v71 )
++*v71;
}
}
goto LABEL_598;
case 0x4Cu:
v73 = (_QWORD *)(a1 + 7784);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2002LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *a5 )
{
if ( !*v73 )
{
v29 = getuid();
v30 = tilde_expand_filename(s1, v29);
*v73 = v30;
if ( v71 )
++*v71;
}
}
goto LABEL_598;
case 0x4Du:
v73 = (_QWORD *)(a1 + 7792);
goto LABEL_540;
case 0x4Eu:
v73 = (_QWORD *)(a1 + 7800);
goto LABEL_548;
case 0x4Fu:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1853LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *s1 != 45 )
{
v24 = *s1 == 43 || *s1 == 94 ? s1 + 1 : s1;
if ( !(unsigned int)kex_names_valid(v24) )
{
if ( s1 )
v25 = s1;
else
v25 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1858LL,
0LL,
1LL,
0LL,
"%s line %d: Bad SSH2 KexAlgorithms '%s'.",
a3,
a4,
v25);
}
}
if ( !*(_QWORD *)(a1 + 1224) )
*(_QWORD *)(a1 + 1224) = xstrdup(s1);
goto LABEL_598;
case 0x50u:
v73 = (_QWORD *)(a1 + 1288);
LABEL_119:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1514LL,
0LL,
1LL,
0LL,
"%s line %d: Missing argument.",
a3,
a4);
if ( *s1 != 45 )
{
v14 = *s1 == 43 || *s1 == 94 ? s1 + 1 : s1;
if ( !(unsigned int)sshkey_names_valid2(v14, 1LL) )
{
if ( s1 )
v15 = s1;
else
v15 = "<NONE>";
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1519LL,
0LL,
1LL,
0LL,
"%s line %d: Bad key types '%s'.",
a3,
a4,
v15);
}
}
if ( *a5 && !*v73 )
goto LABEL_553;
goto LABEL_598;
case 0x51u:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2290LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
matched = parse_ipqos(s1);
if ( matched == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2293LL,
0LL,
1LL,
0LL,
"%s line %d: Bad %s value: %s",
a3,
a4,
v72,
s1);
s1 = (char *)argv_next(&v54, &v70);
if ( s1 )
{
v51 = parse_ipqos(s1);
if ( v51 == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2299LL,
0LL,
1LL,
0LL,
"%s line %d: Bad %s value: %s",
a3,
a4,
v72,
s1);
}
else
{
v51 = matched;
}
if ( *a5 )
{
*(_DWORD *)(a1 + 1200) = matched;
*(_DWORD *)(a1 + 1204) = v51;
}
goto LABEL_598;
case 0x52u:
if ( !v64 || !*v64 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2309LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
j = strspn(v64, " \t\r\n");
if ( strchr(&v64[j], 13) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2313LL,
0LL,
1LL,
0LL,
"%.200s line %d: Invalid %s argument",
a3,
a4,
v72);
s1 = strchr(a2, 35);
if ( s1 )
{
*s1 = 0;
rtrim(a2);
}
if ( *a5 && !*(_QWORD *)(a1 + 7824) )
{
if ( !strcasecmp(&v64[j], "none") )
*(_QWORD *)(a1 + 7824) = xstrdup(&unk_B83A);
else
*(_QWORD *)(a1 + 7824) = xstrdup(&v64[j]);
}
goto LABEL_462;
case 0x53u:
v73 = (_QWORD *)(a1 + 7768);
LABEL_540:
j = strspn(v64, " \t\r\n");
if ( v64[j] != 47 && strcasecmp(&v64[j], "none") )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2334LL,
0LL,
1LL,
0LL,
"%.200s line %d: %s must be an absolute path",
a3,
a4,
v72);
if ( *a5 && !*(_QWORD *)(a1 + 7768) )
{
v40 = xstrdup(&v64[j]);
*v73 = v40;
}
goto LABEL_462;
case 0x54u:
v73 = (_QWORD *)(a1 + 7776);
LABEL_548:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2347LL,
0LL,
1LL,
0LL,
"%s line %d: missing %s argument.",
a3,
a4,
v72);
if ( *a5 && !*v73 )
{
LABEL_553:
v41 = xstrdup(s1);
*v73 = v41;
}
goto LABEL_598;
case 0x55u:
v57 = *(_DWORD *)(a1 + 7832) == 0;
matched = 0;
v51 = 0;
while ( 1 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
if ( !strcmp(s1, "any") )
{
if ( *(_DWORD *)(a1 + 7832) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2369LL,
0LL,
1LL,
0LL,
"%s line %d: \"any\" must appear alone in %s",
a3,
a4,
v72);
matched = 1;
}
else
{
if ( matched )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2375LL,
0LL,
1LL,
0LL,
"%s line %d: \"any\" must appear alone in %s",
a3,
a4,
v72);
if ( (unsigned int)auth2_methods_valid(s1, 0LL) )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2378LL,
0LL,
1LL,
0LL,
"%s line %d: invalid %s method list.",
a3,
a4,
v72);
}
v51 = 1;
if ( v57 && *a5 )
opt_array_append(a3, a4, v72, a1 + 7840, a1 + 7832, s1);
}
if ( v51 )
goto LABEL_598;
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2389LL,
0LL,
1LL,
0LL,
"%s line %d: no %s specified",
a3,
a4,
v72);
LABEL_571:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2397LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
matched = strtol(s1, (char **)&ptr, 8);
if ( s1 == ptr || matched >= 0x200 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2402LL,
0LL,
1LL,
0LL,
"%s line %d: Invalid %s.",
a3,
a4,
v72);
if ( *a5 )
*(_DWORD *)(a1 + 1236) = matched;
goto LABEL_598;
case 0x56u:
v73 = (_QWORD *)(a1 + 1112);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1450LL,
0LL,
1LL,
0LL,
"%s line %d: missing socket name.",
a3,
a4);
if ( *a5 && !*v73 )
{
if ( !strcmp(s1, "SSH_AUTH_SOCK") )
v12 = (void *)xstrdup(s1);
else
v12 = derelativise_path(s1);
*v73 = v12;
}
goto LABEL_598;
case 0x57u:
v71 = (unsigned int *)(a1 + 1188);
goto LABEL_115;
case 0x58u:
goto LABEL_571;
case 0x59u:
v71 = (unsigned int *)(a1 + 1240);
goto LABEL_115;
case 0x5Au:
v71 = (unsigned int *)(a1 + 1376);
v77 = &multistate_tcpfwd;
goto LABEL_71;
case 0x5Bu:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2415LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
matched = ssh_digest_alg_by_name(s1);
if ( matched == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2418LL,
0LL,
1LL,
0LL,
"%.200s line %d: Invalid %s algorithm \"%s\".",
a3,
a4,
v72,
s1);
if ( *a5 )
*(_DWORD *)(a1 + 7848) = matched;
goto LABEL_598;
case 0x5Cu:
v71 = (unsigned int *)(a1 + 1384);
goto LABEL_115;
case 0x5Du:
v71 = (unsigned int *)(a1 + 7852);
LABEL_115:
v77 = &multistate_flag;
LABEL_71:
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1419LL,
0LL,
1LL,
0LL,
"%s line %d: missing argument.",
a3,
a4);
matched = -1;
i = 0;
while ( 2 )
{
if ( v77[2 * i] )
{
if ( strcasecmp(s1, v77[2 * i]) )
{
++i;
continue;
}
matched = (unsigned int)v77[2 * i + 1];
}
break;
}
if ( matched == -1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1429LL,
0LL,
1LL,
0LL,
"%s line %d: unsupported option \"%s\".",
a3,
a4,
s1);
if ( *a5 && *v71 == -1 )
*v71 = matched;
goto LABEL_598;
case 0x5Eu:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2430LL,
0LL,
1LL,
0LL,
"%s line %d: setting RDomain not supported on this platform.",
a3,
a4);
goto LABEL_589;
case 0x5Fu:
v71 = (unsigned int *)(a1 + 1312);
matched = 0;
break;
case 0x60u:
v73 = (_QWORD *)(a1 + 7864);
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 || !*s1 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2276LL,
0LL,
1LL,
0LL,
"%s line %d: %s missing argument.",
a3,
a4,
v72);
if ( *a5 && !*v73 )
{
v39 = !strcasecmp(s1, "internal") ? (void *)xstrdup(s1) : derelativise_path(s1);
*v73 = v39;
if ( v71 )
++*v71;
}
goto LABEL_598;
case 0x61u:
LABEL_589:
v71 = (unsigned int *)(a1 + 7872);
LABEL_163:
s1 = (char *)argv_next(&v54, &v70);
v79 = (const char *)atoi_err(s1, &matched);
if ( v79 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1614LL,
0LL,
1LL,
0LL,
"%s line %d: %s integer value %s.",
a3,
a4,
v72,
v79);
if ( *a5 && *v71 == -1 )
*v71 = matched;
goto LABEL_598;
case 0x62u:
case 0x63u:
case 0x64u:
if ( v60 == 100 )
v42 = "Unsupported";
else
v42 = "Deprecated";
if ( v60 == 99 )
v43 = 6;
else
v43 = 3;
sshlog(
"servconf.c",
"process_server_config_line_depth",
2453LL,
0LL,
v43,
0LL,
"%s line %d: %s option %s",
a3,
a4,
v42,
v72);
argv_consume(&v54);
goto LABEL_598;
default:
sshfatal(
"servconf.c",
"process_server_config_line_depth",
2462LL,
0LL,
1LL,
0LL,
"%s line %d: Missing handler for opcode %s (%d)",
a3,
a4,
v72,
v60);
goto LABEL_598;
}
while ( 1 )
{
s1 = (char *)argv_next(&v54, &v70);
if ( !s1 )
break;
if ( strcasecmp(s1, "none") )
{
if ( !strcasecmp(s1, "touch-required") )
{
matched |= 1u;
}
else
{
if ( strcasecmp(s1, "verify-required") )
{
sshlog(
"servconf.c",
"process_server_config_line_depth",
1552LL,
0LL,
2LL,
0LL,
"%s line %d: unsupported %s option %s",
a3,
a4,
v72,
s1);
goto LABEL_601;
}
matched |= 2u;
}
}
}
if ( *a5 && *v71 == -1 )
*v71 = matched;
LABEL_598:
if ( v54 <= 0 )
v59 = 0;
else
sshlog(
"servconf.c",
"process_server_config_line_depth",
2467LL,
0LL,
2LL,
0LL,
"%.200s line %d: keyword %s extra arguments at end of line",
a3,
a4,
v72);
}
else
{
if ( !a6 )
sshfatal(
"servconf.c",
"process_server_config_line_depth",
1325LL,
0LL,
1LL,
0LL,
"%s line %d: Directive '%s' is not allowed within a Match block",
a3,
a4,
v72);
v59 = 0;
}
LABEL_601:
argv_free(v69, v53);
return v59;
}
}
else
{
sshlog(
"servconf.c",
"process_server_config_line_depth",
1302LL,
0LL,
2LL,
0LL,
"%s line %d: no argument after keyword \"%s\"",
a3,
a4,
v72);
return 0xFFFFFFFFLL;
}
}
// DEA8: using guessed type char *off_DEA8;
// DF00: using guessed type char *multistate_flag;
// DF40: using guessed type char *multistate_ignore_rhosts;
// DF80: using guessed type char *multistate_addressfamily;
// DFC0: using guessed type char *multistate_permitrootlogin;
// E020: using guessed type char *multistate_compression;
// E060: using guessed type char *multistate_gatewayports;
// E0A0: using guessed type char *multistate_tcpfwd;
// E640: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E660: using guessed type long xstrdup(_QWORD);
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E688: using guessed type long tilde_expand_filename(_QWORD, _QWORD);
// E6B0: using guessed type long xasprintf(_QWORD, const char *, ...);
// E6F8: using guessed type long hpdelim(_QWORD);
// E700: using guessed type long cleanhostname(_QWORD);
// E708: using guessed type long permitopen_port(_QWORD);
// E768: using guessed type long strdelim(_QWORD);
// E788: using guessed type long a2port(_QWORD);
// E7A8: using guessed type long argv_split(_QWORD, _QWORD, _QWORD, _QWORD);
// E7B0: using guessed type long argv_consume(_QWORD);
// E7B8: using guessed type long argv_next(_QWORD, _QWORD);
// E7C0: using guessed type long convtime(_QWORD);
// E7C8: using guessed type long sshkey_names_valid2(_QWORD, _QWORD);
// E7D0: using guessed type long atoi_err(_QWORD, _QWORD);
// E7D8: using guessed type long scan_scaled(_QWORD, _QWORD);
// E7E0: using guessed type long log_facility_number(_QWORD);
// E7E8: using guessed type long log_level_number(_QWORD);
// E7F0: using guessed type long match_user(_QWORD, _QWORD, _QWORD, _QWORD);
// E7F8: using guessed type long ciphers_valid(_QWORD);
// E800: using guessed type long mac_valid(_QWORD);
// E808: using guessed type long kex_names_valid(_QWORD);
// E810: using guessed type long xreallocarray(_QWORD, _QWORD, _QWORD);
// E818: using guessed type long strlcat(_QWORD, _QWORD, _QWORD);
// E820: using guessed type long _isoc99_sscanf(_QWORD, const char *, ...);
// E828: using guessed type long lookup_setenv_in_list(_QWORD, _QWORD, _QWORD);
// E830: using guessed type long ssh__compat_glob(_QWORD, _QWORD, _QWORD, _QWORD);
// E838: using guessed type long xcalloc(_QWORD, _QWORD);
// E848: using guessed type long sshbuf_new(void);
// E850: using guessed type long ssh__compat_globfree(_QWORD);
// E860: using guessed type long parse_ipqos(_QWORD);
// E868: using guessed type long rtrim(_QWORD);
// E870: using guessed type long auth2_methods_valid(_QWORD, _QWORD);
// E880: using guessed type long ssh_digest_alg_by_name(_QWORD);
// E888: using guessed type long argv_free(_QWORD, _QWORD);
//----- (00000000000081A5) ----------------------------------------------------
long process_server_config_line(
long a1,
char *a2,
const char *a3,
unsigned int a4,
int *a5,
long a6,
long *a7)
{
int v8; // [rsp+4Ch] [rbp-Ch] BYREF
unsigned long v9; // [rsp+50h] [rbp-8h]
v9 = __readfsqword(0x28u);
v8 = 0;
return process_server_config_line_depth(a1, a2, a3, a4, a5, a6, &v8, 0, a7);
}
//----- (000000000000822D) ----------------------------------------------------
unsigned long load_server_config(const char *a1, long a2)
[33325] {
int v2; // eax
long v3; // rax
char *v4; // rbx
size_t v5; // rax
long v6; // rax
long v7; // rax
long v8; // rax
int v10; // [rsp+18h] [rbp-D8h]
unsigned int v11; // [rsp+1Ch] [rbp-D4h]
unsigned int v12; // [rsp+1Ch] [rbp-D4h]
unsigned int v13; // [rsp+1Ch] [rbp-D4h]
char *s; // [rsp+20h] [rbp-D0h] BYREF
size_t n; // [rsp+28h] [rbp-C8h] BYREF
FILE *stream; // [rsp+30h] [rbp-C0h]
char *v17; // [rsp+38h] [rbp-B8h]
struct stat buf; // [rsp+40h] [rbp-B0h] BYREF
unsigned long v19; // [rsp+D8h] [rbp-18h]
[33348, 33355, 33325, 33329, 33330, 33364, 33333, 33334, 33341] v19 = __readfsqword(0x28u);
[33368, 33370] s = 0LL;
[33381] n = 0LL;
[33392] v10 = 0;
[33408, 33445, 33415, 33416, 33452, 33422, 33457, 33428, 33433, 33402, 33438] sshlog("servconf.c", "load_server_config", 2502LL, 1LL, 6LL, 0LL, "filename %s", a1);
[33473, 33480, 33483, 33488, 33462, 33466] stream = fopen(a1, "r");
[33503, 33495] if ( !stream )
{
[33512, 33505, 33515] perror(a1);
[33520, 33525] exit(1);
}
[33537, 33530, 33540] sshbuf_reset(a2);
[33552, 33545, 33555] v2 = fileno(stream);
[33569, 33572, 33574, 33579, 33581, 33560, 33562] if ( fstat(v2, &buf) )
goto LABEL_9;
[33594, 33587, 33591] if ( buf.st_size <= 0 )
goto LABEL_9;
[33600, 33604, 33607, 33614, 33617, 33620, 33625] v11 = sshbuf_allocate(a2, buf.st_size);
[33638, 33631] if ( !v11 )
goto LABEL_9;
[33652, 33650, 33644] v3 = ssh_err(v11);
[33668, 33669, 33702, 33672, 33707, 33678, 33683, 33688, 33657, 33661, 33695] sshfatal("servconf.c", "load_server_config", 2511LL, 1LL, 1LL, v3, "allocate");
do
{
[33712, 33723, 33717, 33728] ++v10;
[33734] v4 = s;
[33763, 33766, 33741, 33748, 33755, 33758] v17 = &v4[strspn(s, " \t\r")];
[33780, 33773, 33783] v5 = strlen(v17);
[33798, 33805, 33808, 33811, 33816, 33788, 33791] v12 = sshbuf_put(a2, v17, v5);
[33829, 33822] if ( v12 )
{
[33839, 33837, 33831] v6 = ssh_err(v12);
[33856, 33889, 33859, 33894, 33865, 33870, 33875, 33844, 33848, 33882, 33855] sshfatal("servconf.c", "load_server_config", 2521LL, 1LL, 1LL, v6, "sshbuf_put");
}
LABEL_9:
;
}
[33920, 33923, 33926, 33899, 33931, 33935, 33906, 33913] while ( getline(&s, &n, stream) != -1 );
[33948, 33941, 33951] free(s);
[33956, 33963, 33968, 33971, 33976] v13 = sshbuf_put_u8(a2, 0LL);
[33989, 33982] if ( v13 )
{
[33999, 33997, 33991] v7 = ssh_err(v13);
[34016, 34049, 34019, 34054, 34025, 34030, 34035, 34004, 34008, 34042, 34015] sshfatal("servconf.c", "load_server_config", 2525LL, 1LL, 1LL, v7, "sshbuf_put_u8");
}
[34066, 34059, 34069] fclose(stream);
[34081, 34074, 34084] v8 = sshbuf_len(a2);
[34115, 34120, 34089, 34090, 34127, 34097, 34098, 34134, 34104, 34139, 34110] sshlog("servconf.c", "load_server_config", 2527LL, 1LL, 6LL, 0LL, "done config len = %zu", v8);
[34144, 34148, 34149, 34153, 34162, 34164, 34169] return __readfsqword(0x28u) ^ v19;
[34173, 34174] }
// E638: using guessed type long ssh_err(_QWORD);
// E640: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E8A8: using guessed type long sshbuf_reset(_QWORD);
// E8C0: using guessed type long sshbuf_allocate(_QWORD, _QWORD);
// E8C8: using guessed type long sshbuf_put(_QWORD, _QWORD, _QWORD);
// E8D8: using guessed type long sshbuf_put_u8(_QWORD, _QWORD);
// E8E8: using guessed type long sshbuf_len(_QWORD);
//----- (000000000000857F) ----------------------------------------------------
unsigned long parse_server_match_config(long a1, long *a2, long a3)
[34175] {
int v5[948]; // [rsp+20h] [rbp-1ED0h] BYREF
unsigned long v6; // [rsp+1EE8h] [rbp-8h]
[34209, 34179, 34180, 34183, 34216, 34190, 34223, 34195, 34232, 34202, 34175] v6 = __readfsqword(0x28u);
[34248, 34236, 34245, 34238] initialize_server_options(v5);
[34274, 34281, 34253, 34287, 34290, 34260, 34297, 34267, 34300] parse_server_config((long)v5, "reprocess config", cfg, a2, a3, 0);
[34305, 34312, 34319, 34324, 34327, 34330] copy_set_server_options(a1, (long)v5, 0);
[34336, 34340, 34349, 34351, 34356, 34335] return __readfsqword(0x28u) ^ v6;
[34357] }
// 857F: using guessed type _DWORD var_1ED0[948];
//----- (0000000000008636) ----------------------------------------------------
long parse_server_match_testspec(long a1, char *a2)
[34358] {
long v2; // rax
long v3; // rax
long v4; // rax
long v5; // rax
long v6; // rax
int v7; // eax
char *stringp; // [rsp+0h] [rbp-20h] BYREF
long v10; // [rsp+8h] [rbp-18h]
char *s1; // [rsp+18h] [rbp-8h]
[34370, 34358, 34362, 34363, 34366] v10 = a1;
[34378, 34374] stringp = a2;
[34839] while ( 1 )
{
[34820, 34824, 34831, 34834, 34839] s1 = strsep(&stringp, ",");
[34848, 34850, 34854, 34857, 34859, 34865, 34843] if ( !s1 || !*s1 )
break;
[34402, 34407, 34409, 34383, 34387, 34392, 34399] if ( !strncmp(s1, "addr=", 5uLL) )
{
[34419, 34411, 34422, 34415] v2 = xstrdup(s1 + 5);
[34427, 34435, 34431] *(_QWORD *)(v10 + 16) = v2;
}
[34464, 34466, 34440, 34444, 34449, 34456, 34459] else if ( !strncmp(s1, "host=", 5uLL) )
{
[34472, 34476, 34468, 34479] v3 = xstrdup(s1 + 5);
[34488, 34492, 34484] *(_QWORD *)(v10 + 8) = v3;
}
[34497, 34501, 34506, 34513, 34516, 34521, 34523] else if ( !strncmp(s1, "user=", 5uLL) )
{
[34536, 34529, 34525, 34533] v4 = xstrdup(s1 + 5);
[34545, 34548, 34541] *(_QWORD *)v10 = v4;
}
[34562, 34569, 34572, 34577, 34579, 34553, 34557] else if ( !strncmp(s1, "laddr=", 6uLL) )
{
[34592, 34585, 34589, 34581] v5 = xstrdup(s1 + 6);
[34601, 34605, 34597] *(_QWORD *)(v10 + 24) = v5;
}
[34626, 34629, 34634, 34636, 34610, 34614, 34619] else if ( !strncmp(s1, "rdomain=", 8uLL) )
{
[34649, 34646, 34642, 34638] v6 = xstrdup(s1 + 8);
[34658, 34662, 34654] *(_QWORD *)(v10 + 40) = v6;
}
else
{
[34691, 34693, 34667, 34671, 34676, 34683, 34686] if ( strncmp(s1, "lport=", 6uLL) )
{
[34789, 34793, 34800, 34803, 34808, 34782] fprintf(stderr, "Invalid test mode specification %s\n", s1);
[34818, 34813] return 0xFFFFFFFFLL;
}
[34703, 34706, 34699, 34695] v7 = a2port(s1 + 6);
[34715, 34711] *(_DWORD *)(v10 + 32) = v7;
[34728, 34722, 34725, 34718] if ( *(_DWORD *)(v10 + 32) == -1 )
{
[34752, 34755, 34730, 34762, 34765, 34734, 34738, 34770, 34745, 34749] fprintf(stderr, "Invalid port '%s' in test mode specification %s\n", s1 + 6, s1);
[34780, 34775] return 0xFFFFFFFFLL;
}
}
}
[34870] return 0LL;
[34871] }
// E660: using guessed type long xstrdup(_QWORD);
// E788: using guessed type long a2port(_QWORD);
//----- (0000000000008838) ----------------------------------------------------
void copy_set_server_options(long a1, long a2, int a3)
[34872] {
_QWORD *v3; // rbx
_QWORD *v4; // rbx
_QWORD *v5; // rbx
_QWORD *v6; // rbx
_QWORD *v7; // rbx
_QWORD *v8; // rbx
_QWORD *v9; // rbx
_QWORD *v10; // rbx
_QWORD *v11; // rbx
_QWORD *v12; // rbx
_QWORD *v13; // rbx
unsigned int i; // [rsp+24h] [rbp-3Ch]
unsigned int j; // [rsp+24h] [rbp-3Ch]
unsigned int k; // [rsp+28h] [rbp-38h]
unsigned int m; // [rsp+28h] [rbp-38h]
unsigned int n; // [rsp+2Ch] [rbp-34h]
unsigned int ii; // [rsp+2Ch] [rbp-34h]
unsigned int jj; // [rsp+30h] [rbp-30h]
unsigned int kk; // [rsp+30h] [rbp-30h]
unsigned int mm; // [rsp+34h] [rbp-2Ch]
unsigned int nn; // [rsp+34h] [rbp-2Ch]
unsigned int i1; // [rsp+38h] [rbp-28h]
unsigned int i2; // [rsp+38h] [rbp-28h]
unsigned int i3; // [rsp+3Ch] [rbp-24h]
unsigned int i4; // [rsp+3Ch] [rbp-24h]
unsigned int i5; // [rsp+40h] [rbp-20h]
unsigned int i6; // [rsp+40h] [rbp-20h]
unsigned int i7; // [rsp+44h] [rbp-1Ch]
unsigned int i8; // [rsp+44h] [rbp-1Ch]
unsigned int i9; // [rsp+48h] [rbp-18h]
unsigned int i10; // [rsp+48h] [rbp-18h]
unsigned int i11; // [rsp+4Ch] [rbp-14h]
unsigned int i12; // [rsp+4Ch] [rbp-14h]
[34880, 34881, 34885, 34889, 34893, 34896, 34900, 34909, 34872, 34906, 34876, 34877] if ( *(_DWORD *)(a2 + 1344) != -1 )
[34921, 34915, 34925, 34911] *(_DWORD *)(a1 + 1344) = *(_DWORD *)(a2 + 1344);
[34944, 34931, 34941, 34935] if ( *(_DWORD *)(a2 + 1332) != -1 )
[34960, 34946, 34956, 34950] *(_DWORD *)(a1 + 1332) = *(_DWORD *)(a2 + 1332);
[34976, 34970, 34979, 34966] if ( *(_DWORD *)(a2 + 1296) != -1 )
[34985, 34995, 34981, 34991] *(_DWORD *)(a1 + 1296) = *(_DWORD *)(a2 + 1296);
[35001, 35011, 35005, 35014] if ( *(_DWORD *)(a2 + 1312) != -1 )
[35016, 35026, 35020, 35030] *(_DWORD *)(a1 + 1312) = *(_DWORD *)(a2 + 1312);
[35040, 35049, 35036, 35046] if ( *(_DWORD *)(a2 + 1316) != -1 )
[35065, 35051, 35061, 35055] *(_DWORD *)(a1 + 1316) = *(_DWORD *)(a2 + 1316);
[35081, 35075, 35084, 35071] if ( *(_DWORD *)(a2 + 1264) != -1 )
[35096, 35090, 35100, 35086] *(_DWORD *)(a1 + 1264) = *(_DWORD *)(a2 + 1264);
[35106, 35116, 35110, 35119] if ( *(_DWORD *)(a2 + 1268) != -1 )
[35121, 35131, 35125, 35135] *(_DWORD *)(a1 + 1268) = *(_DWORD *)(a2 + 1268);
[35145, 35154, 35141, 35151] if ( *(_DWORD *)(a2 + 1348) != -1 )
[35160, 35170, 35156, 35166] *(_DWORD *)(a1 + 1348) = *(_DWORD *)(a2 + 1348);
[35176, 35186, 35180, 35189] if ( *(_DWORD *)(a2 + 1140) != -1 )
[35201, 35195, 35205, 35191] *(_DWORD *)(a1 + 1140) = *(_DWORD *)(a2 + 1140);
[35224, 35211, 35221, 35215] if ( *(_DWORD *)(a2 + 1352) != -1 )
[35240, 35226, 35236, 35230] *(_DWORD *)(a1 + 1352) = *(_DWORD *)(a2 + 1352);
[35256, 35250, 35259, 35246] if ( *(_DWORD *)(a2 + 1144) != -1 )
[35265, 35275, 35261, 35271] *(_DWORD *)(a1 + 1144) = *(_DWORD *)(a2 + 1144);
[35281, 35291, 35285, 35294] if ( *(_DWORD *)(a2 + 1372) != -1 )
[35296, 35306, 35300, 35310] *(_DWORD *)(a1 + 1372) = *(_DWORD *)(a2 + 1372);
[35320, 35329, 35316, 35326] if ( *(_DWORD *)(a2 + 1376) != -1 )
[35345, 35331, 35341, 35335] *(_DWORD *)(a1 + 1376) = *(_DWORD *)(a2 + 1376);
[35361, 35355, 35364, 35351] if ( *(_DWORD *)(a2 + 1380) != -1 )
[35376, 35370, 35380, 35366] *(_DWORD *)(a1 + 1380) = *(_DWORD *)(a2 + 1380);
[35386, 35396, 35390, 35399] if ( *(_DWORD *)(a2 + 1384) != -1 )
[35401, 35411, 35405, 35415] *(_DWORD *)(a1 + 1384) = *(_DWORD *)(a2 + 1384);
[35425, 35434, 35421, 35431] if ( *(_DWORD *)(a2 + 7852) != -1 )
[35440, 35450, 35436, 35446] *(_DWORD *)(a1 + 7852) = *(_DWORD *)(a2 + 7852);
[35456, 35466, 35460, 35469] if ( *(_DWORD *)(a2 + 7708) != -1 )
[35481, 35475, 35485, 35471] *(_DWORD *)(a1 + 7708) = *(_DWORD *)(a2 + 7708);
[35504, 35491, 35501, 35495] if ( *(_DWORD *)(a2 + 1232) != -1 )
[35520, 35506, 35516, 35510] *(_DWORD *)(a1 + 1232) = *(_DWORD *)(a2 + 1232);
[35536, 35530, 35539, 35526] if ( *(_DWORD *)(a2 + 1240) != -1 )
[35545, 35555, 35541, 35551] *(_DWORD *)(a1 + 1240) = *(_DWORD *)(a2 + 1240);
[35561, 35571, 35565, 35574] if ( *(_DWORD *)(a2 + 1164) != -1 )
[35576, 35586, 35580, 35590] *(_DWORD *)(a1 + 1164) = *(_DWORD *)(a2 + 1164);
[35600, 35609, 35596, 35606] if ( *(_DWORD *)(a2 + 1160) != -1 )
[35625, 35611, 35621, 35615] *(_DWORD *)(a1 + 1160) = *(_DWORD *)(a2 + 1160);
[35641, 35635, 35644, 35631] if ( *(_DWORD *)(a2 + 1168) != -1 )
[35656, 35650, 35660, 35646] *(_DWORD *)(a1 + 1168) = *(_DWORD *)(a2 + 1168);
[35666, 35676, 35670, 35679] if ( *(_DWORD *)(a2 + 1184) != -1 )
[35681, 35691, 35685, 35695] *(_DWORD *)(a1 + 1184) = *(_DWORD *)(a2 + 1184);
[35705, 35714, 35701, 35711] if ( *(_DWORD *)(a2 + 1188) != -1 )
[35720, 35730, 35716, 35726] *(_DWORD *)(a1 + 1188) = *(_DWORD *)(a2 + 1188);
[35736, 35746, 35740, 35749] if ( *(_DWORD *)(a2 + 7660) != -1 )
[35761, 35755, 35765, 35751] *(_DWORD *)(a1 + 7660) = *(_DWORD *)(a2 + 7660);
[35784, 35771, 35781, 35775] if ( *(_DWORD *)(a2 + 7656) != -1 )
[35800, 35786, 35796, 35790] *(_DWORD *)(a1 + 7656) = *(_DWORD *)(a2 + 7656);
[35816, 35810, 35819, 35806] if ( *(_DWORD *)(a2 + 7680) != -1 )
[35825, 35835, 35821, 35831] *(_DWORD *)(a1 + 7680) = *(_DWORD *)(a2 + 7680);
[35841, 35851, 35845, 35854] if ( *(_DWORD *)(a2 + 7676) != -1 )
[35856, 35866, 35860, 35870] *(_DWORD *)(a1 + 7676) = *(_DWORD *)(a2 + 7676);
[35880, 35889, 35876, 35886] if ( *(_DWORD *)(a2 + 1200) != -1 )
[35905, 35891, 35901, 35895] *(_DWORD *)(a1 + 1200) = *(_DWORD *)(a2 + 1200);
[35921, 35915, 35924, 35911] if ( *(_DWORD *)(a2 + 1204) != -1 )
[35936, 35930, 35940, 35926] *(_DWORD *)(a1 + 1204) = *(_DWORD *)(a2 + 1204);
[35961, 35946, 35957, 35950] if ( *(_QWORD *)(a2 + 7808) != -1LL )
[35978, 35963, 35974, 35967] *(_QWORD *)(a1 + 7808) = *(_QWORD *)(a2 + 7808);
[35985, 35995, 35989, 35998] if ( *(_DWORD *)(a2 + 7816) != -1 )
[36000, 36010, 36004, 36014] *(_DWORD *)(a1 + 7816) = *(_DWORD *)(a2 + 7816);
[36024, 36033, 36020, 36030] if ( *(_DWORD *)(a2 + 1248) != -1 )
[36049, 36035, 36045, 36039] *(_DWORD *)(a1 + 1248) = *(_DWORD *)(a2 + 1248);
[36065, 36059, 36068, 36055] if ( *(_DWORD *)(a2 + 7872) != -1 )
[36080, 36074, 36084, 36070] *(_DWORD *)(a1 + 7872) = *(_DWORD *)(a2 + 7872);
[36090, 36100, 36094, 36103] if ( *(_DWORD *)(a2 + 1236) != -1 )
[36105, 36115, 36109, 36119] *(_DWORD *)(a1 + 1236) = *(_DWORD *)(a2 + 1236);
[36129, 36163, 36166, 36136, 36139, 36141, 36145, 36152, 36156, 36125] if ( *(_QWORD *)(a2 + 7664) && *(_QWORD *)(a1 + 7664) != *(_QWORD *)(a2 + 7664) )
{
[36168, 36179, 36172, 36182] free(*(void **)(a1 + 7664));
[36202, 36187, 36198, 36191] *(_QWORD *)(a1 + 7664) = *(_QWORD *)(a2 + 7664);
}
[36225, 36229, 36236, 36240, 36209, 36213, 36247, 36250, 36220, 36223] if ( *(_QWORD *)(a2 + 7760) && *(_QWORD *)(a1 + 7760) != *(_QWORD *)(a2 + 7760) )
{
[36256, 36266, 36252, 36263] free(*(void **)(a1 + 7760));
[36282, 36275, 36286, 36271] *(_QWORD *)(a1 + 7760) = *(_QWORD *)(a2 + 7760);
}
[36320, 36324, 36293, 36297, 36331, 36334, 36304, 36307, 36309, 36313] if ( *(_QWORD *)(a2 + 7752) && *(_QWORD *)(a1 + 7752) != *(_QWORD *)(a2 + 7752) )
{
[36336, 36347, 36340, 36350] free(*(void **)(a1 + 7752));
[36370, 36355, 36366, 36359] *(_QWORD *)(a1 + 7752) = *(_QWORD *)(a2 + 7752);
}
[36418, 36388, 36391, 36393, 36397, 36404, 36408, 36377, 36381, 36415] if ( *(_QWORD *)(a2 + 7768) && *(_QWORD *)(a1 + 7768) != *(_QWORD *)(a2 + 7768) )
{
[36424, 36434, 36420, 36431] free(*(void **)(a1 + 7768));
[36450, 36443, 36454, 36439] *(_QWORD *)(a1 + 7768) = *(_QWORD *)(a2 + 7768);
}
[36481, 36488, 36492, 36461, 36465, 36499, 36502, 36472, 36475, 36477] if ( *(_QWORD *)(a2 + 7776) && *(_QWORD *)(a1 + 7776) != *(_QWORD *)(a2 + 7776) )
{
[36504, 36515, 36508, 36518] free(*(void **)(a1 + 7776));
[36538, 36523, 36534, 36527] *(_QWORD *)(a1 + 7776) = *(_QWORD *)(a2 + 7776);
}
[36576, 36545, 36549, 36583, 36586, 36556, 36559, 36561, 36565, 36572] if ( *(_QWORD *)(a2 + 7784) && *(_QWORD *)(a1 + 7784) != *(_QWORD *)(a2 + 7784) )
{
[36592, 36602, 36588, 36599] free(*(void **)(a1 + 7784));
[36618, 36611, 36622, 36607] *(_QWORD *)(a1 + 7784) = *(_QWORD *)(a2 + 7784);
}
[36640, 36643, 36645, 36649, 36656, 36660, 36629, 36633, 36667, 36670] if ( *(_QWORD *)(a2 + 7792) && *(_QWORD *)(a1 + 7792) != *(_QWORD *)(a2 + 7792) )
{
[36672, 36683, 36676, 36686] free(*(void **)(a1 + 7792));
[36706, 36691, 36702, 36695] *(_QWORD *)(a1 + 7792) = *(_QWORD *)(a2 + 7792);
}
[36740, 36744, 36713, 36717, 36751, 36754, 36724, 36727, 36729, 36733] if ( *(_QWORD *)(a2 + 7800) && *(_QWORD *)(a1 + 7800) != *(_QWORD *)(a2 + 7800) )
{
[36760, 36770, 36756, 36767] free(*(void **)(a1 + 7800));
[36786, 36779, 36790, 36775] *(_QWORD *)(a1 + 7800) = *(_QWORD *)(a2 + 7800);
}
[36801, 36835, 36838, 36808, 36811, 36813, 36817, 36824, 36828, 36797] if ( *(_QWORD *)(a2 + 1272) && *(_QWORD *)(a1 + 1272) != *(_QWORD *)(a2 + 1272) )
{
[36840, 36851, 36844, 36854] free(*(void **)(a1 + 1272));
[36874, 36859, 36870, 36863] *(_QWORD *)(a1 + 1272) = *(_QWORD *)(a2 + 1272);
}
[36897, 36901, 36908, 36912, 36881, 36885, 36919, 36922, 36892, 36895] if ( *(_QWORD *)(a2 + 1304) && *(_QWORD *)(a1 + 1304) != *(_QWORD *)(a2 + 1304) )
{
[36928, 36938, 36924, 36935] free(*(void **)(a1 + 1304));
[36954, 36947, 36958, 36943] *(_QWORD *)(a1 + 1304) = *(_QWORD *)(a2 + 1304);
}
[36992, 36996, 36965, 36969, 37003, 37006, 36976, 36979, 36981, 36985] if ( *(_QWORD *)(a2 + 1288) && *(_QWORD *)(a1 + 1288) != *(_QWORD *)(a2 + 1288) )
{
[37008, 37019, 37012, 37022] free(*(void **)(a1 + 1288));
[37042, 37027, 37038, 37031] *(_QWORD *)(a1 + 1288) = *(_QWORD *)(a2 + 1288);
}
[37090, 37060, 37063, 37065, 37069, 37076, 37080, 37049, 37053, 37087] if ( *(_QWORD *)(a2 + 1064) && *(_QWORD *)(a1 + 1064) != *(_QWORD *)(a2 + 1064) )
{
[37096, 37106, 37092, 37103] free(*(void **)(a1 + 1064));
[37122, 37115, 37126, 37111] *(_QWORD *)(a1 + 1064) = *(_QWORD *)(a2 + 1064);
}
[37153, 37160, 37164, 37133, 37137, 37171, 37174, 37144, 37147, 37149] if ( *(_QWORD *)(a2 + 1360) && *(_QWORD *)(a1 + 1360) != *(_QWORD *)(a2 + 1360) )
{
[37176, 37187, 37180, 37190] free(*(void **)(a1 + 1360));
[37210, 37195, 37206, 37199] *(_QWORD *)(a1 + 1360) = *(_QWORD *)(a2 + 1360);
}
[37217, 37227, 37221, 37229] if ( *(_DWORD *)(a2 + 7684) )
{
[37280, 37284, 37290, 37293, 37235, 37242, 37276] for ( i = 0; i < *(_DWORD *)(a1 + 7684); ++i )
[37248, 37255, 37258, 37262, 37265, 37268, 37271, 37244] free(*(void **)(8LL * i + *(_QWORD *)(a1 + 7688)));
[37306, 37299, 37309, 37295] free(*(void **)(a1 + 7688));
[37314, 37318, 37324, 37326, 37331, 37334, 37339, 37343] *(_QWORD *)(a1 + 7688) = xcalloc(*(unsigned int *)(a2 + 7684), 8LL);
[37350, 37416, 37420, 37357, 37424, 37430, 37433] for ( j = 0; j < *(_DWORD *)(a2 + 7684); ++j )
{
[37380, 37383, 37387, 37394, 37397, 37401] v3 = (_QWORD *)(*(_QWORD *)(a1 + 7688) + 8LL * j);
[37408, 37377, 37405, 37413, 37359, 37363, 37370, 37373] *v3 = xstrdup(*(_QWORD *)(8LL * j + *(_QWORD *)(a2 + 7688)));
}
[37449, 37435, 37445, 37439] *(_DWORD *)(a1 + 7684) = *(_DWORD *)(a2 + 7684);
}
[37465, 37467, 37459, 37455] if ( *(_DWORD *)(a2 + 1388) )
{
[37473, 37480, 37514, 37518, 37522, 37528, 37531] for ( k = 0; k < *(_DWORD *)(a1 + 1388); ++k )
[37506, 37509, 37482, 37486, 37493, 37496, 37500, 37503] free(*(void **)(8LL * k + *(_QWORD *)(a1 + 1392)));
[37544, 37537, 37547, 37533] free(*(void **)(a1 + 1392));
[37569, 37572, 37577, 37581, 37552, 37556, 37562, 37564] *(_QWORD *)(a1 + 1392) = xcalloc(*(unsigned int *)(a2 + 1388), 8LL);
[37668, 37671, 37588, 37654, 37658, 37595, 37662] for ( m = 0; m < *(_DWORD *)(a2 + 1388); ++m )
{
[37632, 37635, 37639, 37618, 37621, 37625] v4 = (_QWORD *)(*(_QWORD *)(a1 + 1392) + 8LL * m);
[37601, 37608, 37611, 37643, 37646, 37615, 37651, 37597] *v4 = xstrdup(*(_QWORD *)(8LL * m + *(_QWORD *)(a2 + 1392)));
}
[37673, 37683, 37677, 37687] *(_DWORD *)(a1 + 1388) = *(_DWORD *)(a2 + 1388);
}
[37705, 37697, 37693, 37703] if ( *(_DWORD *)(a2 + 1400) )
{
[37760, 37766, 37769, 37711, 37718, 37752, 37756] for ( n = 0; n < *(_DWORD *)(a1 + 1400); ++n )
[37731, 37734, 37738, 37741, 37744, 37747, 37720, 37724] free(*(void **)(8LL * n + *(_QWORD *)(a1 + 1408)));
[37785, 37771, 37782, 37775] free(*(void **)(a1 + 1408));
[37794, 37800, 37802, 37807, 37810, 37815, 37819, 37790] *(_QWORD *)(a1 + 1408) = xcalloc(*(unsigned int *)(a2 + 1400), 8LL);
[37826, 37892, 37896, 37833, 37900, 37906, 37909] for ( ii = 0; ii < *(_DWORD *)(a2 + 1400); ++ii )
{
[37856, 37859, 37863, 37870, 37873, 37877] v5 = (_QWORD *)(*(_QWORD *)(a1 + 1408) + 8LL * ii);
[37889, 37835, 37839, 37846, 37881, 37849, 37884, 37853] *v5 = xstrdup(*(_QWORD *)(8LL * ii + *(_QWORD *)(a2 + 1408)));
}
[37921, 37915, 37925, 37911] *(_DWORD *)(a1 + 1400) = *(_DWORD *)(a2 + 1400);
}
[37943, 37931, 37941, 37935] if ( *(_DWORD *)(a2 + 1416) )
{
[37956, 37990, 37994, 37998, 38004, 38007, 37949] for ( jj = 0; jj < *(_DWORD *)(a1 + 1416); ++jj )
[37985, 37958, 37962, 37969, 37972, 37976, 37979, 37982] free(*(void **)(8LL * jj + *(_QWORD *)(a1 + 1424)));
[38009, 38020, 38013, 38023] free(*(void **)(a1 + 1424));
[38048, 38053, 38057, 38028, 38032, 38038, 38040, 38045] *(_QWORD *)(a1 + 1424) = xcalloc(*(unsigned int *)(a2 + 1416), 8LL);
[38144, 38147, 38064, 38130, 38134, 38071, 38138] for ( kk = 0; kk < *(_DWORD *)(a2 + 1416); ++kk )
{
[38115, 38094, 38097, 38101, 38108, 38111] v6 = (_QWORD *)(*(_QWORD *)(a1 + 1424) + 8LL * kk);
[38084, 38087, 38119, 38122, 38091, 38127, 38073, 38077] *v6 = xstrdup(*(_QWORD *)(8LL * kk + *(_QWORD *)(a2 + 1424)));
}
[38153, 38163, 38149, 38159] *(_DWORD *)(a1 + 1416) = *(_DWORD *)(a2 + 1416);
}
[38181, 38169, 38179, 38173] if ( *(_DWORD *)(a2 + 1432) )
{
[38242, 38245, 38187, 38194, 38228, 38232, 38236] for ( mm = 0; mm < *(_DWORD *)(a1 + 1432); ++mm )
[38210, 38214, 38217, 38220, 38223, 38196, 38200, 38207] free(*(void **)(8LL * mm + *(_QWORD *)(a1 + 1440)));
[38258, 38251, 38261, 38247] free(*(void **)(a1 + 1440));
[38276, 38278, 38283, 38286, 38291, 38295, 38266, 38270] *(_QWORD *)(a1 + 1440) = xcalloc(*(unsigned int *)(a2 + 1432), 8LL);
[38368, 38372, 38309, 38376, 38382, 38385, 38302] for ( nn = 0; nn < *(_DWORD *)(a2 + 1432); ++nn )
{
[38339, 38346, 38349, 38353, 38332, 38335] v7 = (_QWORD *)(*(_QWORD *)(a1 + 1440) + 8LL * nn);
[38311, 38315, 38322, 38325, 38357, 38360, 38329, 38365] *v7 = xstrdup(*(_QWORD *)(8LL * nn + *(_QWORD *)(a2 + 1440)));
}
[38401, 38387, 38397, 38391] *(_DWORD *)(a1 + 1432) = *(_DWORD *)(a2 + 1432);
}
[38419, 38417, 38411, 38407] if ( *(_DWORD *)(a2 + 7600) )
{
[38432, 38466, 38470, 38474, 38480, 38483, 38425] for ( i1 = 0; i1 < *(_DWORD *)(a1 + 7600); ++i1 )
[38434, 38438, 38445, 38448, 38452, 38455, 38458, 38461] free(*(void **)(8LL * i1 + *(_QWORD *)(a1 + 7608)));
[38496, 38489, 38499, 38485] free(*(void **)(a1 + 7608));
[38529, 38533, 38504, 38508, 38514, 38516, 38521, 38524] *(_QWORD *)(a1 + 7608) = xcalloc(*(unsigned int *)(a2 + 7600), 8LL);
[38540, 38606, 38610, 38547, 38614, 38620, 38623] for ( i2 = 0; i2 < *(_DWORD *)(a2 + 7600); ++i2 )
{
[38570, 38573, 38577, 38584, 38587, 38591] v8 = (_QWORD *)(*(_QWORD *)(a1 + 7608) + 8LL * i2);
[38560, 38563, 38595, 38598, 38567, 38603, 38549, 38553] *v8 = xstrdup(*(_QWORD *)(8LL * i2 + *(_QWORD *)(a2 + 7608)));
}
[38625, 38635, 38629, 38639] *(_DWORD *)(a1 + 7600) = *(_DWORD *)(a2 + 7600);
}
[38649, 38645, 38657, 38655] if ( *(_DWORD *)(a2 + 7616) )
{
[38721, 38663, 38670, 38704, 38708, 38712, 38718] for ( i3 = 0; i3 < *(_DWORD *)(a1 + 7616); ++i3 )
[38690, 38693, 38696, 38699, 38672, 38676, 38683, 38686] free(*(void **)(8LL * i3 + *(_QWORD *)(a1 + 7624)));
[38737, 38723, 38734, 38727] free(*(void **)(a1 + 7624));
[38752, 38754, 38759, 38762, 38767, 38771, 38742, 38746] *(_QWORD *)(a1 + 7624) = xcalloc(*(unsigned int *)(a2 + 7616), 8LL);
[38848, 38785, 38852, 38858, 38861, 38778, 38844] for ( i4 = 0; i4 < *(_DWORD *)(a2 + 7616); ++i4 )
{
[38822, 38825, 38829, 38808, 38811, 38815] v9 = (_QWORD *)(*(_QWORD *)(a1 + 7624) + 8LL * i4);
[38787, 38791, 38798, 38801, 38833, 38836, 38805, 38841] *v9 = xstrdup(*(_QWORD *)(8LL * i4 + *(_QWORD *)(a2 + 7624)));
}
[38873, 38867, 38877, 38863] *(_DWORD *)(a1 + 7616) = *(_DWORD *)(a2 + 7616);
}
[38895, 38883, 38893, 38887] if ( *(_DWORD *)(a2 + 7832) )
{
[38946, 38950, 38956, 38959, 38901, 38908, 38942] for ( i5 = 0; i5 < *(_DWORD *)(a1 + 7832); ++i5 )
[38914, 38921, 38924, 38928, 38931, 38934, 38937, 38910] free(*(void **)(8LL * i5 + *(_QWORD *)(a1 + 7840)));
[38961, 38972, 38965, 38975] free(*(void **)(a1 + 7840));
[39009, 38980, 38984, 38990, 38992, 38997, 39000, 39005] *(_QWORD *)(a1 + 7840) = xcalloc(*(unsigned int *)(a2 + 7832), 8LL);
[39016, 39082, 39086, 39023, 39090, 39096, 39099] for ( i6 = 0; i6 < *(_DWORD *)(a2 + 7832); ++i6 )
{
[39046, 39049, 39053, 39060, 39063, 39067] v10 = (_QWORD *)(*(_QWORD *)(a1 + 7840) + 8LL * i6);
[39071, 39074, 39043, 39079, 39025, 39029, 39036, 39039] *v10 = xstrdup(*(_QWORD *)(8LL * i6 + *(_QWORD *)(a2 + 7840)));
}
[39105, 39115, 39101, 39111] *(_DWORD *)(a1 + 7832) = *(_DWORD *)(a2 + 7832);
}
[39133, 39121, 39131, 39125] if ( *(_DWORD *)(a2 + 7720) )
{
[39139, 39146, 39180, 39184, 39188, 39194, 39197] for ( i7 = 0; i7 < *(_DWORD *)(a1 + 7720); ++i7 )
[39169, 39172, 39175, 39148, 39152, 39159, 39162, 39166] free(*(void **)(8LL * i7 + *(_QWORD *)(a1 + 7712)));
[39210, 39203, 39213, 39199] free(*(void **)(a1 + 7712));
[39235, 39238, 39243, 39247, 39218, 39222, 39228, 39230] *(_QWORD *)(a1 + 7712) = xcalloc(*(unsigned int *)(a2 + 7720), 8LL);
[39328, 39334, 39337, 39254, 39320, 39324, 39261] for ( i8 = 0; i8 < *(_DWORD *)(a2 + 7720); ++i8 )
{
[39298, 39301, 39305, 39284, 39287, 39291] v11 = (_QWORD *)(*(_QWORD *)(a1 + 7712) + 8LL * i8);
[39267, 39274, 39277, 39309, 39312, 39281, 39317, 39263] *v11 = xstrdup(*(_QWORD *)(8LL * i8 + *(_QWORD *)(a2 + 7712)));
}
[39353, 39339, 39349, 39343] *(_DWORD *)(a1 + 7720) = *(_DWORD *)(a2 + 7720);
}
[39369, 39363, 39371, 39359] if ( *(_DWORD *)(a2 + 7736) )
{
[39426, 39432, 39435, 39377, 39384, 39418, 39422] for ( i9 = 0; i9 < *(_DWORD *)(a1 + 7736); ++i9 )
[39397, 39400, 39404, 39407, 39410, 39413, 39386, 39390] free(*(void **)(8LL * i9 + *(_QWORD *)(a1 + 7728)));
[39448, 39441, 39451, 39437] free(*(void **)(a1 + 7728));
[39456, 39460, 39466, 39468, 39473, 39476, 39481, 39485] *(_QWORD *)(a1 + 7728) = xcalloc(*(unsigned int *)(a2 + 7736), 8LL);
[39492, 39558, 39562, 39499, 39566, 39572, 39575] for ( i10 = 0; i10 < *(_DWORD *)(a2 + 7736); ++i10 )
{
[39522, 39525, 39529, 39536, 39539, 39543] v12 = (_QWORD *)(*(_QWORD *)(a1 + 7728) + 8LL * i10);
[39555, 39501, 39547, 39505, 39512, 39515, 39550, 39519] *v12 = xstrdup(*(_QWORD *)(8LL * i10 + *(_QWORD *)(a2 + 7728)));
}
[39577, 39587, 39581, 39591] *(_DWORD *)(a1 + 7736) = *(_DWORD *)(a2 + 7736);
}
[39601, 39609, 39597, 39607] if ( *(_DWORD *)(a2 + 1252) )
{
[39622, 39656, 39660, 39664, 39670, 39673, 39615] for ( i11 = 0; i11 < *(_DWORD *)(a1 + 1252); ++i11 )
[39648, 39651, 39624, 39628, 39635, 39638, 39642, 39645] free(*(void **)(8LL * i11 + *(_QWORD *)(a1 + 1256)));
[39689, 39675, 39686, 39679] free(*(void **)(a1 + 1256));
[39714, 39719, 39723, 39694, 39698, 39704, 39706, 39711] *(_QWORD *)(a1 + 1256) = xcalloc(*(unsigned int *)(a2 + 1252), 8LL);
[39810, 39813, 39730, 39796, 39800, 39737, 39804] for ( i12 = 0; i12 < *(_DWORD *)(a2 + 1252); ++i12 )
{
[39777, 39781, 39760, 39763, 39767, 39774] v13 = (_QWORD *)(*(_QWORD *)(a1 + 1256) + 8LL * i12);
[39750, 39753, 39785, 39788, 39757, 39793, 39739, 39743] *v13 = xstrdup(*(_QWORD *)(8LL * i12 + *(_QWORD *)(a2 + 1256)));
}
[39825, 39819, 39829, 39815] *(_DWORD *)(a1 + 1252) = *(_DWORD *)(a2 + 1252);
}
[39842, 39835, 39839] assemble_algorithms(a1);
[39851, 39847] if ( !a3 )
{
[39873, 39877, 39884, 39888, 39857, 39861, 39895, 39898, 39868, 39871] if ( *(_QWORD *)(a2 + 7696) && *(_QWORD *)(a1 + 7696) != *(_QWORD *)(a2 + 7696) )
{
[39904, 39914, 39900, 39911] free(*(void **)(a1 + 7696));
[39930, 39923, 39934, 39919] *(_QWORD *)(a1 + 7696) = *(_QWORD *)(a2 + 7696);
}
[39941, 39945, 39952, 39955, 39960, 39962] if ( option_clear_or_none(*(const char **)(a1 + 7696)) )
{
[39968, 39978, 39964, 39975] free(*(void **)(a1 + 7696));
[39987, 39983] *(_QWORD *)(a1 + 7696) = 0LL;
}
[40002, 40036, 40039, 40009, 40012, 40014, 40018, 40025, 40029, 39998] if ( *(_QWORD *)(a2 + 7744) && *(_QWORD *)(a1 + 7744) != *(_QWORD *)(a2 + 7744) )
{
[40041, 40052, 40045, 40055] free(*(void **)(a1 + 7744));
[40064, 40075, 40060, 40071] *(_QWORD *)(a1 + 7744) = *(_QWORD *)(a2 + 7744);
}
[40096, 40101, 40103, 40082, 40086, 40093] if ( option_clear_or_none(*(const char **)(a1 + 7744)) )
{
[40105, 40116, 40109, 40119] free(*(void **)(a1 + 7744));
[40128, 40139, 40124] *(_QWORD *)(a1 + 7744) = 0LL;
}
}
[40146, 40147, 40148, 40142] }
// E660: using guessed type long xstrdup(_QWORD);
// E838: using guessed type long xcalloc(_QWORD, _QWORD);
//----- (0000000000009CD5) ----------------------------------------------------
unsigned long parse_server_config_depth(
long a1,
const char *a2,
long a3,
long *a4,
long a5,
int a6,
int *a7,
unsigned int a8)
{
const char *v8; // rbx
long v9; // rax
unsigned int v10; // ebx
int v12; // [rsp+14h] [rbp-6Ch] BYREF
long v13; // [rsp+18h] [rbp-68h]
long *v14; // [rsp+20h] [rbp-60h]
long v15; // [rsp+28h] [rbp-58h]
const char *v16; // [rsp+30h] [rbp-50h]
long v17; // [rsp+38h] [rbp-48h]
int v18; // [rsp+48h] [rbp-38h]
unsigned int v19; // [rsp+4Ch] [rbp-34h]
char *stringp; // [rsp+50h] [rbp-30h] BYREF
void *ptr; // [rsp+58h] [rbp-28h]
char *v22; // [rsp+60h] [rbp-20h]
unsigned long v23; // [rsp+68h] [rbp-18h]
v17 = a1;
v16 = a2;
v15 = a3;
v14 = a4;
v13 = a5;
v12 = a6;
v23 = __readfsqword(0x28u);
v19 = 0;
if ( a8 >= 0x11 )
sshfatal(
"servconf.c",
"parse_server_config_depth",
2694LL,
0LL,
1LL,
0LL,
"Too many recursive configuration includes");
if ( (v12 & 4) != 0 )
v8 = " [checking syntax only]";
else
v8 = (const char *)&unk_B83A;
v9 = sshbuf_len(v15);
sshlog("servconf.c", "parse_server_config_depth", 2696LL, 1LL, 6LL, 0LL, "config %s len %zu%s", v16, v9, v8);
stringp = (char *)sshbuf_dup_string(v15);
ptr = stringp;
if ( !stringp )
sshfatal("servconf.c", "parse_server_config_depth", 2700LL, 1LL, 1LL, 0LL, "sshbuf_dup_string failed");
v18 = 1;
while ( 1 )
{
v22 = strsep(&stringp, "\n");
if ( !v22 )
break;
v10 = v18++;
if ( (unsigned int)process_server_config_line_depth(v17, v22, v16, v10, a7, v13, &v12, a8, v14) )
++v19;
}
free(ptr);
if ( (int)v19 > 0 )
sshfatal(
"servconf.c",
"parse_server_config_depth",
2710LL,
0LL,
1LL,
0LL,
"%s: terminating, %d bad configuration options",
v16,
v19);
return __readfsqword(0x28u) ^ v23;
}
// E640: using guessed type long sshfatal(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E8E8: using guessed type long sshbuf_len(_QWORD);
// E918: using guessed type long sshbuf_dup_string(_QWORD);
//----- (0000000000009F0F) ----------------------------------------------------
unsigned long parse_server_config(
long a1,
const char *a2,
long a3,
long *a4,
long a5,
int a6)
{
int v6; // r9d
_BOOL4 v9; // [rsp+34h] [rbp-Ch] BYREF
unsigned long v10; // [rsp+38h] [rbp-8h]
v10 = __readfsqword(0x28u);
v9 = a5 == 0;
if ( a5 )
v6 = 8;
else
v6 = 0;
parse_server_config_depth(a1, a2, a3, a4, a5, v6, (int *)&v9, 0);
if ( !a6 )
process_queued_listen_addrs(a1);
return __readfsqword(0x28u) ^ v10;
}
//----- (0000000000009FB5) ----------------------------------------------------
const char * fmt_multistate_int(int a1, long a2)
[40885] {
unsigned int i; // [rsp+1Ch] [rbp-4h]
[40896, 40960, 40963, 40900, 40967, 40970, 40907, 40974, 40977, 40980, 40885, 40983, 40889, 40890, 40956, 40893, 40985] for ( i = 0; *(_QWORD *)(16LL * i + a2); ++i )
{
[40929, 40932, 40909, 40912, 40916, 40919, 40923, 40926] if ( a1 == *(_DWORD *)(16LL * i + a2 + 8) )
[40934, 40937, 40941, 40944, 40948, 40951, 40954] return *(const char **)(16LL * i + a2);
}
[40992] return "UNKNOWN";
[40993] }
//----- (000000000000A022) ----------------------------------------------------
const char * fmt_intarg(unsigned int a1, int a2)
[40994] {
const char *result; // rax
[40994, 40998, 40999, 41002, 41006, 41009, 41012, 41016] if ( a2 == -1 )
[41025, 41018] return "unset";
[41034, 41030] if ( a1 == 91 )
[41266, 41276, 41269, 41271] return (const char *)ssh_digest_alg_name((unsigned int)a2);
[41040, 41044] if ( a1 > 0x5B )
goto LABEL_18;
[41050, 41054] if ( a1 > 0x28 )
{
[41120, 41122, 41116] if ( a1 == 90 )
[41226, 41219, 41212, 41221] return fmt_multistate_int(a2, (long)&multistate_tcpfwd);
goto LABEL_18;
}
[41056, 41066, 41060, 41069] if ( a1 < 5 )
{
LABEL_18:
[41282, 41278] if ( !a2 )
[41299, 41292] return "no";
[41288, 41284] if ( a2 == 1 )
[41308, 41301] return "yes";
[41290] return "UNKNOWN";
}
[41113, 41091, 41098, 41101, 41103, 41072, 41075, 41110, 41081, 41083] switch ( a1 )
{
case 5u:
[41152, 41161, 41149, 41159] result = fmt_multistate_int(a2, (long)&multistate_permitrootlogin);
[41166] break;
case 0x10u:
[41137, 41130, 41139, 41127] result = fmt_multistate_int(a2, (long)&multistate_addressfamily);
[41144] break;
case 0x13u:
[41257, 41250, 41259, 41247] result = fmt_multistate_int(a2, (long)&multistate_ignore_rhosts);
[41264] break;
case 0x1Cu:
[41209, 41219, 41212, 41221] return fmt_multistate_int(a2, (long)&multistate_tcpfwd);
case 0x1Du:
[41200, 41193, 41202, 41190] result = fmt_multistate_int(a2, (long)&multistate_compression);
[41207] break;
case 0x28u:
[41171, 41181, 41174, 41183] result = fmt_multistate_int(a2, (long)&multistate_gatewayports);
[41188] break;
default:
goto LABEL_18;
}
[41317] return result;
[41318] }
// DF40: using guessed type char *multistate_ignore_rhosts;
// DF80: using guessed type char *multistate_addressfamily;
// DFC0: using guessed type char *multistate_permitrootlogin;
// E020: using guessed type char *multistate_compression;
// E060: using guessed type char *multistate_gatewayports;
// E0A0: using guessed type char *multistate_tcpfwd;
// E920: using guessed type long ssh_digest_alg_name(_QWORD);
//----- (000000000000A167) ----------------------------------------------------
int dump_cfg_int(int a1, unsigned int a2)
[41319] {
const char *v2; // rax
[41319, 41323, 41324, 41327, 41331, 41334, 41337, 41340, 41342] v2 = lookup_opcode_name(a1);
[41376, 41347, 41350, 41353, 41355, 41358, 41365, 41370, 41375] return printf("%s %d\n", v2, a2);
[41377] }
//----- (000000000000A1A2) ----------------------------------------------------
int dump_cfg_oct(int a1, unsigned int a2)
[41378] {
const char *v2; // rax
[41378, 41382, 41383, 41386, 41390, 41393, 41396, 41399, 41401] v2 = lookup_opcode_name(a1);
[41409, 41412, 41414, 41417, 41424, 41429, 41434, 41435, 41406] return printf("%s 0%o\n", v2, a2);
[41436] }
//----- (000000000000A1DD) ----------------------------------------------------
int dump_cfg_fmtint(unsigned int a1, int a2)
[41437] {
const char *v2; // rbx
const char *v3; // rax
[41441, 41442, 41445, 41446, 41450, 41453, 41456, 41459, 41462, 41464, 41466, 41437, 41471] v2 = fmt_intarg(a1, a2);
[41474, 41477, 41479] v3 = lookup_opcode_name(a1);
[41507, 41508, 41484, 41487, 41490, 41497, 41502] return printf("%s %s\n", v3, v2);
[41512, 41513, 41514] }
//----- (000000000000A22B) ----------------------------------------------------
int dump_cfg_string(int a1, const char *a2)
[41515] {
const char *v2; // rbx
const char *v3; // rax
[41540, 41515, 41519, 41520, 41523, 41524, 41528, 41531, 41535] if ( a2 )
[41546, 41542] v2 = a2;
else
[41548] v2 = "none";
[41560, 41555, 41558] v3 = lookup_opcode_name(a1);
[41568, 41571, 41578, 41583, 41588, 41589, 41565] return printf("%s %s\n", v3, v2);
[41593, 41594, 41595] }
//----- (000000000000A27C) ----------------------------------------------------
long dump_cfg_strarray(int a1, unsigned int a2, long a3)
[41596] {
const char *v3; // rbx
const char *v4; // rax
long result; // rax
unsigned int i; // [rsp+1Ch] [rbp-14h]
[41600, 41601, 41604, 41605, 41609, 41612, 41615, 41682, 41619, 41626, 41596] for ( i = 0; ; ++i )
{
[41686] result = i;
[41689, 41692] if ( i >= a2 )
break;
[41639, 41643, 41646, 41628, 41631] v3 = *(const char **)(8LL * i + a3);
[41649, 41652, 41654] v4 = lookup_opcode_name(a1);
[41665, 41672, 41677, 41659, 41662] printf("%s %s\n", v4, v3);
}
[41696, 41694, 41695] return result;
[41700, 41701, 41702] }
//----- (000000000000A2E7) ----------------------------------------------------
void dump_cfg_strarray_oneline(int a1, unsigned int a2, long a3)
[41703] {
const char *v3; // rax
unsigned int i; // [rsp+1Ch] [rbp-4h]
[41729, 41731, 41703, 41735, 41707, 41708, 41711, 41715, 41718, 41721, 41725] if ( a2 || a1 == 85 )
{
[41744, 41746, 41741] v3 = lookup_opcode_name(a1);
[41761, 41754, 41766, 41751] printf("%s", v3);
[41825, 41828, 41831, 41771, 41778, 41821] for ( i = 0; i < a2; ++i )
[41795, 41798, 41801, 41804, 41811, 41780, 41783, 41816, 41791] printf(" %s", *(const char **)(8LL * i + a3));
[41833, 41843, 41837, 41839] if ( a1 == 85 && !a2 )
[41857, 41852, 41845] printf(" any");
[41874, 41869, 41862, 41879] printf("\n");
}
[41882, 41883] }
//----- (000000000000A39C) ----------------------------------------------------
void * format_listen_addrs(long a1)
[41884] {
const char *v1; // rax
const char *v2; // rax
const char *v3; // rdx
const char *v4; // rax
const char *v5; // rdx
unsigned int v7; // [rsp+14h] [rbp-44Ch]
void *v8; // [rsp+18h] [rbp-448h] BYREF
long i; // [rsp+20h] [rbp-440h]
void *ptr; // [rsp+28h] [rbp-438h]
char serv[32]; // [rsp+30h] [rbp-430h] BYREF
char host[1032]; // [rsp+50h] [rbp-410h] BYREF
unsigned long v13; // [rsp+458h] [rbp-8h]
[41888, 41889, 41892, 41899, 41906, 41915, 41884] v13 = __readfsqword(0x28u);
[41928, 41921, 41933, 41919] v8 = (void *)xstrdup(&unk_B83A);
[41940] ptr = 0LL;
[41958, 41962, 42442, 42446, 41969, 42453, 42461, 41951] for ( i = *(_QWORD *)(a1 + 8); i; i = *(_QWORD *)(i + 40) )
{
[41984, 42021, 42041, 41991, 42024, 41995, 42029, 42032, 42002, 42013, 42037, 41974, 42009, 41981, 42015] v7 = getnameinfo(*(const struct sockaddr **)(i + 24), *(_DWORD *)(i + 16), host, 0x401u, serv, 0x20u, 3);
[42054, 42047] if ( v7 )
{
[42056, 42064, 42062] v1 = (const char *)ssh_gai_strerror(v7);
[42114, 42084, 42119, 42090, 42124, 42095, 42128, 42100, 42069, 42070, 42107, 42077, 42078] sshlog("servconf.c", "format_listen_addrs", 2838LL, 0LL, 2LL, 0LL, "getnameinfo: %.100s", v1);
}
else
{
[42140, 42133] ptr = v8;
[42160, 42154, 42147, 42157] if ( *(_DWORD *)(i + 4) == 10 )
{
[42176, 42179, 42173, 42166] if ( *(_QWORD *)a1 )
[42188, 42181, 42191] v2 = *(const char **)a1;
else
[42193] v2 = (const char *)&unk_B83A;
[42200, 42210, 42213, 42207] if ( *(_QWORD *)a1 )
[42224] v3 = " rdomain ";
else
[42222, 42215] v3 = (const char *)&unk_B83A;
[42245, 42278, 42283, 42252, 42256, 42288, 42292, 42262, 42231, 42265, 42268, 42238, 42271] xasprintf(&v8, "listenaddress [%s]:%s%s%s\n%s", host, serv, v3, v2, (const char *)ptr);
}
else
{
[42304, 42307, 42301, 42294] if ( *(_QWORD *)a1 )
[42316, 42309, 42319] v4 = *(const char **)a1;
else
[42321] v4 = (const char *)&unk_B83A;
[42328, 42338, 42341, 42335] if ( *(_QWORD *)a1 )
[42352] v5 = " rdomain ";
else
[42350, 42343] v5 = (const char *)&unk_B83A;
[42373, 42406, 42411, 42380, 42384, 42416, 42390, 42359, 42393, 42396, 42366, 42399] xasprintf(&v8, "listenaddress %s:%s%s%s\n%s", host, serv, v5, v4, (const char *)ptr);
}
[42435, 42427, 42420, 42430] free(ptr);
}
}
[42467, 42474, 42478, 42487, 42489, 42494] return v8;
[42495] }
// E660: using guessed type long xstrdup(_QWORD);
// E678: using guessed type long sshlog(_QWORD, _QWORD, _QWORD, _QWORD, _QWORD, _QWORD, const char *, ...);
// E6B0: using guessed type long xasprintf(_QWORD, const char *, ...);
// E6D8: using guessed type long ssh_gai_strerror(_QWORD);
//----- (000000000000A600) ----------------------------------------------------
int dump_config(long a1)
[42496] {
const char *v1; // rax
const char *v2; // rax
const char *v3; // rax
const char *v4; // rax
const char *v5; // rax
unsigned int i; // [rsp+14h] [rbp-Ch]
unsigned int j; // [rsp+14h] [rbp-Ch]
unsigned int k; // [rsp+14h] [rbp-Ch]
unsigned int m; // [rsp+14h] [rbp-Ch]
unsigned int n; // [rsp+14h] [rbp-Ch]
unsigned int ii; // [rsp+14h] [rbp-Ch]
char *ptr; // [rsp+18h] [rbp-8h]
for ( i = 0; i < *(_DWORD *)a1; ++i )
[42496, 42561, 42500, 42501, 42551, 42564, 42504, 42508, 42512, 42519, 42555, 42559] printf("port %d\n", *(unsigned int *)(a1 + 4LL * i + 8));
[42528, 42532, 42534, 42541, 42546, 42521, 42525] dump_cfg_fmtint(0x10u, *(_DWORD *)(a1 + 1060));
[42566, 42570, 42576, 42578, 42583] for ( j = 0; j < *(_DWORD *)(a1 + 1056); ++j )
[42595, 42666, 42670, 42674, 42680, 42683, 42588] {
ptr = (char *)format_listen_addrs(16LL * j + *(_QWORD *)(a1 + 1048));
[42626, 42597, 42601, 42608, 42611, 42615, 42618, 42621] printf("%s", ptr);
[42630, 42634, 42637, 42644, 42649] free(ptr);
[42658, 42661, 42654] }
dump_cfg_int(4, *(_DWORD *)(a1 + 1136));
[42689, 42695, 42697, 42702, 42685] dump_cfg_int(21, *(_DWORD *)(a1 + 1164));
[42724, 42707, 42711, 42717, 42719] dump_cfg_int(46, *(_DWORD *)(a1 + 7656));
[42729, 42733, 42739, 42741, 42746] dump_cfg_int(47, *(_DWORD *)(a1 + 7660));
[42755, 42761, 42763, 42768, 42751] dump_cfg_int(56, *(_DWORD *)(a1 + 7676));
[42785, 42790, 42773, 42777, 42783] dump_cfg_int(57, *(_DWORD *)(a1 + 7680));
[42795, 42799, 42805, 42807, 42812] dump_cfg_int(97, *(_DWORD *)(a1 + 7872));
[42817, 42821, 42827, 42829, 42834] dump_cfg_oct(88, *(_DWORD *)(a1 + 1236));
[42849, 42851, 42856, 42839, 42843] dump_cfg_fmtint(5u, *(_DWORD *)(a1 + 1140));
[42861, 42865, 42871, 42873, 42878] dump_cfg_fmtint(0x13u, *(_DWORD *)(a1 + 1144));
[42883, 42887, 42893, 42895, 42900] dump_cfg_fmtint(0x23u, *(_DWORD *)(a1 + 1148));
[42915, 42917, 42922, 42905, 42909] dump_cfg_fmtint(0x32u, *(_DWORD *)(a1 + 1264));
[42944, 42927, 42931, 42937, 42939] dump_cfg_fmtint(0x33u, *(_DWORD *)(a1 + 1268));
[42949, 42953, 42959, 42961, 42966] dump_cfg_fmtint(0x29u, *(_DWORD *)(a1 + 1296));
[42981, 42983, 42988, 42971, 42975] dump_cfg_fmtint(0xDu, *(_DWORD *)(a1 + 1344));
[43010, 42993, 42997, 43003, 43005] dump_cfg_fmtint(0xEu, *(_DWORD *)(a1 + 1348));
[43015, 43019, 43025, 43027, 43032] dump_cfg_fmtint(0x11u, *(_DWORD *)(a1 + 1152));
[43041, 43047, 43049, 43054, 43037] dump_cfg_fmtint(0x12u, *(_DWORD *)(a1 + 1156));
[43076, 43059, 43063, 43069, 43071] dump_cfg_fmtint(0x14u, *(_DWORD *)(a1 + 1160));
[43081, 43085, 43091, 43093, 43098] dump_cfg_fmtint(0x16u, *(_DWORD *)(a1 + 1168));
[43107, 43113, 43115, 43120, 43103] dump_cfg_fmtint(0x17u, *(_DWORD *)(a1 + 1184));
[43137, 43142, 43125, 43129, 43135] dump_cfg_fmtint(0x57u, *(_DWORD *)(a1 + 1188));
[43147, 43151, 43157, 43159, 43164] dump_cfg_fmtint(0x18u, *(_DWORD *)(a1 + 1192));
[43169, 43173, 43179, 43181, 43186] dump_cfg_fmtint(0x1Au, *(_DWORD *)(a1 + 1196));
[43201, 43203, 43208, 43191, 43195] dump_cfg_fmtint(0x19u, *(_DWORD *)(a1 + 1352));
[43213, 43217, 43223, 43225, 43230] dump_cfg_fmtint(0x1Du, *(_DWORD *)(a1 + 1368));
[43235, 43239, 43245, 43247, 43252] dump_cfg_fmtint(0x28u, *(_DWORD *)(a1 + 1232));
[43267, 43269, 43274, 43257, 43261] dump_cfg_fmtint(0x31u, *(_DWORD *)(a1 + 7672));
[43296, 43279, 43283, 43289, 43291] dump_cfg_fmtint(0x1Cu, *(_DWORD *)(a1 + 1372));
[43301, 43305, 43311, 43313, 43318] dump_cfg_fmtint(0x47u, *(_DWORD *)(a1 + 1380));
[43333, 43335, 43340, 43323, 43327] dump_cfg_fmtint(0x5Cu, *(_DWORD *)(a1 + 1384));
[43362, 43345, 43349, 43355, 43357] dump_cfg_fmtint(0x5Au, *(_DWORD *)(a1 + 1376));
[43367, 43371, 43377, 43379, 43384] dump_cfg_fmtint(0x59u, *(_DWORD *)(a1 + 1240));
[43393, 43399, 43401, 43406, 43389] dump_cfg_fmtint(0x5Bu, *(_DWORD *)(a1 + 7848));
[43428, 43411, 43415, 43421, 43423] dump_cfg_fmtint(0x5Du, *(_DWORD *)(a1 + 7852));
[43433, 43437, 43443, 43445, 43450] dump_cfg_string(38, *(const char **)(a1 + 1120));
[43459, 43466, 43469, 43474, 43455] dump_cfg_string(39, *(const char **)(a1 + 1128));
[43490, 43493, 43498, 43479, 43483] dump_cfg_string(43, *(const char **)(a1 + 1176));
[43522, 43503, 43507, 43514, 43517] dump_cfg_string(36, *(const char **)(a1 + 1208));
[43527, 43531, 43538, 43541, 43546] dump_cfg_string(37, *(const char **)(a1 + 1216));
[43555, 43562, 43565, 43570, 43551] dump_cfg_string(48, *(const char **)(a1 + 7664));
[43586, 43589, 43594, 43575, 43579] dump_cfg_string(68, *(const char **)(a1 + 7696));
[43618, 43599, 43603, 43610, 43613] dump_cfg_string(69, *(const char **)(a1 + 7744));
[43623, 43627, 43634, 43637, 43642] dump_cfg_string(75, *(const char **)(a1 + 7760));
[43651, 43658, 43661, 43666, 43647] dump_cfg_string(74, *(const char **)(a1 + 7752));
[43682, 43685, 43690, 43671, 43675] dump_cfg_string(96, *(const char **)(a1 + 7864));
[43714, 43695, 43699, 43706, 43709] dump_cfg_string(76, *(const char **)(a1 + 7784));
[43719, 43723, 43730, 43733, 43738] if ( **(_BYTE **)(a1 + 7824) )
[43747, 43754, 43757, 43759, 43743] v1 = *(const char **)(a1 + 7824);
[43761, 43772, 43765] else
v1 = "none";
[43774] dump_cfg_string(82, v1);
[43784, 43789, 43781] dump_cfg_string(83, *(const char **)(a1 + 7768));
[43808, 43813, 43794, 43798, 43805] dump_cfg_string(84, *(const char **)(a1 + 7776));
[43818, 43822, 43829, 43832, 43837] dump_cfg_string(77, *(const char **)(a1 + 7792));
[43842, 43846, 43853, 43856, 43861] dump_cfg_string(78, *(const char **)(a1 + 7800));
[43877, 43880, 43885, 43866, 43870] dump_cfg_string(86, *(const char **)(a1 + 1112));
[43904, 43909, 43890, 43894, 43901] dump_cfg_string(79, *(const char **)(a1 + 1224));
[43914, 43918, 43925, 43928, 43933] dump_cfg_string(80, *(const char **)(a1 + 1288));
[43938, 43942, 43949, 43952, 43957] dump_cfg_string(52, *(const char **)(a1 + 1272));
[43973, 43976, 43981, 43962, 43966] dump_cfg_string(53, *(const char **)(a1 + 1280));
[44000, 44005, 43986, 43990, 43997] dump_cfg_string(42, *(const char **)(a1 + 1304));
[44010, 44014, 44021, 44024, 44029] v2 = (const char *)log_level_name(*(unsigned int *)(a1 + 1248));
[44034, 44038, 44044, 44046, 44051] dump_cfg_string(7, v2);
[44059, 44051, 44054] v3 = (const char *)log_facility_name(*(unsigned int *)(a1 + 1244));
[44064, 44074, 44068, 44076] dump_cfg_string(6, v3);
[44081, 44084, 44089] dump_cfg_strarray_oneline(58, *(_DWORD *)(a1 + 7684), *(_QWORD *)(a1 + 7688));
[44098, 44105, 44109, 44115, 44117, 44122, 44094] dump_cfg_strarray(3, *(_DWORD *)(a1 + 1088), *(_QWORD *)(a1 + 1072));
[44131, 44138, 44142, 44148, 44150, 44155, 44127] dump_cfg_strarray(72, *(_DWORD *)(a1 + 1104), *(_QWORD *)(a1 + 1096));
[44160, 44164, 44171, 44175, 44181, 44183, 44188] dump_cfg_strarray(31, *(_DWORD *)(a1 + 1388), *(_QWORD *)(a1 + 1392));
[44193, 44197, 44204, 44208, 44214, 44216, 44221] dump_cfg_strarray(32, *(_DWORD *)(a1 + 1400), *(_QWORD *)(a1 + 1408));
[44226, 44230, 44237, 44241, 44247, 44249, 44254] dump_cfg_strarray(33, *(_DWORD *)(a1 + 1416), *(_QWORD *)(a1 + 1424));
[44259, 44263, 44270, 44274, 44280, 44282, 44287] dump_cfg_strarray(34, *(_DWORD *)(a1 + 1432), *(_QWORD *)(a1 + 1440));
[44320, 44292, 44296, 44303, 44307, 44313, 44315] dump_cfg_strarray(62, *(_DWORD *)(a1 + 7600), *(_QWORD *)(a1 + 7608));
[44353, 44325, 44329, 44336, 44340, 44346, 44348] dump_cfg_strarray(63, *(_DWORD *)(a1 + 7616), *(_QWORD *)(a1 + 7624));
[44386, 44358, 44362, 44369, 44373, 44379, 44381] dump_cfg_strarray_oneline(85, *(_DWORD *)(a1 + 7832), *(_QWORD *)(a1 + 7840));
[44419, 44391, 44395, 44402, 44406, 44412, 44414] dump_cfg_strarray_oneline(8, *(_DWORD *)(a1 + 1252), *(_QWORD *)(a1 + 1256));
[44452, 44424, 44428, 44435, 44439, 44445, 44447] for ( k = 0; k < *(_DWORD *)(a1 + 1448); ++k )
[44457, 44522, 44526, 44464, 44530, 44536, 44539] printf("subsystem %s %s\n", *(const char **)(a1 + 8 * (k + 182LL)), *(const char **)(a1 + 8 * (k + 694LL)));
[44480, 44512, 44484, 44517, 44488, 44491, 44505, 44466, 44498, 44470, 44502, 44473] printf(
[44545, 44573, 44580, 44551, 44585, 44555, 44561, 44565, 44571, 44541] "maxstartups %d:%d:%d\n",
*(unsigned int *)(a1 + 7632),
*(unsigned int *)(a1 + 7636),
*(unsigned int *)(a1 + 7640));
printf("persourcemaxstartups ");
[44602, 44597, 44590] if ( *(_DWORD *)(a1 + 7644) == 0x7FFFFFFF )
[44617, 44611, 44622, 44607] printf("none\n");
[44624, 44641, 44636, 44631] else
printf("%d\n", *(unsigned int *)(a1 + 7644));
[44643, 44647, 44653, 44655, 44662, 44667] printf("persourcenetblocksize %d:%d\n", *(unsigned int *)(a1 + 7648), *(unsigned int *)(a1 + 7652));
[44672, 44706, 44676, 44682, 44686, 44692, 44694, 44701] for ( m = 0; *((_DWORD *)&tunmode_desc + 4 * m) != -1; ++m )
[44711] {
[44800, 44803, 44810, 44813, 44719, 44816, 44789, 44726, 44793, 44796] if ( *((_DWORD *)&tunmode_desc + 4 * m) == *(_DWORD *)(a1 + 7708) )
{
[44738, 44745, 44748, 44760, 44752, 44758, 44728, 44731, 44735] dump_cfg_string(64, (&off_DEA8)[2 * m]);
goto LABEL_22;
[44769, 44772, 44779, 44783, 44762, 44765] }
[44787] }
dump_cfg_string(64, 0LL);
LABEL_22:
[44825, 44818, 44822, 44830] v4 = (const char *)iptos2str(*(unsigned int *)(a1 + 1200));
[44847, 44835, 44845, 44839] printf("ipqos %s ", v4);
[44867, 44852, 44862, 44855] v5 = (const char *)iptos2str(*(unsigned int *)(a1 + 1204));
[44872, 44882, 44876, 44884] printf("%s\n", v5);
[44904, 44889, 44899, 44892] printf("rekeylimit %llu %d\n", *(_QWORD *)(a1 + 7808), *(unsigned int *)(a1 + 7816));
[44930, 44933, 44935, 44938, 44909, 44913, 44945, 44950, 44919, 44923] printf("permitopen");
[44962, 44955, 44967] if ( *(_DWORD *)(a1 + 7720) )
[44976, 44984, 44972, 44982] {
for ( n = 0; n < *(_DWORD *)(a1 + 7720); ++n )
[45058, 45062, 45066, 45005, 45072, 45075, 45012] printf(" %s", *(const char **)(8LL * n + *(_QWORD *)(a1 + 7712)));
[45025, 45028, 45032, 45035, 45038, 45041, 45014, 45048, 45018, 45053] }
else
{
printf(" any");
[44993, 44986, 45003, 44998] }
printf("\n");
[45089, 45084, 45077] printf("permitlisten");
[45106, 45101, 45094] if ( *(_DWORD *)(a1 + 7736) )
[45121, 45123, 45115, 45111] {
for ( ii = 0; ii < *(_DWORD *)(a1 + 7736); ++ii )
[45197, 45201, 45205, 45144, 45211, 45214, 45151] printf(" %s", *(const char **)(8LL * ii + *(_QWORD *)(a1 + 7728)));
[45153, 45187, 45157, 45192, 45164, 45167, 45171, 45174, 45177, 45180] }
else
{
printf(" any");
[45137, 45132, 45125, 45142] }
printf("\n");
[45216, 45228, 45223] if ( *(_QWORD *)(a1 + 1360) )
[45233, 45244, 45237, 45247] printf("permituserenvironment %s\n", *(const char **)(a1 + 1360));
[45284, 45287, 45294, 45299, 45273, 45277] else
dump_cfg_fmtint(0x1Bu, *(_DWORD *)(a1 + 1356));
[45249, 45253, 45259, 45261, 45266, 45271] printf("pubkeyauthoptions");
[45304, 45316, 45311] if ( !*(_DWORD *)(a1 + 1312) )
[45321, 45333, 45331, 45325] printf(" none");
[45347, 45342, 45335] if ( (*(_DWORD *)(a1 + 1312) & 1) != 0 )
[45352, 45356, 45362, 45365, 45367] printf(" touch-required");
[45376, 45369, 45381] if ( (*(_DWORD *)(a1 + 1312) & 2) != 0 )
[45386, 45390, 45396, 45399, 45401] printf(" verify-required");
[45410, 45403, 45415] return printf("\n");
[45420, 45427, 45432, 45437, 45438] }
// DEA8: using guessed type char *off_DEA8;
// E938: using guessed type long log_level_name(_QWORD);
// E940: using guessed type long log_facility_name(_QWORD);
// E948: using guessed type long iptos2str(_QWORD);
// nfuncs=143 queued=39 decompiled=39 lumina nreq=0 worse=0 better=0
// ALL OK, 39 function(s) have been successfully decompiled
|
void iptunnel_print_help(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3) {
[48] char v0; // [bp-0x10]
[48] unsigned long long v1; // [bp-0x8]
[48] unsigned long long v3; // r12
[48] char *v6; // rdi
[48] unsigned long long v7; // rax
[48] unsigned int v8; // ecx
[48] unsigned long long v9; // rbp
[48] unsigned long long v10; // r12
[48] unsigned long long v11; // rax
[48]
[48] v1 = v3;
[48, 52] v6 = a0->field_8;
[73] v7 = strcmp(v6, "sit");
[76, 54] v8 = a0->field_8;
[81] *(&v6) = a3;
[84] v9 = *(&v0);
[112, 116, 123, 125] v10 = v1;
[126] v11 = __fprintf_chk(v6, 0x1, "Usage: ... %-6s\t[ remote ADDR ]\n\t\t\t[ local ADDR ]\n\t\t\t[ ttl TTL ]\n\t\t\t[ tos TOS ]\n\t\t\t[ [no]pmtudisc ]\n\t\t\t[ 6rd-prefix ADDR ]\n\t\t\t[ 6rd-relay_prefix ADDR ]\n\t\t\t[ 6rd-reset ]\n\t\t\t[ dev PHYS_DEV ]\n\t\t\t[ fwmark MARK ]\n\t\t\t[ external ]\n\t\t\t[ noencap ]\n\t\t\t[ encap { fou | gue | none } ]\n\t\t\t[ encap-sport PORT ]\n\t\t\t[ encap-dport PORT ]\n\t\t\t[ [no]encap-csum ]\n\t\t\t[ [no]encap-csum6 ]\n\t\t\t[ [no]encap-remcsum ]\n\t\t\t[ mode %s ]\n\nWhere:\tADDR := { IP_ADDRESS | any }\n\tTOS := { NUMBER | inherit }\n\tTTL := { 1..255 | inherit }\n\tMARK := { 0x0..0xffffffff }\n", v8);
[128, 2129, 2131, 116, 87] return;
[128, 2129, 2131] }
|
void iptunnel_print_help(struct_0 *a0, unsigned long a1, unsigned long a2, void* a3) {
[402] unsigned long v0; // [bp-0x30]
[402] unsigned int v1; // [bp-0x24]
[402] unsigned long long v2; // [bp-0x10]
[402] unsigned long long v4; // rax
[402]
[402] v1 = a1;
[418, 402, 406, 407, 410, 414] v0 = a2;
[421] if (!strcmp(a0->field_8, "sit"))
[437, 447] v2 = "{ ip6ip | ipip | mplsip | any } ]\n\t\t\t[ isatap";
[456, 463] else
v2 = "{ ipip |";
[469, 476, 480, 484, 488, 492, 496, 503, 506, 511] v4 = fprintf(a3, "Usage: ... %-6s\t[ remote ADDR ]\n\t\t\t[ local ADDR ]\n\t\t\t[ ttl TTL ]\n\t\t\t[ tos TOS ]\n\t\t\t[ [no]pmtudisc ]\n\t\t\t[ 6rd-prefix ADDR ]\n\t\t\t[ 6rd-relay_prefix ADDR ]\n\t\t\t[ 6rd-reset ]\n\t\t\t[ dev PHYS_DEV ]\n\t\t\t[ fwmark MARK ]\n\t\t\t[ external ]\n\t\t\t[ noencap ]\n\t\t\t[ encap { fou | gue | none } ]\n\t\t\t[ encap-sport PORT ]\n\t\t\t[ encap-dport PORT ]\n\t\t\t[ [no]encap-csum ]\n\t\t\t[ [no]encap-csum6 ]\n\t\t\t[ [no]encap-remcsum ]\n\t\t\t[ mode %s ]\n\nWhere:\tADDR := { IP_ADDRESS | any }\n\tTOS := { NUMBER | inherit }\n\tTTL := { 1..255 | inherit }\n\tMARK := { 0x0..0xffffffff }\n", a0->field_8);
[480, 484, 488, 492, 496, 503, 506, 511] return;
[516, 517, 518] }
long long iptunnel_parse_opt(struct_1 *a0, unsigned long a1, unsigned int a2, struct_0 *a3) {
[519] unsigned long long *v0; // [bp-0x790]
[519] unsigned int v1; // [bp-0x784], Other Possible Types: unsigned long
[519] char v2; // [bp-0x76f]
[519] char v3; // [bp-0x76e]
[519] char v4; // [bp-0x76d]
[519] char v5; // [bp-0x76c]
[519] char v6; // [bp-0x76b]
[519] unsigned short v7; // [bp-0x76a]
[519] unsigned short v8; // [bp-0x768]
[519] unsigned short v9; // [bp-0x766]
[519] unsigned short v10; // [bp-0x764]
[519] unsigned short v11; // [bp-0x762]
[519] unsigned int v12; // [bp-0x760]
[519] char v13; // [bp-0x75c]
[519] unsigned int v14; // [bp-0x758]
[519] unsigned int v15; // [bp-0x754]
[519] char v16; // [bp-0x750]
[519] struct_2 *v17; // [bp-0x748]
[519] unsigned long long v18; // [bp-0x740]
[519] void* v19; // [bp-0x738], Other Possible Types: unsigned int
[519] unsigned short v20; // [bp-0x734]
[519] unsigned short v21; // [bp-0x732]
[519] void* v22; // [bp-0x730]
[519] char v23; // [bp-0x728], Other Possible Types: void*
[519] unsigned int v24; // [bp-0x724]
[519] void* v25; // [bp-0x720]
[519] char v26; // [bp-0x718]
[519] char v27; // [bp-0x708]
[519] char v28; // [bp-0x6e8]
[519] char v29; // [bp-0x6e0]
[519] char v30; // [bp-0x6d8]
[519] char v31; // [bp-0x6d0]
[519] char v32; // [bp-0x6c8]
[519] char v33; // [bp-0x6c0]
[519] char v34; // [bp-0x6a8]
[519] char v35; // [bp-0x6a0]
[519] char v36; // [bp-0x698]
[519] char v37; // [bp-0x690]
[519] char v38; // [bp-0x688]
[519] char v39; // [bp-0x680]
[519] char v40; // [bp-0x678]
[519] char v41; // [bp-0x670]
[519] char v42; // [bp-0x668]
[519] char v43; // [bp-0x660]
[519] char v44; // [bp-0x658]
[519] char v45; // [bp-0x650]
[519] char v46; // [bp-0x648]
[519] char v47; // [bp-0x638]
[519] char v48; // [bp-0x636]
[519] char v49; // [bp-0x630]
[519] char v50; // [bp-0x528]
[519] char v51; // [bp-0x526]
[519] char v52; // [bp-0x520]
[519] char v53; // [bp-0x418]
[519] char v54; // [bp-0x416]
[519] unsigned short v55; // [bp-0x414]
[519] char v56; // [bp-0x410]
[519] char v57; // [bp-0x308]
[519] unsigned short v58; // [bp-0x304]
[519] char v59; // [bp-0x300]
[519] char v60; // [bp-0x1f8]
[519] char v61; // [bp-0x168]
[519] unsigned short v63; // ax
[519] unsigned long long v64; // rax
[519]
[519] v1 = a1;
[519, 523, 524, 527, 534, 541] *(&v0) = a2;
[547] v17 = &a3[2].padding_0;
[576, 583, 554, 587, 561, 570, 574] v19 = 0;
[594] v22 = 0;
[605] v23 = 0;
[616] v25 = 0;
[627] v19 = 32;
[638] v20 = 18;
[648] v21 = 1;
[657] v23 = preferred_family;
[672, 666] v24 = v17->field_4;
[688, 678, 685] v3 = 1;
[694] v4 = 0;
[701] v9 = 0;
[708] v2 = 0;
[717] v5 = 0;
[724] v14 = 0;
[731] v10 = 0;
[741] v11 = 0;
[750] v7 = 0;
[759] v8 = 0;
[768] v6 = 0;
[777] v12 = 0;
[784] inet_prefix_reset(&v47);
[801, 804, 794] inet_prefix_reset(&v50);
[816, 819, 809] inet_prefix_reset(&v53);
[834, 824, 831] inet_prefix_reset(&v57);
[849, 839, 846] if ((a3->field_6 & 0x400)) {
[868] while (true) {
LABEL_40125a:
if (v1 <= 0) {
[4705, 4698] if (v2 && !v3) {
[4720, 4718, 4711] fprintf(*(&stderr), "ttl != 0 and nopmtudisc are incompatible\n");
[4738, 4745, 4748, 4753, 4731] exit(0xffffffff); /* do not return */
[4763, 4758] }
addattr8(a3, 0x400, 0x9, v5);
[4768, 4775, 4782, 4784, 4789, 4794, 4797] if (v6) {
addattr_l(a3, 0x400, 0x13, 0x0, 0x0);
[4834, 4839, 4842, 4811, 4818, 4824, 4829] v64 = 0;
[4847] goto LABEL_4015e2;
[4852] } else {
if (is_addrtype_inet_not_unspec(&v47))
[4867] addattr_l(a3, 0x400, 0x2, &v49, *(&v48));
[4876, 4883, 4886, 4893, 4897, 4904, 4907, 4910, 4915, 4920, 4923] if (is_addrtype_inet_not_unspec(&v50))
[4938] addattr_l(a3, 0x400, 0x3, &v52, *(&v51));
[4994, 4947, 4954, 4957, 4964, 4968, 4975, 4978, 4981, 4986, 4991] addattr8(a3, 0x400, 0xa, v3);
[5025, 5028, 4999, 5006, 5013, 5015, 5020] addattr8(a3, 0x400, 0x5, v4);
[5059, 5062, 5033, 5040, 5047, 5049, 5054] addattr8(a3, 0x400, 0x4, v2);
[5091, 5096, 5067, 5099, 5074, 5077, 5084, 5086] addattr32(a3, 0x400, 0x1, v14);
[5124, 5129, 5132, 5104, 5110, 5117, 5119] addattr32(a3, 0x400, 0x14, v12);
[5152, 5157, 5162, 5165, 5137, 5143, 5150] addattr16(a3, 0x400, 0xf, v10);
[5184, 5186, 5191, 5196, 5199, 5170, 5177] addattr16(a3, 0x400, 0x10, v11);
[5218, 5220, 5225, 5230, 5233, 5204, 5211] addattr16(a3, 0x400, 0x11, htons(v7));
[5280, 5250, 5255, 5258, 5265, 5267, 5272, 5277] addattr16(a3, 0x400, 0x12, htons(v8));
[5312, 5314, 5319, 5324, 5327, 5297, 5302, 5305] if (!strcmp(a0->field_8, "sit")) {
[5353, 5343] addattr16(a3, 0x400, 0x8, v9);
[5380, 5382, 5387, 5392, 5395, 5366, 5373] if (is_addrtype_inet(&v53)) {
[5410] addattr_l(a3, 0x400, 0xb, &v56, *(&v54));
[5440, 5447, 5450, 5453, 5458, 5463, 5466, 5419, 5426, 5429, 5436] addattr16(a3, 0x400, 0xd, v55);
[5478, 5471, 5481, 5488, 5490, 5495, 5500, 5503] }
if (is_addrtype_inet(&v57)) {
[5518] addattr32(a3, 0x400, 0xc, *(&v59));
[5540, 5542, 5547, 5552, 5555, 5527, 5533] addattr16(a3, 0x400, 0xe, v58);
[5570, 5560, 5577, 5579, 5584, 5589, 5592, 5567] }
}
v64 = 0;
[5602, 5606, 5615, 5597] goto LABEL_4015e2;
[5602, 5606, 5615, 5597] }
}
if (!strcmp(*(v0), "mode"))
[1977, 1967] break;
[1984, 1982] LABEL_40094f:
if (!strcmp(*(v0), "remote")) {
[2393, 2403] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[2436] get_addr(&v50, *(v0), 0x2, *(v0));
[2466, 2469, 2441, 2448, 2451, 2458, 2463] goto LABEL_40124a;
[2474] }
if (!strcmp(*(v0), "local")) {
[2489, 2499] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[2532] get_addr(&v47, *(v0), 0x2, *(v0));
[2562, 2565, 2537, 2544, 2547, 2554, 2559] goto LABEL_40124a;
[2570] }
*(&v63) = matches(*(v0), "dev") ^ 1;
[2600, 2585, 2595] if (v63) {
v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[2631] v14 = ll_name_to_index(*(v0));
[2649, 2654] if (!v14)
exit(nodev(*(v0))); /* do not return */
[2691, 2693, 2686] goto LABEL_40124a;
[2607] }
if (strcmp(*(v0), "ttl") && strcmp(*(v0), "hoplimit") && strcmp(*(v0), "hlim")) {
[2752, 2754, 2723, 2725, 2766, 2737, 2708, 2776, 2747, 2718] if (strcmp(*(v0), "tos") && strcmp(*(v0), "tclass") && strcmp(*(v0), "tc")) {
[2945, 2979, 2981, 2950, 2952, 2993, 2964, 2935, 3003, 2974] *(&v63) = matches(*(v0), "dsfield") ^ 1;
[3032, 3037, 3022] if (!v63) {
if (!strcmp(*(v0), "nopmtudisc")) {
[3202, 3212] v3 = 0;
[3221] goto LABEL_40124a;
[3228] }
if (!strcmp(*(v0), "pmtudisc")) {
[3243, 3253] v3 = 1;
[3262] goto LABEL_40124a;
[3269] }
if (!strcmp(a0->field_8, "sit") && !strcmp(*(v0), "isatap")) {
[3300, 3302, 3314, 3285, 3324, 3295] v9 |= 1;
[3333] goto LABEL_40124a;
[3341] }
if (!strcmp(*(v0), "noencap")) {
[3356, 3366] v10 = 0;
[3375] goto LABEL_40124a;
[3384] }
if (!strcmp(*(v0), "encap")) {
[3409, 3399] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[3446] if (!strcmp(*(v0), "fou")) {
[3461, 3471] v10 = 1;
[3480] goto LABEL_40124a;
[3489] }
if (!strcmp(*(v0), "gue")) {
[3504, 3514] v10 = 2;
[3523] goto LABEL_40124a;
[3532] }
if (!strcmp(*(v0), "none")) {
[3547, 3557] v10 = 0;
[3566] goto LABEL_40124a;
[3575] } else {
invarg("Invalid encap type.", *(v0));
[3587, 3590, 3593, 3600, 3580] }
}
if (!strcmp(*(v0), "encap-sport")) {
[3625, 3615] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[3662] if (!strcmp(*(v0), "auto")) {
[3677, 3687] v7 = 0;
[3696] goto LABEL_40124a;
[3705] }
if (!get_u16(&v7, *(v0), 0x0, *(v0)))
[3738, 3727] goto LABEL_40124a;
[3745, 3743] invarg("Invalid source port.", *(v0));
[3751, 3758, 3761, 3764, 3771] }
if (!strcmp(*(v0), "encap-dport")) {
[3786, 3796] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[3829] if (!get_u16(&v8, *(v0), 0x0, *(v0)))
[3851, 3862] goto LABEL_40124a;
[3867, 3869] invarg("Invalid destination port.", *(v0));
[3875, 3882, 3885, 3888, 3895] }
if (!strcmp(*(v0), "encap-csum")) {
[3920, 3910] v11 |= 1;
[3929] goto LABEL_40124a;
[3937] }
if (!strcmp(*(v0), "noencap-csum")) {
[3952, 3962] v11 &= 65534;
[3971] goto LABEL_40124a;
[3979] }
if (!strcmp(*(v0), "encap-udp6-csum")) {
[3994, 4004] v11 |= 2;
[4013] goto LABEL_40124a;
[4021] }
if (!strcmp(*(v0), "noencap-udp6-csum")) {
[4036, 4046] v11 &= 65533;
[4055] goto LABEL_40124a;
[4063] }
if (!strcmp(*(v0), "encap-remcsum")) {
[4088, 4078] v11 |= 4;
[4097] goto LABEL_40124a;
[4105] }
if (!strcmp(*(v0), "noencap-remcsum")) {
[4120, 4130] v11 &= 65531;
[4139] goto LABEL_40124a;
[4147] }
if (!strcmp(*(v0), "external")) {
[4162, 4172] v6 = 1;
[4181] goto LABEL_40124a;
[4188] }
if (!strcmp(*(v0), "6rd-prefix")) {
[4203, 4213] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[4246] if (!get_prefix(&v53, *(v0), 0xa, *(v0)))
[4268, 4279] goto LABEL_40124a;
[4284, 4286] invarg("invalid 6rd_prefix\n", *(v0));
[4292, 4299, 4302, 4305, 4312] }
if (!strcmp(*(v0), "6rd-relay_prefix")) {
[4337, 4327] v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[4370] if (!get_prefix(&v57, *(v0), 0x2, *(v0)))
[4392, 4403] goto LABEL_40124a;
[4408, 4410] invarg("invalid 6rd-relay_prefix\n", *(v0));
[4416, 4423, 4426, 4429, 4436] }
if (!strcmp(*(v0), "6rd-reset")) {
[4451, 4461] get_prefix(&v53, "2002::/16", 0xa, a3);
[4482, 4489, 4492, 4470, 4477] inet_prefix_reset(&v57);
[4497, 4504, 4507] goto LABEL_40124a;
[4512] } else if (strcmp(*(v0), "fwmark")) {
[4537, 4527] LABEL_40121d:
iptunnel_print_help(a0, v1, v0, *(&stderr));
[4644, 4651, 4657, 4664, 4667, 4637] v64 = 4294967295;
[4672] goto LABEL_4015e2;
[5602, 5606, 5615, 5597] } else {
v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[4570] if (get_u32(&v12, *(v0), 0x0, *(v0))) {
[4592, 4603] invarg("invalid fwmark\n", *(v0));
[4612, 4619, 4622, 4625, 4632] goto LABEL_40121d;
[4612] }
}
}
}
v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[3072] if (!strcmp(*(v0), "inherit")) {
[3097, 3087] v4 = 1;
[3180] goto LABEL_40124a;
[3187] } else {
if (rtnl_dsfield_a2n(&v13, *(v0), *(v0)))
[3129] invarg("bad TOS value", *(v0));
[3138, 3145, 3148, 3151, 3158] v4 = *(&v13);
[3169, 3163] goto LABEL_40124a;
[3175] }
}
v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[2813] if (strcmp(*(v0), "inherit")) {
[2828, 2838] if (!get_u8(&v2, *(v0), 0x0, *(v0)))
[2864, 2875] goto LABEL_40124a;
[2880, 2882] invarg("invalid TTL\n", *(v0));
[2888, 2895, 2898, 2901, 2908] }
v2 = 0;
[2913] LABEL_40124a:
v1 = v1 - 1;
[4683, 2420] v0 += 1;
[4705, 4690, 4698] }
v0 = v0 + 1;
[2412] v1 = v1 - 1;
[2420] if (v1 <= 0)
[4705, 4698] incomplete_command();
[2014] if (strcmp(a0->field_8, "sit")) {
[2040, 2030] LABEL_400847:
if (strcmp(*(v0), "ipv4/ipv4") && strcmp(*(v0), "ipip") && strcmp(*(v0), "ip4ip4")) {
[2144, 2146, 2187, 2158, 2129, 2197, 2168, 2139, 2173, 2175] if (strcmp(*(v0), "mpls/ipv4") && strcmp(*(v0), "mplsip")) {
[2243, 2245, 2257, 2228, 2267, 2238] if (strcmp(*(v0), "any/ipv4") && strcmp(*(v0), "any")) {
[2337, 2308, 2313, 2315, 2327, 2298] invarg("Cannot guess tunnel mode.", *(v0));
[2368, 2371, 2378, 2358, 2365] goto LABEL_40094f;
[2358] }
v5 = 0;
[2346] goto LABEL_40124a;
[2353] }
v5 = 137;
[2276] goto LABEL_40124a;
[2283] }
v5 = 4;
[2206] goto LABEL_40124a;
[2213] } else {
if (strcmp(*(v0), "ipv6/ipv4") && !(!strcmp(*(v0), "ip6ip")))
[2088, 2059, 2098, 2069, 2074, 2076] goto LABEL_400847;
[2105, 2103] v5 = 41;
[2107] goto LABEL_40124a;
[2114] }
} else {
if (rtnl_talk(0x500040, &v19, &v16) >= 0) {
[912, 905, 898, 910] v15 = *(*(&v16));
[980, 982, 973] v15 -= 32;
[994, 997, 988] if (v15 >= 0) {
[1010, 1003] parse_rtattr(&v60, 0x3c, *(&v16) + 32, v15);
[1029, 1036, 1038, 1041, 1012, 1046, 1049, 1019, 1023] if (*(&v61)) {
parse_rtattr_flags(&v26, 0x5, *(&v61) + 4, *(*(&v61)) - 4, 0x8000);
[1088, 1095, 1099, 1106, 1112, 1117, 1120, 1070, 1077, 1080, 1083, 1086] if (*(&v27)) {
parse_rtattr_flags(&v28, 0x14, *(&v27) + 4, *(*(&v27)) - 4, 0x8000);
[1154, 1157, 1159, 1166, 1170, 1177, 1183, 1188, 1191, 1141, 1148, 1151] v18 = *(&v30);
[1203, 1196] if (v18 && !(!get_addr_rta(&v47, v18, 0x2, v18)))
[1210, 1234, 1218, 1245] goto LABEL_4003a8;
[1250, 1252] v18 = *(&v31);
[1265, 1258] if (v18 && !(!get_addr_rta(&v50, v18, 0x2, v18)))
[1272, 1280, 1307, 1296] goto LABEL_4003a8;
[1312, 1314] v18 = *(&v37);
[1320, 1327] if (v18 && !(!get_addr_rta(&v53, v18, 0xa, v18)))
[1334, 1369, 1342, 1358] goto LABEL_4003a8;
[1376, 1374] v18 = *(&v38);
[1389, 1382] if (!v18) {
LABEL_4005a4:
v18 = *(&v39);
[1451, 1444] if (!v18)
v63 = 0;
[1504, 1511, 1485, 1519, 1490, 1497] else
v63 = rta_getattr_u16(v18);
[1475, 1478, 1468] v55 = v63;
[1490] v18 = *(&v40);
[1504, 1497] if (!v18)
v63 = 0;
[1538, 1543, 1550, 1557, 1560] else
v63 = rta_getattr_u16(v18);
[1521, 1528, 1531] v58 = v63;
[1543] if (*(&v32))
v2 = rta_getattr_u8(*(&v32));
[1572, 1577, 1583, 1590, 1593] if (*(&v36))
v3 = rta_getattr_u8(*(&v36));
[1605, 1610, 1616, 1623, 1626] if (*(&v33))
v4 = rta_getattr_u8(*(&v33));
[1638, 1643, 1649, 1656, 1659] if (*(&v34))
v9 = rta_getattr_u16(*(&v34));
[1671, 1676, 1683, 1690, 1693] if (*(&v29))
v14 = rta_getattr_u32(*(&v29));
[1705, 1710, 1716, 1723, 1726] if (*(&v35))
v5 = rta_getattr_u8(*(&v35));
[1738, 1743, 1749, 1756, 1759] if (*(&v41))
v10 = rta_getattr_u16(*(&v41));
[1793, 1771, 1776, 1783, 1790] if (*(&v42))
v11 = rta_getattr_u16(*(&v42));
[1824, 1827, 1805, 1810, 1817] if (*(&v43))
v7 = rta_getattr_u16(*(&v43));
[1858, 1861, 1839, 1844, 1851] if (*(&v44))
v8 = rta_getattr_u16(*(&v44));
[1892, 1895, 1873, 1878, 1885] if (*(&v45))
v6 = 1;
[1897, 1904, 1911, 1914] if (*(&v46))
v12 = rta_getattr_u32(*(&v46));
[1926, 1931, 1937, 1944, 1947] free(*(&v16));
[1937, 1944, 1947] goto LABEL_40125a;
[1952] } else if (!get_addr_rta(&v57, v18, 0x2, v18)) {
[1420, 1431] goto LABEL_4005a4;
[1436, 1438] }
}
}
}
}
LABEL_4003a8:
fprintf(*(&stderr), "Failed to get existing tunnel info.\n");
[936, 943, 950, 953, 958] v64 = 4294967295;
[963] }
LABEL_4015e2:
return v64;
}
long long iptunnel_print_opt(unsigned long a0, unsigned long a1, unsigned long long a2[21]) {
[5624] unsigned long v0; // [bp-0x98]
[5624] unsigned long v1; // [bp-0x90]
[5624] char v2; // [bp-0x84]
[5624] char v3; // [bp-0x83]
[5624] unsigned short v4; // [bp-0x82]
[5624] unsigned short v5; // [bp-0x80]
[5624] unsigned short v6; // [bp-0x7e]
[5624] unsigned int v7; // [bp-0x7c]
[5624] unsigned int v8; // [bp-0x78]
[5624] unsigned int v9; // [bp-0x74]
[5624] unsigned long long v10; // [bp-0x70]
[5624] char v11; // [bp-0x68]
[5624] unsigned long long v13; // rax
[5624]
[5624] v1 = a0;
[5632, 5633, 5640, 5624, 5628, 5629] v0 = a1;
[5647] v2 = 0;
[5670, 5674, 5676, 5654, 5661] v3 = 0;
[5680] if (a2) {
if (a2[19])
print_bool(0x4, "external", "external ", 0x1);
[5731, 5738, 5743, 5719, 5724] if (a2[9]) {
v13 = rta_getattr_u8(a2[9]);
[5771, 5778, 5782, 5785, 5788] if (v13 == 137) {
[5793, 5801, 5796] print_string(0x4, "proto", "%s ", "mplsip");
[5921, 5928, 5933, 5907, 5914] } else if (v13 <= 137) {
[5808, 5803] if (v13 == 41) {
[5817, 5814] print_string(0x4, "proto", "%s ", "ip6ip");
[5888, 5895, 5900, 5874, 5881] } else if (v13 <= 41) {
[5819, 5822] if (!v13) {
print_string(0x4, "proto", "%s ", "any");
[5954, 5961, 5966, 5940, 5947] } else if (v13 == 4) {
[5832, 5835] print_string(0x4, "proto", "%s ", "ipip");
[5862, 5867, 5841, 5848, 5855] }
}
}
}
tnl_print_endpoint("remote", a2[3], 0x2);
[5985, 5988, 5993, 5996, 6003, 5974, 5981] tnl_print_endpoint("local", a2[2], 0x2);
[6019, 6022, 6027, 6030, 6037, 6008, 6015] if (a2[1]) {
v8 = rta_getattr_u32(a2[1]);
[6083, 6078] if (v8)
print_string(0x4, "link", "dev %s ", ll_index_to_name(v8));
[6112, 6119, 6124, 6097, 6102, 6105] }
if (a2[4])
v2 = rta_getattr_u8(a2[4]);
[6165, 6170, 6173] if (is_json_context()) {
[6173] LABEL_40182c:
print_uint(0x4, "ttl", "ttl %u ", v2);
[6208, 6213, 6188, 6192, 6194, 6201] } else {
if (!(!v2))
goto LABEL_40182c;
[6186, 6182] print_string(0x1, 0x0, "ttl %s ", "inherit");
[6244, 6220, 6227, 6234, 6239] }
if (a2[5])
v3 = rta_getattr_u8(a2[5]);
[6290, 6293, 6297, 6285] if (v3) {
if (is_json_context()) {
[6299] LABEL_4018aa:
print_0xhex(0x4, "tos", "tos %#llx ", v3);
[6340, 6314, 6318, 6321, 6328, 6335] } else {
if (!(v3 == 1))
[6312, 6308] goto LABEL_4018aa;
[6312, 6308] print_string(0x1, 0x0, "tos %s ", "inherit");
[6371, 6347, 6354, 6361, 6366] }
}
if (a2[10] && rta_getattr_u8(a2[10])) {
[6387, 6390, 6376, 6393, 6412, 6383] print_bool(0x4, "pmtudisc", "pmtudisc ", 0x1);
[6433, 6440, 6445, 6421, 6426] goto LABEL_401951;
[6450] }
print_bool(0x4, "pmtudisc", "nopmtudisc ", 0x0);
[6464, 6471, 6476, 6452, 6457] LABEL_401951:
if (a2[8]) {
v4 = rta_getattr_u16(a2[8]);
[6522, 6517] if ((v4 & 1))
print_bool(0x4, "isatap", "isatap ", 0x1);
[6561, 6537, 6542, 6549, 6556] }
if (a2[13]) {
v5 = rta_getattr_u16(a2[13]);
[6611, 6606] if (v5) {
v6 = rta_getattr_u16(a2[14]);
[6648, 6643] v7 = rta_getattr_u32(a2[12]);
[6674, 6669] v10 = inet_ntop(0xa, a2[11] + 4, &v11, 0x40);
[6712, 6691, 6717] if (is_json_context()) {
[6721] print_string(0x2, "prefix", 0x0, v10);
[6753, 6758, 6734, 6738, 6741, 6746] print_int(0x2, "prefixlen", 0x0, v5);
[6786, 6763, 6767, 6769, 6774, 6781] if (v7) {
print_string(0x2, "relay_prefix", 0x0, format_host(0x2, 0x4, &v7));
[6819, 6824, 6827, 6832, 6839, 6809, 6844, 6814] print_int(0x2, "relay_prefixlen", 0x0, v6);
[6849, 6853, 6855, 6860, 6867, 6872] }
} else {
printf("6rd-prefix %s/%u ", v10, v5);
[6883, 6887, 6890, 6897, 6902, 6879] if (v7)
printf("6rd-relay_prefix %s/%u ", format_host(0x2, 0x4, &v7), v6);
[6945, 6952, 6957, 6925, 6930, 6935, 6940, 6942] }
}
}
if (a2[20]) {
v9 = rta_getattr_u32(a2[20]);
[7002, 7007] if (v9)
print_0xhex(0x4, "fwmark", "fwmark %#llx ", v9);
[7041, 7016, 7019, 7022, 7029, 7036] }
tnl_print_encap(a2, 0xf, 0x10, 0x11, 0x12);
[7074, 7077, 7046, 7053, 7059, 7064, 7069] }
return 0;
}
|
int ipnetns_have_nsid(unsigned long a0, unsigned long a1, unsigned long a2) {
[272] unsigned long long v0; // [bp-0x438], Other Possible Types: char, void*
[272] unsigned long long v2; // rcx
[272] void* v3; // rdi
[272] unsigned long v4; // d
[272] unsigned int v5; // eax
[272]
[272] v2 = 130;
[272, 274] for (v3 = &v0; v2; v3 += v4 * 8) {
[280, 296, 304, 306, 309, 279, 312, 287] v2 -= 1;
[312] v0 = 0;
[312, 304] }
v0 = 281861523767313;
v5 = have_rtnl_getnsid;
*(v3) = 0;
if (have_rtnl_getnsid < 0)
return v5;
v5 = open64("/proc/self/ns/net", 0x0, a2);
if (v5 < 0) {
__fprintf_chk(*(&stderr), 0x1, "/proc/self/ns/net: %s. Continuing anyway.\n", strerror(*(__errno_location())));
v5 = 0;
have_rtnl_getnsid = 0;
return v5;
}
addattr32(&v0, 0x400, 0x3, v5);
if (rtnl_send(0x500028, &v0, v0) >= 0) {
rtnl_listen(0x500028, ipnetns_accept_msg, 0x0);
close(v5);
v5 = have_rtnl_getnsid;
return v5;
}
__fprintf_chk(*(&stderr), 0x1, "rtnl_send(RTM_GETNSID): %s. Continuing anyway.\n", strerror(*(__errno_location())));
have_rtnl_getnsid = 0;
close(v5);
v5 = 0;
return v5;
}
|
int ipnetns_have_nsid() {
[466] unsigned int v0; // [bp-0x42c]
[466] unsigned int v1; // [bp-0x428], Other Possible Types: char, void*
[466] unsigned short v2; // [bp-0x424]
[466] unsigned short v3; // [bp-0x422]
[466] unsigned long long v5; // rcx
[466] void* v6; // rdi
[466] unsigned long v7; // d
[466] unsigned int v8; // eax
[466]
[466] v5 = 130;
[466, 470, 471, 474, 481, 490, 494, 496, 503, 508] for (v6 = &v1; v5; v6 += v7 * 8) {
[513, 516] v5 -= 1;
[516] v1 = 0;
[516, 503] }
*(v6) = 0;
v1 = 17;
v2 = 90;
v3 = 1;
if (have_rtnl_getnsid >= 0) {
v0 = open64("/proc/self/ns/net", 0x0, v6 + 4);
if (v0 < 0) {
fprintf(*(&stderr), "/proc/self/ns/net: %s. Continuing anyway.\n", strerror(*(__errno_location())));
have_rtnl_getnsid = 0;
v8 = 0;
return v8;
}
addattr32(&v1, 0x400, 0x3, v0);
if (rtnl_send(0x500050, &v1, v1) < 0) {
fprintf(*(&stderr), "rtnl_send(RTM_GETNSID): %s. Continuing anyway.\n", strerror(*(__errno_location())));
have_rtnl_getnsid = 0;
close(v0);
v8 = 0;
return v8;
}
rtnl_listen(0x500050, ipnetns_accept_msg, 0x0);
close(v0);
}
v8 = have_rtnl_getnsid;
return v8;
}
|
void process_add() {
[224] unsigned long v0; // [bp-0x80], Other Possible Types: unsigned long long
[224] char v1; // [bp-0x70]
[224] char v2; // [bp-0x68]
[224] void* v3; // [bp-0x60]
[224] char v4; // [bp-0x58]
[224] char v5; // [bp-0x50]
[224] void* v6; // [bp-0x48]
[224] char v7; // [bp-0x40]
[224] unsigned long long v8; // [bp-0x10]
[224] unsigned long long v9; // [bp-0x8], Other Possible Types: unsigned long
[224] char v10; // [bp+0x0]
[224] unsigned long long v13; // rbp
[224] unsigned long long v14; // rax
[224] unsigned long long v15; // r12
[224] unsigned long long v16; // rax
[224] unsigned long long v17; // rax
[224] unsigned long long v18; // rax
[224] unsigned long long v19; // rax
[224] void* v20; // rbx
[224] void* v21; // rdi
[224] unsigned long v22; // rsi
[224] unsigned long long v23; // rax
[224] unsigned long long *v24; // fs
[224] unsigned long long v25; // rax
[224]
[224] v3 = 0;
[224, 226, 228, 230, 232, 233, 234, 238, 247, 252, 254] v6 = 0;
[263] if (!reg_56) {
v9 = 1;
[930, 979, 986] v8 = "sshbuf_new failed";
[997, 988, 991] sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0, *(&v10));
[1024, 998, 1003, 1005, 1010, 1017, 988, 991] __stack_chk_fail(); /* do not return */
[1029] }
reg_56 = sshbuf_new();
v14 = sshbuf_get_cstring(0x4853d58948550000, &v1, 0x0);
if (v14) {
v9 = *(v6);
v8 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v14), *(&v10));
v9 = 1;
v8 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0, *(&v10));
__stack_chk_fail(); /* do not return */
} else {
v14 = sshbuf_get_cstring(0x4853d58948550000, &v2, 0x0);
if (v14) {
v9 = *(v6);
v8 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v14), *(&v10));
v9 = 1;
v8 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0, *(&v10));
__stack_chk_fail(); /* do not return */
} else {
v15 = pkcs11_add_provider(*(&v1), *(&v2), &v3, &v6);
if (v15 > 0) {
v16 = sshbuf_put_u8(v13, 0xc);
if (v16) {
v0 = v22;
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x8a, 0x1, 0x1, ssh_err(v16), "compose");
v23 = del_keys_by_name("ssh-pkcs11-helper.c");
return;
}
v16 = sshbuf_put_u32(v13, v15);
if (v16) {
v0 = v22;
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x8a, 0x1, 0x1, ssh_err(v16), "compose");
v23 = del_keys_by_name("ssh-pkcs11-helper.c");
return;
} else {
v20 = 0;
while (true) {
v18 = sshkey_to_blob(*((v3 + v20)), &v4, &v5);
if (v18) {
v20 += 8;
sshlog("ssh-pkcs11-helper.c", "process_add", 0x8d, 0x1, 0x5, ssh_err(v18));
reg_8192 = 4194968;
if ((v15 - 1 << 3) + 8 == v20)
break;
} else {
v19 = sshbuf_put_string(v13, *(&v4), *(&v5));
reg_8192 = 4195168;
if (!v19) {
v19 = sshbuf_put_cstring(v13, *((v6 + v20)));
reg_8192 = 4195168;
if (!v19) {
free(*(&v4));
add_key(*((v3 + v20)), *(&v1), *((v6 + v20)));
v21 = *((v6 + v20));
v20 += 8;
free(v21);
reg_8192 = 4194968;
if ((v15 - 1 << 3) + 8 == v20)
break;
}
}
}
}
if (reg_8192 != 4195168) {
free(v6);
free(v3);
free(*(&v2));
free(*(&v1));
send_msg(v13);
sshbuf_free(v13);
v25 = *(&v7) ^ v24[5];
return;
}
v8 = "compose key";
v14 = sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v19), *(&v10));
v9 = *(v6);
v8 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v14), *(&v10));
v9 = 1;
v8 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0, *(&v10));
__stack_chk_fail(); /* do not return */
}
} else {
v17 = sshbuf_put_u8(v13, 0x5);
if (v17) {
v0 = ssh_err(v17);
v19 = sshfatal("ssh-pkcs11-helper.c", "process_add", 0x99, 0x1, 0x1, v0, "compose");
v8 = "compose key";
v14 = sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v19), *(&v10));
v9 = *(v6);
v8 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v14), *(&v10));
v9 = 1;
v8 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0, *(&v10));
__stack_chk_fail(); /* do not return */
} else {
v17 = sshbuf_put_u32(v13, __negvsi2(v15));
if (!v17) {
free(v6);
free(v3);
free(*(&v2));
free(*(&v1));
send_msg(v13);
sshbuf_free(v13);
v25 = *(&v7) ^ v24[5];
return;
} else {
v0 = ssh_err(v17);
v19 = sshfatal("ssh-pkcs11-helper.c", "process_add", 0x99, 0x1, 0x1, v0, "compose");
v8 = "compose key";
v14 = sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v19), *(&v10));
v9 = *(v6);
v8 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v14), *(&v10));
v9 = 1;
v8 = "sshbuf_new failed";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0, *(&v10));
__stack_chk_fail(); /* do not return */
}
}
}
}
}
}
|
void process_add() {
[694] unsigned long long v0; // [bp-0x68]
[694] unsigned int v1; // [bp-0x54]
[694] unsigned int v2; // [bp-0x50]
[694] unsigned int v3; // [bp-0x4c]
[694] char v4; // [bp-0x48]
[694] char v5; // [bp-0x40]
[694] void* v6; // [bp-0x38]
[694] char v7; // [bp-0x30]
[694] char v8; // [bp-0x28]
[694] void* v9; // [bp-0x20]
[694] unsigned long long v10; // [bp-0x18]
[694] unsigned long long v11; // [bp-0x10]
[694] char v12; // [bp+0x0]
[694] unsigned long long v13; // [bp+0x8]
[694] char v14; // [bp+0x10]
[694] unsigned long long v15; // rax
[694] unsigned long long *v16; // fs
[694] unsigned long long v17; // rax
[694]
[694] v6 = 0;
[706, 715, 719, 721, 694, 698, 699, 702] v9 = 0;
[729] v10 = sshbuf_new();
[737, 742] if (!v10) {
v0 = "sshbuf_new failed";
[753, 757, 764] sshfatal("ssh-pkcs11-helper.c", "process_add", 0x82, 0x1, 0x1, 0x0);
[801, 771, 806, 777, 782, 787, 794, 765] }
v1 = sshbuf_get_cstring(0xe87d894830ec8348, &v4, 0x0, &v4);
if (v1) {
v11 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v1));
v3 = pkcs11_add_provider(*(&v4), *(&v5), &v6, &v9);
if (v3 <= 0) {
v1 = sshbuf_put_u8(v10, 0x5);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x99, 0x1, 0x1, ssh_err(v1));
free(v9);
free(v6);
free(*(&v5));
free(*(&v4));
send_msg(v10);
sshbuf_free(v10);
v17 = v11 ^ v16[5];
} else {
v15 = __negvsi2(v3);
v1 = sshbuf_put_u32(v10, v15, v15);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x99, 0x1, 0x1, ssh_err(v1));
}
free(v9);
free(v6);
free(*(&v5));
free(*(&v4));
send_msg(v10);
sshbuf_free(v10);
v17 = v11 ^ v16[5];
}
} else {
v1 = sshbuf_put_u8(v10, 0xc);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x8a, 0x1, 0x1, ssh_err(v1));
v2 = 0;
while (true) {
if (v2 >= v3)
break;
v1 = sshkey_to_blob(*((v6 + 8 * v2)), &v7, &v8, &v7);
if (v1) {
v11 = "encode key";
sshlog("ssh-pkcs11-helper.c", "process_add", 0x8d, 0x1, 0x5, ssh_err(v1), *(&v12), v13, *(&v14));
} else {
v1 = sshbuf_put_string(v10, *(&v7), *(&v8), *(&v7));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
} else {
v1 = sshbuf_put_cstring(v10, *((v9 + 8 * v2)), *((v9 + 8 * v2)));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
}
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
}
}
v2 = __addvsi3(v2, 0x1);
}
} else {
v1 = sshbuf_put_u32(v10, v3, v3);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x8a, 0x1, 0x1, ssh_err(v1));
}
v2 = 0;
while (true) {
if (v2 >= v3)
break;
v1 = sshkey_to_blob(*((v6 + 8 * v2)), &v7, &v8, &v7);
if (v1) {
v11 = "encode key";
sshlog("ssh-pkcs11-helper.c", "process_add", 0x8d, 0x1, 0x5, ssh_err(v1), *(&v12), v13, *(&v14));
} else {
v1 = sshbuf_put_string(v10, *(&v7), *(&v8), *(&v7));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
} else {
v1 = sshbuf_put_cstring(v10, *((v9 + 8 * v2)), *((v9 + 8 * v2)));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
}
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
}
}
v2 = __addvsi3(v2, 0x1);
}
}
free(v9);
free(v6);
free(*(&v5));
free(*(&v4));
send_msg(v10);
sshbuf_free(v10);
v17 = v11 ^ v16[5];
}
} else {
v1 = sshbuf_get_cstring(0xe87d894830ec8348, &v5, 0x0, &v5);
if (v1) {
v11 = "parse";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x85, 0x1, 0x1, ssh_err(v1));
}
v3 = pkcs11_add_provider(*(&v4), *(&v5), &v6, &v9);
if (v3 <= 0) {
v1 = sshbuf_put_u8(v10, 0x5);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x99, 0x1, 0x1, ssh_err(v1));
free(v9);
free(v6);
free(*(&v5));
free(*(&v4));
send_msg(v10);
sshbuf_free(v10);
v17 = v11 ^ v16[5];
} else {
v15 = __negvsi2(v3);
v1 = sshbuf_put_u32(v10, v15, v15);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x99, 0x1, 0x1, ssh_err(v1));
}
free(v9);
free(v6);
free(*(&v5));
free(*(&v4));
send_msg(v10);
sshbuf_free(v10);
v17 = v11 ^ v16[5];
}
} else {
v1 = sshbuf_put_u8(v10, 0xc);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x8a, 0x1, 0x1, ssh_err(v1));
v2 = 0;
while (true) {
if (v2 >= v3)
break;
v1 = sshkey_to_blob(*((v6 + 8 * v2)), &v7, &v8, &v7);
if (v1) {
v11 = "encode key";
sshlog("ssh-pkcs11-helper.c", "process_add", 0x8d, 0x1, 0x5, ssh_err(v1), *(&v12), v13, *(&v14));
} else {
v1 = sshbuf_put_string(v10, *(&v7), *(&v8), *(&v7));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
} else {
v1 = sshbuf_put_cstring(v10, *((v9 + 8 * v2)), *((v9 + 8 * v2)));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
}
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
}
}
v2 = __addvsi3(v2, 0x1);
}
} else {
v1 = sshbuf_put_u32(v10, v3, v3);
if (v1) {
v11 = "compose";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x8a, 0x1, 0x1, ssh_err(v1));
}
v2 = 0;
while (true) {
if (v2 >= v3)
break;
v1 = sshkey_to_blob(*((v6 + 8 * v2)), &v7, &v8, &v7);
if (v1) {
v11 = "encode key";
sshlog("ssh-pkcs11-helper.c", "process_add", 0x8d, 0x1, 0x5, ssh_err(v1), *(&v12), v13, *(&v14));
} else {
v1 = sshbuf_put_string(v10, *(&v7), *(&v8), *(&v7));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
} else {
v1 = sshbuf_put_cstring(v10, *((v9 + 8 * v2)), *((v9 + 8 * v2)));
if (v1) {
v11 = "compose key";
sshfatal("ssh-pkcs11-helper.c", "process_add", 0x92, 0x1, 0x1, ssh_err(v1));
}
free(*(&v7));
add_key(*((v6 + 8 * v2)), *(&v4), *((v9 + 8 * v2)));
free(*((v9 + 8 * v2)));
}
}
v2 = __addvsi3(v2, 0x1);
}
}
free(v9);
free(v6);
free(*(&v5));
free(*(&v4));
send_msg(v10);
sshbuf_free(v10);
v17 = v11 ^ v16[5];
}
}
return;
}
|
long long radixsort(unsigned long long a0, unsigned long long a1, char *a2, char *a3) {
[2128] char v0; // [bp-0x118], Other Possible Types: uint128_t
[2128] int tmp_134; // tmp #134
[2128] int tmp_131; // tmp #131
[2128] int tmp_128; // tmp #128
[2128] int tmp_74; // tmp #74
[2128] int tmp_71; // tmp #71
[2128] int tmp_51; // tmp #51
[2128] int tmp_63; // tmp #63
[2128] int tmp_60; // tmp #60
[2128] int tmp_38; // tmp #38
[2128] uint128_t v1; // [bp-0x108]
[2128] uint128_t v2; // [bp-0xf8]
[2128] uint128_t v3; // [bp-0xe8]
[2128] uint128_t v4; // [bp-0xd8]
[2128] uint128_t v5; // [bp-0xc8]
[2128] uint128_t v6; // [bp-0xb8]
[2128] uint128_t v7; // [bp-0xa8]
[2128] uint128_t v8; // [bp-0x98]
[2128] uint128_t v9; // [bp-0x88]
[2128] uint128_t v10; // [bp-0x78]
[2128] uint128_t v11; // [bp-0x68]
[2128] uint128_t v12; // [bp-0x58]
[2128] uint128_t v13; // [bp-0x48]
[2128] uint128_t v14; // [bp-0x38]
[2128] uint128_t v15; // [bp-0x28]
[2128] unsigned long long v17; // r9, Other Possible Types: char *
[2128] void* v18; // r8
[2128] unsigned long long v19; // rax
[2128] unsigned int v20; // edx
[2128] unsigned long long v21; // r8
[2128] unsigned long long v22; // rax
[2128] unsigned long long v24; // rax
[2128] unsigned long long v26; // rcx
[2128] unsigned long long v27; // rax
[2128]
[2128] if (!a2) {
if (!a3) {
v0 = 0;
[5344] v24 = 1;
[5348] v26 = 255;
[5353] goto LABEL_400b92;
[5358] }
if ((a3 + 1) <= 14) {
[2248, 2251, 2254] v19 = 0;
[5363] goto LABEL_400a3e;
[5365] } else {
v0 = 578437695752307201;
[2273, 2260, 2268, 2270] if ((a3 >> 4) != 1) {
[2280, 2277, 2270] v1 = 1735880461161533969;
[2286, 2294] if ((a3 >> 4) != 2) {
[2302, 2299, 2270] v2 = 2893323226570760737;
[2308, 2316] if ((a3 >> 4) != 3) {
[2321, 2324, 2270] v3 = 4050765991979987505;
[2330, 2338] if ((a3 >> 4) != 4) {
[2346, 2270, 2343] v4 = 5208208757389214273;
[2352, 2360] if ((a3 >> 4) != 5) {
[2368, 2365, 2270] v5 = 6365651522798441041;
[2374, 2382] if ((a3 >> 4) != 6) {
[2390, 2387, 2270] v6 = 7523094288207667809;
[2404, 2396] if ((a3 >> 4) != 7) {
[2409, 2412, 2270] v7 = 8680537053616894577;
[2418, 2426] if ((a3 >> 4) != 8) {
[2434, 2270, 2431] v8 = 9837979819026121345;
[2440, 2448] if ((a3 >> 4) != 9) {
[2456, 2459, 2270] v9 = 10995422584435348113;
[2465, 2473] if ((a3 >> 4) != 10) {
[2481, 2484, 2270] v10 = 12152865349844574881;
[2486, 2494] if ((a3 >> 4) != 11) {
[2505, 2502, 2270] v11 = 13310308115253801649;
[2507, 2515] if ((a3 >> 4) != 12) {
[2523, 2526, 2270] v12 = 14467750880663028417;
[2528, 2536] if ((a3 >> 4) != 13) {
[2544, 2547, 2270] v13 = 15625193646072255185;
[2549, 2557] if ((a3 >> 4) != 14) {
[2568, 2565, 2270] v14 = 16782636411481481953;
[2570, 2578] if ((a3 >> 4) != 15)
[2586, 2589, 2270] v15 = 17940079176890708721;
[2591, 2599] }
}
}
}
}
}
}
}
}
}
}
}
}
}
v19 = a3 & -0x10;
[2608, 2610] if ((a3 & 15)) {
[2613] LABEL_400a3e:
*(&v0 + v19) = v19 + 1;
[2624, 2628, 2622] if (a3 > (v19 + 1)) {
[2632, 2635, 2637] *(&v0 + v19) = v19 + 2;
[2643, 2646, 2649] if (a3 > (v19 + 2)) {
[2656, 2658, 2653] *(&v0 + v19) = v19 + 3;
[2664, 2667, 2670] if (a3 > (v19 + 3)) {
[2674, 2677, 2679] *(&v0 + v19) = v19 + 4;
[2688, 2691, 2685] if (a3 > (v19 + 4)) {
[2698, 2700, 2695] *(&v0 + v19) = v19 + 5;
[2706, 2709, 2712] if (a3 > (v19 + 5)) {
[2721, 2716, 2719] *(&v0 + v19) = v19 + 6;
[2727, 2730, 2733] if (a3 > (v19 + 6)) {
[2737, 2740, 2742] *(&v0 + v19) = v19 + 7;
[2754, 2748, 2751] if (a3 > (v19 + 7)) {
[2761, 2763, 2758] *(&v0 + v19) = v19 + 8;
[2769, 2772, 2775] if (a3 > (v19 + 8)) {
[2784, 2779, 2782] *(&v0 + v19) = v19 + 9;
[2786, 2789, 2792] if (a3 > (v19 + 9)) {
[2801, 2796, 2799] *(&v0 + v19) = v19 + 10;
[2803, 2806, 2809] if (a3 > (v19 + 10)) {
[2816, 2818, 2813] *(&v0 + v19) = v19 + 11;
[2820, 2823, 2826] if (a3 > (v19 + 11)) {
[2833, 2835, 2830] *(&v0 + v19) = v19 + 12;
[2837, 2840, 2843] if (a3 > (v19 + 12)) {
[2850, 2852, 2847] *(&v0 + v19) = v19 + 13;
[2854, 2857, 2860] v20 = v19 + 13;
[2864] if (a3 > (v19 + 13)) {
[2864, 2867, 2869] v21 = v19 + 13;
[2864, 2871] v22 = v19 + 14;
[2874] *(&v20) = v20 + 1;
[2877] *(&v0 + v21) = v20;
[2880] if (a3 > reg_32) {
[2884, 2886] reg_32 = v22;
[2888] *(&v22) = reg_32 + 1;
[2890] *(&v0 + reg_32) = v22;
[2913, 2893, 2896, 2898, 2901, 2905, 2908] }
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
v17 = &v0;
[2896, 2898] *((&v0 + a3)) = 0;
[2901] v24 = a3 + 1;
[2905] if ((a3 + 1) <= 255) {
[2913, 2908] v17 = &v0;
[2922, 2927] v26 = (a3 + 2 <= 0x100 ? 1 : 0x100 - v24);
[2919, 2930, 2932, 2938, 2943] if (255 - v24 > 14) {
[2946, 2951, 2953, 2956] LABEL_400b92:
v17 = &v0;
[2982, 2985, 2990, 2962, 2970, 2974] tmp_134 = BinaryOp QNarrowBin;
[3074, 3078, 3082, 3086, 3090, 3094, 3098, 3106, 3110, 3114, 3118, 2993, 2995, 2999, 3003, 3007, 3010, 3018, 3022, 3026, 3034, 3038, 3042, 3046, 3050, 3054, 3058, 3062, 3070] *((v24 + &v0)) = tmp_134;
[3122] if ((v26 >> 4) != 1) {
[3129, 2995, 3125] tmp_74 = BinaryOp QNarrowBin;
[3203, 3211, 3215, 3219, 3223, 3227, 3231, 3235, 3239, 3243, 3247, 3251, 3255, 3135, 3143, 3147, 3151, 3159, 3167, 3171, 3175, 3179, 3183, 3187, 3191, 3195, 3199] *((&v1 + v24)) = tmp_74;
[3259] if ((v26 >> 4) != 2) {
[2995, 3267, 3263] tmp_74 = BinaryOp QNarrowBin;
[3329, 3333, 3337, 3341, 3349, 3353, 3357, 3361, 3365, 3369, 3373, 3377, 3381, 3385, 3389, 3393, 3273, 3281, 3285, 3289, 3297, 3305, 3309, 3313, 3317, 3321, 3325] *((&v2 + v24)) = tmp_74;
[3397] if ((v26 >> 4) != 3) {
[3401, 2995, 3405] tmp_74 = BinaryOp QNarrowBin;
[3459, 3463, 3467, 3471, 3475, 3479, 3487, 3491, 3495, 3499, 3503, 3507, 3511, 3515, 3519, 3523, 3527, 3531, 3411, 3419, 3423, 3427, 3435, 3443, 3447, 3451, 3455] *((&v3 + v24)) = tmp_74;
[3535] if ((v26 >> 4) != 4) {
[2995, 3539, 3543] tmp_74 = BinaryOp QNarrowBin;
[3585, 3589, 3593, 3597, 3601, 3605, 3609, 3613, 3617, 3625, 3629, 3633, 3637, 3641, 3645, 3649, 3653, 3657, 3661, 3665, 3669, 3549, 3557, 3561, 3565, 3573, 3581] *((&v4 + v24)) = tmp_74;
[3673] if ((v26 >> 4) != 5) {
[3681, 2995, 3677] tmp_74 = BinaryOp QNarrowBin;
[3719, 3723, 3727, 3731, 3735, 3739, 3743, 3747, 3751, 3755, 3763, 3767, 3771, 3775, 3779, 3783, 3787, 3791, 3795, 3799, 3803, 3807, 3687, 3695, 3699, 3703, 3711] *((&v5 + v24)) = tmp_74;
[3811] if ((v26 >> 4) != 6) {
[3815, 2995, 3819] tmp_74 = BinaryOp QNarrowBin;
[3841, 3849, 3857, 3861, 3865, 3869, 3873, 3877, 3881, 3885, 3889, 3893, 3901, 3905, 3909, 3913, 3917, 3921, 3925, 3929, 3933, 3937, 3941, 3945, 3825, 3833, 3837] *((&v6 + v24)) = tmp_74;
[3949] if ((v26 >> 4) != 7) {
[3953, 2995, 3957] tmp_74 = BinaryOp QNarrowBin;
[3971, 3975, 3979, 3987, 3995, 3999, 4003, 4007, 4011, 4015, 4019, 4023, 4027, 4031, 4039, 4043, 4047, 4051, 4055, 4059, 4063, 4067, 4071, 4075, 4079, 4083, 3963] *((&v7 + v24)) = tmp_74;
[4087] if ((v26 >> 4) != 8) {
[4095, 2995, 4091] tmp_74 = BinaryOp QNarrowBin;
[4101, 4109, 4113, 4117, 4125, 4133, 4137, 4141, 4145, 4149, 4153, 4157, 4161, 4165, 4169, 4177, 4181, 4185, 4189, 4193, 4197, 4201, 4205, 4209, 4213, 4217, 4221] *((&v8 + v24)) = tmp_74;
[4225] if ((v26 >> 4) != 9) {
[4232, 2995, 4236] tmp_74 = BinaryOp QNarrowBin;
[4354, 4358, 4362, 4242, 4250, 4254, 4258, 4266, 4274, 4278, 4282, 4286, 4290, 4294, 4298, 4302, 4306, 4310, 4318, 4322, 4326, 4330, 4334, 4338, 4342, 4346, 4350] *((&v9 + v24)) = tmp_74;
[4366] if ((v26 >> 4) != 10) {
[4377, 2995, 4373] tmp_74 = BinaryOp QNarrowBin;
[4483, 4487, 4491, 4495, 4499, 4503, 4383, 4391, 4395, 4399, 4407, 4415, 4419, 4423, 4427, 4431, 4435, 4439, 4443, 4447, 4451, 4459, 4463, 4467, 4471, 4475, 4479] *((&v10 + v24)) = tmp_74;
[4507] if ((v26 >> 4) != 11) {
[4514, 2995, 4518] tmp_74 = BinaryOp QNarrowBin;
[4608, 4612, 4616, 4620, 4624, 4628, 4632, 4636, 4640, 4644, 4524, 4532, 4536, 4540, 4548, 4556, 4560, 4564, 4568, 4572, 4576, 4580, 4584, 4588, 4592, 4600, 4604] *((&v11 + v24)) = tmp_74;
[4648] if ((v26 >> 4) != 12) {
[4659, 2995, 4655] tmp_74 = BinaryOp QNarrowBin;
[4741, 4745, 4749, 4753, 4757, 4761, 4765, 4769, 4773, 4777, 4781, 4785, 4665, 4673, 4677, 4681, 4689, 4697, 4701, 4705, 4709, 4713, 4717, 4721, 4725, 4729, 4733] *((&v12 + v24)) = tmp_74;
[4789] if ((v26 >> 4) != 13) {
[4800, 2995, 4796] tmp_74 = BinaryOp QNarrowBin;
[4866, 4870, 4874, 4882, 4886, 4890, 4894, 4898, 4902, 4906, 4910, 4914, 4918, 4922, 4926, 4806, 4814, 4818, 4822, 4830, 4838, 4842, 4846, 4850, 4854, 4858, 4862] *((&v13 + v24)) = tmp_74;
[4930] if ((v26 >> 4) == 15) {
[4937, 2995, 4941] tmp_63 = BinaryOp QNarrowBin;
[4999, 5003, 5007, 5015, 5019, 5023, 5027, 5031, 5035, 5039, 5043, 5047, 5051, 5055, 5059, 4947, 4955, 4959, 4963, 4967, 4971, 4975, 4979, 4983, 4987, 4991] *((&v14 + v24)) = tmp_63;
[5063] }
}
}
}
}
}
}
}
}
}
}
}
}
}
v24 = v24 + (v26 & -0x10);
[5072, 5074, 5077] if ((v26 & -0x10) == v26)
[5081, 5074, 5079] goto LABEL_4014d0;
[5081, 5079] }
*(&v0 + v24) = v24;
[5089, 5087] if (v24 != 255) {
[5092, 5100, 5095] *(&v0 + v24) = v24 + 1;
[5106, 5092, 5108] if (v24 != 254) {
[5114, 5111, 5119] *(&v0 + v24) = v24 + 2;
[5127, 5125, 5111] if (v24 != 253) {
[5130, 5138, 5133] *(&v0 + v24) = v24 + 3;
[5130, 5144, 5146] if (v24 != 252) {
[5152, 5149, 5157] *(&v0 + v24) = v24 + 4;
[5165, 5163, 5149] if (v24 != 251) {
[5168, 5176, 5171] *(&v0 + v24) = v24 + 5;
[5184, 5168, 5182] if (v24 != 250) {
[5187, 5195, 5190] *(&v0 + v24) = v24 + 6;
[5201, 5187, 5203] if (v24 != 249) {
[5209, 5206, 5214] *(&v0 + v24) = v24 + 7;
[5216, 5218, 5206] if (v24 != 248) {
[5224, 5221, 5229] *(&v0 + v24) = v24 + 8;
[5233, 5221, 5231] if (v24 != 247) {
[5236, 5244, 5239] *(&v0 + v24) = v24 + 9;
[5248, 5236, 5246] if (v24 != 246) {
[5251, 5259, 5254] *(&v0 + v24) = v24 + 10;
[5251, 5261, 5263] if (v24 != 245) {
[5266, 5269, 5274] *(&v0 + v24) = v24 + 11;
[5266, 5276, 5278] if (v24 != 244) {
[5281, 5289, 5284] *(&v0 + v24) = v24 + 12;
[5281, 5291, 5293] if (v24 != 243) {
[5296, 5299, 5304] *(&v0 + v24) = v24 + 13;
[5296, 5306, 5308] if (v24 != 242)
[5311, 5314, 5319] *(&v0 + v24) = v24 + 14;
[5321, 5323, 5311] }
}
}
}
}
}
}
}
}
}
}
}
}
}
LABEL_4014d0:
v18 = 0;
[5328] } else {
v17 = a2;
[2163, 2165] v18 = *((a2 + a3));
[2168] if (*((a2 + a3)) - 1 <= 253) {
[2176, 2179, 2181, 2168, 2173] *(__errno_location()) = 22;
[5370, 5375] v27 = 4294967295;
[5381] return v27;
[2229, 2222] }
}
r_sort_a(a0, a1, NULL, v17, v18);
v27 = 0;
return v27;
}
|
long long radixsort(unsigned int a0, unsigned long a1, char *a2, unsigned long a3) {
[0] unsigned int v0; // [bp-0x138]
[0] unsigned int v1; // [bp-0x124]
[0] char *v2; // [bp-0x120]
[0] char v3; // [bp-0x118]
[0] unsigned long long v5; // rax
[0]
[0] v0 = a3;
[0, 35, 4, 5, 8, 15, 22, 28] if (a2) {
v0 = a2[v0];
[227, 230, 233, 236, 214, 220] v2 = a2;
[249, 242] switch (v0) {
[256, 263] case 0: case 255:
[256, 263] r_sort_a(a0, a1, 0x0, v2, v0);
[321, 324, 327, 295, 332, 301, 335, 308, 314] v5 = 0;
[358, 340, 345, 349] return v5;
[365, 366] default:
[256, 263] *(__errno_location()) = 22;
[282, 277] v5 = 4294967295;
[288] return v5;
[365, 366] }
} else {
v2 = &v3;
[77, 70] for (v1 = 0; v1 < v0; v1 += 1) {
[131, 137, 84, 118, 125] (&v3)[v1] = v1 + 1;
[96, 102, 105, 111] }
(&v3)[v1] = 0;
[145, 139] for (v1 += 1; v1 <= 255; v1 += 1) {
[131, 200, 137, 118, 183, 153, 125, 190] (&v3)[v1] = v1;
[162, 168, 170, 176] }
v0 = 0;
[202] r_sort_a(a0, a1, 0x0, v2, v0);
[321, 324, 327, 295, 332, 301, 335, 308, 314] v5 = 0;
[358, 340, 345, 349] return v5;
[365, 366] }
}
|
void send_data(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
[8464] unsigned long v0; // [bp-0x28]
[8464] unsigned long long v2; // rax
[8464]
[8464] v0 = a2;
[8464, 8466, 8473, 8476, 8478, 8480, 8487, 8490, 8493, 8494, 8500, 8502, 8506] sshlog("sftp-server.c", "send_data", 0x257, 0x0, 0x5, 0x0, "request %u: sent data len %d", a0);
[8512, 8513, 8480, 8520, 8521, 8490, 8523, 8494, 8507, 8476] v2 = send_data_or_handle(0x67, a0, a1, a2);
[10576, 10577, 8528, 10579, 8532, 10582, 8535, 8538, 10587, 8540, 8545, 8546, 8548, 10596, 8550, 10604, 10606, 10609] return;
[10576, 10577, 8528, 10579, 8532, 10582, 8535, 8538, 10587, 8540, 8545, 8546, 8548, 10596, 8550, 10604, 10606, 10609] }
|
void send_data(unsigned long a0, unsigned long long a1, unsigned long a2) {
[4873] unsigned long v0; // [bp-0x30]
[4873] unsigned long v1; // [bp-0x28]
[4873] unsigned long long v3; // rax
[4873]
[4873] v1 = a2;
[4873, 4877, 4878, 4881, 4885, 4888, 4892, 4895, 4899, 4902] v0 = a0;
[4906, 4903] sshlog("sftp-server.c", "send_data", 0x257, 0x0, 0x5, 0x0, "request %u: sent data len %d");
[4932, 4937, 4944, 4951, 4956, 4907, 4914, 4915, 4921, 4927] v3 = send_data_or_handle(0x67, a0, a1, a2);
[4961, 4965, 4968, 4972, 4975, 4977, 4982] return;
[4987, 4988, 4989] }
|
int ssh_session2_open(unsigned long long a0, unsigned long a1, unsigned long a2) {
[3248] unsigned long v0; // [bp-0x48]
[3248] unsigned long v1; // [bp-0x40]
[3248] unsigned long long v2; // [bp-0x38]
[3248] unsigned long long v3; // [bp-0x30]
[3248] char v4; // [bp-0x18]
[3248] unsigned long long v6; // r12
[3248] unsigned long long v7; // rbx
[3248] struct_0 *v9; // rbx
[3248]
[3248] if (false)
[3506, 3507, 3508, 3510, 3500] v6 = dup(0x0);
[3522, 3527] else
v6 = open("/dev/null", 0x0, a2);
[3271, 3280, 3285, 3288, 3293] v7 = dup(0x1);
[3298, 3303, 3293] if (v6 != -1 && v7 != -1 && dup(0x2) != -1) {
[3328, 3334, 3305, 3338, 3310, 3314, 3317, 3320, 3323, 3326] v3 = "client-session";
[3394, 3400, 3402, 3344, 3408, 3351, 3354, 3357, 3360, 3362, 3369, 3375, 3381, 3388, 3390] v2 = 2;
[3409] v1 = (-(tty_flag < 1) & 0x4000) + 0x4000;
[3360, 3411, 3369, 3375] v0 = (-(tty_flag < 1) & 0x100000) + 0x100000;
[3394, 3402, 3412, 3419, 3388] v9 = channel_new(a0, "session", 0x3, v6, v7);
[3425, 3430, 3434, 3439, 3442, 3412, 3420] sshlog("ssh.c", "ssh_session2_open", 0x832, 0x1, 0x7, 0x0);
[3459, 3466, 3473, 3474, 3481, 3482, 3484, 3434, 3439, 3445, 3448, 3453] channel_send_open(a0, v9->field_4);
[3489, 3492, 3495] channel_register_open_confirm(a0, v9->field_4, ssh_session2_setup, 0x0);
[3535, 3538, 3540, 3547, 3550] return v9->field_4;
[3512, 3515, 3516, 3517, 3519] }
sshfatal("ssh.c", "ssh_session2_open", 0x825, 0x0, 0x1, 0x0, "dup() in/out/err failed", 0x0, *(&v4));
return control_persist_detach();
}
|
int ssh_session2_open(unsigned long a0, unsigned long a1, unsigned long a2) {
[29814] unsigned long long v0; // [bp-0x48]
[29814] unsigned long v1; // [bp-0x30], Other Possible Types: unsigned long long
[29814] unsigned long v2; // [bp-0x28]
[29814] unsigned int v3; // [bp-0x24]
[29814] unsigned int v4; // [bp-0x20], Other Possible Types: unsigned long long
[29814] unsigned int v5; // [bp-0x1c]
[29814] unsigned int v6; // [bp-0x18], Other Possible Types: unsigned long long
[29814] unsigned int v7; // [bp-0x14]
[29814] unsigned long long v8; // [bp-0x10], Other Possible Types: struct_0 *
[29814] char v9; // [bp+0x0]
[29814] unsigned long long v10; // [bp+0x8]
[29814] char v11; // [bp+0x10]
[29814] char v12; // [bp+0x18]
[29814] unsigned long long v13; // [bp+0x20]
[29814] unsigned long v14; // [bp+0x28]
[29814] unsigned long long v15; // r9
[29814] unsigned long long v16; // r8
[29814]
[29814] v1 = a0;
[29826, 29814, 29818, 29819, 29822] if (false)
[30168, 30174, 30176] v5 = dup(0x0);
[29872, 29877, 29880, 29885] else
v5 = open("/dev/null", 0x0, a2);
[29857, 29845, 29862] v6 = dup(0x1);
[29890, 29885] v7 = dup(0x2);
[29898, 29903] if (v5 != -1 && v6 != -1 && !(v7 == -1))
[29906, 29922, 29910, 29912, 29916, 29918] goto LABEL_40751e;
[29922, 29918] v0 = "dup() in/out/err failed";
[29924, 29928, 29935] sshfatal("ssh.c", "ssh_session2_open", 0x825, 0x0, 0x1, 0x0);
[29953, 29958, 29965, 29936, 29972, 29942, 29977, 29948] LABEL_40751e:
v3 = 0x200000;
[29982] v4 = 0x8000;
[29989] if (tty_flag) {
v3 >>= 1;
[30006] v4 >>= 1;
[30009, 30012, 30015, 30018, 30022, 30026, 30029, 30033, 30037, 30039, 30046, 30047, 30049, 30050, 30051, 30053, 30058, 30065, 30068] }
v15 = v7;
v16 = v6;
v8 = 2;
v6 = "client-session";
v4 = 2;
v2 = v4;
v1 = *((&v2 + 4));
v8 = channel_new(v1, "session", 0x3, *((&v4 + 4)), v16, v15, *(&v9), v10, *(&v11), *(&v12));
v14 = v8->field_4;
v13 = "channel_new: %d";
sshlog("ssh.c", "ssh_session2_open", 0x832, 0x1, 0x7, 0x0, *(&v9), v10);
channel_send_open(v1, v8->field_4, v8->field_4);
channel_register_open_confirm(v1, v8->field_4, ssh_session2_setup, 0x0);
return v8->field_4;
}
|
long long rl_abort() {
[19552] return rl_kill_text();
[21600, 21602, 21604, 21606, 21608, 21610, 21612, 21614, 21616, 21618, 21620, 21622, 21624, 21626, 21628, 21630, 21632, 21634, 21636, 21638, 21640, 21642, 21644, 21646, 21648, 21650, 21652, 21654, 21656, 21658, 21660, 21662, 21664, 21666, 21668, 21670, 21672, 21674, 21676, 21678, 21680, 21682, 21684, 21686, 21688, 21690, 21692, 21694, 21696, 21698, 21700, 21702, 21704, 21706, 21708, 21710, 21712, 21714, 21716, 21718, 21720, 21722, 21724, 21726, 21728, 21730, 21732, 21734, 21736, 21738, 21740, 21742, 21744, 21746, 21748, 21750, 21752, 21754, 21756, 21758, 21760, 21762, 21764, 21766, 21768, 21770, 21772, 21774, 21776, 21778, 21780, 21782, 21784, 21786, 21788, 21790, 21792, 21794, 21796] }
|
long long rl_abort(unsigned long a0, unsigned long a1) {
[22965] unsigned int v0; // [bp-0x10]
[22965] unsigned int v1; // [bp-0xc]
[22965]
[22965] v1 = a0;
[22965, 22969, 22970, 22973] v0 = a1;
[22976] return 0;
[22979, 22984, 22985] }
|
void print_string(unsigned long long a0, unsigned long long a1, unsigned long long a2) {
[4528] unsigned long long v1; // rcx
[4528] unsigned long long v2; // r8
[4528] unsigned long long v3; // rsi
[4528] unsigned long long v4; // rdx
[4528] unsigned long long v5; // rdi
[4528] unsigned long long v6; // rax
[4528]
[4528] v1 = a1;
[4528] v2 = a2;
[4531] v3 = 6;
[4534] v4 = a0;
[4539] v5 = 1;
[4542] v6 = print_color_string();
[6576, 4547] return;
[6576, 4547] }
|
void print_string(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3) {
[242] unsigned long long v1; // rax
[242]
[242] v1 = print_color_string(a0, 0x6, a1, a2, a3);
[257, 261, 265, 269, 273, 277, 280, 283, 288, 290, 242, 243, 246, 250, 253] return;
[296, 295] }
|
int three_arguments(unsigned long long a0, unsigned int a1, unsigned int a2, unsigned int a3, unsigned long a4) {
[4736] unsigned long v1; // eax, Other Possible Types: unsigned int
[4736]
[4736] if (binop(*((argv + (pos + 1 << 3))))) {
[4760, 4779, 4764] return binary_operator(0x0, a1, a2, a3, a4);
[4948, 7063, 7065, 7068] } else if (!strcmp(*((argv + (pos + 1 << 3) - 8)), "!")) {
[4768, 4807, 4760, 4792, 4797] advance();
[4912] v1 = two_arguments() ^ 1;
[4929, 4930, 4931, 4933, 4935, 4917, 4922, 4925] goto LABEL_40133d;
[4929, 4930, 4931, 4933, 4935, 4922, 4925] } else {
if (!strcmp(*((argv + (pos + 1 << 3) - 8)), "(") && !strcmp(*((argv + (pos + 1 << 3) + 8)), ")")) {
[4768, 4833, 4835, 4840, 4760, 4847, 4816, 4792, 4826, 4831] advance();
[4968] one_argument();
[4973] v1 = advance();
[4978] LABEL_40133d:
return v1;
[4929, 4930, 4931, 4933, 4935, 4925] }
*(&a0) = *((argv + (pos + 1) * 8));
[4856, 4764, 4760, 4863] if (strcmp(*((argv + (pos + 1 << 3))), "-a")) {
[4760, 4866, 4764, 4856] *(&a0) = *((argv + (pos + 1) * 8));
[4882, 4760, 4875, 4764] if (strcmp(*((argv + (pos + 1 << 3))), "-o"))
[4760, 4875, 4764, 4885] test_syntax_error(dcgettext(NULL, "%s: binary operator expected", 0x5), quote(*((argv + (pos + 1) * 8)))); /* do not return */
[4993, 4764, 5000, 5010, 5015, 4760, 5018, 4988, 5021, 5023] }
return expr(a0, a1, a2, a3, a4);
[7064, 7065, 7068] }
}
|
int three_arguments() {
[8191] char v0; // [bp-0x19]
[8191] unsigned long long v2; // rax
[8191]
[8191] if (binop(*((argv + (pos + 1 << 3))))) {
[8224, 8220, 8228, 8237] v0 = binary_operator(0x0);
[8256, 8251, 8246] goto LABEL_4021ce;
[8259] }
if (!strcmp(*((argv + (pos << 3))), "!")) {
advance(0x1);
v2 = two_arguments();
*(&v2) = v2;
*(&v2) = v2 ^ 1;
v0 = v2;
v0 &= 1;
goto LABEL_4021ce;
}
if (!strcmp(*((argv + (pos << 3))), "(") && !strcmp(*((argv + (pos + 2 << 3))), ")")) {
advance(0x0);
v0 = one_argument();
advance(0x0);
goto LABEL_4021ce;
}
if (strcmp(*((argv + (pos + 1 << 3))), "-a") && strcmp(*((argv + (pos + 1 << 3))), "-o"))
test_syntax_error(gettext("%s: binary operator expected"), quote(*((argv + (pos + 1) * 8)))); /* do not return */
v0 = expr();
LABEL_4021ce:
return v0;
}
|
int xwrite(unsigned long a0, void* a1, unsigned long a2) {
[640] unsigned long long v0; // [bp-0x28]
[640] unsigned long v1; // [bp-0x20]
[640] unsigned long long v2; // [bp-0x18]
[640] unsigned long long v3; // [bp-0x10]
[640] unsigned long long v4; // [bp-0x8]
[640] char v5; // [bp+0x0]
[640] unsigned long long v7; // r14
[640] unsigned long long v8; // r13
[640] unsigned long long v9; // r12
[640] unsigned long long v10; // rbx
[640] void* v11; // rbx
[640] unsigned long long v12; // rbp
[640] unsigned long long v13; // rax
[640] unsigned long long v14; // rbx
[640] unsigned long v15; // r13
[640] unsigned long long v16; // rbx
[640] unsigned long long v17; // r12
[640] unsigned long long v18; // r13
[640] unsigned long long v19; // r14
[640] unsigned long long v20; // rbx
[640] unsigned long long v21; // r12
[640] unsigned long long v22; // r13
[640] unsigned long long v23; // r14
[640]
[640] if (!a2)
return 0;
[768, 766] v4 = v7;
[649] v3 = v8;
[651, 661] v15 = a2;
[663] v2 = v9;
[666] v1 = &v5;
[668, 671] v0 = v10;
[672] v11 = a1;
[673] while (true) {
[680] if (!([D] amd64g_calculate_condition(0x9<64>, 0x14<64>, r13<8>, 0x0<64>, cc_ndep<8>)))
v12 = 9223372036854775807;
[680, 683, 651, 686, 687, 690] else
v12 = v15;
[680, 683, 686, 687, 690] while (true) {
[708] v13 = write(a0, v11, v12);
[708, 711, 714, 717] if (v13 >= 0)
[722, 725] break;
[722, 725] if (*(dash_errno) == 4)
[696, 706, 703] continue;
[696, 706, 703] v16 = v0;
[752] v17 = v2;
[753, 758, 759] v18 = v3;
[761] v19 = v4;
[763] return -1;
[753, 765] }
v14 = v11 + v13;
[727] v15 -= v13;
[730] if (a2 - v13 == v13)
[730, 733] break;
[733] }
v20 = v0;
v21 = v2;
v22 = v3;
v23 = v4;
return 0;
}
|
int xwrite(unsigned long a0, void* a1, unsigned int a2) {
[2062] unsigned int v0; // [bp-0x40]
[2062] unsigned long v1; // [bp-0x20], Other Possible Types: void*
[2062] unsigned long long v2; // [bp-0x18]
[2062] unsigned int v3; // [bp-0x10]
[2062] unsigned int v5; // rax
[2062]
[2062] v0 = a2;
[2081, 2062, 2066, 2067, 2070, 2074, 2077] v1 = a1;
[2089, 2085] while (true) {
[2202] if (!*(&v0)) {
v5 = 0;
[2209, 2214, 2215] break;
[2209, 2214, 2215] } else {
v2 = *(&v0);
[2099, 2095] if (v2 < 0)
[2107, 2110, 2103] v2 = 9223372036854775807;
[2112, 2122, 2126, 2130, 2134, 2137, 2140, 2142] while (true) {
[2126] v5 = write(a0, v1, v2);
[2126, 2130, 2134, 2137, 2140, 2142] v3 = v5;
[2147] if (!((*(&v3) - 0 >> 63)))
[2156, 2177, 2151, 2172] break;
[2156, 2151] if (*(dash_errno) != 4)
[2170, 2165, 2158, 2167] break;
[2158, 2165, 2167, 2170] }
if ((*(&v3) - 0 >> 63)) {
[2177, 2172] v5 = -1;
[2179] break;
[2184] } else {
v1 += *(&v3);
[2186, 2190] *(&v0) = *(&v0) - *(&v3);
[2194, 2198, 2202, 2207] }
}
}
return v5;
}
|
void check_sgr_file(unsigned int *a0, char *a1) {
[4544] unsigned long long v1; // rax
[4544] struct_1 *v2; // rbp
[4544] unsigned long long v3[4]; // r12
[4544] struct_3 *v4; // rbx
[4544] char *v5; // r15, Other Possible Types: unsigned long long
[4544] struct_0 *v6; // rax
[4544] char *v8; // rax
[4544] unsigned long long v10; // rax
[4544] unsigned long long v11; // rax
[4544] unsigned long long v12; // rax
[4544]
[4544] v1 = __sgr_get_head();
[4544, 4546, 4548, 4550, 4553, 4555, 4556, 4557, 4561, 4566] if (v1) {
v2 = v1;
[4580] do {
[4825] v3 = v2->field_8;
[4825] if (!v2->field_8) {
puts(dcgettext(NULL, "invalid shadow group file entry", 0x5));
[4612, 4614, 4619, 4622, 4605] __printf_chk(0x1, dcgettext(NULL, "delete line '%s'? ", 0x5));
[4645, 4650, 4655, 4658, 4627, 4661, 4663, 4638] *(a0) = *(a0) + 1;
[4668] if (!yes_or_no(read_only))
[4680, 4673] continue;
[4685, 4687] } else {
v5 = v2->field_8->field_0;
[4843] v4 = __sgr_get_head();
[4838, 4847] if (v4) {
do {
[4864] if (!v4->field_8)
continue;
[4864, 4868, 4871] if (v4 == v2)
[4873, 4876] continue;
[4873, 4876] if (!(!strcmp(v5, v4->field_8->field_0)))
[4884] continue;
[4889, 4891] puts(dcgettext(NULL, "duplicate shadow group entry", 0x5));
[4901, 4583, 4903, 4908, 4911] __printf_chk(0x1, dcgettext(NULL, "delete line '%s'? ", 0x5));
[4934, 4939, 4944, 4947, 4916, 4950, 4952, 4927] *(a0) = *(a0) + 1;
[4668] if (!(!yes_or_no(read_only)))
[4969] goto LABEL_401251;
[4976, 4974] v5 = v3[0];
[4993, 4982, 4986, 4990] v4 = v4->field_18;
[4986] } while (v4);
[4864] goto LABEL_401251;
[4864] }
v6 = gr_locate(v5);
[5002, 4999] if (!v6) {
__printf_chk(0x1, dcgettext(NULL, "no matching group file entry in %s\n", 0x5));
[5313, 5318, 5321, 5324, 5326, 5294, 5301, 5308] __printf_chk(0x1, dcgettext(NULL, "delete line '%s'? ", 0x5));
[5349, 5354, 5359, 5362, 5331, 5365, 5367, 5342] *(a0) = *(a0) + 1;
[4668] if (!yes_or_no(read_only))
[5384] goto LABEL_4013b8;
[5389, 5391] } else {
compare_members_lists(v2->field_8->field_0, v2->field_8->field_18, v6->field_18, sgr_file, grp_file);
[5025, 5032, 5039, 5043, 5016, 5020] LABEL_4013b8:
if (check_members(v2->field_8->field_0, v2->field_8->field_10, dcgettext(NULL, "shadow group %s: no administrative user %s\n", 0x5), dcgettext(NULL, "delete administrative member '%s'? ", 0x5), "delete admin '%s' from shadow group '%s'", a0) == 1) {
[5122, 5062, 5067, 5074, 5107, 5048, 5114, 5119, 5084, 5055] *(a1) = 1;
[5402, 5407] v2->field_20 = v2->field_20 | 1;
[5410] __sgr_set_changed();
[5414] }
v11 = check_members(v2->field_8->field_0, v2->field_8->field_18, dcgettext(NULL, "shadow group %s: no user %s\n", 0x5), dcgettext(NULL, "delete member '%s'? ", 0x5), "delete member '%s' from shadow group '%s'", a0);
[5184, 5187, 5128, 5194, 5135, 5142, 5147, 5154, 5164, 5169, 5174, 5177, 5180] if (v11 == 1) {
[5202, 5199] *(a1) = 1;
[5208, 5213] v2->field_20 = v2->field_20 | 1;
[5216] v12 = __sgr_set_changed();
[5220] }
continue;
[5225] }
}
LABEL_401251:
v8 = setlocale(0x6, NULL);
[4689, 4694, 4696] if (v8 && a0) {
[4704, 4707, 4701] setlocale(0x6, "C");
[4737, 4742, 4730] __syslog_chk(0x6, 0x1, "delete shadow line '%s'", v2->field_0);
[4770, 4747, 4751, 4756, 4758, 4765] setlocale(0x6, a0);
[4775, 4780, 4783] a0 = strdup(v8);
[4713, 4788] free(a0);
[4791] goto LABEL_4012bc;
[4730] }
__syslog_chk(0x6, 0x1, "delete shadow line '%s'", v2->field_0);
[5248, 5255, 5232, 5236, 5241, 5246] LABEL_4012bc:
*(a1) = 1;
[4801, 4804, 4796] v10 = __sgr_del_entry(v2);
[4807] v2 = v2->field_18;
[4812] } while (v2);
[4825] }
return;
}
|
void check_sgr_file(unsigned int *a0, char *a1) {
[5415] unsigned int *v0; // [bp-0x60]
[5415] struct_1 *v1; // [bp-0x50]
[5415] unsigned long long v2[4]; // [bp-0x48]
[5415] void* v3; // [bp-0x40]
[5415] unsigned long long v4[4]; // [bp-0x38]
[5415] struct_0 *v5; // [bp-0x30]
[5415] unsigned long long *v6; // [bp-0x28]
[5415] char *v7; // [bp-0x20]
[5415] unsigned long long v9; // rax
[5415] unsigned long long v10; // rax
[5415]
[5415] v0 = a0;
[5415, 5419, 5420, 5423, 5424, 5428] v9 = __sgr_get_head();
[5432, 5436] v1 = v9;
[5441] while (true) {
if (!v1)
break;
[6361, 6356] if (v1->field_8) {
v4[0] = v1->field_8;
[5735, 5739, 5743] v2[0] = __sgr_get_head();
[5752, 5747] while (true) {
if (v2) {
v6 = v2[1];
[5761, 5765, 5769] if (v2 != v1 && v6 && !strcmp(v4[0], *(v6))) {
[5792, 5777, 5781, 5818, 5787, 5773] puts(gettext("duplicate shadow group entry"));
[5842, 5827, 5834, 5839] printf(gettext("delete line '%s'? "));
[5861, 5866, 5869, 5872, 5877, 5854] *(a0) = *(a0) + 1;
[5888, 5891, 5895, 5882, 5886] if (yes_or_no(read_only))
[5909] break;
[5914, 5916] }
v2[0] = v2[3];
[5931, 5935, 5939, 5943, 5948] } else {
v5 = gr_locate(v4[0]);
[5969, 5964] if (v5) {
compare_members_lists(v4[0], v4[3], v5->field_18, sgr_file, grp_file);
[6091, 6098, 6105, 6109, 6113, 6117, 6121, 6125, 6128, 6131, 6134] } else {
printf(gettext("no matching group file entry in %s\n"));
[5987, 5994, 5999, 6002, 6005, 6010] printf(gettext("delete line '%s'? "));
[6022, 6029, 6034, 6037, 6040, 6045] *(a0) = *(a0) + 1;
[5888, 5891, 5895, 5882, 5886] if (yes_or_no(read_only))
[6077] break;
[6082, 6084] }
if (check_members(v4[0], v4[2], gettext("shadow group %s: no administrative user %s\n"), gettext("delete administrative member '%s'? "), "delete admin '%s' from shadow group '%s'", a0) == 1) {
[6209, 6146, 6212, 6154, 6191, 6161, 6139, 6204] *(a1) = 1;
[6218, 6214] v1->field_20 = v1->field_20 | 1;
[6221, 6225, 6229, 6232] __sgr_set_changed();
[6235] }
if (check_members(v4[0], v4[3], gettext("shadow group %s: no user %s\n"), gettext("delete member '%s'? "), "delete member '%s' from shadow group '%s'", a0) == 1) {
[6240, 6305, 6310, 6247, 6313, 6255, 6292, 6262] *(a1) = 1;
[6315, 6319] v1->field_20 = v1->field_20 | 1;
[6221, 6225, 6229, 6232] __sgr_set_changed();
[6336] goto LABEL_4018c8;
[6341] }
}
}
} else {
puts(gettext("invalid shadow group file entry"));
[5474, 5479, 5482, 5467] printf(gettext("delete line '%s'? "));
[5506, 5509, 5512, 5517, 5494, 5501] *(a0) = *(a0) + 1;
[5888, 5891, 5895, 5882, 5886] *(&v9) = yes_or_no(read_only) ^ 1;
[5554, 5549] if (!(!v9))
goto LABEL_4018c8;
[5557, 5559] }
v7 = setlocale(0x6, NULL);
[5584, 5569, 5579] v3 = 0;
[5588] if (v7)
v3 = strdup(v7);
[5619, 5624, 5610, 5615] if (v3)
setlocale(0x6, "C");
[5633, 5638, 5626] syslog(0x6, "delete shadow line '%s'");
[5665, 5670, 5643, 5647, 5650, 5653, 5660] if (v3) {
setlocale(0x6, v3);
[5682, 5686, 5689, 5694] free(v3);
[5699, 5703, 5706] }
*(a1) = 1;
[5715, 5711] __sgr_del_entry(v1);
[5718, 5722, 5725] LABEL_4018c8:
v10 = v1->field_18;
[6344, 6348] v1 = v1->field_18;
[6352, 6356, 6361] }
return;
}
|
int should_drop_connection(unsigned long long a0) {
[2080] unsigned long v0; // [bp-0x38]
[2080] unsigned int v2; // eax
[2080] unsigned int v3; // ebp
[2080] unsigned long long v4; // r12
[2080]
[2080] v2 = 0;
[2080, 2082] if (3330609088 <= a0) {
[2097, 2098, 2084, 2101, 2086, 2088, 2090] v2 = 1;
[2114, 2116, 2107] if (2215636357 > a0) {
[2121, 2124] v3 = __mulvsi3(__subvsi3(a0, 0x4d000001c6850fc0), __subvsi3(0x64, 0x840fed854d000001));
[2178, 2150, 2183, 2186, 2155, 2189, 2168] v2 = __subvsi3(0xa4840fed85, 0x4d000001c6850fc0);
[2191] v4 = __addvsi3((v3 >> 31 CONCAT v3) /m v2 >> 64, (v3 >> 31 CONCAT v3) /m v2);
[2210, 2215, 2220, 2204, 2205] v0 = arc4random_uniform(0x64);
[2241, 2215, 2223, 2228, 2232, 2235] sshlog("sshd.c", "should_drop_connection", 0x344, 0x1, 0x5, 0x0, "p %d, r %d", v4);
[2242, 2244, 2251, 2256, 2258, 2263, 2270, 2277, 2278, 2280, 2232, 2235] v2 = 0;
[2285] *(&v2) = v0 < v4;
[2304, 2306, 2287, 2291, 2294, 2297, 2298, 2300, 2302] }
}
return v2;
}
|
int should_drop_connection(unsigned long a0) {
[5902] unsigned long long v0; // [bp-0x48]
[5902] unsigned long v1; // [bp-0x40]
[5902] unsigned long v2; // [bp-0x38]
[5902] unsigned int v3; // [bp-0x10]
[5902] unsigned int v4; // [bp-0xc]
[5902] unsigned int v6; // eax
[5902]
[5902] if (a0 < 1224230283) {
[5923, 5926, 5902, 5906, 5907, 5910, 5914, 5917] v6 = 0;
[5928] } else if (a0 >= 1207963619) {
[5944, 5938, 5947] v6 = 1;
[5949] } else if (false) {
[5968, 5965, 5959] v6 = 1;
[5970] } else {
v3 = __subvsi3(0x64, 0x48000fe3d5e8c789);
[5993, 5988, 5998] v3 = __mulvsi3(v3, __subvsi3(a0, 0xd5e8c78948f8458b));
[6027, 6012, 6022] v3 = (v3 >> 31 CONCAT v3) /m __subvsi3(0x4808ec8348000fe3, 0xd5e8c78948f8458b);
[6051, 6053, 6056, 6057, 6059, 6046] v3 = __addvsi3(v3, 0x48000fe3d5e8c789);
[6073, 6078] v4 = arc4random_uniform(0x64);
[6081, 6091, 6086] v2 = v4;
[6098, 6101, 6094] v1 = v3;
[6105, 6102] v0 = "p %d, r %d";
[6113, 6106] sshlog("sshd.c", "should_drop_connection", 0x344, 0x1, 0x5, 0x0);
[6114, 6150, 6120, 6155, 6126, 6131, 6136, 6143] v6 = v4 < v3;
[6176, 6177, 6160, 6164, 6167, 6170, 6173] }
return v6;
}
|
void sh_wrerror() {
[2080] unsigned long long v1; // rax
[2080]
[2080] strerror(*(__errno_location()));
[2085, 2090, 2092] v1 = builtin_error(dcgettext(NULL, "write error: %s", 0x5));
[2114, 2119, 4167, 2122, 2123, 2126, 2128, 2097, 2104] return;
[2128, 2119, 4167, 2122, 2123, 2126] }
|
void sh_wrerror() {
[2192] unsigned long long v1; // rax
[2192]
[2192] strerror(*(__errno_location()));
[2210, 2212, 2214, 2205] gettext("write error: %s");
[2229, 2219, 2222] v1 = builtin_error();
[2240, 2245, 2234, 2237] return;
[2256, 2257, 2250, 2251, 2255] }
|
long long substring(unsigned long a0, unsigned long a1, unsigned long a2) {
[432] char *v1; // rax
[432]
[432] v1 = memcpy(sh_xmalloc(a2 - a1 + 1, "stringlib.c", 0x87), a0 + a1, a2 - a1);
[481, 484, 452, 458, 463, 469, 474, 445, 478] v1[a2 + -1 * a1] = 0;
[489] return v1;
[493, 494, 495, 497] }
|
long long substring(unsigned long a0, unsigned long a1, unsigned long a2) {
[688] char *v1; // r12
[688]
[688] v1 = sh_xmalloc(a2 - a1 + 1, "stringlib.c", 0x87);
[741, 746, 716, 721, 726, 731] memcpy(v1, a1 + a0, a2 - a1);
[768, 771, 774, 716, 749, 752, 755, 758, 762, 765] v1[a2 + -1 * a1] = 0;
[785, 779, 782] return v1;
[788, 791, 795, 796, 798, 799] }
|
void writemsg(void* a0) {
[960] unsigned long long v1; // rax
[960]
[960] write(0x2, "\r", 0x1);
[960, 961, 966, 969, 976, 981] write(0x2, a0, strlen(a0));
[994, 997, 1002, 1005, 989] v1 = write(0x2, "\r\n", 0x2);
[1028, 3058, 1010, 1015, 3064, 1020, 1021, 3071] return;
[1028, 3058, 1010, 1015, 3064, 1020, 1021, 3071] }
|
void writemsg(void* a0) {
[2611] unsigned long long v1; // rax
[2611]
[2611] write(0x2, "\r", 0x1);
[2627, 2632, 2639, 2611, 2644, 2615, 2616, 2619, 2623] write(0x2, a0, strlen(a0));
[2656, 2661, 2664, 2668, 2671, 2676] v1 = write(0x2, "\r\n", 0x2);
[2693, 2698, 2681, 2686] return;
[2704, 2705, 2703] }
|
int parse_principals_key_and_options(unsigned int a0, unsigned int a1, char *a2, unsigned long a3, unsigned long long *a4, unsigned long long *a5, unsigned long long *v5) {
[8912] unsigned long long v0; // [bp-0x98]
[8912] unsigned long v1; // [bp-0x90]
[8912] unsigned long v2; // [bp-0x80], Other Possible Types: void*, unsigned long long
[8912] unsigned long v3; // [bp-0x50], Other Possible Types: void*
[8912] void* v4; // [bp-0x48]
[8912] unsigned int v7; // r12d
[8912] char *v8; // rax
[8912] void* v9; // r14
[8912] void* v10; // rbp
[8912] void* v11; // rbp
[8912] unsigned long long v12; // rax, Other Possible Types: void*
[8912] char *v13; // rax
[8912] unsigned long long v14; // rdx
[8912] void* v15; // r13
[8912]
[8912] *(a4) = 0;
[8967, 8972, 8974, 8912, 8914, 8917, 8919, 8921, 8923, 8924, 8927, 8928, 8931, 8935, 8940, 8948, 8953, 8958] v4 = 0;
[8981] if (v5)
*(v5) = 0;
[8995, 9003, 9006] if (a5)
*(a5) = 0;
[9025, 9030, 9008, 9015, 9018] v3 = a2;
[9025, 9015, 9018] v3 = &a2[strspn(a2, " \t")];
[9042, 9030, 9018, 9038] if (*(v3) != 35 && *(v3)) {
[9049, 9047] v8 = strdelimw(&v3);
[9063, 9068, 9071] if (v8 && v3) {
[9082, 9076, 9079] v15 = strdup(v8);
[9105, 9100] if (!v15) {
v2 = a3;
[10029, 10022] v9 = 0;
[10052, 10054, 10059, 10030, 10033, 10038, 10039, 10046] v10 = 0;
[10062] v7 = -2;
[10064] sshlog("sshsig.c", "parse_principals_key_and_options", 0x2ed, 0x1, 0x2, 0x0, "strdup failed");
[10054, 10030, 10033, 10070, 10039, 10038, 10077, 10046] goto LABEL_4023c3;
[10082, 10083, 10084] } else {
if (a3) {
if (match_pattern_list() != 1) {
[9139, 9142, 9134] v7 = -46;
[9144] v9 = 0;
[9150] v10 = 0;
[9153, 9155, 9158] goto LABEL_4023c3;
[9153, 9155, 9158] } else {
v2 = a3;
[9224, 9231] *(&v1) = a0;
[9250, 9255, 9262, 9232, 9235, 9240, 9244] sshlog("sshsig.c", "parse_principals_key_and_options", 0x2fc, 0x1, 0x5, 0x0, "%s:%lu: matched principal \"%s\"");
[9250, 9255, 9244, 9232, 9266, 9235, 9273, 9274, 9276] }
}
v9 = sshkey_new(0xe);
[9290, 9285, 9295] if (!v9) {
v10 = 0;
[9699, 9702, 9688, 9692] v7 = -2;
[9730, 9704, 9705, 9737, 9710, 9712, 9718, 9723] sshlog("sshsig.c", "parse_principals_key_and_options", 0x301, 0x1, 0x2, 0x0, "sshkey_new failed");
[9730, 9699, 9704, 9705, 9743, 9712, 9718, 9723] goto LABEL_4023c3;
[9748, 9749, 9750] } else {
if (!sshkey_read(v9, &v3)) {
[9313] v11 = 0;
[9326] v12 = &.LC25;
[9346, 9348, 9352, 9357, 9363, 9368, 9375, 9382, 9384, 9385, 9387, 9328, 9335, 9336, 9343] goto LABEL_402477;
[9346, 9348, 9352, 9357, 9363, 9368, 9375, 9382, 9384, 9385, 9387, 9328, 9335, 9336, 9343] }
v11 = v3;
[9568, 9571] if (sshkey_advance_past_options(&v3)) {
[9576] v14 = 777;
[9856, 9860, 9866, 9840, 9844, 9851, 9854] *(&v1) = a0;
[9250, 9255, 9262, 9232, 9235, 9240, 9244] v0 = "%s:%lu: invalid options";
[9875] LABEL_4025ac:
v7 = -0x4;
[9651, 9653, 9644] v10 = 0;
[9659] sshlog("sshsig.c", "parse_principals_key_and_options", v14, 0x0, 0x2, 0x0, v0);
[9668, 9860, 9851, 9644, 9661, 9854] goto LABEL_4023c3;
[9673, 9677] } else {
v13 = v3;
[9589] if (v3 && *(v3)) {
[9088, 9094] v3 += 1;
[9760, 9764, 9767] *(v13) = 0;
[9772] skip_space(&v3);
[9775] if (sshkey_read(v9, &v3)) {
[9786] v14 = 789;
[9987, 9990, 9992, 9996, 10002, 9976, 9980] *(&v1) = a0;
[9250, 9255, 9262, 9232, 9235, 9240, 9244] v0 = "%s:%lu: invalid key";
[10011] goto LABEL_4025ac;
[10012] } else {
if (v11)
v12 = v11;
[9799, 9802, 9809, 9810, 9813] else
v12 = &.LC25;
[9799, 9802, 9809, 9810, 9813] LABEL_402477:
v2 = v12;
[9335] *(&v1) = a0;
[9346, 9348, 9352, 9357, 9363, 9368, 9375, 9382, 9336, 9343] sshlog("sshsig.c", "parse_principals_key_and_options", 0x31a, 0x0, 0x7, 0x0, "%s:%lu: options %s");
[9346, 9343, 9384, 9385, 9387, 9357, 9363, 9368, 9375] v10 = sshsigopt_parse(v11, a0, a1, &v4);
[9417, 9412] if (!v10) {
v2 = v4;
[9904, 9911] *(&v1) = a0;
[9920, 9924, 9930, 9935, 9942, 9915, 9918] v7 = -0x4;
[9953, 9946] sshlog("sshsig.c", "parse_principals_key_and_options", 0x31c, 0x0, 0x2, 0x0, "%s:%lu: bad options: %s");
[9924, 9959, 9960, 9930, 9962, 9935, 9946, 9915, 9918] goto LABEL_4023c3;
[9971, 9967] } else {
*(a4) = v15;
[9434, 9429] if (v5) {
*(v5) = v10;
[9442] v10 = 0;
[9446, 9448, 9451] }
if (!a5) {
v15 = 0;
[9824] v7 = 0;
[9827] goto LABEL_4023c3;
[9830] } else {
*(a5) = v9;
[9457] v7 = 0;
[9460] v9 = 0;
[9463] v15 = 0;
[9466] goto LABEL_4023c3;
[9469] }
}
}
}
v14 = 782;
[9634, 9608, 9612, 9619, 9622, 9624, 9628] *(&v1) = a0;
[9250, 9255, 9262, 9232, 9235, 9240, 9244] v0 = "%s:%lu: missing key";
[9668, 9643, 9644, 9651, 9653, 9659, 9661] goto LABEL_4025ac;
[9668, 9643, 9644, 9651, 9653, 9659, 9661] }
}
}
}
v9 = 0;
[9506, 9480, 9484, 9491, 9494, 9496, 9500] v10 = 0;
[9509] *(&v1) = a0;
[9511] v15 = 0;
[9520, 9515] v7 = -0x4;
[9538, 9540, 9523, 9530, 9531] sshlog("sshsig.c", "parse_principals_key_and_options", 0x2e8, 0x0, 0x2, 0x0, "%s:%lu: invalid line");
[9546, 9515, 9523, 9491, 9494, 9530, 9531, 9500] LABEL_4023c3:
free(v15);
[9155, 9158] sshsigopt_free(v10);
[9163, 9166] sshkey_free(v9);
[9171, 9174] goto LABEL_4023db;
[9063] }
v7 = -46;
LABEL_4023db:
return v7;
}
|
int parse_principals_key_and_options(unsigned long a0, unsigned int a1, char *a2, unsigned long long a3, unsigned long long *a4, unsigned long long *a5, unsigned long v13) {
[9889] unsigned long long v0; // [bp-0xc8]
[9889] int tmp_9; // tmp #9
[9889] unsigned long v1; // [bp-0xc0]
[9889] unsigned long v2; // [bp-0xb8], Other Possible Types: unsigned long long
[9889] unsigned long v3; // [bp-0xb0], Other Possible Types: void*
[9889] unsigned long long *v4; // [bp-0xa0]
[9889] unsigned int v5; // [bp-0x5c]
[9889] unsigned long v6; // [bp-0x58], Other Possible Types: char *
[9889] void* v7; // [bp-0x50]
[9889] unsigned long v8; // [bp-0x48]
[9889] void* v9; // [bp-0x40]
[9889] void* v10; // [bp-0x38]
[9889] void* v11; // [bp-0x30]
[9889] char *v12; // [bp-0x28]
[9889] unsigned long v14; // eax, Other Possible Types: unsigned int
[9889]
[9889] v4 = v13;
[9921, 9928, 9935, 9939, 9889, 9893, 9894, 9897, 9898, 9905, 9909, 9913, 9917] v8 = 0;
[9955, 9959, 9961, 9946] v9 = 0;
[9969] v7 = 0;
[9977] v10 = 0;
[9985] v11 = 0;
[9993] v5 = -1;
[10001] if (a4)
*(a4) = 0;
[10018, 10025, 10032, 10040] if (v4)
*(v4) = 0;
[10049, 10056, 10064, 10042] if (a5)
*(a5) = 0;
[10080, 10084, 10088, 10092, 10096, 10066, 10103, 10073, 10106] v6 = a2;
[10080, 10084] v6 = &v6[strspn(v6, " \t")];
[10096, 10114, 10106, 10111] if (*(v6) == 35) {
[10122, 10125, 10118, 10127] LABEL_40279c:
v14 = -46;
[10140] } else {
if (!*(v6))
goto LABEL_40279c;
[10129, 10133, 10136, 10138] v12 = strdelimw(&v6);
[10162, 10157] if (!v12) {
LABEL_4027c6:
*(&v2) = a1;
[10186, 10182] v1 = a0;
[10189] v0 = "%s:%lu: invalid line";
[10192, 10199] sshlog("sshsig.c", "parse_principals_key_and_options", 0x2e8, 0x0, 0x2, 0x0);
[10241, 10212, 10217, 10222, 10229, 10200, 10236, 10206] v5 = -0x4;
[10250, 10246] } else {
if (!v6)
goto LABEL_4027c6;
[10177, 10180, 10173] v9 = strdup(v12);
[10274, 10269] if (!v9) {
v2 = "strdup failed";
[10289, 10296, 10285] sshlog("sshsig.c", "parse_principals_key_and_options", 0x2ed, 0x1, 0x2, 0x0);
[10338, 10309, 10314, 10319, 10326, 10297, 10333, 10303] v5 = -2;
[10347, 10343] } else {
if (a3) {
if (match_pattern_list(a3, v9, 0x0) != 1) {
[10385, 10393, 10390, 10374] v5 = -46;
[10395] goto LABEL_402bdf;
[10402] } else {
v3 = a3;
[10407] *(&v2) = a1;
[10186, 10182] v1 = a0;
[10189] v0 = "%s:%lu: matched principal \"%s\"";
[10416, 10423] sshlog("sshsig.c", "parse_principals_key_and_options", 0x2fc, 0x1, 0x5, 0x0);
[10465, 10436, 10441, 10446, 10453, 10424, 10460, 10430] }
}
v11 = sshkey_new(0xe);
[10474, 10484, 10479] if (!v11) {
v2 = "sshkey_new failed";
[10499, 10506, 10495] sshlog("sshsig.c", "parse_principals_key_and_options", 0x301, 0x1, 0x2, 0x0);
[10529, 10536, 10507, 10543, 10513, 10548, 10519, 10524] v5 = -2;
[10553, 10557] } else if (!sshkey_read(v11, &v6, &v6)) {
[10583] if (!v8)
v14 = &g_404419;
[10950, 10951, 10954, 10957, 10964, 10965, 10971, 10977, 10982, 10987, 10994, 11001, 11006, 10943] else
v14 = v8;
[10937] v3 = v14;
[10950] *(&v2) = a1;
[10951] v1 = a0;
[10954] v0 = "%s:%lu: options %s";
[10964, 10957] sshlog("sshsig.c", "parse_principals_key_and_options", 0x31a, 0x0, 0x7, 0x0);
[10977, 10982, 10987, 10994, 10965, 11001, 10971, 11006] v10 = sshsigopt_parse(v8, a0, a1, &v7);
[11034, 11039] if (!v10) {
v3 = v7;
[11050, 11054] *(&v2) = a1;
[11055] v1 = a0;
[11058] v0 = "%s:%lu: bad options: %s";
[11068, 11061] sshlog("sshsig.c", "parse_principals_key_and_options", 0x31c, 0x0, 0x2, 0x0);
[11105, 11075, 11110, 11081, 11086, 11091, 11098, 11069] v5 = -0x4;
[11115, 11119] } else {
if (a4) {
*(a4) = v9;
[11138, 11145, 11149] v9 = 0;
[11152, 11168, 11160] }
if (v4) {
*(v4) = v10;
[11170, 11177, 11181] v10 = 0;
[11184, 11200, 11192] }
if (a5) {
*(a5) = v11;
[11202, 11209, 11213] v11 = 0;
[11235, 11238, 11216, 11224, 11231] }
v5 = 0;
[11235, 11238, 11224, 11231] }
} else {
v8 = v6;
[10600, 10596] if (sshkey_advance_past_options(&v6)) {
[10611] *(&v2) = a1;
[10186, 10182] v1 = a0;
[10189] v0 = "%s:%lu: invalid options";
[10637, 10630] sshlog("sshsig.c", "parse_principals_key_and_options", 0x309, 0x0, 0x2, 0x0);
[10660, 10667, 10638, 10674, 10644, 10679, 10650, 10655] v5 = -0x4;
[10688, 10684] goto LABEL_402bdf;
[10695] }
if (v6 && *(v6)) {
[10704, 10707, 10700] tmp_9 = v6;
[10800] v6 += 1;
[10808, 10804] *(tmp_9) = 0;
[10812] skip_space(&v6);
[10819, 10822, 10815] if (sshkey_read(v11, &v6, &v6)) {
[10841] *(&v2) = a1;
[10186, 10182] v1 = a0;
[10189] v0 = "%s:%lu: invalid key";
[10867, 10860] sshlog("sshsig.c", "parse_principals_key_and_options", 0x315, 0x0, 0x2, 0x0);
[10880, 10885, 10890, 10897, 10868, 10904, 10874, 10909] v5 = -0x4;
[10914, 10918] goto LABEL_402bdf;
[10925] }
}
*(&v2) = a1;
[10186, 10182] v1 = a0;
[10189] v0 = "%s:%lu: missing key";
[10737, 10730] sshlog("sshsig.c", "parse_principals_key_and_options", 0x30e, 0x0, 0x2, 0x0);
[10755, 10760, 10767, 10738, 10774, 10744, 10779, 10750] v5 = -0x4;
[10784, 10788] }
}
}
LABEL_402bdf:
free(v9);
[11235, 11238, 11231] sshsigopt_free(v10);
[11250, 11243, 11247] sshkey_free(v11);
[11255, 11259, 11262] *(&v14) = v5;
[11267, 11270, 11274, 11283] }
return v14;
}
|
void emit_ancillary_info() {
[0] char v0; // [bp-0xa8], Other Possible Types: int
[0] int tmp_61; // tmp #61
[0] int tmp_59; // tmp #59
[0] int tmp_37; // tmp #37
[0] int tmp_71; // tmp #71
[0] int tmp_64; // tmp #64
[0] int tmp_69; // tmp #69
[0] int tmp_81; // tmp #81
[0] int tmp_57; // tmp #57
[0] int tmp_79; // tmp #79
[0] int tmp_91; // tmp #91
[0] int tmp_89; // tmp #89
[0] int tmp_103; // tmp #103
[0] int tmp_99; // tmp #99
[0] int tmp_106; // tmp #106
[0] int tmp_101; // tmp #101
[0] int v1; // [bp-0x98]
[0] int v2; // [bp-0x88]
[0] int v3; // [bp-0x78]
[0] int v4; // [bp-0x68]
[0] int v5; // [bp-0x58]
[0] uint128_t v6; // [bp-0x48]
[0] unsigned long long v8; // rsi
[0] struct_0 *v9; // rbx
[0] unsigned long long v10; // r12
[0] char *v11; // rax
[0] unsigned long long v12; // rax
[0]
[0] v8 = "[";
[0, 2] v9 = &v0;
[9, 16, 18, 23, 24, 31, 32, 39, 48, 53, 55, 62] tmp_61 = BinaryOp InterleaveLO;
[65, 70, 77, 82, 89] *(&v0) = tmp_61;
[98, 105, 93] tmp_71 = BinaryOp InterleaveLO;
[114, 109] *(&v1) = tmp_71;
[118] tmp_81 = BinaryOp InterleaveLO;
[128, 135, 123] *(&v2) = tmp_81;
[139] tmp_91 = BinaryOp InterleaveLO;
[144, 149, 156] *(&v3) = tmp_91;
[160] tmp_103 = BinaryOp InterleaveLO;
[165, 170, 177, 182] tmp_106 = BinaryOp InterleaveLO;
[186] *(&v4) = tmp_103;
[194, 190] *(&v5) = tmp_106;
[199] v6 = 0;
[204] do { } while (strcmp("link", v8) && (v8 = v1, v9 = &v1, v1));
[229, 232, 24, 220, 216] v10 = v9->field_8;
[241] if (!v9->field_8)
v10 = "link";
[569, 245] __printf_chk(0x1, dcgettext(NULL, "\n%s online help: <%s>\n", 0x5));
[292, 266, 299, 302, 304, 273, 275, 280, 287] v11 = setlocale(0x5, NULL);
[309, 314, 316] if (v11 && strncmp(v11, "en_", 0x3))
[321, 324, 327, 329, 334, 341] fputs_unlocked(dcgettext(NULL, "Report any translation bugs to <https://translationproject.org/team/>\n", 0x5), stdout);
[548, 553, 556, 559, 534, 541] __printf_chk(0x1, dcgettext(NULL, "Full documentation <%s%s>\n", 0x5));
[407, 419, 424, 394, 427, 430, 437, 405, 439, 412] v12 = __printf_chk(0x1, dcgettext(NULL, "or available locally via: info '(coreutils) %s%s'\n", 0x5));
[512, 517, 518, 520, 522, 463, 470, 472, 496, 503, 506, 509, 511] return;
[512, 517, 518, 520, 522, 496, 503, 506, 509, 511] }
|
void emit_ancillary_info(char *a0) {
[0] unsigned long v0; // [bp-0xb8]
[0] unsigned long long v1[2]; // [bp-0xb0]
[0] char *v2; // [bp-0xa8]
[0] unsigned long v3; // [bp-0xa0]
[0] unsigned long long v4; // [bp-0x98]
[0] unsigned long long v5; // [bp-0x90]
[0] unsigned long long v6; // [bp-0x88]
[0] unsigned long long v7; // [bp-0x80]
[0] unsigned long long v8; // [bp-0x78]
[0] unsigned long long v9; // [bp-0x70]
[0] unsigned long long v10; // [bp-0x68]
[0] unsigned long long v11; // [bp-0x60]
[0] unsigned long long v12; // [bp-0x58]
[0] unsigned long long v13; // [bp-0x50]
[0] unsigned long long v14; // [bp-0x48]
[0] unsigned long long v15; // [bp-0x40]
[0] void* v16; // [bp-0x38]
[0] void* v17; // [bp-0x30]
[0] char v18; // [bp-0x20]
[0] unsigned long long *v21; // fs
[0] unsigned long long v22; // rax
[0]
[0] v4 = "[";
[0, 1, 4, 5, 12, 19, 28, 32, 34, 41] v5 = "test invocation";
[48, 55] v6 = "coreutils";
[69, 62] v7 = "Multi-call invocation";
[80, 73] v8 = "sha224sum";
[91, 84] v9 = "sha2 utilities";
[102, 95] v10 = "sha256sum";
[113, 106] v11 = "sha2 utilities";
[124, 117] v12 = "sha384sum";
[128, 135] v13 = "sha2 utilities";
[146, 139] v14 = "sha512sum";
[157, 150] v15 = "sha2 utilities";
[168, 161] v16 = 0;
[172] v17 = 0;
[180] v0 = a0;
[195, 188] for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1);
[226, 264, 233, 202, 236, 239, 209, 218] if (v1[1])
v0 = v1[1];
[289, 296, 300, 307, 314] printf(gettext("\n%s online help: <%s>\n"));
[326, 333, 336, 307, 341, 314, 319] v2 = setlocale(0x5, NULL);
[361, 346, 356] if (v2 && strncmp(v2, "en_", 0x3))
[385, 390, 368, 400, 376] fputs_unlocked(gettext("Report any translation bugs to <https://translationproject.org/team/>\n"), stdout);
[416, 423, 428, 431, 434] *(&v3) = (!strcmp(a0, "[") ? a0 : "test");
[481, 456, 461, 446, 463] printf(gettext("Full documentation <%s%s>\n"));
[513, 520, 523, 528, 488, 495, 500, 503, 510] printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
[577, 580, 587, 590, 593, 596, 601, 565, 572] v22 = *(&v18) ^ v21[5];
[611, 606, 607] return;
[627, 634, 635, 636] }
|
Bool isempty_RL ( EState* s )
{
if (s->state_in_ch < 256 && s->state_in_len > 0)
return ((Bool)0); else
return ((Bool)1);
}
int BZ2_bzCompressInit
( bz_stream* strm,
int blockSize100k,
int verbosity,
int workFactor )
{
Int32 n;
EState* s;
if (!bz_config_ok()) return (-9);
if (strm ==
((void *)0)
||
blockSize100k < 1 || blockSize100k > 9 ||
workFactor < 0 || workFactor > 250)
return (-2);
if (workFactor == 0) workFactor = 30;
if (strm->bzalloc ==
((void *)0)
) strm->bzalloc = default_bzalloc;
if (strm->bzfree ==
((void *)0)
) strm->bzfree = default_bzfree;
s = (strm->bzalloc)(strm->opaque,(sizeof(EState)),1);
if (s ==
((void *)0)
) return (-3);
s->strm = strm;
s->arr1 =
((void *)0)
;
s->arr2 =
((void *)0)
;
s->ftab =
((void *)0)
;
n = 100000 * blockSize100k;
s->arr1 = (strm->bzalloc)(strm->opaque,(n * sizeof(UInt32)),1);
s->arr2 = (strm->bzalloc)(strm->opaque,((n+(2 + 12 + 18 + 2)) * sizeof(UInt32)),1);
s->ftab = (strm->bzalloc)(strm->opaque,(65537 * sizeof(UInt32)),1);
if (s->arr1 ==
((void *)0)
|| s->arr2 ==
((void *)0)
|| s->ftab ==
((void *)0)
) {
if (s->arr1 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr1));
if (s->arr2 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr2));
if (s->ftab !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ftab));
if (s !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s));
return (-3);
}
s->blockNo = 0;
s->state = 2;
s->mode = 2;
s->combinedCRC = 0;
s->blockSize100k = blockSize100k;
s->nblockMAX = 100000 * blockSize100k - 19;
s->verbosity = verbosity;
s->workFactor = workFactor;
s->block = (UChar*)s->arr2;
s->mtfv = (UInt16*)s->arr1;
s->zbits =
((void *)0)
;
s->ptr = (UInt32*)s->arr1;
strm->state = s;
strm->total_in_lo32 = 0;
strm->total_in_hi32 = 0;
strm->total_out_lo32 = 0;
strm->total_out_hi32 = 0;
init_RL ( s );
prepare_new_block ( s );
return 0;
}
static
void add_pair_to_block ( EState* s )
{
Int32 i;
UChar ch = (UChar)(s->state_in_ch);
for (i = 0; i < s->state_in_len; i++) {
{ s->blockCRC = (s->blockCRC << 8) ^ BZ2_crc32Table[(s->blockCRC >> 24) ^ ((UChar)ch)]; };
}
s->inUse[s->state_in_ch] = ((Bool)1);
switch (s->state_in_len) {
case 1:
s->block[s->nblock] = (UChar)ch; s->nblock++;
break;
case 2:
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
break;
case 3:
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
break;
default:
s->inUse[s->state_in_len-4] = ((Bool)1);
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = ((UChar)(s->state_in_len-4));
s->nblock++;
break;
}
}
static
void flush_RL ( EState* s )
{
if (s->state_in_ch < 256) add_pair_to_block ( s );
init_RL ( s );
}
static
Bool copy_input_until_stop ( EState* s )
{
Bool progress_in = ((Bool)0);
if (s->mode == 2) {
while (((Bool)1)) {
if (s->nblock >= s->nblockMAX) break;
if (s->strm->avail_in == 0) break;
progress_in = ((Bool)1);
{ UInt32 zchh = (UInt32)((UInt32)(*((UChar*)(s->strm->next_in)))); if (zchh != s->state_in_ch && s->state_in_len == 1) { UChar ch = (UChar)(s->state_in_ch); { s->blockCRC = (s->blockCRC << 8) ^ BZ2_crc32Table[(s->blockCRC >> 24) ^ ((UChar)ch)]; }; s->inUse[s->state_in_ch] = ((Bool)1); s->block[s->nblock] = (UChar)ch; s->nblock++; s->state_in_ch = zchh; } else if (zchh != s->state_in_ch || s->state_in_len == 255) { if (s->state_in_ch < 256) add_pair_to_block ( s ); s->state_in_ch = zchh; s->state_in_len = 1; } else { s->state_in_len++; } };
s->strm->next_in++;
s->strm->avail_in--;
s->strm->total_in_lo32++;
if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
}
} else {
while (((Bool)1)) {
if (s->nblock >= s->nblockMAX) break;
if (s->strm->avail_in == 0) break;
if (s->avail_in_expect == 0) break;
progress_in = ((Bool)1);
{ UInt32 zchh = (UInt32)((UInt32)(*((UChar*)(s->strm->next_in)))); if (zchh != s->state_in_ch && s->state_in_len == 1) { UChar ch = (UChar)(s->state_in_ch); { s->blockCRC = (s->blockCRC << 8) ^ BZ2_crc32Table[(s->blockCRC >> 24) ^ ((UChar)ch)]; }; s->inUse[s->state_in_ch] = ((Bool)1); s->block[s->nblock] = (UChar)ch; s->nblock++; s->state_in_ch = zchh; } else if (zchh != s->state_in_ch || s->state_in_len == 255) { if (s->state_in_ch < 256) add_pair_to_block ( s ); s->state_in_ch = zchh; s->state_in_len = 1; } else { s->state_in_len++; } };
s->strm->next_in++;
s->strm->avail_in--;
s->strm->total_in_lo32++;
if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
s->avail_in_expect--;
}
}
return progress_in;
}
static
Bool copy_output_until_stop ( EState* s )
{
Bool progress_out = ((Bool)0);
while (((Bool)1)) {
if (s->strm->avail_out == 0) break;
if (s->state_out_pos >= s->numZ) break;
progress_out = ((Bool)1);
*(s->strm->next_out) = s->zbits[s->state_out_pos];
s->state_out_pos++;
s->strm->avail_out--;
s->strm->next_out++;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
return progress_out;
}
static
Bool handle_compress ( bz_stream* strm )
{
Bool progress_in = ((Bool)0);
Bool progress_out = ((Bool)0);
EState* s = strm->state;
while (((Bool)1)) {
if (s->state == 1) {
progress_out |= copy_output_until_stop ( s );
if (s->state_out_pos < s->numZ) break;
if (s->mode == 4 &&
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
prepare_new_block ( s );
s->state = 2;
if (s->mode == 3 &&
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
}
if (s->state == 2) {
progress_in |= copy_input_until_stop ( s );
if (s->mode != 2 && s->avail_in_expect == 0) {
flush_RL ( s );
BZ2_compressBlock ( s, (Bool)(s->mode == 4) );
s->state = 1;
}
else
if (s->nblock >= s->nblockMAX) {
BZ2_compressBlock ( s, ((Bool)0) );
s->state = 1;
}
else
if (s->strm->avail_in == 0) {
break;
}
}
}
return progress_in || progress_out;
}
int BZ2_bzCompress ( bz_stream *strm, int action )
{
Bool progress;
EState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
preswitch:
switch (s->mode) {
case 1:
return (-1);
case 2:
if (action == 0) {
progress = handle_compress ( strm );
return progress ? 1 : (-2);
}
else
if (action == 1) {
s->avail_in_expect = strm->avail_in;
s->mode = 3;
goto preswitch;
}
else
if (action == 2) {
s->avail_in_expect = strm->avail_in;
s->mode = 4;
goto preswitch;
}
else
return (-2);
case 3:
if (action != 1) return (-1);
if (s->avail_in_expect != s->strm->avail_in)
return (-1);
progress = handle_compress ( strm );
if (s->avail_in_expect > 0 || !isempty_RL(s) ||
s->state_out_pos < s->numZ) return 2;
s->mode = 2;
return 1;
case 4:
if (action != 2) return (-1);
if (s->avail_in_expect != s->strm->avail_in)
return (-1);
progress = handle_compress ( strm );
if (!progress) return (-1);
if (s->avail_in_expect > 0 || !isempty_RL(s) ||
s->state_out_pos < s->numZ) return 3;
s->mode = 1;
return 4;
}
return 0;
}
int BZ2_bzCompressEnd ( bz_stream *strm )
{
EState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
if (s->arr1 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr1));
if (s->arr2 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr2));
if (s->ftab !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ftab));
(strm->bzfree)(strm->opaque,(strm->state));
strm->state =
((void *)0)
;
return 0;
}
int BZ2_bzDecompressInit
( bz_stream* strm,
int verbosity,
int small )
{
DState* s;
if (!bz_config_ok()) return (-9);
if (strm ==
((void *)0)
) return (-2);
if (small != 0 && small != 1) return (-2);
if (verbosity < 0 || verbosity > 4) return (-2);
if (strm->bzalloc ==
((void *)0)
) strm->bzalloc = default_bzalloc;
if (strm->bzfree ==
((void *)0)
) strm->bzfree = default_bzfree;
s = (strm->bzalloc)(strm->opaque,(sizeof(DState)),1);
if (s ==
((void *)0)
) return (-3);
s->strm = strm;
strm->state = s;
s->state = 10;
s->bsLive = 0;
s->bsBuff = 0;
s->calculatedCombinedCRC = 0;
strm->total_in_lo32 = 0;
strm->total_in_hi32 = 0;
strm->total_out_lo32 = 0;
strm->total_out_hi32 = 0;
s->smallDecompress = (Bool)small;
s->ll4 =
((void *)0)
;
s->ll16 =
((void *)0)
;
s->tt =
((void *)0)
;
s->currBlockNo = 0;
s->verbosity = verbosity;
return 0;
}
static
Bool unRLE_obuf_to_output_FAST ( DState* s )
{
UChar k1;
if (s->blockRandomised) {
while (((Bool)1)) {
while (((Bool)1)) {
if (s->strm->avail_out == 0) return ((Bool)0);
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
{ s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; };
s->state_out_len--;
s->strm->next_out++;
s->strm->avail_out--;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
if (s->nblock_used == s->save_nblock+1) return ((Bool)0);
if (s->nblock_used > s->save_nblock+1)
return ((Bool)1);
s->state_out_len = 1;
s->state_out_ch = s->k0;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; s->k0 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
s->k0 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
}
} else {
UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC;
UChar c_state_out_ch = s->state_out_ch;
Int32 c_state_out_len = s->state_out_len;
Int32 c_nblock_used = s->nblock_used;
Int32 c_k0 = s->k0;
UInt32* c_tt = s->tt;
UInt32 c_tPos = s->tPos;
char* cs_next_out = s->strm->next_out;
unsigned int cs_avail_out = s->strm->avail_out;
Int32 ro_blockSize100k = s->blockSize100k;
UInt32 avail_out_INIT = cs_avail_out;
Int32 s_save_nblockPP = s->save_nblock+1;
unsigned int total_out_lo32_old;
while (((Bool)1)) {
if (c_state_out_len > 0) {
while (((Bool)1)) {
if (cs_avail_out == 0) goto return_notr;
if (c_state_out_len == 1) break;
*( (UChar*)(cs_next_out) ) = c_state_out_ch;
{ c_calculatedBlockCRC = (c_calculatedBlockCRC << 8) ^ BZ2_crc32Table[(c_calculatedBlockCRC >> 24) ^ ((UChar)c_state_out_ch)]; };
c_state_out_len--;
cs_next_out++;
cs_avail_out--;
}
s_state_out_len_eq_one:
{
if (cs_avail_out == 0) {
c_state_out_len = 1; goto return_notr;
};
*( (UChar*)(cs_next_out) ) = c_state_out_ch;
{ c_calculatedBlockCRC = (c_calculatedBlockCRC << 8) ^ BZ2_crc32Table[(c_calculatedBlockCRC >> 24) ^ ((UChar)c_state_out_ch)]; };
cs_next_out++;
cs_avail_out--;
}
}
if (c_nblock_used > s_save_nblockPP)
return ((Bool)1);
if (c_nblock_used == s_save_nblockPP) {
c_state_out_len = 0; goto return_notr;
};
c_state_out_ch = c_k0;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
if (k1 != c_k0) {
c_k0 = k1; goto s_state_out_len_eq_one;
};
if (c_nblock_used == s_save_nblockPP)
goto s_state_out_len_eq_one;
c_state_out_len = 2;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
if (c_nblock_used == s_save_nblockPP) continue;
if (k1 != c_k0) { c_k0 = k1; continue; };
c_state_out_len = 3;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
if (c_nblock_used == s_save_nblockPP) continue;
if (k1 != c_k0) { c_k0 = k1; continue; };
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
c_state_out_len = ((Int32)k1) + 4;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; c_k0 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
}
return_notr:
total_out_lo32_old = s->strm->total_out_lo32;
s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out);
if (s->strm->total_out_lo32 < total_out_lo32_old)
s->strm->total_out_hi32++;
s->calculatedBlockCRC = c_calculatedBlockCRC;
s->state_out_ch = c_state_out_ch;
s->state_out_len = c_state_out_len;
s->nblock_used = c_nblock_used;
s->k0 = c_k0;
s->tt = c_tt;
s->tPos = c_tPos;
s->strm->next_out = cs_next_out;
s->strm->avail_out = cs_avail_out;
}
return ((Bool)0);
}
__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
{
Int32 nb, na, mid;
nb = 0;
na = 256;
do {
mid = (nb + na) >> 1;
if (indx >= cftab[mid]) nb = mid; else na = mid;
}
while (na - nb != 1);
return nb;
}
static
Bool unRLE_obuf_to_output_SMALL ( DState* s )
{
UChar k1;
if (s->blockRandomised) {
while (((Bool)1)) {
while (((Bool)1)) {
if (s->strm->avail_out == 0) return ((Bool)0);
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
{ s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; };
s->state_out_len--;
s->strm->next_out++;
s->strm->avail_out--;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
if (s->nblock_used == s->save_nblock+1) return ((Bool)0);
if (s->nblock_used > s->save_nblock+1)
return ((Bool)1);
s->state_out_len = 1;
s->state_out_ch = s->k0;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->k0 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
s->k0 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
}
} else {
while (((Bool)1)) {
while (((Bool)1)) {
if (s->strm->avail_out == 0) return ((Bool)0);
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
{ s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; };
s->state_out_len--;
s->strm->next_out++;
s->strm->avail_out--;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
if (s->nblock_used == s->save_nblock+1) return ((Bool)0);
if (s->nblock_used > s->save_nblock+1)
return ((Bool)1);
s->state_out_len = 1;
s->state_out_ch = s->k0;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->k0 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
}
}
}
int BZ2_bzDecompress ( bz_stream *strm )
{
Bool corrupt;
DState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
while (((Bool)1)) {
if (s->state == 1) return (-1);
if (s->state == 2) {
if (s->smallDecompress)
corrupt = unRLE_obuf_to_output_SMALL ( s ); else
corrupt = unRLE_obuf_to_output_FAST ( s );
if (corrupt) return (-4);
if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
{ s->calculatedBlockCRC = ~(s->calculatedBlockCRC); };
if (s->verbosity >= 3)
fprintf(
stderr
," {0x%08x, 0x%08x}",s->storedBlockCRC,s->calculatedBlockCRC)
;
if (s->verbosity >= 2) fprintf(
stderr
,"]");
if (s->calculatedBlockCRC != s->storedBlockCRC)
return (-4);
s->calculatedCombinedCRC
= (s->calculatedCombinedCRC << 1) |
(s->calculatedCombinedCRC >> 31);
s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
s->state = 14;
} else {
return 0;
}
}
if (s->state >= 10) {
Int32 r = BZ2_decompress ( s );
if (r == 4) {
if (s->verbosity >= 3)
fprintf(
stderr
,"\n combined CRCs: stored = 0x%08x, computed = 0x%08x",s->storedCombinedCRC,s->calculatedCombinedCRC)
;
if (s->calculatedCombinedCRC != s->storedCombinedCRC)
return (-4);
return r;
}
if (s->state != 2) return r;
}
}
{ if (!(0)) BZ2_bz__AssertH__fail ( 6001 ); };
return 0;
}
int BZ2_bzDecompressEnd ( bz_stream *strm )
{
DState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
if (s->tt !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->tt));
if (s->ll16 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ll16));
if (s->ll4 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ll4));
(strm->bzfree)(strm->opaque,(strm->state));
strm->state =
((void *)0)
;
return 0;
}
typedef
struct {
FILE* handle;
Char buf[5000];
Int32 bufN;
Bool writing;
bz_stream strm;
Int32 lastErr;
Bool initialisedOk;
}
bzFile;
static Bool myfeof ( FILE* f )
{
Int32 c = fgetc ( f );
if (c ==
(-1)
) return ((Bool)1);
ungetc ( c, f );
return ((Bool)0);
}
BZFILE* BZ2_bzWriteOpen
( int* bzerror,
FILE* f,
int blockSize100k,
int verbosity,
int workFactor )
{
Int32 ret;
bzFile* bzf =
((void *)0)
;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (f ==
((void *)0)
||
(blockSize100k < 1 || blockSize100k > 9) ||
(workFactor < 0 || workFactor > 250) ||
(verbosity < 0 || verbosity > 4))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return
((void *)0)
; };
if (ferror(f))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return
((void *)0)
; };
bzf = malloc ( sizeof(bzFile) );
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-3); if (bzf !=
((void *)0)
) bzf->lastErr = (-3); }; return
((void *)0)
; };
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
bzf->initialisedOk = ((Bool)0);
bzf->bufN = 0;
bzf->handle = f;
bzf->writing = ((Bool)1);
bzf->strm.bzalloc =
((void *)0)
;
bzf->strm.bzfree =
((void *)0)
;
bzf->strm.opaque =
((void *)0)
;
if (workFactor == 0) workFactor = 30;
ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
verbosity, workFactor );
if (ret != 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; free(bzf); return
((void *)0)
; };
bzf->strm.avail_in = 0;
bzf->initialisedOk = ((Bool)1);
return bzf;
}
void BZ2_bzWrite
( int* bzerror,
BZFILE* b,
void* buf,
int len )
{
Int32 n, n2, ret;
bzFile* bzf = (bzFile*)b;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (bzf ==
((void *)0)
|| buf ==
((void *)0)
|| len < 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return; };
if (!(bzf->writing))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
if (len == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
bzf->strm.avail_in = len;
bzf->strm.next_in = buf;
while (((Bool)1)) {
bzf->strm.avail_out = 5000;
bzf->strm.next_out = bzf->buf;
ret = BZ2_bzCompress ( &(bzf->strm), 0 );
if (ret != 1)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; return; };
if (bzf->strm.avail_out < 5000) {
n = 5000 - bzf->strm.avail_out;
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n, bzf->handle );
if (n != n2 || ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
}
if (bzf->strm.avail_in == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
}
}
void BZ2_bzWriteClose
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in,
unsigned int* nbytes_out )
{
BZ2_bzWriteClose64 ( bzerror, b, abandon,
nbytes_in,
((void *)0)
, nbytes_out,
((void *)0)
);
}
void BZ2_bzWriteClose64
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in_lo32,
unsigned int* nbytes_in_hi32,
unsigned int* nbytes_out_lo32,
unsigned int* nbytes_out_hi32 )
{
Int32 n, n2, ret;
bzFile* bzf = (bzFile*)b;
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
if (!(bzf->writing))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
if (nbytes_in_lo32 !=
((void *)0)
) *nbytes_in_lo32 = 0;
if (nbytes_in_hi32 !=
((void *)0)
) *nbytes_in_hi32 = 0;
if (nbytes_out_lo32 !=
((void *)0)
) *nbytes_out_lo32 = 0;
if (nbytes_out_hi32 !=
((void *)0)
) *nbytes_out_hi32 = 0;
if ((!abandon) && bzf->lastErr == 0) {
while (((Bool)1)) {
bzf->strm.avail_out = 5000;
bzf->strm.next_out = bzf->buf;
ret = BZ2_bzCompress ( &(bzf->strm), 2 );
if (ret != 3 && ret != 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; return; };
if (bzf->strm.avail_out < 5000) {
n = 5000 - bzf->strm.avail_out;
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n, bzf->handle );
if (n != n2 || ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
}
if (ret == 4) break;
}
}
if ( !abandon && !ferror ( bzf->handle ) ) {
fflush ( bzf->handle );
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
}
if (nbytes_in_lo32 !=
((void *)0)
)
*nbytes_in_lo32 = bzf->strm.total_in_lo32;
if (nbytes_in_hi32 !=
((void *)0)
)
*nbytes_in_hi32 = bzf->strm.total_in_hi32;
if (nbytes_out_lo32 !=
((void *)0)
)
*nbytes_out_lo32 = bzf->strm.total_out_lo32;
if (nbytes_out_hi32 !=
((void *)0)
)
*nbytes_out_hi32 = bzf->strm.total_out_hi32;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
BZ2_bzCompressEnd ( &(bzf->strm) );
free ( bzf );
}
BZFILE* BZ2_bzReadOpen
( int* bzerror,
FILE* f,
int verbosity,
int small,
void* unused,
int nUnused )
{
bzFile* bzf =
((void *)0)
;
int ret;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (f ==
((void *)0)
||
(small != 0 && small != 1) ||
(verbosity < 0 || verbosity > 4) ||
(unused ==
((void *)0)
&& nUnused != 0) ||
(unused !=
((void *)0)
&& (nUnused < 0 || nUnused > 5000)))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return
((void *)0)
; };
if (ferror(f))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return
((void *)0)
; };
bzf = malloc ( sizeof(bzFile) );
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-3); if (bzf !=
((void *)0)
) bzf->lastErr = (-3); }; return
((void *)0)
; };
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
bzf->initialisedOk = ((Bool)0);
bzf->handle = f;
bzf->bufN = 0;
bzf->writing = ((Bool)0);
bzf->strm.bzalloc =
((void *)0)
;
bzf->strm.bzfree =
((void *)0)
;
bzf->strm.opaque =
((void *)0)
;
while (nUnused > 0) {
bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
unused = ((void*)( 1 + ((UChar*)(unused)) ));
nUnused--;
}
ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
if (ret != 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; free(bzf); return
((void *)0)
; };
bzf->strm.avail_in = bzf->bufN;
bzf->strm.next_in = bzf->buf;
bzf->initialisedOk = ((Bool)1);
return bzf;
}
void BZ2_bzReadClose ( int *bzerror, BZFILE *b )
{
bzFile* bzf = (bzFile*)b;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
if (bzf->writing)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (bzf->initialisedOk)
(void)BZ2_bzDecompressEnd ( &(bzf->strm) );
free ( bzf );
}
int BZ2_bzRead
( int* bzerror,
BZFILE* b,
void* buf,
int len )
{
Int32 n, ret;
bzFile* bzf = (bzFile*)b;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (bzf ==
((void *)0)
|| buf ==
((void *)0)
|| len < 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return 0; };
if (bzf->writing)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return 0; };
if (len == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return 0; };
bzf->strm.avail_out = len;
bzf->strm.next_out = buf;
while (((Bool)1)) {
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return 0; };
if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
n = fread ( bzf->buf, sizeof(UChar),
5000, bzf->handle );
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return 0; };
bzf->bufN = n;
bzf->strm.avail_in = bzf->bufN;
bzf->strm.next_in = bzf->buf;
}
ret = BZ2_bzDecompress ( &(bzf->strm) );
if (ret != 0 && ret != 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; return 0; };
if (ret == 0 && myfeof(bzf->handle) &&
bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-7); if (bzf !=
((void *)0)
) bzf->lastErr = (-7); }; return 0; };
if (ret == 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = 4; if (bzf !=
((void *)0)
) bzf->lastErr = 4; };
return len - bzf->strm.avail_out; };
if (bzf->strm.avail_out == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return len; };
}
return 0;
}
void BZ2_bzReadGetUnused
( int* bzerror,
BZFILE* b,
void** unused,
int* nUnused )
{
bzFile* bzf = (bzFile*)b;
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return; };
if (bzf->lastErr != 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (unused ==
((void *)0)
|| nUnused ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return; };
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
*nUnused = bzf->strm.avail_in;
*unused = bzf->strm.next_in;
}
int BZ2_bzBuffToBuffCompress
( char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int blockSize100k,
int verbosity,
int workFactor )
{
bz_stream strm;
int ret;
if (dest ==
((void *)0)
|| destLen ==
((void *)0)
||
source ==
((void *)0)
||
blockSize100k < 1 || blockSize100k > 9 ||
verbosity < 0 || verbosity > 4 ||
workFactor < 0 || workFactor > 250)
return (-2);
if (workFactor == 0) workFactor = 30;
strm.bzalloc =
((void *)0)
;
strm.bzfree =
((void *)0)
;
strm.opaque =
((void *)0)
;
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
verbosity, workFactor );
if (ret != 0) return ret;
strm.next_in = source;
strm.next_out = dest;
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
ret = BZ2_bzCompress ( &strm, 2 );
if (ret == 3) goto output_overflow;
if (ret != 4) goto errhandler;
*destLen -= strm.avail_out;
BZ2_bzCompressEnd ( &strm );
return 0;
output_overflow:
BZ2_bzCompressEnd ( &strm );
return (-8);
errhandler:
BZ2_bzCompressEnd ( &strm );
return ret;
}
int BZ2_bzBuffToBuffDecompress
( char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int small,
int verbosity )
{
bz_stream strm;
int ret;
if (dest ==
((void *)0)
|| destLen ==
((void *)0)
||
source ==
((void *)0)
||
(small != 0 && small != 1) ||
verbosity < 0 || verbosity > 4)
return (-2);
strm.bzalloc =
((void *)0)
;
strm.bzfree =
((void *)0)
;
strm.opaque =
((void *)0)
;
ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
if (ret != 0) return ret;
strm.next_in = source;
strm.next_out = dest;
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
ret = BZ2_bzDecompress ( &strm );
if (ret == 0) goto output_overflow_or_eof;
if (ret != 4) goto errhandler;
*destLen -= strm.avail_out;
BZ2_bzDecompressEnd ( &strm );
return 0;
output_overflow_or_eof:
if (strm.avail_out > 0) {
BZ2_bzDecompressEnd ( &strm );
return (-7);
} else {
BZ2_bzDecompressEnd ( &strm );
return (-8);
};
errhandler:
BZ2_bzDecompressEnd ( &strm );
return ret;
}
const char * BZ2_bzlibVersion(void)
{
return "1.0.8, 13-Jul-2019";
}
static
BZFILE * bzopen_or_bzdopen
( const char *path,
int fd,
const char *mode,
int open_mode)
{
int bzerr;
char unused[5000];
int blockSize100k = 9;
int writing = 0;
char mode2[10] = "";
FILE *fp =
((void *)0)
;
BZFILE *bzfp =
((void *)0)
;
int verbosity = 0;
int workFactor = 30;
int smallMode = 0;
int nUnused = 0;
if (mode ==
((void *)0)
) return
((void *)0)
;
while (*mode) {
switch (*mode) {
case 'r':
writing = 0; break;
case 'w':
writing = 1; break;
case 's':
smallMode = 1; break;
default:
if (
((*__ctype_b_loc ())[(int) ((
(int)(*mode)
))] & (unsigned short int) _ISdigit)
) {
blockSize100k = *mode-0x30;
}
}
mode++;
}
strcat(mode2, writing ? "w" : "r" );
strcat(mode2,"b");
if (open_mode==0) {
if (path==
((void *)0)
|| strcmp(path,"")==0) {
fp = (writing ?
stdout
:
stdin
);
;
} else {
fp = fopen(path,mode2);
}
} else {
fp = fdopen(fd,mode2);
}
if (fp ==
((void *)0)
) return
((void *)0)
;
if (writing) {
if (blockSize100k < 1) blockSize100k = 1;
if (blockSize100k > 9) blockSize100k = 9;
bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
verbosity,workFactor);
} else {
bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
unused,nUnused);
}
if (bzfp ==
((void *)0)
) {
if (fp !=
stdin
&& fp !=
stdout
) fclose(fp);
return
((void *)0)
;
}
return bzfp;
}
BZFILE * BZ2_bzopen
( const char *path,
const char *mode )
{
return bzopen_or_bzdopen(path,-1,mode, 0);
}
BZFILE * BZ2_bzdopen
( int fd,
const char *mode )
{
return bzopen_or_bzdopen(
((void *)0)
,fd,mode, 1);
}
int BZ2_bzread (BZFILE* b, void* buf, int len )
{
int bzerr, nread;
if (((bzFile*)b)->lastErr == 4) return 0;
nread = BZ2_bzRead(&bzerr,b,buf,len);
if (bzerr == 0 || bzerr == 4) {
return nread;
} else {
return -1;
}
}
int BZ2_bzwrite (BZFILE* b, void* buf, int len )
{
int bzerr;
BZ2_bzWrite(&bzerr,b,buf,len);
if(bzerr == 0){
return len;
}else{
return -1;
}
}
int BZ2_bzflush (BZFILE *b)
{
return 0;
}
void BZ2_bzclose (BZFILE* b)
{
int bzerr;
FILE *fp;
if (b==
((void *)0)
) {return;}
fp = ((bzFile *)b)->handle;
if(((bzFile*)b)->writing){
BZ2_bzWriteClose(&bzerr,b,0,
((void *)0)
,
((void *)0)
);
if(bzerr != 0){
BZ2_bzWriteClose(
((void *)0)
,b,1,
((void *)0)
,
((void *)0)
);
}
}else{
BZ2_bzReadClose(&bzerr,b);
}
if(fp!=
stdin
&& fp!=
stdout
){
fclose(fp);
}
}
static const char *bzerrorstrings[] = {
"OK"
,"SEQUENCE_ERROR"
,"PARAM_ERROR"
,"MEM_ERROR"
,"DATA_ERROR"
,"DATA_ERROR_MAGIC"
,"IO_ERROR"
,"UNEXPECTED_EOF"
,"OUTBUFF_FULL"
,"CONFIG_ERROR"
,"???"
,"???"
,"???"
,"???"
,"???"
,"???"
};
const char * BZ2_bzerror (BZFILE *b, int *errnum)
{
int err = ((bzFile *)b)->lastErr;
if(err>0) err = 0;
*errnum = err;
return bzerrorstrings[err*-1];
}
|
Bool isempty_RL ( EState* s )
{
if (s->state_in_ch < 256 && s->state_in_len > 0)
return ((Bool)0); else
return ((Bool)1);
}
int BZ2_bzCompressInit
( bz_stream* strm,
int blockSize100k,
int verbosity,
int workFactor )
{
Int32 n;
EState* s;
if (!bz_config_ok()) return (-9);
if (strm ==
((void *)0)
||
blockSize100k < 1 || blockSize100k > 9 ||
workFactor < 0 || workFactor > 250)
return (-2);
if (workFactor == 0) workFactor = 30;
if (strm->bzalloc ==
((void *)0)
) strm->bzalloc = default_bzalloc;
if (strm->bzfree ==
((void *)0)
) strm->bzfree = default_bzfree;
s = (strm->bzalloc)(strm->opaque,(sizeof(EState)),1);
if (s ==
((void *)0)
) return (-3);
s->strm = strm;
s->arr1 =
((void *)0)
;
s->arr2 =
((void *)0)
;
s->ftab =
((void *)0)
;
n = 100000 * blockSize100k;
s->arr1 = (strm->bzalloc)(strm->opaque,(n * sizeof(UInt32)),1);
s->arr2 = (strm->bzalloc)(strm->opaque,((n+(2 + 12 + 18 + 2)) * sizeof(UInt32)),1);
s->ftab = (strm->bzalloc)(strm->opaque,(65537 * sizeof(UInt32)),1);
if (s->arr1 ==
((void *)0)
|| s->arr2 ==
((void *)0)
|| s->ftab ==
((void *)0)
) {
if (s->arr1 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr1));
if (s->arr2 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr2));
if (s->ftab !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ftab));
if (s !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s));
return (-3);
}
s->blockNo = 0;
s->state = 2;
s->mode = 2;
s->combinedCRC = 0;
s->blockSize100k = blockSize100k;
s->nblockMAX = 100000 * blockSize100k - 19;
s->verbosity = verbosity;
s->workFactor = workFactor;
s->block = (UChar*)s->arr2;
s->mtfv = (UInt16*)s->arr1;
s->zbits =
((void *)0)
;
s->ptr = (UInt32*)s->arr1;
strm->state = s;
strm->total_in_lo32 = 0;
strm->total_in_hi32 = 0;
strm->total_out_lo32 = 0;
strm->total_out_hi32 = 0;
init_RL ( s );
prepare_new_block ( s );
return 0;
}
static
void add_pair_to_block ( EState* s )
{
Int32 i;
UChar ch = (UChar)(s->state_in_ch);
for (i = 0; i < s->state_in_len; i++) {
{ s->blockCRC = (s->blockCRC << 8) ^ BZ2_crc32Table[(s->blockCRC >> 24) ^ ((UChar)ch)]; };
}
s->inUse[s->state_in_ch] = ((Bool)1);
switch (s->state_in_len) {
case 1:
s->block[s->nblock] = (UChar)ch; s->nblock++;
break;
case 2:
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
break;
case 3:
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
break;
default:
s->inUse[s->state_in_len-4] = ((Bool)1);
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = (UChar)ch; s->nblock++;
s->block[s->nblock] = ((UChar)(s->state_in_len-4));
s->nblock++;
break;
}
}
static
void flush_RL ( EState* s )
{
if (s->state_in_ch < 256) add_pair_to_block ( s );
init_RL ( s );
}
static
Bool copy_input_until_stop ( EState* s )
{
Bool progress_in = ((Bool)0);
if (s->mode == 2) {
while (((Bool)1)) {
if (s->nblock >= s->nblockMAX) break;
if (s->strm->avail_in == 0) break;
progress_in = ((Bool)1);
{ UInt32 zchh = (UInt32)((UInt32)(*((UChar*)(s->strm->next_in)))); if (zchh != s->state_in_ch && s->state_in_len == 1) { UChar ch = (UChar)(s->state_in_ch); { s->blockCRC = (s->blockCRC << 8) ^ BZ2_crc32Table[(s->blockCRC >> 24) ^ ((UChar)ch)]; }; s->inUse[s->state_in_ch] = ((Bool)1); s->block[s->nblock] = (UChar)ch; s->nblock++; s->state_in_ch = zchh; } else if (zchh != s->state_in_ch || s->state_in_len == 255) { if (s->state_in_ch < 256) add_pair_to_block ( s ); s->state_in_ch = zchh; s->state_in_len = 1; } else { s->state_in_len++; } };
s->strm->next_in++;
s->strm->avail_in--;
s->strm->total_in_lo32++;
if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
}
} else {
while (((Bool)1)) {
if (s->nblock >= s->nblockMAX) break;
if (s->strm->avail_in == 0) break;
if (s->avail_in_expect == 0) break;
progress_in = ((Bool)1);
{ UInt32 zchh = (UInt32)((UInt32)(*((UChar*)(s->strm->next_in)))); if (zchh != s->state_in_ch && s->state_in_len == 1) { UChar ch = (UChar)(s->state_in_ch); { s->blockCRC = (s->blockCRC << 8) ^ BZ2_crc32Table[(s->blockCRC >> 24) ^ ((UChar)ch)]; }; s->inUse[s->state_in_ch] = ((Bool)1); s->block[s->nblock] = (UChar)ch; s->nblock++; s->state_in_ch = zchh; } else if (zchh != s->state_in_ch || s->state_in_len == 255) { if (s->state_in_ch < 256) add_pair_to_block ( s ); s->state_in_ch = zchh; s->state_in_len = 1; } else { s->state_in_len++; } };
s->strm->next_in++;
s->strm->avail_in--;
s->strm->total_in_lo32++;
if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
s->avail_in_expect--;
}
}
return progress_in;
}
static
Bool copy_output_until_stop ( EState* s )
{
Bool progress_out = ((Bool)0);
while (((Bool)1)) {
if (s->strm->avail_out == 0) break;
if (s->state_out_pos >= s->numZ) break;
progress_out = ((Bool)1);
*(s->strm->next_out) = s->zbits[s->state_out_pos];
s->state_out_pos++;
s->strm->avail_out--;
s->strm->next_out++;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
return progress_out;
}
static
Bool handle_compress ( bz_stream* strm )
{
Bool progress_in = ((Bool)0);
Bool progress_out = ((Bool)0);
EState* s = strm->state;
while (((Bool)1)) {
if (s->state == 1) {
progress_out |= copy_output_until_stop ( s );
if (s->state_out_pos < s->numZ) break;
if (s->mode == 4 &&
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
prepare_new_block ( s );
s->state = 2;
if (s->mode == 3 &&
s->avail_in_expect == 0 &&
isempty_RL(s)) break;
}
if (s->state == 2) {
progress_in |= copy_input_until_stop ( s );
if (s->mode != 2 && s->avail_in_expect == 0) {
flush_RL ( s );
BZ2_compressBlock ( s, (Bool)(s->mode == 4) );
s->state = 1;
}
else
if (s->nblock >= s->nblockMAX) {
BZ2_compressBlock ( s, ((Bool)0) );
s->state = 1;
}
else
if (s->strm->avail_in == 0) {
break;
}
}
}
return progress_in || progress_out;
}
int BZ2_bzCompress ( bz_stream *strm, int action )
{
Bool progress;
EState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
preswitch:
switch (s->mode) {
case 1:
return (-1);
case 2:
if (action == 0) {
progress = handle_compress ( strm );
return progress ? 1 : (-2);
}
else
if (action == 1) {
s->avail_in_expect = strm->avail_in;
s->mode = 3;
goto preswitch;
}
else
if (action == 2) {
s->avail_in_expect = strm->avail_in;
s->mode = 4;
goto preswitch;
}
else
return (-2);
case 3:
if (action != 1) return (-1);
if (s->avail_in_expect != s->strm->avail_in)
return (-1);
progress = handle_compress ( strm );
if (s->avail_in_expect > 0 || !isempty_RL(s) ||
s->state_out_pos < s->numZ) return 2;
s->mode = 2;
return 1;
case 4:
if (action != 2) return (-1);
if (s->avail_in_expect != s->strm->avail_in)
return (-1);
progress = handle_compress ( strm );
if (!progress) return (-1);
if (s->avail_in_expect > 0 || !isempty_RL(s) ||
s->state_out_pos < s->numZ) return 3;
s->mode = 1;
return 4;
}
return 0;
}
int BZ2_bzCompressEnd ( bz_stream *strm )
{
EState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
if (s->arr1 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr1));
if (s->arr2 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->arr2));
if (s->ftab !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ftab));
(strm->bzfree)(strm->opaque,(strm->state));
strm->state =
((void *)0)
;
return 0;
}
int BZ2_bzDecompressInit
( bz_stream* strm,
int verbosity,
int small )
{
DState* s;
if (!bz_config_ok()) return (-9);
if (strm ==
((void *)0)
) return (-2);
if (small != 0 && small != 1) return (-2);
if (verbosity < 0 || verbosity > 4) return (-2);
if (strm->bzalloc ==
((void *)0)
) strm->bzalloc = default_bzalloc;
if (strm->bzfree ==
((void *)0)
) strm->bzfree = default_bzfree;
s = (strm->bzalloc)(strm->opaque,(sizeof(DState)),1);
if (s ==
((void *)0)
) return (-3);
s->strm = strm;
strm->state = s;
s->state = 10;
s->bsLive = 0;
s->bsBuff = 0;
s->calculatedCombinedCRC = 0;
strm->total_in_lo32 = 0;
strm->total_in_hi32 = 0;
strm->total_out_lo32 = 0;
strm->total_out_hi32 = 0;
s->smallDecompress = (Bool)small;
s->ll4 =
((void *)0)
;
s->ll16 =
((void *)0)
;
s->tt =
((void *)0)
;
s->currBlockNo = 0;
s->verbosity = verbosity;
return 0;
}
static
Bool unRLE_obuf_to_output_FAST ( DState* s )
{
UChar k1;
if (s->blockRandomised) {
while (((Bool)1)) {
while (((Bool)1)) {
if (s->strm->avail_out == 0) return ((Bool)0);
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
{ s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; };
s->state_out_len--;
s->strm->next_out++;
s->strm->avail_out--;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
if (s->nblock_used == s->save_nblock+1) return ((Bool)0);
if (s->nblock_used > s->save_nblock+1)
return ((Bool)1);
s->state_out_len = 1;
s->state_out_ch = s->k0;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; k1 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->tPos = s->tt[s->tPos]; s->k0 = (UChar)(s->tPos & 0xff); s->tPos >>= 8;; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
s->k0 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
}
} else {
UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC;
UChar c_state_out_ch = s->state_out_ch;
Int32 c_state_out_len = s->state_out_len;
Int32 c_nblock_used = s->nblock_used;
Int32 c_k0 = s->k0;
UInt32* c_tt = s->tt;
UInt32 c_tPos = s->tPos;
char* cs_next_out = s->strm->next_out;
unsigned int cs_avail_out = s->strm->avail_out;
Int32 ro_blockSize100k = s->blockSize100k;
UInt32 avail_out_INIT = cs_avail_out;
Int32 s_save_nblockPP = s->save_nblock+1;
unsigned int total_out_lo32_old;
while (((Bool)1)) {
if (c_state_out_len > 0) {
while (((Bool)1)) {
if (cs_avail_out == 0) goto return_notr;
if (c_state_out_len == 1) break;
*( (UChar*)(cs_next_out) ) = c_state_out_ch;
{ c_calculatedBlockCRC = (c_calculatedBlockCRC << 8) ^ BZ2_crc32Table[(c_calculatedBlockCRC >> 24) ^ ((UChar)c_state_out_ch)]; };
c_state_out_len--;
cs_next_out++;
cs_avail_out--;
}
s_state_out_len_eq_one:
{
if (cs_avail_out == 0) {
c_state_out_len = 1; goto return_notr;
};
*( (UChar*)(cs_next_out) ) = c_state_out_ch;
{ c_calculatedBlockCRC = (c_calculatedBlockCRC << 8) ^ BZ2_crc32Table[(c_calculatedBlockCRC >> 24) ^ ((UChar)c_state_out_ch)]; };
cs_next_out++;
cs_avail_out--;
}
}
if (c_nblock_used > s_save_nblockPP)
return ((Bool)1);
if (c_nblock_used == s_save_nblockPP) {
c_state_out_len = 0; goto return_notr;
};
c_state_out_ch = c_k0;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
if (k1 != c_k0) {
c_k0 = k1; goto s_state_out_len_eq_one;
};
if (c_nblock_used == s_save_nblockPP)
goto s_state_out_len_eq_one;
c_state_out_len = 2;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
if (c_nblock_used == s_save_nblockPP) continue;
if (k1 != c_k0) { c_k0 = k1; continue; };
c_state_out_len = 3;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
if (c_nblock_used == s_save_nblockPP) continue;
if (k1 != c_k0) { c_k0 = k1; continue; };
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; k1 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
c_state_out_len = ((Int32)k1) + 4;
if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return ((Bool)1); c_tPos = c_tt[c_tPos]; c_k0 = (UChar)(c_tPos & 0xff); c_tPos >>= 8;; c_nblock_used++;
}
return_notr:
total_out_lo32_old = s->strm->total_out_lo32;
s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out);
if (s->strm->total_out_lo32 < total_out_lo32_old)
s->strm->total_out_hi32++;
s->calculatedBlockCRC = c_calculatedBlockCRC;
s->state_out_ch = c_state_out_ch;
s->state_out_len = c_state_out_len;
s->nblock_used = c_nblock_used;
s->k0 = c_k0;
s->tt = c_tt;
s->tPos = c_tPos;
s->strm->next_out = cs_next_out;
s->strm->avail_out = cs_avail_out;
}
return ((Bool)0);
}
__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
{
Int32 nb, na, mid;
nb = 0;
na = 256;
do {
mid = (nb + na) >> 1;
if (indx >= cftab[mid]) nb = mid; else na = mid;
}
while (na - nb != 1);
return nb;
}
static
Bool unRLE_obuf_to_output_SMALL ( DState* s )
{
UChar k1;
if (s->blockRandomised) {
while (((Bool)1)) {
while (((Bool)1)) {
if (s->strm->avail_out == 0) return ((Bool)0);
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
{ s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; };
s->state_out_len--;
s->strm->next_out++;
s->strm->avail_out--;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
if (s->nblock_used == s->save_nblock+1) return ((Bool)0);
if (s->nblock_used > s->save_nblock+1)
return ((Bool)1);
s->state_out_len = 1;
s->state_out_ch = s->k0;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->k0 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--;;
s->k0 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++;
}
} else {
while (((Bool)1)) {
while (((Bool)1)) {
if (s->strm->avail_out == 0) return ((Bool)0);
if (s->state_out_len == 0) break;
*( (UChar*)(s->strm->next_out) ) = s->state_out_ch;
{ s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; };
s->state_out_len--;
s->strm->next_out++;
s->strm->avail_out--;
s->strm->total_out_lo32++;
if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
}
if (s->nblock_used == s->save_nblock+1) return ((Bool)0);
if (s->nblock_used > s->save_nblock+1)
return ((Bool)1);
s->state_out_len = 1;
s->state_out_ch = s->k0;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 2;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
s->state_out_len = 3;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
if (s->nblock_used == s->save_nblock+1) continue;
if (k1 != s->k0) { s->k0 = k1; continue; };
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
s->state_out_len = ((Int32)k1) + 4;
if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->k0 = BZ2_indexIntoF ( s->tPos, s->cftab ); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16));; s->nblock_used++;
}
}
}
int BZ2_bzDecompress ( bz_stream *strm )
{
Bool corrupt;
DState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
while (((Bool)1)) {
if (s->state == 1) return (-1);
if (s->state == 2) {
if (s->smallDecompress)
corrupt = unRLE_obuf_to_output_SMALL ( s ); else
corrupt = unRLE_obuf_to_output_FAST ( s );
if (corrupt) return (-4);
if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
{ s->calculatedBlockCRC = ~(s->calculatedBlockCRC); };
if (s->verbosity >= 3)
fprintf(
stderr
," {0x%08x, 0x%08x}",s->storedBlockCRC,s->calculatedBlockCRC)
;
if (s->verbosity >= 2) fprintf(
stderr
,"]");
if (s->calculatedBlockCRC != s->storedBlockCRC)
return (-4);
s->calculatedCombinedCRC
= (s->calculatedCombinedCRC << 1) |
(s->calculatedCombinedCRC >> 31);
s->calculatedCombinedCRC ^= s->calculatedBlockCRC;
s->state = 14;
} else {
return 0;
}
}
if (s->state >= 10) {
Int32 r = BZ2_decompress ( s );
if (r == 4) {
if (s->verbosity >= 3)
fprintf(
stderr
,"\n combined CRCs: stored = 0x%08x, computed = 0x%08x",s->storedCombinedCRC,s->calculatedCombinedCRC)
;
if (s->calculatedCombinedCRC != s->storedCombinedCRC)
return (-4);
return r;
}
if (s->state != 2) return r;
}
}
{ if (!(0)) BZ2_bz__AssertH__fail ( 6001 ); };
return 0;
}
int BZ2_bzDecompressEnd ( bz_stream *strm )
{
DState* s;
if (strm ==
((void *)0)
) return (-2);
s = strm->state;
if (s ==
((void *)0)
) return (-2);
if (s->strm != strm) return (-2);
if (s->tt !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->tt));
if (s->ll16 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ll16));
if (s->ll4 !=
((void *)0)
) (strm->bzfree)(strm->opaque,(s->ll4));
(strm->bzfree)(strm->opaque,(strm->state));
strm->state =
((void *)0)
;
return 0;
}
typedef
struct {
FILE* handle;
Char buf[5000];
Int32 bufN;
Bool writing;
bz_stream strm;
Int32 lastErr;
Bool initialisedOk;
}
bzFile;
static Bool myfeof ( FILE* f )
{
Int32 c = fgetc ( f );
if (c ==
(-1)
) return ((Bool)1);
ungetc ( c, f );
return ((Bool)0);
}
BZFILE* BZ2_bzWriteOpen
( int* bzerror,
FILE* f,
int blockSize100k,
int verbosity,
int workFactor )
{
Int32 ret;
bzFile* bzf =
((void *)0)
;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (f ==
((void *)0)
||
(blockSize100k < 1 || blockSize100k > 9) ||
(workFactor < 0 || workFactor > 250) ||
(verbosity < 0 || verbosity > 4))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return
((void *)0)
; };
if (ferror(f))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return
((void *)0)
; };
bzf = malloc ( sizeof(bzFile) );
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-3); if (bzf !=
((void *)0)
) bzf->lastErr = (-3); }; return
((void *)0)
; };
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
bzf->initialisedOk = ((Bool)0);
bzf->bufN = 0;
bzf->handle = f;
bzf->writing = ((Bool)1);
bzf->strm.bzalloc =
((void *)0)
;
bzf->strm.bzfree =
((void *)0)
;
bzf->strm.opaque =
((void *)0)
;
if (workFactor == 0) workFactor = 30;
ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k,
verbosity, workFactor );
if (ret != 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; free(bzf); return
((void *)0)
; };
bzf->strm.avail_in = 0;
bzf->initialisedOk = ((Bool)1);
return bzf;
}
void BZ2_bzWrite
( int* bzerror,
BZFILE* b,
void* buf,
int len )
{
Int32 n, n2, ret;
bzFile* bzf = (bzFile*)b;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (bzf ==
((void *)0)
|| buf ==
((void *)0)
|| len < 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return; };
if (!(bzf->writing))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
if (len == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
bzf->strm.avail_in = len;
bzf->strm.next_in = buf;
while (((Bool)1)) {
bzf->strm.avail_out = 5000;
bzf->strm.next_out = bzf->buf;
ret = BZ2_bzCompress ( &(bzf->strm), 0 );
if (ret != 1)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; return; };
if (bzf->strm.avail_out < 5000) {
n = 5000 - bzf->strm.avail_out;
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n, bzf->handle );
if (n != n2 || ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
}
if (bzf->strm.avail_in == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
}
}
void BZ2_bzWriteClose
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in,
unsigned int* nbytes_out )
{
BZ2_bzWriteClose64 ( bzerror, b, abandon,
nbytes_in,
((void *)0)
, nbytes_out,
((void *)0)
);
}
void BZ2_bzWriteClose64
( int* bzerror,
BZFILE* b,
int abandon,
unsigned int* nbytes_in_lo32,
unsigned int* nbytes_in_hi32,
unsigned int* nbytes_out_lo32,
unsigned int* nbytes_out_hi32 )
{
Int32 n, n2, ret;
bzFile* bzf = (bzFile*)b;
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
if (!(bzf->writing))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
if (nbytes_in_lo32 !=
((void *)0)
) *nbytes_in_lo32 = 0;
if (nbytes_in_hi32 !=
((void *)0)
) *nbytes_in_hi32 = 0;
if (nbytes_out_lo32 !=
((void *)0)
) *nbytes_out_lo32 = 0;
if (nbytes_out_hi32 !=
((void *)0)
) *nbytes_out_hi32 = 0;
if ((!abandon) && bzf->lastErr == 0) {
while (((Bool)1)) {
bzf->strm.avail_out = 5000;
bzf->strm.next_out = bzf->buf;
ret = BZ2_bzCompress ( &(bzf->strm), 2 );
if (ret != 3 && ret != 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; return; };
if (bzf->strm.avail_out < 5000) {
n = 5000 - bzf->strm.avail_out;
n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar),
n, bzf->handle );
if (n != n2 || ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
}
if (ret == 4) break;
}
}
if ( !abandon && !ferror ( bzf->handle ) ) {
fflush ( bzf->handle );
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return; };
}
if (nbytes_in_lo32 !=
((void *)0)
)
*nbytes_in_lo32 = bzf->strm.total_in_lo32;
if (nbytes_in_hi32 !=
((void *)0)
)
*nbytes_in_hi32 = bzf->strm.total_in_hi32;
if (nbytes_out_lo32 !=
((void *)0)
)
*nbytes_out_lo32 = bzf->strm.total_out_lo32;
if (nbytes_out_hi32 !=
((void *)0)
)
*nbytes_out_hi32 = bzf->strm.total_out_hi32;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
BZ2_bzCompressEnd ( &(bzf->strm) );
free ( bzf );
}
BZFILE* BZ2_bzReadOpen
( int* bzerror,
FILE* f,
int verbosity,
int small,
void* unused,
int nUnused )
{
bzFile* bzf =
((void *)0)
;
int ret;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (f ==
((void *)0)
||
(small != 0 && small != 1) ||
(verbosity < 0 || verbosity > 4) ||
(unused ==
((void *)0)
&& nUnused != 0) ||
(unused !=
((void *)0)
&& (nUnused < 0 || nUnused > 5000)))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return
((void *)0)
; };
if (ferror(f))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return
((void *)0)
; };
bzf = malloc ( sizeof(bzFile) );
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-3); if (bzf !=
((void *)0)
) bzf->lastErr = (-3); }; return
((void *)0)
; };
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
bzf->initialisedOk = ((Bool)0);
bzf->handle = f;
bzf->bufN = 0;
bzf->writing = ((Bool)0);
bzf->strm.bzalloc =
((void *)0)
;
bzf->strm.bzfree =
((void *)0)
;
bzf->strm.opaque =
((void *)0)
;
while (nUnused > 0) {
bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++;
unused = ((void*)( 1 + ((UChar*)(unused)) ));
nUnused--;
}
ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small );
if (ret != 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; free(bzf); return
((void *)0)
; };
bzf->strm.avail_in = bzf->bufN;
bzf->strm.next_in = bzf->buf;
bzf->initialisedOk = ((Bool)1);
return bzf;
}
void BZ2_bzReadClose ( int *bzerror, BZFILE *b )
{
bzFile* bzf = (bzFile*)b;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return; };
if (bzf->writing)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (bzf->initialisedOk)
(void)BZ2_bzDecompressEnd ( &(bzf->strm) );
free ( bzf );
}
int BZ2_bzRead
( int* bzerror,
BZFILE* b,
void* buf,
int len )
{
Int32 n, ret;
bzFile* bzf = (bzFile*)b;
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
if (bzf ==
((void *)0)
|| buf ==
((void *)0)
|| len < 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return 0; };
if (bzf->writing)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return 0; };
if (len == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return 0; };
bzf->strm.avail_out = len;
bzf->strm.next_out = buf;
while (((Bool)1)) {
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return 0; };
if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) {
n = fread ( bzf->buf, sizeof(UChar),
5000, bzf->handle );
if (ferror(bzf->handle))
{ { if (bzerror !=
((void *)0)
) *bzerror = (-6); if (bzf !=
((void *)0)
) bzf->lastErr = (-6); }; return 0; };
bzf->bufN = n;
bzf->strm.avail_in = bzf->bufN;
bzf->strm.next_in = bzf->buf;
}
ret = BZ2_bzDecompress ( &(bzf->strm) );
if (ret != 0 && ret != 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = ret; if (bzf !=
((void *)0)
) bzf->lastErr = ret; }; return 0; };
if (ret == 0 && myfeof(bzf->handle) &&
bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-7); if (bzf !=
((void *)0)
) bzf->lastErr = (-7); }; return 0; };
if (ret == 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = 4; if (bzf !=
((void *)0)
) bzf->lastErr = 4; };
return len - bzf->strm.avail_out; };
if (bzf->strm.avail_out == 0)
{ { if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; }; return len; };
}
return 0;
}
void BZ2_bzReadGetUnused
( int* bzerror,
BZFILE* b,
void** unused,
int* nUnused )
{
bzFile* bzf = (bzFile*)b;
if (bzf ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return; };
if (bzf->lastErr != 4)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-1); if (bzf !=
((void *)0)
) bzf->lastErr = (-1); }; return; };
if (unused ==
((void *)0)
|| nUnused ==
((void *)0)
)
{ { if (bzerror !=
((void *)0)
) *bzerror = (-2); if (bzf !=
((void *)0)
) bzf->lastErr = (-2); }; return; };
{ if (bzerror !=
((void *)0)
) *bzerror = 0; if (bzf !=
((void *)0)
) bzf->lastErr = 0; };
*nUnused = bzf->strm.avail_in;
*unused = bzf->strm.next_in;
}
int BZ2_bzBuffToBuffCompress
( char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int blockSize100k,
int verbosity,
int workFactor )
{
bz_stream strm;
int ret;
if (dest ==
((void *)0)
|| destLen ==
((void *)0)
||
source ==
((void *)0)
||
blockSize100k < 1 || blockSize100k > 9 ||
verbosity < 0 || verbosity > 4 ||
workFactor < 0 || workFactor > 250)
return (-2);
if (workFactor == 0) workFactor = 30;
strm.bzalloc =
((void *)0)
;
strm.bzfree =
((void *)0)
;
strm.opaque =
((void *)0)
;
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
verbosity, workFactor );
if (ret != 0) return ret;
strm.next_in = source;
strm.next_out = dest;
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
ret = BZ2_bzCompress ( &strm, 2 );
if (ret == 3) goto output_overflow;
if (ret != 4) goto errhandler;
*destLen -= strm.avail_out;
BZ2_bzCompressEnd ( &strm );
return 0;
output_overflow:
BZ2_bzCompressEnd ( &strm );
return (-8);
errhandler:
BZ2_bzCompressEnd ( &strm );
return ret;
}
int BZ2_bzBuffToBuffDecompress
( char* dest,
unsigned int* destLen,
char* source,
unsigned int sourceLen,
int small,
int verbosity )
{
bz_stream strm;
int ret;
if (dest ==
((void *)0)
|| destLen ==
((void *)0)
||
source ==
((void *)0)
||
(small != 0 && small != 1) ||
verbosity < 0 || verbosity > 4)
return (-2);
strm.bzalloc =
((void *)0)
;
strm.bzfree =
((void *)0)
;
strm.opaque =
((void *)0)
;
ret = BZ2_bzDecompressInit ( &strm, verbosity, small );
if (ret != 0) return ret;
strm.next_in = source;
strm.next_out = dest;
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
ret = BZ2_bzDecompress ( &strm );
if (ret == 0) goto output_overflow_or_eof;
if (ret != 4) goto errhandler;
*destLen -= strm.avail_out;
BZ2_bzDecompressEnd ( &strm );
return 0;
output_overflow_or_eof:
if (strm.avail_out > 0) {
BZ2_bzDecompressEnd ( &strm );
return (-7);
} else {
BZ2_bzDecompressEnd ( &strm );
return (-8);
};
errhandler:
BZ2_bzDecompressEnd ( &strm );
return ret;
}
const char * BZ2_bzlibVersion(void)
{
return "1.0.8, 13-Jul-2019";
}
static
BZFILE * bzopen_or_bzdopen
( const char *path,
int fd,
const char *mode,
int open_mode)
{
int bzerr;
char unused[5000];
int blockSize100k = 9;
int writing = 0;
char mode2[10] = "";
FILE *fp =
((void *)0)
;
BZFILE *bzfp =
((void *)0)
;
int verbosity = 0;
int workFactor = 30;
int smallMode = 0;
int nUnused = 0;
if (mode ==
((void *)0)
) return
((void *)0)
;
while (*mode) {
switch (*mode) {
case 'r':
writing = 0; break;
case 'w':
writing = 1; break;
case 's':
smallMode = 1; break;
default:
if (
((*__ctype_b_loc ())[(int) ((
(int)(*mode)
))] & (unsigned short int) _ISdigit)
) {
blockSize100k = *mode-0x30;
}
}
mode++;
}
strcat(mode2, writing ? "w" : "r" );
strcat(mode2,"b");
if (open_mode==0) {
if (path==
((void *)0)
|| strcmp(path,"")==0) {
fp = (writing ?
stdout
:
stdin
);
;
} else {
fp = fopen(path,mode2);
}
} else {
fp = fdopen(fd,mode2);
}
if (fp ==
((void *)0)
) return
((void *)0)
;
if (writing) {
if (blockSize100k < 1) blockSize100k = 1;
if (blockSize100k > 9) blockSize100k = 9;
bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k,
verbosity,workFactor);
} else {
bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode,
unused,nUnused);
}
if (bzfp ==
((void *)0)
) {
if (fp !=
stdin
&& fp !=
stdout
) fclose(fp);
return
((void *)0)
;
}
return bzfp;
}
BZFILE * BZ2_bzopen
( const char *path,
const char *mode )
{
return bzopen_or_bzdopen(path,-1,mode, 0);
}
BZFILE * BZ2_bzdopen
( int fd,
const char *mode )
{
return bzopen_or_bzdopen(
((void *)0)
,fd,mode, 1);
}
int BZ2_bzread (BZFILE* b, void* buf, int len )
{
int bzerr, nread;
if (((bzFile*)b)->lastErr == 4) return 0;
nread = BZ2_bzRead(&bzerr,b,buf,len);
if (bzerr == 0 || bzerr == 4) {
return nread;
} else {
return -1;
}
}
int BZ2_bzwrite (BZFILE* b, void* buf, int len )
{
int bzerr;
BZ2_bzWrite(&bzerr,b,buf,len);
if(bzerr == 0){
return len;
}else{
return -1;
}
}
int BZ2_bzflush (BZFILE *b)
{
return 0;
}
void BZ2_bzclose (BZFILE* b)
{
int bzerr;
FILE *fp;
if (b==
((void *)0)
) {return;}
fp = ((bzFile *)b)->handle;
if(((bzFile*)b)->writing){
BZ2_bzWriteClose(&bzerr,b,0,
((void *)0)
,
((void *)0)
);
if(bzerr != 0){
BZ2_bzWriteClose(
((void *)0)
,b,1,
((void *)0)
,
((void *)0)
);
}
}else{
BZ2_bzReadClose(&bzerr,b);
}
if(fp!=
stdin
&& fp!=
stdout
){
fclose(fp);
}
}
static const char *bzerrorstrings[] = {
"OK"
,"SEQUENCE_ERROR"
,"PARAM_ERROR"
,"MEM_ERROR"
,"DATA_ERROR"
,"DATA_ERROR_MAGIC"
,"IO_ERROR"
,"UNEXPECTED_EOF"
,"OUTBUFF_FULL"
,"CONFIG_ERROR"
,"???"
,"???"
,"???"
,"???"
,"???"
,"???"
};
const char * BZ2_bzerror (BZFILE *b, int *errnum)
{
int err = ((bzFile *)b)->lastErr;
if(err>0) err = 0;
*errnum = err;
return bzerrorstrings[err*-1];
}
|
long e2fsck_should_rebuild_extents(long a1, long a2, unsigned int *a3, long a4)
[3312] {
int v6; // r10d
long v7; // rax
unsigned int v8; // ecx
long v9; // r9
long v10; // rsi
[3328, 3331, 3333, 3312, 3316, 3317, 3320, 3321, 3324] if ( a3[1] )
[3328, 3587, 3576, 3582] return e2fsck_rebuild_extents_later((_QWORD *)a1, *a3);
[3339, 3343] if ( (*(_BYTE *)(a1 + 78) & 1) != 0 )
[3343] return 0LL;
[3352, 3355, 3359] v6 = *(_DWORD *)(a4 + 16);
[3386, 3389] if ( v6 < 0 )
[3389] return 0LL;
[3395] v7 = 0LL;
[3397] while ( 1 )
{
[3397] v8 = a3[2 * v7 + 2];
[3369, 3401, 3372, 3376, 3408, 3410, 3379, 3412, 3349, 3382] if ( a3[2 * v7 + 3] - v8 > (unsigned int)(((unsigned long)*(unsigned int *)(*(_QWORD *)a1 + 40LL) - 12) / 0xC) )
break;
[3418, 3420, 3423] if ( v7 )
{
[3432, 3429] if ( v8 < a3[3] )
goto LABEL_22;
[3434, 3437] if ( (_DWORD)v7 != 1 )
{
[3443, 3446] if ( v8 < a3[5] )
goto LABEL_22;
[3448, 3451] if ( (_DWORD)v7 != 2 )
{
[3457, 3460] if ( v8 < a3[7] )
goto LABEL_22;
[3465, 3462] if ( (_DWORD)v7 != 3 )
{
[3474, 3471] if ( v8 < a3[9] )
goto LABEL_22;
[3476, 3479] if ( (_DWORD)v7 != 4 )
{
[3481, 3484] if ( v8 < a3[11] )
goto LABEL_22;
[3489, 3486] if ( (_DWORD)v7 != 5 )
{
[3491, 3494] if ( v8 < a3[13] )
goto LABEL_22;
[3496, 3499] if ( (_DWORD)v7 != 6 )
{
[3507, 3501] v9 = 6LL;
[3528, 3521, 3526] while ( v8 >= a3[2 * v9 + 3] )
{
[3512, 3516, 3519] if ( (int)v7 <= (int)++v9 )
goto LABEL_26;
}
LABEL_22:
[3536, 3405] *(_QWORD *)(a2 + 40) = (int)v7;
[3540] v10 = 81926LL;
goto LABEL_23;
}
}
}
}
}
}
}
LABEL_26:
[3600, 3604, 3613, 3607] if ( v6 < (int)++v7 )
[3607] return 0LL;
}
[3405, 3615] *(_QWORD *)(a2 + 40) = (int)v7;
[3624, 3619] v10 = 81927LL;
LABEL_23:
[3556, 3558, 3545, 3548, 3551] if ( (unsigned int)fix_problem(a1, v10, a2) )
[3576, 3587, 3582] return e2fsck_rebuild_extents_later((_QWORD *)a1, *a3);
else
[3560, 3564] return 0LL;
[3585, 3586, 3566, 3567, 3568, 3578] }
// 1568: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (0000000000000E30) ----------------------------------------------------
long e2fsck_check_rebuild_extents(char *a1, unsigned int a2, long a3, long a4)
[3632] {
int v6; // eax
long v8; // rdi
long v9; // rdi
long v10; // rax
long v11; // rdi
unsigned long v12; // rax
int v13; // esi
int v14; // edi
int v15; // ecx
_DWORD *v16; // rdx
int v17; // r8d
int v18; // r8d
long v19; // rax
char v20; // al
long v21; // [rsp+8h] [rbp-100h] BYREF
char v22[20]; // [rsp+10h] [rbp-F8h] BYREF
int v23; // [rsp+24h] [rbp-E4h]
int v24; // [rsp+30h] [rbp-D8h] BYREF
int v25; // [rsp+34h] [rbp-D4h]
int v26; // [rsp+38h] [rbp-D0h]
int v27; // [rsp+3Ch] [rbp-CCh]
char v28[16]; // [rsp+60h] [rbp-A8h] BYREF
int v29; // [rsp+70h] [rbp-98h]
__int128 v30[3]; // [rsp+90h] [rbp-78h] BYREF
unsigned long v31; // [rsp+C8h] [rbp-40h]
[3650, 3651, 3654, 3655, 3662, 3632, 3636, 3638, 3671, 3640, 3642, 3645, 3647] v31 = __readfsqword(0x28u);
[3681, 3679] v6 = *(_DWORD *)(a3 + 32);
[3689, 3691, 3684, 3695] if ( (v6 & 0x10080000) != 0 || (a1[77] & 0x40) == 0 )
{
[3718, 3727, 3701, 3706, 3708, 3710] if ( (v6 & 0x80000) == 0 )
[3706] return 0LL;
[3760] v8 = *(_QWORD *)a1;
[3776] memset(v30, 0, sizeof(v30));
[3784, 3800, 3792] LODWORD(v30[0]) = a2;
[3808, 3813, 3816, 3764, 3768, 3773] if ( ext2fs_extent_open2(v8, a2, a3, &v21) )
[3750] return 0LL;
[3818, 3823, 3828, 3831, 3836, 3839] if ( !ext2fs_extent_get_info(v21, v28) )
{
[3888] v10 = v29;
[3893] v11 = v21;
[3898] *(_DWORD *)(a4 + 8) = a2;
[3902] *(_QWORD *)(a4 + 40) = v10;
[3906] v12 = ext2fs_max_extent_depth(v11);
[3911] *(_QWORD *)(a4 + 48) = v12;
[3915, 3919] if ( v12 < *(_QWORD *)(a4 + 40) )
{
[4200, 4203, 4208, 4211, 4216, 4218] if ( (unsigned int)fix_problem(a1, 65663LL, a4) )
[4220] DWORD1(v30[0]) = 1;
[4235, 4231] v12 = *(_QWORD *)(a4 + 48);
}
[3925] *(_QWORD *)(a4 + 40) = 5LL;
[3937, 3933] if ( v12 > 5 )
[4192, 4176, 4179, 4184, 4187] fix_problem(a1, 81925LL, a4);
[3943] v9 = v21;
[3952, 3948] if ( a1[77] < 0 )
goto LABEL_8;
[3969, 3972, 3943, 3980, 3985, 3954, 3988, 3959, 3994, 3964] if ( !ext2fs_extent_get(v21, 1LL, v22) )
{
[4130, 4135, 4138, 4122, 4127] while ( !ext2fs_extent_get_info(v21, &v24) )
{
[4144, 4149] v20 = v23;
[4000, 4002, 4005, 4012, 4153, 4155] if ( v24 == 1 && !(DWORD1(v30[0]) | v23 & 4) )
{
[4019, 4014] v13 = v27;
[4023] v14 = v26;
[4027] v15 = v25;
[4027, 4030] v16 = (_DWORD *)v30 + 2 * v25 + 2;
[4034] v17 = v16[1];
[4038] *v16 += v26;
[4040] v18 = v13 + v17;
[4049, 4043, 4045, 4047] if ( v15 && v14 < v13 )
[4051] --v18;
[4059, 4055] v16[1] = v18;
}
[4064] v9 = v21;
[4069, 4071] if ( (v20 & 1) != 0 )
{
[4064, 4073, 4076, 4081] v19 = ext2fs_extent_get(v21, 4LL, v22);
[4086] v9 = v21;
[4091, 4094] if ( v19 )
goto LABEL_8;
}
[4100, 4103, 4108, 4113, 4116] if ( ext2fs_extent_get(v9, 9LL, v22) )
break;
}
}
}
[3841] v9 = v21;
LABEL_8:
[3846] ext2fs_extent_free(v9);
[3873, 3851, 3854, 3857, 3860, 3868] return e2fsck_should_rebuild_extents((long)a1, a4, (unsigned int *)v30, (long)v28);
}
[4160, 4165, 3733] return e2fsck_rebuild_extents_later(a1, a2);
[3744, 3746, 3748, 3740, 3741, 3742] }
// 14B8: using guessed type long ext2fs_extent_get(_QWORD, _QWORD, _QWORD);
// 14C0: using guessed type long ext2fs_extent_free(_QWORD);
// 14E0: using guessed type long ext2fs_extent_open2(_QWORD, _QWORD, _QWORD, _QWORD);
// 1568: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
// 15C0: using guessed type long ext2fs_extent_get_info(_QWORD, _QWORD);
// 15C8: using guessed type long ext2fs_max_extent_depth(_QWORD);
//----- (00000000000010A0) ----------------------------------------------------
unsigned long e2fsck_pass1e(long *a1)
[4256] {
[4256, 4260] return rebuild_extents_constprop_0(a1);
}
// nfuncs=55 queued=17 decompiled=17 lumina nreq=0 worse=0 better=0
// ALL OK, 17 function(s) have been successfully decompiled
|
long e2fsck_should_rebuild_extents(long a1, long a2, unsigned int *a3, long a4)
[6048] {
int v6; // [rsp+28h] [rbp-18h]
int i; // [rsp+2Ch] [rbp-14h]
unsigned int v8; // [rsp+30h] [rbp-10h]
unsigned int *v9; // [rsp+38h] [rbp-8h]
[6048, 6080, 6083, 6052, 6053, 6085, 6056, 6060, 6064, 6068, 6072, 6076] if ( a3[1] )
{
LABEL_15:
[6337, 6341, 6345, 6347, 6350, 6323, 6355, 6357, 6327, 6330, 6332, 6334] if ( a3[1] || (unsigned int)fix_problem(a1, v8, a2) )
[6369, 6371, 6374, 6379, 6359, 6363, 6365] return e2fsck_rebuild_extents_later((_QWORD *)a1, *a3);
else
[6381] return 0LL;
}
[6091, 6095, 6098, 6103, 6105] else if ( (*(_DWORD *)(a1 + 76) & 0x10000) != 0 )
{
[6112, 6107] return 0LL;
}
else
{
[6156] v6 = 0;
[6171, 6163, 6175, 6167] v9 = a3 + 2;
[6306, 6299, 6309, 6303] while ( v6 <= *(_DWORD *)(a4 + 16) )
{
[6146, 6117, 6149, 6181, 6184, 6121, 6153, 6124, 6188, 6190, 6127, 6192, 6129, 6194, 6133, 6197, 6143] if ( (unsigned int)(((unsigned long)*(unsigned int *)(*(_QWORD *)a1 + 40LL) - 12) / 0xC) < v9[1] - *v9 )
{
[6209, 6202, 6205, 6199] *(_QWORD *)(a2 + 40) = v6;
[6213] v8 = 81927;
[6220] goto LABEL_15;
}
[6278, 6282, 6285, 6222, 6288, 6229] for ( i = 0; i < v6; ++i )
{
[6241, 6244, 6247, 6251, 6253, 6231, 6235, 6237] if ( *v9 < a3[2 * i + 3] )
{
[6265, 6258, 6261, 6255] *(_QWORD *)(a2 + 40) = v6;
[6269] v8 = 81926;
[6276] goto LABEL_15;
}
}
[6290] ++v6;
[6294] v9 += 2;
}
[6320, 6315] return 0LL;
}
[6386, 6387] }
// 18C9: variable 'v8' is possibly undefined
// 1CA8: using guessed type long fix_problem(_QWORD, _QWORD, _QWORD);
//----- (00000000000018F4) ----------------------------------------------------
unsigned long e2fsck_pass1e(_QWORD *a1)
[6388] {
[6400, 6404, 6408, 6413, 6388, 6420, 6428, 6423, 6392, 6393, 6396, 6429] return rebuild_extents(a1, (long)"Pass 1E", 0x14000u);
[6430] }
// nfuncs=56 queued=15 decompiled=15 lumina nreq=0 worse=0 better=0
// ALL OK, 15 function(s) have been successfully decompiled
|
int rta_getattr_str(unsigned long a0) {
[32] return a0 + 4;
[32, 36] }
|
int rta_getattr_str(unsigned long a0) {
[35] return a0 + 4;
[35, 36, 39, 43, 47, 51, 52] }
|
int mux_master_process_hello(unsigned long a0, unsigned long a1, struct_0 *a2, unsigned long long a3) {
[720] unsigned long long v0; // [bp-0x58]
[720] char v1; // [bp-0x50]
[720] char v2; // [bp-0x48]
[720] char v3; // [bp-0x44]
[720] void* v4; // [bp-0x40]
[720] void* v5; // [bp-0x38]
[720] void* v7; // r9
[720] unsigned long long v8; // rdx
[720] unsigned long long v9; // rax
[720] unsigned long long v10; // rax
[720] unsigned long long v11; // rax
[720] unsigned long long v12; // rax
[720] unsigned int v13; // r12d
[720]
[720] if (a2->field_150) {
if (!a2->field_150->field_0) {
v9 = sshbuf_get_u32(a3, &v3);
[781, 786, 789, 792] v13 = v9;
[797] if (!v9) {
v10 = *(&v3);
[808] if (*(&v3) == 4) {
[812, 815] sshlog("mux.c", "mux_master_process_hello", 0x121, 0x1, 0x6, 0x0, "channel %d client version %u", a2->field_4, 0x4, *(&v1));
[834, 839, 841, 844, 849, 856, 863, 870, 871, 878, 879, 881, 821, 825, 828] while (true) {
[1019] v11 = sshbuf_len(a3);
[1019, 1022] if (v11) {
v4 = 0;
[896, 898, 903, 906] v5 = 0;
[915] v12 = sshbuf_get_cstring(a3, &v4, 0x0);
[896, 924] if (!v12) {
v12 = sshbuf_get_string_direct(a3, 0x0, &v5);
[933, 935, 940, 943] if (!v12) {
sshlog("mux.c", "mux_master_process_hello", 0x12d, 0x1, 0x6, 0x0, "Unrecognised extension \"%s\" length %zu", v4, v5, *(&v1));
[963, 966, 968, 972, 978, 983, 988, 863, 992, 999, 1000, 952, 956] free(v4);
[1010, 1014, 1005] }
}
if (v12 || v12) {
v7 = ssh_err(v12);
[1058, 1063, 1067, 1073, 1078] v8 = 298;
[1088, 1081] v0 = "parse extension";
[1093, 1094, 1096, 1103, 1110, 1116] break;
[1093, 1094, 1110, 1096, 1116, 1103] }
} else {
a2->field_150->field_0 = 1;
[1036] break;
[1044] }
}
} else {
v13 = -1;
[1157, 1161, 1164, 1170, 1175, 1177, 1182, 1189, 1196, 1197, 1204] sshlog("mux.c", "mux_master_process_hello", 0x11d, 0x1, 0x2, 0x0, "unsupported multiplexing protocol version %u (expected %u)", v10, 0x4, *(&v1));
[1189, 1161, 1164, 1170, 1175, 1177, 1210, 1211, 1213, 1182] }
} else {
v7 = ssh_err(v9);
[1282, 1262, 1267, 1271, 1277] v8 = 281;
[1292, 1285] v0 = "parse";
[1297] }
} else {
v7 = 0;
[1235, 1224, 1228] v0 = "HELLO received twice";
[1244, 1238] v8 = 277;
[1250, 1245] }
if (a2->field_150->field_0 || v9 || *(&v3) == 4 && v11) {
[812, 815] v13 = -1;
[1094, 1096, 1103, 1110] sshlog("mux.c", "mux_master_process_hello", v8, 0x1, 0x2, v7, v0, *(&v1), *(&v2), 0x0);
[896, 898, 903, 1096, 906, 1103, 1238, 1116, 1245] }
return v13;
[1152, 1154, 1156, 1143, 1147, 1150, 1151] } else {
sshfatal("mux.c", "mux_master_process_hello", 0x113, 0x1, 0x1, 0x0, "channel %d: c->mux_ctx == NULL");
[1347, 1348, 1350, 1303, 1306, 1309, 1315, 1320, 1325, 1332, 1339, 1340] __stack_chk_fail(); /* do not return */
[1355] }
}
|
long long mux_master_process_hello(unsigned long a0, unsigned long a1, struct_0 *a2, unsigned long long a3, unsigned long a4) {
[1263] unsigned long v0; // [bp-0x70]
[1263] unsigned long v1; // [bp-0x60]
[1263] unsigned int v2; // [bp-0x44]
[1263] unsigned long v3; // [bp-0x40]
[1263] char v4; // [bp-0x30]
[1263] unsigned int v5; // [bp-0x2c]
[1263] void* v6; // [bp-0x28]
[1263] unsigned long long v7; // [bp-0x20], Other Possible Types: void*
[1263] void* v8; // [bp-0x18], Other Possible Types: unsigned int *, unsigned long
[1263] unsigned long long v9; // [bp-0x10], Other Possible Types: unsigned long, void*
[1263] char v10; // [bp+0x0]
[1263] unsigned long long v12; // rax
[1263]
[1263] v3 = a0;
[1263, 1267, 1268, 1271, 1275] v2 = a1;
[1279] v1 = a4;
[1282, 1286, 1290] v8 = a2->field_150;
[1313, 1320, 1294, 1303, 1307, 1309] if (!v8) {
v0 = a2->field_4;
[1331, 1335, 1338] sshfatal("mux.c", "mux_master_process_hello", 0x113, 0x1, 0x1, 0x0, "channel %d: c->mux_ctx == NULL");
[1346, 1347, 1353, 1359, 1364, 1369, 1376, 1383, 1388, 1339] }
if (*(v8)) {
v9 = "HELLO received twice";
sshlog("mux.c", "mux_master_process_hello", 0x115, 0x1, 0x2, 0x0, *(&v10));
v12 = 4294967295;
} else {
v5 = sshbuf_get_u32(a3, &v4, &v4);
if (v5) {
v9 = "parse";
sshlog("mux.c", "mux_master_process_hello", 0x119, 0x1, 0x2, ssh_err(v5), *(&v10));
v12 = 4294967295;
} else if (*(&v4) != 4) {
v9 = 4;
v8 = *(&v4);
v7 = "unsupported multiplexing protocol version %u (expected %u)";
sshlog("mux.c", "mux_master_process_hello", 0x11d, 0x1, 0x2, 0x0, *(&v10));
v12 = 4294967295;
} else {
v9 = *(&v4);
v8 = a2->field_4;
v7 = "channel %d client version %u";
sshlog("mux.c", "mux_master_process_hello", 0x121, 0x1, 0x6, 0x0, *(&v10));
while (true) {
if (sshbuf_len(a3)) {
v6 = 0;
v7 = 0;
v5 = sshbuf_get_cstring(a3, &v6, 0x0, &v6);
if (!v5) {
v5 = sshbuf_get_string_direct(a3, 0x0, &v7);
if (!v5) {
v9 = v7;
v8 = v6;
v7 = "Unrecognised extension \"%s\" length %zu";
sshlog("mux.c", "mux_master_process_hello", 0x12d, 0x1, 0x6, 0x0, *(&v10));
free(v6);
}
}
if (v5 || v5) {
v9 = "parse extension";
sshlog("mux.c", "mux_master_process_hello", 0x12a, 0x1, 0x2, ssh_err(v5), *(&v10));
v12 = 4294967295;
break;
}
} else {
*(v8) = 1;
v12 = 0;
break;
}
}
}
}
return v12;
}
|
int compare_names(char *a0, char *a1) {
[368] unsigned long long v1; // rax
[368]
[368] if (!locale_specific_sorting)
return strcmp(a0, a1);
[2560, 2562, 2564, 2566, 2568, 2570, 2572, 2574, 2576, 2578, 2580, 2582, 2584, 2586, 2588, 2590, 2592, 2594, 2596, 2598, 2600, 2602, 2604, 2606, 2608, 2610, 2612, 2614, 2616, 2618, 2620, 2622, 2624, 2626, 2628, 2630, 2488, 2490, 2492, 2494, 2496, 2498, 2500, 2502, 2504, 2506, 2508, 2510, 2512, 2514, 2516, 2518, 2520, 2522, 2524, 2526, 2528, 2530, 2532, 2534, 2536, 2538, 2540, 2542, 2544, 2546, 2548, 2550, 2552, 2554, 2556, 2558] v1 = compare_collated(a0, a1);
[384, 388, 393, 397] if (v1) {
return v1;
[440, 444] } else if (ignore_file_name_case) {
return v1;
[440, 444] } else {
return strcmp(a0, a1);
[2560, 2562, 2564, 2566, 2568, 2570, 2572, 2574, 2576, 2578, 2580, 2582, 2584, 2586, 2588, 2590, 2592, 2594, 2596, 2598, 2600, 2602, 2604, 2606, 2608, 2610, 2612, 2614, 2616, 2618, 2620, 2622, 2624, 2626, 2628, 2630, 2488, 2490, 2492, 2494, 2496, 2498, 2500, 2502, 2504, 2506, 2508, 2510, 2512, 2514, 2516, 2518, 2520, 2522, 2524, 2526, 2528, 2530, 2532, 2534, 2536, 2538, 2540, 2542, 2544, 2546, 2548, 2550, 2552, 2554, 2556, 2558] }
}
|
int compare_names(char *a0, char *a1) {
[857] unsigned int v0; // [bp-0xc]
[857] unsigned long v2; // eax, Other Possible Types: unsigned int
[857]
[857] if (!locale_specific_sorting) {
v2 = strcmp(a0, a1);
[932, 936, 940, 943, 946] } else {
v0 = compare_collated(a0, a1);
[907, 902] if (v0) {
v2 = v0;
[927] } else if (ignore_file_name_case) {
v2 = v0;
[927] } else {
v2 = strcmp(a0, a1);
[932, 936, 940, 943, 946] }
}
return v2;
}
|
long long TCPSendFrame(struct_0 *a0, void* a1, unsigned long a2) {
[5296] struct_0 *v1; // rbp
[5296] unsigned long v2; // rbx
[5296] void* v3; // rdx
[5296] struct_0 *v4; // rdi
[5296] unsigned long long v5; // rax
[5296]
[5296] v1 = a0;
[5312, 5296, 5300, 5306, 5308, 5311] v2 = a2;
[5315, 5316] v3 = a0->field_40b0;
[5319] if (Debug) {
r_dbgprintf("omfwd.c", "omfwd: add %u bytes to send buffer (curr offs %u)\n", v2);
[5444, 5424, 5426, 5433, 5435, 5437] v3 = a0->field_40b0;
[5449] }
if (!v3) {
if (v2 > 0x4000)
return TCPSendBuf(a0, a1, v2, 0x0);
v4 = a0 + v3 + 176;
memcpy(v4, a1, v2);
a0->field_40b0 = a0->field_40b0 + v2;
v5 = 4294965175;
return v5;
} else {
if (v3 + v2 > 16383) {
if (Debug) {
r_dbgprintf("omfwd.c", "omfwd: we need to do a tcp send due to buffer out of space. If the transaction fails, this will lead to duplication of messages", v3);
*(&v3) = a0->field_40b0;
}
a1 = &v1->padding_0[176];
a0 = v1;
v5 = TCPSendBuf(a0, a1, v3, 0x0);
if (v5) {
return v5;
} else {
a0->field_40b0 = 0;
v3 = 0;
if (v2 > 0x4000) {
return TCPSendBuf(a0, a1, v2, 0x0);
} else {
v4 = a0 + v3 + 176;
memcpy(v4, a1, v2);
a0->field_40b0 = a0->field_40b0 + v2;
v5 = 4294965175;
return v5;
}
}
} else if (v2 > 0x4000) {
return TCPSendBuf(a0, a1, v2, 0x0);
} else {
v4 = a0 + v3 + 176;
memcpy(v4, a1, v2);
a0->field_40b0 = a0->field_40b0 + v2;
v5 = 4294965175;
return v5;
}
}
}
|
long long TCPSendFrame(struct_0 *a0, void* a1, unsigned int a2) {
[5324] unsigned int v0; // [bp-0x14]
[5324]
[5324] v0 = 0;
[5344, 5348, 5324, 5328, 5329, 5332, 5336, 5340] if (Debug)
r_dbgprintf("omfwd.c", "omfwd: add %u bytes to send buffer (curr offs %u)\n");
[5408, 5377, 5383, 5387, 5389, 5396, 5403, 5373] if (!a0->field_40b0) {
if (a2 <= 0x4000) {
[5553, 5561] memcpy(&a0->padding_0[176 + a0->field_40b0], a1, a2);
[5635, 5639, 5643, 5646, 5649, 5608, 5612, 5619, 5623, 5629, 5631] a0->field_40b0 = a2 + a0->field_40b0;
[5664, 5668, 5670, 5674, 5654, 5658] v0 = -2121;
[5680] } else {
v0 = TCPSendBuf(a0, a1, a2, 0x0);
[5585, 5577, 5590] if (!v0)
v0 = 0;
[5599] }
return v0;
[5696, 5697, 5693] } else if (a2 + a0->field_40b0 <= 16383) {
[5443, 5446, 5452, 5427, 5431, 5437, 5439] if (a2 <= 0x4000) {
[5553, 5561] memcpy(&a0->padding_0[176 + a0->field_40b0], a1, a2);
[5635, 5639, 5643, 5646, 5649, 5608, 5612, 5619, 5623, 5629, 5631] a0->field_40b0 = a2 + a0->field_40b0;
[5664, 5668, 5670, 5674, 5654, 5658] v0 = -2121;
[5680] } else {
v0 = TCPSendBuf(a0, a1, a2, 0x0);
[5585, 5577, 5590] if (!v0)
v0 = 0;
[5599] }
return v0;
[5696, 5697, 5693] } else {
if (Debug)
r_dbgprintf("omfwd.c", "omfwd: we need to do a tcp send due to buffer out of space. If the transaction fails, this will lead to duplication of messages");
[5478, 5483, 5464, 5471] v0 = TCPSendBuf(a0, a0 + 176, a0->field_40b0, 0x0);
[5521, 5526, 5513, 5502] if (!v0) {
a0->field_40b0 = 0;
[5539, 5543, 5553, 5561] if (a2 <= 0x4000) {
[5553, 5561] memcpy(&a0->padding_0[176 + a0->field_40b0], a1, a2);
[5635, 5639, 5643, 5646, 5649, 5608, 5612, 5619, 5623, 5629, 5631] a0->field_40b0 = a2 + a0->field_40b0;
[5664, 5668, 5670, 5674, 5654, 5658] v0 = -2121;
[5680] } else {
v0 = TCPSendBuf(a0, a1, a2, 0x0);
[5585, 5577, 5590] if (!v0)
v0 = 0;
[5599] }
}
return v0;
[5696, 5697, 5693] }
}
|
int tee_files(unsigned long a0, unsigned long long a1) {
[16] char v0; // [bp-0x2070], Other Possible Types: unsigned int, unsigned long
[16] unsigned int v1; // [bp-0x2064]
[16] unsigned long long v2[2]; // [bp-0x2060]
[16] unsigned long long v3; // [bp-0x2058]
[16] char v4; // [bp-0x2048]
[16] char v5; // [bp-0x2030], Other Possible Types: unsigned long long
[16] char v6; // [bp-0x1030], Other Possible Types: unsigned long long
[16] char v7; // [bp-0x8], Other Possible Types: unsigned long
[16] unsigned long long v9; // r13
[16] unsigned long long v10; // rbx
[16] void* v11; // rax
[16] unsigned long long *v12; // r12
[16] unsigned long long *v13; // rbp
[16] unsigned long v14; // rbp
[16] unsigned long long v15[2]; // r15
[16] unsigned long long *v16; // r14, Other Possible Types: unsigned long long
[16] unsigned int *v17; // rax
[16] void* v18; // rdi
[16] unsigned int v19; // r8d
[16] unsigned long long v20; // rbx
[16] unsigned long long v21; // rdx
[16] unsigned long long v22; // r15
[16]
[16] v6 = *(&v6);
[33, 16, 18, 20, 22, 24, 25, 26] v5 = *(&v5);
[45, 38] v1 = a0;
[50, 54, 61] v9 = (!append ? "a" : "w");
[65, 68, 75, 78, 83, 88, 97, 105, 107, 114, 54, 121] fadvise(stdin, 0x2);
[83, 125] v2[0] = xnmalloc(a0 + 1, 0x8);
[161, 130, 134, 142, 147, 152, 159] v3 = &v7;
[166, 169, 173] v2[0] = stdout;
[185, 178] v7 = bad_cast(dcgettext(NULL, "standard output", 0x5));
[196, 201, 208, 210, 212, 152, 188, 159] setvbuf(stdout, NULL, 0x2, 0x0);
[208, 210, 216, 221] if (a0 <= 0) {
[226, 229] v0 = 1;
[977] v10 = 1;
[982] goto LABEL_40019d;
[987] }
v13 = a1;
v12 = &v2[1];
v0 = 1;
v10 = 1;
while (true) {
v11 = fopen_safer(*(v13), v9);
*(v12) = v11;
if (!v11) {
v0 = quotearg_n_style_colon(v11, 0x3, *(v13));
v13 += 1;
v12 += 1;
error(output_error - 3 <= 1, *(__errno_location()), "%s");
v0 = 0;
if (v13 == a1 + (a0 - 1 << 3) + 8)
break;
} else {
v13 += 1;
setvbuf(v11, NULL, 0x2, 0x0);
v10 += 1;
v12 += 1;
if (v13 == a1 + (a0 - 1 << 3) + 8)
break;
}
}
if (!v10) {
LABEL_4001eb:
v20 = 1;
while (true) {
if (v2[v20] && rpl_fclose(v2[v20])) {
v21 = *((a1 + v20 * 8 - 8));
v20 += 1;
v22 = quotearg_n_style_colon(0x0, 0x3, v21);
error(0x0, *(__errno_location()), "%s");
v0 = 0;
if (v1 < v20)
break;
} else {
v20 += 1;
if (v1 < v20)
break;
}
}
} else {
LABEL_40019d:
do {
v14 = read(0x0, &v4, 0x2000);
if (v14 < 0) {
if (*(__errno_location()) == 4)
goto LABEL_4002a0;
break;
}
if (!v14)
goto LABEL_4001e3;
if (v1 >= 0) {
v15 = v2;
v16 = v3;
do {
if (v15[0] && fwrite_unlocked(&v4, v14, 0x1, v15[0]) != 1) {
v17 = __errno_location();
v18 = v15[0];
v19 = *(v17);
if (*(v17) != 32 || (output_error & -3) == 1) {
if (v18 == stdout) {
v0 = *(v17);
clearerr_unlocked(v18);
v19 = v0;
}
v0 = v19;
quotearg_n_style_colon(0x0, 0x3, *(v16));
error(output_error - 3 <= 1, v0, "%s");
v15[0] = 0;
v0 = 0;
} else {
if (v15[0] == stdout)
clearerr_unlocked(v15[0]);
v15[0] = 0;
}
v10 -= 1;
}
} while ((v16 += 8, v15 += 8, v16 != a1 + (v1 << 3)));
}
LABEL_4002a0:
} while (v10);
if (v14 == -1) {
error(0x0, *(__errno_location()), dcgettext(NULL, "read error", 0x5));
v0 = 0;
}
LABEL_4001e3:
if (!(v1 <= 0))
goto LABEL_4001eb;
}
free(v2);
return v0;
}
|
int tee_files(unsigned int a0, unsigned long a1) {
[1593] unsigned long v0; // [bp-0x2068], Other Possible Types: unsigned long long *
[1593] char v1; // [bp-0x2052]
[1593] char v2; // [bp-0x2051]
[1593] unsigned int v3; // [bp-0x2050]
[1593] unsigned int v4; // [bp-0x204c]
[1593] unsigned long v5; // [bp-0x2048], Other Possible Types: void*
[1593] void* v6; // [bp-0x2040]
[1593] char v7; // [bp-0x2038]
[1593] unsigned long long *v8; // [bp-0x2030]
[1593] char v9; // [bp-0x2028]
[1593] char v10; // [bp-0x2010], Other Possible Types: unsigned long long
[1593] char v11; // [bp-0x1010], Other Possible Types: unsigned long long
[1593] char v13; // rax
[1593] unsigned long long v14; // rbx
[1593]
[1593] v11 = *(&v11);
[1601, 1602, 1609, 1593, 1597, 1598] v10 = *(&v10);
[1621, 1614] v0 = a1;
[1636, 1626, 1630] v5 = 0;
[1643, 1652, 1656, 1658] v6 = 0;
[1669] v1 = 1;
[1680] v13 = (!append ? "a" : "w");
[1696, 1698, 1687, 1694] v7 = v13;
[1714] xset_binary_mode(0x0, 0x0);
[1731, 1721, 1726] xset_binary_mode(0x1, 0x0);
[1746, 1736, 1741] fadvise(stdin, 0x2);
[1763, 1766, 1751, 1758] v8 = xnmalloc(a0 + 1, 0x8);
[1795, 1780, 1782, 1790] v0 -= 8;
[1802] *(v8) = stdout;
[1824, 1810, 1817] *(v0) = bad_cast(gettext("standard output"));
[1827, 1834, 1842, 1847, 1854] setvbuf(stdout, NULL, 0x2, 0x0);
[1857, 1864, 1869, 1874, 1879, 1882] v5 += 1;
[1887] for (v3 = 1; v3 <= a0; v3 += 1) {
[2211, 1895, 2217, 2223, 2204] v8[v3] = fopen_safer(v0[v3], *(&v7), *(&v7), v3 * 8);
[1985, 1980, 1948] if (v8[v3]) {
setvbuf(v8[v3], NULL, 0x2, 0x0);
[2178, 2183, 2188, 2191, 2144, 2150, 2152, 2160, 2167, 2170, 2173] v5 += 1;
[1887] } else {
v14 = quotearg_n_style_colon(0x0, 0x3, v0[v3]);
[2064, 2069, 2054, 2059] *(&v13) = *(__errno_location());
[2072, 2077] switch (output_error) {
[2088, 2085, 2079] case 3: case 4:
[2085, 2088, 2079] a0 = 1;
[2101] break;
[2106] default:
[2088, 2085, 2079] a0 = 0;
[2113, 2116, 2123, 2125, 2130, 2108] break;
[2113, 2130, 2116, 2123, 2108, 2125] }
error(a0, *(&v13), "%s");
[2113, 2116, 2123, 2125, 2130] v1 = 0;
[2135] }
}
while (true) {
if (!v5)
break;
v6 = read(0x0, &v9, 0x2000);
if ((v6 - 0 >> 63) && (*(&v13) = *(__errno_location()), *(&v13) == 4))
continue;
if (v6 <= 0)
break;
for (v3 = 0; v3 <= a0; v3 += 1) {
if (v8[v3] && fwrite_unlocked(&v9, v6, 0x1, v8[v3]) != 1) {
v4 = *(__errno_location());
*(&v13) = *(__errno_location());
if (*(&v13) != 32) {
v13 = 1;
} else {
switch (output_error) {
case 1: case 3:
v13 = 1;
break;
default:
v13 = 0;
break;
}
}
v2 = v13;
v2 &= 1;
if (v8[v3] == stdout)
clearerr_unlocked(stdout);
if (v2) {
quotearg_n_style_colon(0x0, 0x3, v0[v3]);
switch (output_error) {
case 3: case 4:
a0 = 1;
break;
default:
a0 = 0;
break;
}
error(a0, v4, "%s");
}
v8[v3] = 0;
if (v2)
v1 = 0;
v5 -= 1;
}
}
}
if (v6 == -1) {
error(0x0, *(__errno_location()), gettext("read error"));
v1 = 0;
}
for (v3 = 1; v3 <= a0; v3 += 1) {
if (v8[v3] && rpl_fclose(v8[v3])) {
quotearg_n_style_colon(0x0, 0x3, v0[v3]);
error(0x0, *(__errno_location()), "%s");
v1 = 0;
}
}
free(v8);
return v1;
}
|
long ch_resizefun(long a1, long a2, long a3)
[5136] {
long result; // rax
[5136, 5140] *(_QWORD *)(a1 + 976) = a2;
[5147] result = 0LL;
[5149] *(_QWORD *)(a1 + 992) = a3;
[5156] return result;
}
//----- (0000000000001430) ----------------------------------------------------
long ch_aliasfun(long a1, long a2, long a3)
[5168] {
long result; // rax
[5168, 5172] *(_QWORD *)(a1 + 984) = a2;
[5179] result = 0LL;
[5181] *(_QWORD *)(a1 + 1000) = a3;
[5188] return result;
}
// nfuncs=46 queued=29 decompiled=29 lumina nreq=0 worse=0 better=0
// ALL OK, 29 function(s) have been successfully decompiled
|
long ch_resizefun(long a1, long a2, long a3)
[6217] {
[6241, 6245, 6217, 6221, 6222, 6225, 6229, 6233, 6237] *(_QWORD *)(a1 + 976) = a2;
[6256, 6252, 6260] *(_QWORD *)(a1 + 992) = a3;
[6272, 6267] return 0LL;
[6273] }
//----- (0000000000001882) ----------------------------------------------------
long ch_aliasfun(long a1, long a2, long a3)
[6274] {
[6274, 6278, 6279, 6282, 6286, 6290, 6294, 6298, 6302] *(_QWORD *)(a1 + 984) = a2;
[6313, 6309, 6317] *(_QWORD *)(a1 + 1000) = a3;
[6329, 6324] return 0LL;
[6330] }
// nfuncs=46 queued=29 decompiled=29 lumina nreq=0 worse=0 better=0
// ALL OK, 29 function(s) have been successfully decompiled
|
long long rl_forced_update_display() {
[6640] char *v1; // rax
[6640] unsigned long long v2; // rdi
[6640] unsigned long long v3; // rsi
[6640] unsigned long long v4; // rdx
[6640] unsigned long long v5; // rcx
[6640] unsigned long long v6; // r8
[6640] unsigned long long v7; // r9
[6640]
[6640] if (*(line_state_visible)) {
for (v1 = *(line_state_visible); *(v1); v1 += 1) {
[6640, 6675, 6644, 6679, 6648, 6682, 6655] *(v1) = 0;
[6672] }
}
rl_on_new_line();
forced_display = forced_display + 1;
rl_redisplay(v2, v3, v4, v5, v6, v7);
return 0;
}
|
long long rl_forced_update_display() {
[25320] char *v1; // rbx
[25320] char *v2; // rax
[25320] unsigned long long v3; // rdi
[25320] unsigned long long v4; // rsi
[25320] unsigned long long v5; // rdx
[25320] unsigned long long v6; // rcx
[25320] unsigned long long v7; // r8
[25320] unsigned long long v8; // r9
[25320]
[25320] if (*(line_state_visible)) {
for (v1 = *(line_state_visible); *(v1); *(v2) = 0) {
[25348, 25355, 25367, 25370, 25373, 25375] v2 = v1;
[25360] v1 += 1;
[25363] }
}
rl_on_new_line();
forced_display = forced_display + 1;
rl_redisplay(v3, v4, v5, v6, v7, v8);
return 0;
}
|
int copy_command(unsigned long long a0) {
[768] unsigned long v1; // r12d, Other Possible Types: unsigned int
[768] struct_0 *v2; // rbx
[768] struct_2 *v3; // rax
[768] unsigned long long v4; // rdi
[768] struct_1 *v5; // rbp
[768]
[768] if (!a0) {
v1 = 0;
[896, 898, 888, 891, 894, 895] goto LABEL_40037b;
[896, 898, 888, 891, 894, 895] } else {
v2 = a0;
[781] v3 = sh_xmalloc(0x20, "copy_cmd.c", 0x176);
[801, 784, 789, 794] v1 = v3;
[810, 806] v3->field_0 = *(&v2->field_0);
[813] *(&v3->field_4) = *(&v2->field_10);
[816, 821] v4 = *(&v2->field_10);
[825, 828] *((&v3->field_0 + 4)) = v2->field_4;
[832] *((&v3->field_0 + 8)) = v2->field_8;
[840, 837] if (v4)
*(&v3->field_4) = copy_redirects(*(&v2->field_10));
[850, 855, 860, 863] switch (*(&v2->field_0)) {
[860, 863] case 0: case 5:
[860, 863] *((v1 + 24)) = copy_for_command(v2->field_18);
[913, 908] return v1;
[918, 921, 922, 923, 925] case 1:
[860, 863] *(&v3->padding_c) = copy_case_command(v2->field_18);
[1113, 1108] break;
[1118] case 2: case 8:
[860, 863] *(&v3->padding_c) = copy_while_command(v2->field_18);
[937, 932] break;
[942] case 3:
[860, 863] *(&v3->padding_c) = copy_if_command(v2->field_18);
[953, 948] break;
[958] case 4:
[860, 863] *(&v3->padding_c) = copy_simple_command(v2->field_18);
[969, 964] break;
[974] case 6:
[860, 863] v5 = sh_xmalloc(0x20, "copy_cmd.c", 0x1be);
[1128, 1135, 1140, 1145, 1150] v5->field_18 = v2->field_18->field_18;
[1153, 1157, 1160, 1164] v5->field_8 = copy_command(v2->field_18->field_8);
[1172, 1167] v5->field_10 = copy_command(v2->field_18->field_10);
[1184, 1189] *((v1 + 24)) = v5;
[1193] break;
[1198] case 7:
[860, 863] *(&v3->padding_c) = copy_function_def(v2->field_18);
[1217, 1212] break;
[1222] case 9:
[860, 863] *(&v3->padding_c) = copy_group_command(&v2->field_18->field_8);
[1040, 1045] break;
[1050] case 10:
[860, 863] *(&v3->padding_c) = copy_arith_command(v2->field_18);
[1065, 1060] break;
[1070] case 11:
[860, 863] *(&v3->padding_c) = copy_cond_command(v2->field_18);
[1017, 1012] break;
[1022] case 12:
[860, 863] *(&v3->padding_c) = copy_arith_for_command(v2->field_18);
[985, 980] break;
[990] case 13:
[860, 863] *(&v3->padding_c) = copy_subshell_command(v2->field_18);
[1089, 1084] break;
[1094] case 14:
[860, 863] *(&v3->padding_c) = copy_coproc_command(v2->field_18);
[1001, 996] break;
[1006] default:
[860, 863] LABEL_40037b:
return v1;
[896, 898, 891, 894, 895] }
}
}
|
int copy_command(struct_0 *a0) {
[2663] struct_2 *v0; // [bp-0x20]
[2663] int tmp_36; // tmp #36
[2663] int tmp_46; // tmp #46
[2663] struct_3 *v1; // [bp-0x18]
[2663] struct_1 *v2; // [bp-0x10]
[2663] unsigned int v4; // eax
[2663]
[2663] v0 = &a0->field_0;
[2663, 2667, 2668, 2671, 2675] if (!a0) {
v4 = a0;
[2686] } else {
v1 = sh_xmalloc(0x20, "copy_cmd.c", 0x176);
[2695, 2700, 2707, 2712, 2717] tmp_36 = *(&a0->field_8);
[2721, 2725, 2729, 2732] v1->field_0 = *(&a0->field_0);
[2736] *(&v1->field_4) = tmp_36;
[2739] tmp_46 = a0->field_18;
[2747, 2743] *(&v1->padding_9[3]) = a0->field_10;
[2751] v1->field_10 = tmp_46;
[2755] *((&v1->field_0 + 4)) = a0->field_4;
[2759, 2763, 2766, 2770] v1->field_4 = *(&a0->field_8);
[2784, 2773, 2777, 2780] if (a0->field_10)
*(&v1->padding_9[3]) = copy_redirects(a0->field_10);
[2816, 2820, 2824, 2828, 2830, 2833, 2811] switch (*(&a0->field_0)) {
[2824, 2833, 2828, 2830] case 0:
[2824, 2833, 2828, 2830] v1->field_10 = copy_for_command(a0->field_18);
[2885, 2890, 2894] break;
[2898] case 1:
[2824, 2833, 2828, 2830] v1->field_10 = copy_case_command(a0->field_18);
[3059, 3064, 3068] break;
[3072] case 2: case 8:
[2824, 2828, 2830, 2833] v1->field_10 = copy_while_command(a0->field_18);
[3088, 3093, 3097] break;
[3101] case 3:
[2824, 2833, 2828, 2830] v1->field_10 = copy_if_command(a0->field_18);
[3122, 3126, 3117] break;
[3130] case 4:
[2824, 2833, 2828, 2830] v1->field_10 = copy_simple_command(a0->field_18);
[3204, 3209, 3213] break;
[3217] case 5:
[2824, 2833, 2828, 2830] v1->field_10 = copy_for_command(a0->field_18);
[2948, 2952, 2943] break;
[2956] case 6:
[2824, 2833, 2828, 2830] v2 = sh_xmalloc(0x20, "copy_cmd.c", 0x1be);
[3234, 3239, 3244, 3222, 3227] v2->field_18 = a0->field_18->field_18;
[3248, 3252, 3256, 3259, 3263] v2->field_8 = copy_command(a0->field_18->field_8);
[3281, 3286, 3290] v2->field_10 = copy_command(a0->field_18->field_10);
[3314, 3318, 3309] v1->field_10 = v2;
[3330, 3322, 3326] break;
[3334] case 7:
[2824, 2833, 2828, 2830] v1->field_10 = copy_function_def(a0->field_18);
[3347, 3352, 3356] break;
[3360] case 9:
[2824, 2833, 2828, 2830] v1->field_10 = copy_group_command(a0->field_18);
[2977, 2981, 2972] break;
[2985] case 10:
[2824, 2833, 2828, 2830] v1->field_10 = copy_arith_command(a0->field_18);
[3155, 3146, 3151] break;
[3159] case 11:
[2824, 2833, 2828, 2830] v1->field_10 = copy_cond_command(a0->field_18);
[3184, 3175, 3180] break;
[3188] case 12:
[2824, 2833, 2828, 2830] v1->field_10 = copy_arith_for_command(a0->field_18);
[2914, 2919, 2923] break;
[2927] case 13:
[2824, 2833, 2828, 2830] v1->field_10 = copy_subshell_command(a0->field_18);
[3010, 3001, 3006] break;
[3014] case 14:
[2824, 2833, 2828, 2830] v1->field_10 = copy_coproc_command(a0->field_18);
[3030, 3035, 3039] break;
[3043] }
v4 = v1;
[3361, 3365, 3366] }
return v4;
}
|
long strlcpy(_BYTE *a1, _BYTE *a2, long a3)
[0] {
_BYTE *v3; // rax
_BYTE *v4; // rcx
_BYTE *v5; // rdi
char v6; // dl
_BYTE *v7; // rdx
[0, 8, 11, 4] if ( !a3 )
{
[104, 107] v5 = a2;
do
LABEL_8:
[112] ++v5;
[116] while ( *(v5 - 1) );
[122, 75, 80, 87, 120, 90] return v5 - a2 - 1;
}
[13] v3 = a1;
[16] v4 = &a1[a3 - 1];
[24, 21] v5 = a2;
[47] while ( 1 )
{
[47] v7 = v5++;
[57, 50, 54] if ( v3 == v4 )
break;
[32] v6 = *(v5 - 1);
[40, 36] *v3++ = v6;
[43, 45] if ( !v6 )
[90, 75, 45] return v5 - a2 - 1;
}
[59, 62] *v3 = 0;
[65] v5 = v7 + 1;
[73, 69] if ( *v7 )
goto LABEL_8;
[90, 75, 95] return v5 - a2 - 1;
[99] }
// nfuncs=3 queued=1 decompiled=1 lumina nreq=0 worse=0 better=0
// ALL OK, 1 function(s) have been successfully decompiled
|
long strlcpy(_BYTE *a1, _BYTE *a2, long a3)
[0] {
_BYTE *v3; // rdx
_BYTE *v4; // rax
_BYTE *v5; // rax
_BYTE *v9; // [rsp+30h] [rbp-10h]
long v10; // [rsp+38h] [rbp-8h]
[0, 32, 4, 5, 36, 8, 12, 16, 20, 24, 28] v9 = a2;
[40, 44] v10 = a3;
[48, 53, 55] if ( a3 )
{
do
{
[105, 98, 93, 103] if ( !--v10 )
break;
[57] v3 = v9++;
[65, 69, 61] v4 = a1++;
[81, 73, 84, 77] *v4 = *v3;
}
[89, 91, 86] while ( *v4 );
}
[113, 108] if ( !v10 )
{
[120, 115] if ( a3 )
[129, 122, 126] *a1 = 0;
do
[130] v5 = v9++;
[134, 138, 142, 145, 147] while ( *v5 );
}
[162, 169, 172, 177, 149, 153, 157] return v9 - a2 - 1;
[178] }
// nfuncs=3 queued=1 decompiled=1 lumina nreq=0 worse=0 better=0
// ALL OK, 1 function(s) have been successfully decompiled
|
int exclude_options(unsigned long a0) {
[768] return (-(a0 < 1) & 0x40000000) + 0x10000000;
[768, 772, 774, 779, 784] }
|
int exclude_options(unsigned long a0) {
[3025] unsigned int v1; // eax
[3025]
[3025] if (a0)
v1 = 0x10000000;
[3044] else
v1 = 0x50000000;
[3056, 3057, 3051] return v1;
[3056, 3057] }
|
static void _print_timer(FILE *f, const char *attr, struct rtattr *timer)
{
struct timeval tv;
__jiffies_to_tv(&tv, rta_getattr_u64(timer));
if (is_json_context()) {
json_writer_t *jw = get_json_writer();
jsonw_name(jw, attr);
jsonw_printf(jw, "%i.%.2i",
(int)tv.tv_sec, (int)tv.tv_usec / 10000);
} else {
fprintf(f, "%s %4i.%.2i ", attr, (int)tv.tv_sec,
(int)tv.tv_usec / 10000);
}
}
static void _bitmask2str(__u16 bitmask, char *dst, size_t dst_size,
const char **tbl)
{
int len, i;
for (i = 0, len = 0; bitmask; i++, bitmask >>= 1) {
if (bitmask & 0x1) {
if (tbl[i])
len += snprintf(dst + len, dst_size - len, "%s,",
tbl[i]);
else
len += snprintf(dst + len, dst_size - len, "0x%x,",
(1 << i));
}
}
if (!len)
snprintf(dst, dst_size, "0x0");
else
dst[len - 1] = 0;
}
static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
struct rtattr *tb[])
{
if (!tb)
return;
if (tb[IFLA_BRPORT_STATE])
print_portstate(f, rta_getattr_u8(tb[IFLA_BRPORT_STATE]));
if (tb[IFLA_BRPORT_PRIORITY])
print_int(PRINT_ANY,
"priority",
"priority %d ",
rta_getattr_u16(tb[IFLA_BRPORT_PRIORITY]));
if (tb[IFLA_BRPORT_COST])
print_int(PRINT_ANY,
"cost",
"cost %d ",
rta_getattr_u32(tb[IFLA_BRPORT_COST]));
if (tb[IFLA_BRPORT_MODE])
print_on_off(PRINT_ANY, "hairpin", "hairpin %s ",
rta_getattr_u8(tb[IFLA_BRPORT_MODE]));
if (tb[IFLA_BRPORT_GUARD])
print_on_off(PRINT_ANY, "guard", "guard %s ",
rta_getattr_u8(tb[IFLA_BRPORT_GUARD]));
if (tb[IFLA_BRPORT_PROTECT])
print_on_off(PRINT_ANY, "root_block", "root_block %s ",
rta_getattr_u8(tb[IFLA_BRPORT_PROTECT]));
if (tb[IFLA_BRPORT_FAST_LEAVE])
print_on_off(PRINT_ANY, "fastleave", "fastleave %s ",
rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE]));
if (tb[IFLA_BRPORT_LEARNING])
print_on_off(PRINT_ANY, "learning", "learning %s ",
rta_getattr_u8(tb[IFLA_BRPORT_LEARNING]));
if (tb[IFLA_BRPORT_UNICAST_FLOOD])
print_on_off(PRINT_ANY, "flood", "flood %s ",
rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD]));
if (tb[IFLA_BRPORT_ID])
print_0xhex(PRINT_ANY, "id", "port_id %#llx ",
rta_getattr_u16(tb[IFLA_BRPORT_ID]));
if (tb[IFLA_BRPORT_NO])
print_0xhex(PRINT_ANY, "no", "port_no %#llx ",
rta_getattr_u16(tb[IFLA_BRPORT_NO]));
if (tb[IFLA_BRPORT_DESIGNATED_PORT])
print_uint(PRINT_ANY,
"designated_port",
"designated_port %u ",
rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_PORT]));
if (tb[IFLA_BRPORT_DESIGNATED_COST])
print_uint(PRINT_ANY,
"designated_cost",
"designated_cost %u ",
rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_COST]));
if (tb[IFLA_BRPORT_BRIDGE_ID]) {
char bridge_id[32];
br_dump_bridge_id(((void*)(((char*)(tb[IFLA_BRPORT_BRIDGE_ID])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
bridge_id, sizeof(bridge_id));
print_string(PRINT_ANY,
"bridge_id",
"designated_bridge %s ",
bridge_id);
}
if (tb[IFLA_BRPORT_ROOT_ID]) {
char root_id[32];
br_dump_bridge_id(((void*)(((char*)(tb[IFLA_BRPORT_ROOT_ID])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
root_id, sizeof(root_id));
print_string(PRINT_ANY,
"root_id",
"designated_root %s ", root_id);
}
if (tb[IFLA_BRPORT_HOLD_TIMER])
_print_timer(f, "hold_timer", tb[IFLA_BRPORT_HOLD_TIMER]);
if (tb[IFLA_BRPORT_MESSAGE_AGE_TIMER])
_print_timer(f, "message_age_timer",
tb[IFLA_BRPORT_MESSAGE_AGE_TIMER]);
if (tb[IFLA_BRPORT_FORWARD_DELAY_TIMER])
_print_timer(f, "forward_delay_timer",
tb[IFLA_BRPORT_FORWARD_DELAY_TIMER]);
if (tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK])
print_uint(PRINT_ANY,
"topology_change_ack",
"topology_change_ack %u ",
rta_getattr_u8(tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK]));
if (tb[IFLA_BRPORT_CONFIG_PENDING])
print_uint(PRINT_ANY,
"config_pending",
"config_pending %u ",
rta_getattr_u8(tb[IFLA_BRPORT_CONFIG_PENDING]));
if (tb[IFLA_BRPORT_PROXYARP])
print_on_off(PRINT_ANY, "proxy_arp", "proxy_arp %s ",
rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP]));
if (tb[IFLA_BRPORT_PROXYARP_WIFI])
print_on_off(PRINT_ANY, "proxy_arp_wifi", "proxy_arp_wifi %s ",
rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP_WIFI]));
if (tb[IFLA_BRPORT_MULTICAST_ROUTER])
print_uint(PRINT_ANY,
"multicast_router",
"mcast_router %u ",
rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER]));
if (tb[IFLA_BRPORT_FAST_LEAVE])
print_string(PRINT_FP,
((void *)0)
,
"mcast_fast_leave %s ",
rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE]) ? "on" : "off");
if (tb[IFLA_BRPORT_MCAST_FLOOD])
print_on_off(PRINT_ANY, "mcast_flood", "mcast_flood %s ",
rta_getattr_u8(tb[IFLA_BRPORT_MCAST_FLOOD]));
if (tb[IFLA_BRPORT_BCAST_FLOOD])
print_on_off(PRINT_ANY, "bcast_flood", "bcast_flood %s ",
rta_getattr_u8(tb[IFLA_BRPORT_BCAST_FLOOD]));
if (tb[IFLA_BRPORT_MCAST_TO_UCAST])
print_on_off(PRINT_ANY, "mcast_to_unicast", "mcast_to_unicast %s ",
rta_getattr_u8(tb[IFLA_BRPORT_MCAST_TO_UCAST]));
if (tb[IFLA_BRPORT_NEIGH_SUPPRESS])
print_on_off(PRINT_ANY, "neigh_suppress", "neigh_suppress %s ",
rta_getattr_u8(tb[IFLA_BRPORT_NEIGH_SUPPRESS]));
if (tb[IFLA_BRPORT_GROUP_FWD_MASK]) {
char convbuf[256];
__u16 fwd_mask;
fwd_mask = rta_getattr_u16(tb[IFLA_BRPORT_GROUP_FWD_MASK]);
print_0xhex(PRINT_ANY, "group_fwd_mask",
"group_fwd_mask %#llx ", fwd_mask);
_bitmask2str(fwd_mask, convbuf, sizeof(convbuf), fwd_mask_tbl);
print_string(PRINT_ANY, "group_fwd_mask_str",
"group_fwd_mask_str %s ", convbuf);
}
if (tb[IFLA_BRPORT_VLAN_TUNNEL])
print_on_off(PRINT_ANY, "vlan_tunnel", "vlan_tunnel %s ",
rta_getattr_u8(tb[IFLA_BRPORT_VLAN_TUNNEL]));
if (tb[IFLA_BRPORT_ISOLATED])
print_on_off(PRINT_ANY, "isolated", "isolated %s ",
rta_getattr_u8(tb[IFLA_BRPORT_ISOLATED]));
if (tb[IFLA_BRPORT_LOCKED])
print_on_off(PRINT_ANY, "locked", "locked %s ",
rta_getattr_u8(tb[IFLA_BRPORT_LOCKED]));
if (tb[IFLA_BRPORT_BACKUP_PORT]) {
int backup_p = rta_getattr_u32(tb[IFLA_BRPORT_BACKUP_PORT]);
print_string(PRINT_ANY, "backup_port", "backup_port %s ",
ll_index_to_name(backup_p));
}
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
struct nlmsghdr *n, int type)
{
int ret;
__u8 val = parse_on_off(arg_name, arg_val, &ret);
if (ret)
exit(1);
addattr8(n, 1024, type, val);
}
static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
__u8 state;
__u16 priority;
__u32 cost;
while (argc > 0) {
if (matches(*argv, "fdb_flush") == 0) {
addattr(n, 1024, IFLA_BRPORT_FLUSH);
} else if (matches(*argv, "state") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u8(&state, *argv, 0))
invarg("state is invalid", *argv);
addattr8(n, 1024, IFLA_BRPORT_STATE, state);
} else if (matches(*argv, "priority") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u16(&priority, *argv, 0))
invarg("priority is invalid", *argv);
addattr16(n, 1024, IFLA_BRPORT_PRIORITY, priority);
} else if (matches(*argv, "cost") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u32(&cost, *argv, 0))
invarg("cost is invalid", *argv);
addattr32(n, 1024, IFLA_BRPORT_COST, cost);
} else if (matches(*argv, "hairpin") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("hairpin", *argv, n,
IFLA_BRPORT_MODE);
} else if (matches(*argv, "guard") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("guard", *argv, n,
IFLA_BRPORT_GUARD);
} else if (matches(*argv, "root_block") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("root_block", *argv, n,
IFLA_BRPORT_PROTECT);
} else if (matches(*argv, "fastleave") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("fastleave", *argv, n,
IFLA_BRPORT_FAST_LEAVE);
} else if (matches(*argv, "learning") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("learning", *argv, n,
IFLA_BRPORT_LEARNING);
} else if (matches(*argv, "flood") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("flood", *argv, n,
IFLA_BRPORT_UNICAST_FLOOD);
} else if (matches(*argv, "mcast_flood") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("mcast_flood", *argv, n,
IFLA_BRPORT_MCAST_FLOOD);
} else if (matches(*argv, "bcast_flood") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("bcast_flood", *argv, n,
IFLA_BRPORT_BCAST_FLOOD);
} else if (matches(*argv, "mcast_to_unicast") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("mcast_to_unicast", *argv, n,
IFLA_BRPORT_MCAST_TO_UCAST);
} else if (matches(*argv, "proxy_arp") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("proxy_arp", *argv, n,
IFLA_BRPORT_PROXYARP);
} else if (matches(*argv, "proxy_arp_wifi") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("proxy_arp_wifi", *argv, n,
IFLA_BRPORT_PROXYARP_WIFI);
} else if (matches(*argv, "mcast_router") == 0) {
__u8 mcast_router;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u8(&mcast_router, *argv, 0))
invarg("invalid mcast_router", *argv);
addattr8(n, 1024, IFLA_BRPORT_MULTICAST_ROUTER,
mcast_router);
} else if (matches(*argv, "mcast_fast_leave") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("mcast_fast_leave", *argv, n,
IFLA_BRPORT_FAST_LEAVE);
} else if (matches(*argv, "neigh_suppress") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("neigh_suppress", *argv, n,
IFLA_BRPORT_NEIGH_SUPPRESS);
} else if (matches(*argv, "group_fwd_mask") == 0) {
__u16 mask;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u16(&mask, *argv, 0))
invarg("invalid group_fwd_mask", *argv);
addattr16(n, 1024, IFLA_BRPORT_GROUP_FWD_MASK, mask);
} else if (matches(*argv, "vlan_tunnel") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("vlan_tunnel", *argv, n,
IFLA_BRPORT_VLAN_TUNNEL);
} else if (matches(*argv, "isolated") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("isolated", *argv, n,
IFLA_BRPORT_ISOLATED);
} else if (matches(*argv, "locked") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("locked", *argv, n,
IFLA_BRPORT_LOCKED);
} else if (matches(*argv, "backup_port") == 0) {
int ifindex;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
invarg("Device does not exist\n", *argv);
addattr32(n, 1024, IFLA_BRPORT_BACKUP_PORT, ifindex);
} else if (matches(*argv, "nobackup_port") == 0) {
addattr32(n, 1024, IFLA_BRPORT_BACKUP_PORT, 0);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
} else {
fprintf(
stderr
, "bridge_slave: unknown option \"%s\"?\n",
*argv);
explain();
return -1;
}
argc--, argv++;
}
return 0;
}
static void bridge_slave_print_help(struct link_util *lu, int argc, char **argv,
FILE *f)
{
print_explain(f);
}
struct link_util bridge_slave_link_util = {
.id = "bridge_slave",
.maxattr = (__IFLA_BRPORT_MAX - 1),
.print_opt = bridge_slave_print_opt,
.parse_opt = bridge_slave_parse_opt,
.print_help = bridge_slave_print_help,
.parse_ifla_xstats = bridge_parse_xstats,
.print_ifla_xstats = bridge_print_xstats,
};
|
static void _print_timer(FILE *f, const char *attr, struct rtattr *timer)
{
struct timeval tv;
__jiffies_to_tv(&tv, rta_getattr_u64(timer));
if (is_json_context()) {
json_writer_t *jw = get_json_writer();
jsonw_name(jw, attr);
jsonw_printf(jw, "%i.%.2i",
(int)tv.tv_sec, (int)tv.tv_usec / 10000);
} else {
fprintf(f, "%s %4i.%.2i ", attr, (int)tv.tv_sec,
(int)tv.tv_usec / 10000);
}
}
static void _bitmask2str(__u16 bitmask, char *dst, size_t dst_size,
const char **tbl)
{
int len, i;
for (i = 0, len = 0; bitmask; i++, bitmask >>= 1) {
if (bitmask & 0x1) {
if (tbl[i])
len += snprintf(dst + len, dst_size - len, "%s,",
tbl[i]);
else
len += snprintf(dst + len, dst_size - len, "0x%x,",
(1 << i));
}
}
if (!len)
snprintf(dst, dst_size, "0x0");
else
dst[len - 1] = 0;
}
static void bridge_slave_print_opt(struct link_util *lu, FILE *f,
struct rtattr *tb[])
{
if (!tb)
return;
if (tb[IFLA_BRPORT_STATE])
print_portstate(f, rta_getattr_u8(tb[IFLA_BRPORT_STATE]));
if (tb[IFLA_BRPORT_PRIORITY])
print_int(PRINT_ANY,
"priority",
"priority %d ",
rta_getattr_u16(tb[IFLA_BRPORT_PRIORITY]));
if (tb[IFLA_BRPORT_COST])
print_int(PRINT_ANY,
"cost",
"cost %d ",
rta_getattr_u32(tb[IFLA_BRPORT_COST]));
if (tb[IFLA_BRPORT_MODE])
print_on_off(PRINT_ANY, "hairpin", "hairpin %s ",
rta_getattr_u8(tb[IFLA_BRPORT_MODE]));
if (tb[IFLA_BRPORT_GUARD])
print_on_off(PRINT_ANY, "guard", "guard %s ",
rta_getattr_u8(tb[IFLA_BRPORT_GUARD]));
if (tb[IFLA_BRPORT_PROTECT])
print_on_off(PRINT_ANY, "root_block", "root_block %s ",
rta_getattr_u8(tb[IFLA_BRPORT_PROTECT]));
if (tb[IFLA_BRPORT_FAST_LEAVE])
print_on_off(PRINT_ANY, "fastleave", "fastleave %s ",
rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE]));
if (tb[IFLA_BRPORT_LEARNING])
print_on_off(PRINT_ANY, "learning", "learning %s ",
rta_getattr_u8(tb[IFLA_BRPORT_LEARNING]));
if (tb[IFLA_BRPORT_UNICAST_FLOOD])
print_on_off(PRINT_ANY, "flood", "flood %s ",
rta_getattr_u8(tb[IFLA_BRPORT_UNICAST_FLOOD]));
if (tb[IFLA_BRPORT_ID])
print_0xhex(PRINT_ANY, "id", "port_id %#llx ",
rta_getattr_u16(tb[IFLA_BRPORT_ID]));
if (tb[IFLA_BRPORT_NO])
print_0xhex(PRINT_ANY, "no", "port_no %#llx ",
rta_getattr_u16(tb[IFLA_BRPORT_NO]));
if (tb[IFLA_BRPORT_DESIGNATED_PORT])
print_uint(PRINT_ANY,
"designated_port",
"designated_port %u ",
rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_PORT]));
if (tb[IFLA_BRPORT_DESIGNATED_COST])
print_uint(PRINT_ANY,
"designated_cost",
"designated_cost %u ",
rta_getattr_u16(tb[IFLA_BRPORT_DESIGNATED_COST]));
if (tb[IFLA_BRPORT_BRIDGE_ID]) {
char bridge_id[32];
br_dump_bridge_id(((void*)(((char*)(tb[IFLA_BRPORT_BRIDGE_ID])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
bridge_id, sizeof(bridge_id));
print_string(PRINT_ANY,
"bridge_id",
"designated_bridge %s ",
bridge_id);
}
if (tb[IFLA_BRPORT_ROOT_ID]) {
char root_id[32];
br_dump_bridge_id(((void*)(((char*)(tb[IFLA_BRPORT_ROOT_ID])) + (( ((sizeof(struct rtattr))+4U -1) & ~(4U -1) ) + (0)))),
root_id, sizeof(root_id));
print_string(PRINT_ANY,
"root_id",
"designated_root %s ", root_id);
}
if (tb[IFLA_BRPORT_HOLD_TIMER])
_print_timer(f, "hold_timer", tb[IFLA_BRPORT_HOLD_TIMER]);
if (tb[IFLA_BRPORT_MESSAGE_AGE_TIMER])
_print_timer(f, "message_age_timer",
tb[IFLA_BRPORT_MESSAGE_AGE_TIMER]);
if (tb[IFLA_BRPORT_FORWARD_DELAY_TIMER])
_print_timer(f, "forward_delay_timer",
tb[IFLA_BRPORT_FORWARD_DELAY_TIMER]);
if (tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK])
print_uint(PRINT_ANY,
"topology_change_ack",
"topology_change_ack %u ",
rta_getattr_u8(tb[IFLA_BRPORT_TOPOLOGY_CHANGE_ACK]));
if (tb[IFLA_BRPORT_CONFIG_PENDING])
print_uint(PRINT_ANY,
"config_pending",
"config_pending %u ",
rta_getattr_u8(tb[IFLA_BRPORT_CONFIG_PENDING]));
if (tb[IFLA_BRPORT_PROXYARP])
print_on_off(PRINT_ANY, "proxy_arp", "proxy_arp %s ",
rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP]));
if (tb[IFLA_BRPORT_PROXYARP_WIFI])
print_on_off(PRINT_ANY, "proxy_arp_wifi", "proxy_arp_wifi %s ",
rta_getattr_u8(tb[IFLA_BRPORT_PROXYARP_WIFI]));
if (tb[IFLA_BRPORT_MULTICAST_ROUTER])
print_uint(PRINT_ANY,
"multicast_router",
"mcast_router %u ",
rta_getattr_u8(tb[IFLA_BRPORT_MULTICAST_ROUTER]));
if (tb[IFLA_BRPORT_FAST_LEAVE])
print_string(PRINT_FP,
((void *)0)
,
"mcast_fast_leave %s ",
rta_getattr_u8(tb[IFLA_BRPORT_FAST_LEAVE]) ? "on" : "off");
if (tb[IFLA_BRPORT_MCAST_FLOOD])
print_on_off(PRINT_ANY, "mcast_flood", "mcast_flood %s ",
rta_getattr_u8(tb[IFLA_BRPORT_MCAST_FLOOD]));
if (tb[IFLA_BRPORT_BCAST_FLOOD])
print_on_off(PRINT_ANY, "bcast_flood", "bcast_flood %s ",
rta_getattr_u8(tb[IFLA_BRPORT_BCAST_FLOOD]));
if (tb[IFLA_BRPORT_MCAST_TO_UCAST])
print_on_off(PRINT_ANY, "mcast_to_unicast", "mcast_to_unicast %s ",
rta_getattr_u8(tb[IFLA_BRPORT_MCAST_TO_UCAST]));
if (tb[IFLA_BRPORT_NEIGH_SUPPRESS])
print_on_off(PRINT_ANY, "neigh_suppress", "neigh_suppress %s ",
rta_getattr_u8(tb[IFLA_BRPORT_NEIGH_SUPPRESS]));
if (tb[IFLA_BRPORT_GROUP_FWD_MASK]) {
char convbuf[256];
__u16 fwd_mask;
fwd_mask = rta_getattr_u16(tb[IFLA_BRPORT_GROUP_FWD_MASK]);
print_0xhex(PRINT_ANY, "group_fwd_mask",
"group_fwd_mask %#llx ", fwd_mask);
_bitmask2str(fwd_mask, convbuf, sizeof(convbuf), fwd_mask_tbl);
print_string(PRINT_ANY, "group_fwd_mask_str",
"group_fwd_mask_str %s ", convbuf);
}
if (tb[IFLA_BRPORT_VLAN_TUNNEL])
print_on_off(PRINT_ANY, "vlan_tunnel", "vlan_tunnel %s ",
rta_getattr_u8(tb[IFLA_BRPORT_VLAN_TUNNEL]));
if (tb[IFLA_BRPORT_ISOLATED])
print_on_off(PRINT_ANY, "isolated", "isolated %s ",
rta_getattr_u8(tb[IFLA_BRPORT_ISOLATED]));
if (tb[IFLA_BRPORT_LOCKED])
print_on_off(PRINT_ANY, "locked", "locked %s ",
rta_getattr_u8(tb[IFLA_BRPORT_LOCKED]));
if (tb[IFLA_BRPORT_BACKUP_PORT]) {
int backup_p = rta_getattr_u32(tb[IFLA_BRPORT_BACKUP_PORT]);
print_string(PRINT_ANY, "backup_port", "backup_port %s ",
ll_index_to_name(backup_p));
}
}
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val,
struct nlmsghdr *n, int type)
{
int ret;
__u8 val = parse_on_off(arg_name, arg_val, &ret);
if (ret)
exit(1);
addattr8(n, 1024, type, val);
}
static int bridge_slave_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n)
{
__u8 state;
__u16 priority;
__u32 cost;
while (argc > 0) {
if (matches(*argv, "fdb_flush") == 0) {
addattr(n, 1024, IFLA_BRPORT_FLUSH);
} else if (matches(*argv, "state") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u8(&state, *argv, 0))
invarg("state is invalid", *argv);
addattr8(n, 1024, IFLA_BRPORT_STATE, state);
} else if (matches(*argv, "priority") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u16(&priority, *argv, 0))
invarg("priority is invalid", *argv);
addattr16(n, 1024, IFLA_BRPORT_PRIORITY, priority);
} else if (matches(*argv, "cost") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u32(&cost, *argv, 0))
invarg("cost is invalid", *argv);
addattr32(n, 1024, IFLA_BRPORT_COST, cost);
} else if (matches(*argv, "hairpin") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("hairpin", *argv, n,
IFLA_BRPORT_MODE);
} else if (matches(*argv, "guard") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("guard", *argv, n,
IFLA_BRPORT_GUARD);
} else if (matches(*argv, "root_block") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("root_block", *argv, n,
IFLA_BRPORT_PROTECT);
} else if (matches(*argv, "fastleave") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("fastleave", *argv, n,
IFLA_BRPORT_FAST_LEAVE);
} else if (matches(*argv, "learning") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("learning", *argv, n,
IFLA_BRPORT_LEARNING);
} else if (matches(*argv, "flood") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("flood", *argv, n,
IFLA_BRPORT_UNICAST_FLOOD);
} else if (matches(*argv, "mcast_flood") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("mcast_flood", *argv, n,
IFLA_BRPORT_MCAST_FLOOD);
} else if (matches(*argv, "bcast_flood") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("bcast_flood", *argv, n,
IFLA_BRPORT_BCAST_FLOOD);
} else if (matches(*argv, "mcast_to_unicast") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("mcast_to_unicast", *argv, n,
IFLA_BRPORT_MCAST_TO_UCAST);
} else if (matches(*argv, "proxy_arp") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("proxy_arp", *argv, n,
IFLA_BRPORT_PROXYARP);
} else if (matches(*argv, "proxy_arp_wifi") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("proxy_arp_wifi", *argv, n,
IFLA_BRPORT_PROXYARP_WIFI);
} else if (matches(*argv, "mcast_router") == 0) {
__u8 mcast_router;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u8(&mcast_router, *argv, 0))
invarg("invalid mcast_router", *argv);
addattr8(n, 1024, IFLA_BRPORT_MULTICAST_ROUTER,
mcast_router);
} else if (matches(*argv, "mcast_fast_leave") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("mcast_fast_leave", *argv, n,
IFLA_BRPORT_FAST_LEAVE);
} else if (matches(*argv, "neigh_suppress") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("neigh_suppress", *argv, n,
IFLA_BRPORT_NEIGH_SUPPRESS);
} else if (matches(*argv, "group_fwd_mask") == 0) {
__u16 mask;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
if (get_u16(&mask, *argv, 0))
invarg("invalid group_fwd_mask", *argv);
addattr16(n, 1024, IFLA_BRPORT_GROUP_FWD_MASK, mask);
} else if (matches(*argv, "vlan_tunnel") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("vlan_tunnel", *argv, n,
IFLA_BRPORT_VLAN_TUNNEL);
} else if (matches(*argv, "isolated") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("isolated", *argv, n,
IFLA_BRPORT_ISOLATED);
} else if (matches(*argv, "locked") == 0) {
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
bridge_slave_parse_on_off("locked", *argv, n,
IFLA_BRPORT_LOCKED);
} else if (matches(*argv, "backup_port") == 0) {
int ifindex;
do { argv++; if (--argc <= 0) incomplete_command(); } while(0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
invarg("Device does not exist\n", *argv);
addattr32(n, 1024, IFLA_BRPORT_BACKUP_PORT, ifindex);
} else if (matches(*argv, "nobackup_port") == 0) {
addattr32(n, 1024, IFLA_BRPORT_BACKUP_PORT, 0);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
} else {
fprintf(
stderr
, "bridge_slave: unknown option \"%s\"?\n",
*argv);
explain();
return -1;
}
argc--, argv++;
}
return 0;
}
static void bridge_slave_print_help(struct link_util *lu, int argc, char **argv,
FILE *f)
{
print_explain(f);
}
struct link_util bridge_slave_link_util = {
.id = "bridge_slave",
.maxattr = (__IFLA_BRPORT_MAX - 1),
.print_opt = bridge_slave_print_opt,
.parse_opt = bridge_slave_parse_opt,
.print_help = bridge_slave_print_help,
.parse_ifla_xstats = bridge_parse_xstats,
.print_ifla_xstats = bridge_print_xstats,
};
|
int path_in_hostfiles(char *a0, unsigned long a1) {
[4848] unsigned long long v0; // [bp-0x18]
[4848] unsigned long v1; // [bp-0x10]
[4848] unsigned long long v2; // [bp-0x8]
[4848] char v3; // [bp+0x0]
[4848] unsigned long long v5; // r12
[4848] unsigned long long v6; // rbx
[4848] unsigned long long v7; // rbx
[4848] unsigned long long v8; // rax
[4848] unsigned long long v9; // rbx
[4848] unsigned long long v10; // r12
[4848] unsigned long long v11; // rbx
[4848] unsigned long long v12; // r12
[4848]
[4848] if (!a1)
return 0;
[4929, 4927] v2 = v5;
[4852] v1 = &v3;
[4857, 4854] v0 = v6;
[4858, 4861] v7 = __negvsi2;
[4862] while (true) {
[4889] v8 = strcmp(a0, *(v7));
[4889, 4892, 4895] if (!v8) {
v9 = v0;
[4904] v10 = v2;
[4905, 4910, 4911] return 1;
[4913, 4905] }
v7 += 8;
[4880] if (v7 != strerror + (a1 - 1 << 3))
[4873, 4854] continue;
[4884, 4887] v11 = v0;
[4920] v12 = v2;
[4921, 4923, 4924] return 0;
[4921, 4926] }
}
|
int path_in_hostfiles(char *a0, unsigned long long *a1, unsigned long a2) {
[7074] unsigned int v0; // [bp-0xc]
[7074] unsigned int v2; // rax
[7074]
[7074] v0 = 0;
[7074, 7078, 7079, 7082, 7086, 7090, 7094, 7097] while (true) {
[7157] if (v0 >= a2) {
[7160, 7163, 7157] v2 = 0;
[7170, 7171, 7165] break;
[7170, 7171, 7165] } else {
v2 = strcmp(a0, a1[v0]);
[7137, 7106, 7109, 7117, 7121, 7124, 7127, 7131, 7134] if (!v2) {
v2 = 1;
[7146] break;
[7151] } else {
v0 += 1;
[7153, 7157, 7160, 7163] }
}
}
return v2;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.