// File: /workspace/github_c_makefile_star2_O0/s3lase[P]v6shell/osh.c
// Function: do_sigign
static void
do_sigign(char **av, enum tnflags f)
{
	struct sigaction act, oact;
	sigset_t new_mask, old_mask;
	char *sigbad;
	long lsigno;
	int i, sigerr, signo;
	static bool ignlst[NSIG], gotlst;

	/* Temporarily block all signals in this function. */
	(void)sigfillset(&new_mask);
	(void)sigprocmask(SIG_SETMASK, &new_mask, &old_mask);

	if (!gotlst) {
		/* Initialize the list of already ignored signals. */
		for (i = 1; i < NSIG; i++) {
			ignlst[i - 1] = false;
			if (sigaction(i, NULL, &oact) < 0)
				continue;
			if (oact.sa_handler == SIG_IGN)
				ignlst[i - 1] = true;
		}
		gotlst = true;
	}

	sigerr = 0;
	if (av[1] != NULL) {
		if (av[2] == NULL) {
			sigerr = 1;
			goto sigdone;
		}

		(void)memset(&act, 0, sizeof(act));
		(void)sigemptyset(&act.sa_mask);
		if (EQUAL(av[1], "+"))
			act.sa_handler = SIG_IGN;
		else if (EQUAL(av[1], "-"))
			act.sa_handler = SIG_DFL;
		else {
			sigerr = 1;
			goto sigdone;
		}
		act.sa_flags = SA_RESTART;

		for (i = 2; av[i] != NULL; i++) {
			errno = 0;
			lsigno = strtol(av[i], &sigbad, 10);
			if (errno  != 0 || *av[i] == EOS || *sigbad != EOS ||
			    lsigno <= 0 || lsigno >= NSIG) {
				sigerr = i;
				goto sigdone;
			}
			signo = (int)lsigno;

			/* Do nothing if no signal changes are needed. */
			if (sigaction(signo, NULL, &oact) < 0 ||
			    (act.sa_handler  == SIG_DFL &&
			     oact.sa_handler == SIG_DFL))
				continue;

			/* Set up already ignored signal if needed. */
			if (ignlst[signo - 1]) {
				set_ss_flags(signo, act.sa_handler);
				if (act.sa_handler == SIG_DFL)
					continue;
			}

			/* Reinstall SIGHUP signal handler if needed. */
			if (is_login&&signo==SIGHUP&&act.sa_handler==SIG_DFL) {
				if (oact.sa_handler == sighup)
					continue;
				if (sasignal(signo, sighup) == SIG_ERR) {
					sigerr = signo;
					goto sigdone;
				}
				continue;
			}

			/*
			 * Trying to ignore SIGKILL, SIGSTOP, and/or SIGCHLD
			 * has no effect.
			 */
			if (signo == SIGKILL ||
			    signo == SIGSTOP || signo == SIGCHLD ||
			    sigaction(signo, &act, NULL) < 0)
				continue;

			set_ss_flags(signo, act.sa_handler);
		}
	} else {
		/* Print signals currently ignored because of `sigign'. */
		for (i = 1; i < NSIG; i++) {
			if (sigaction(i, NULL, &oact) < 0 ||
			    oact.sa_handler != SIG_IGN)
				continue;
			if (!ignlst[i - 1] || ((f & FINTR) == 0 &&
			    ((i == SIGINT  && (sig_state & S_SIGINT)  != 0 &&
			     (sig_child & S_SIGINT)  != 0)   ||
			     (i == SIGQUIT && (sig_state & S_SIGQUIT) != 0 &&
			     (sig_child & S_SIGQUIT) != 0))) ||
			     (i == SIGTERM && (sig_state & S_SIGTERM) != 0 &&
			     (sig_child & S_SIGTERM) != 0))
				fd_print(FD1, "%s + %2u\n", av[0], (unsigned)i);
		}
	}

sigdone:
	(void)sigprocmask(SIG_SETMASK, &old_mask, NULL);
	if (sigerr == 0)
		status = SH_TRUE;
	else if (sigerr == 1)
		err(-1, FMT3S, getmyname(), av[0], ERR_GENERIC);
	else
		err(-1, FMT4S, getmyname(), av[0], av[sigerr], ERR_BADSIGNAL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
leaq -0x1c0(%rbp), %rdi
callq 0x2290
movl $0x2, %edi
leaq -0x1c0(%rbp), %rsi
leaq -0x240(%rbp), %rdx
callq 0x2040
testb $0x1, 0xb6b4(%rip)      # 0x13371
jne 0x7d49
movl $0x1, -0x254(%rbp)
cmpl $0x41, -0x254(%rbp)
jge 0x7d42
movl -0x254(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xb647(%rip), %rax      # 0x13330
movb $0x0, (%rax,%rcx)
movl -0x254(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
leaq -0x140(%rbp), %rdx
callq 0x20b0
cmpl $0x0, %eax
jge 0x7d0a
jmp 0x7d31
movl $0x1, %eax
cmpq %rax, -0x140(%rbp)
jne 0x7d2f
movl -0x254(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xb605(%rip), %rax      # 0x13330
movb $0x1, (%rax,%rcx)
jmp 0x7d31
movl -0x254(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x254(%rbp)
jmp 0x7ccd
movb $0x1, 0xb628(%rip)      # 0x13371
movl $0x0, -0x258(%rbp)
movq -0x8(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x8016
movq -0x8(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x7d7c
movl $0x1, -0x258(%rbp)
jmp 0x8128
leaq -0xa8(%rbp), %rdi
xorl %esi, %esi
movl $0x98, %edx
callq 0x21b0
leaq -0xa8(%rbp), %rdi
addq $0x8, %rdi
callq 0x2250
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
movsbl 0x3b26(%rip), %ecx      # 0xb8d7
cmpl %ecx, %eax
jne 0x7ddc
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3b13(%rip), %rsi      # 0xb8d7
callq 0x2230
cmpl $0x0, %eax
jne 0x7ddc
movl $0x1, %eax
movq %rax, -0xa8(%rbp)
jmp 0x7e29
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
movsbl 0x3ad1(%rip), %ecx      # 0xb8bf
cmpl %ecx, %eax
jne 0x7e18
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x3abe(%rip), %rsi      # 0xb8bf
callq 0x2230
cmpl $0x0, %eax
jne 0x7e18
movq $0x0, -0xa8(%rbp)
jmp 0x7e27
movl $0x1, -0x258(%rbp)
jmp 0x8128
jmp 0x7e29
movl $0x10000000, -0x20(%rbp) # imm = 0x10000000
movl $0x2, -0x254(%rbp)
movq -0x8(%rbp), %rax
movslq -0x254(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x8011
callq 0x2070
movl $0x0, (%rax)
movq -0x8(%rbp), %rax
movslq -0x254(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq -0x248(%rbp), %rsi
movl $0xa, %edx
callq 0x2280
movq %rax, -0x250(%rbp)
callq 0x2070
cmpl $0x0, (%rax)
jne 0x7ec6
movq -0x8(%rbp), %rax
movslq -0x254(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x7ec6
movq -0x248(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x7ec6
cmpq $0x0, -0x250(%rbp)
jle 0x7ec6
cmpq $0x41, -0x250(%rbp)
jl 0x7ed7
movl -0x254(%rbp), %eax
movl %eax, -0x258(%rbp)
jmp 0x8128
movq -0x250(%rbp), %rax
movl %eax, -0x25c(%rbp)
movl -0x25c(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
leaq -0x140(%rbp), %rdx
callq 0x20b0
cmpl $0x0, %eax
jl 0x7f13
cmpq $0x0, -0xa8(%rbp)
jne 0x7f18
cmpq $0x0, -0x140(%rbp)
jne 0x7f18
jmp 0x7ffd
movl -0x25c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xb405(%rip), %rax      # 0x13330
testb $0x1, (%rax,%rcx)
je 0x7f54
movl -0x25c(%rbp), %edi
movq -0xa8(%rbp), %rsi
callq 0x85e0
cmpq $0x0, -0xa8(%rbp)
jne 0x7f52
jmp 0x7ffd
jmp 0x7f54
testb $0x1, 0x62ed(%rip)      # 0xe248
je 0x7fb3
cmpl $0x1, -0x25c(%rbp)
jne 0x7fb3
cmpq $0x0, -0xa8(%rbp)
jne 0x7fb3
leaq -0x5217(%rip), %rax     # 0x2d60
cmpq %rax, -0x140(%rbp)
jne 0x7f82
jmp 0x7ffd
movl -0x25c(%rbp), %edi
leaq -0x522f(%rip), %rsi     # 0x2d60
callq 0xac70
movq $-0x1, %rcx
cmpq %rcx, %rax
jne 0x7fb1
movl -0x25c(%rbp), %eax
movl %eax, -0x258(%rbp)
jmp 0x8128
jmp 0x7ffd
cmpl $0x9, -0x25c(%rbp)
je 0x7fe9
cmpl $0x13, -0x25c(%rbp)
je 0x7fe9
cmpl $0x11, -0x25c(%rbp)
je 0x7fe9
movl -0x25c(%rbp), %edi
leaq -0xa8(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x20b0
cmpl $0x0, %eax
jge 0x7feb
jmp 0x7ffd
movl -0x25c(%rbp), %edi
movq -0xa8(%rbp), %rsi
callq 0x85e0
movl -0x254(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x254(%rbp)
jmp 0x7e3a
jmp 0x8126
movl $0x1, -0x254(%rbp)
cmpl $0x41, -0x254(%rbp)
jge 0x8124
movl -0x254(%rbp), %edi
xorl %eax, %eax
movl %eax, %esi
leaq -0x140(%rbp), %rdx
callq 0x20b0
cmpl $0x0, %eax
jl 0x8056
movl $0x1, %eax
cmpq %rax, -0x140(%rbp)
je 0x805b
jmp 0x8110
movl -0x254(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0xb2c2(%rip), %rax      # 0x13330
testb $0x1, (%rax,%rcx)
je 0x80ee
movl -0xc(%rbp), %eax
andl $0x40, %eax
cmpl $0x0, %eax
jne 0x80c9
cmpl $0x2, -0x254(%rbp)
jne 0x80a4
movl 0xb2e6(%rip), %eax      # 0x13374
andl $0x1, %eax
cmpl $0x0, %eax
je 0x80a4
movl 0x61b0(%rip), %eax      # 0xe24c
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x80ee
cmpl $0x3, -0x254(%rbp)
jne 0x80c9
movl 0xb2c1(%rip), %eax      # 0x13374
andl $0x2, %eax
cmpl $0x0, %eax
je 0x80c9
movl 0x618b(%rip), %eax      # 0xe24c
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x80ee
cmpl $0xf, -0x254(%rbp)
jne 0x810e
movl 0xb29c(%rip), %eax      # 0x13374
andl $0x4, %eax
cmpl $0x0, %eax
je 0x810e
movl 0x6166(%rip), %eax      # 0xe24c
andl $0x4, %eax
cmpl $0x0, %eax
je 0x810e
movq -0x8(%rbp), %rax
movq (%rax), %rdx
movl -0x254(%rbp), %ecx
movl $0x1, %edi
leaq 0x37d2(%rip), %rsi      # 0xb8d9
movb $0x0, %al
callq 0x8d40
jmp 0x8110
movl -0x254(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x254(%rbp)
jmp 0x8020
jmp 0x8126
jmp 0x8128
movl $0x2, %edi
leaq -0x240(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x2040
cmpl $0x0, -0x258(%rbp)
jne 0x8152
movl $0x0, 0x6118(%rip)      # 0xe268
jmp 0x81c0
cmpl $0x1, -0x258(%rbp)
jne 0x8186
callq 0x8df0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x3627(%rip), %rsi      # 0xb79d
leaq 0x3792(%rip), %r8       # 0xb90f
movb $0x0, %al
callq 0x8af0
jmp 0x81be
callq 0x8df0
movq %rax, %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movslq -0x258(%rbp), %rsi
movq (%rax,%rsi,8), %r8
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x35e9(%rip), %rsi      # 0xb799
leaq 0x372c(%rip), %r9       # 0xb8e3
movb $0x0, %al
callq 0x8af0
jmp 0x81c0
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
nopl (%rax)