// File: /workspace/github_c_makefile_star2_O1/lyda[P]tz/zic.c
// Function: rulesub
static void
rulesub(rp, loyearp, hiyearp, typep, monthp, dayp, timep)
register struct rule * const	rp;
const char * const		loyearp;
const char * const		hiyearp;
const char * const		typep;
const char * const		monthp;
const char * const		dayp;
const char * const		timep;
{
	register const struct lookup *	lp;
	register const char *		cp;
	register char *			dp;
	register char *			ep;

	if ((lp = byword(monthp, mon_names)) == NULL) {
		error(_("invalid month name"));
		return;
	}
	rp->r_month = lp->l_value;
	rp->r_todisstd = FALSE;
	rp->r_todisgmt = FALSE;
	dp = ecpyalloc(timep);
	if (*dp != '\0') {
		ep = dp + strlen(dp) - 1;
		switch (lowerit(*ep)) {
			case 's':	/* Standard */
				rp->r_todisstd = TRUE;
				rp->r_todisgmt = FALSE;
				*ep = '\0';
				break;
			case 'w':	/* Wall */
				rp->r_todisstd = FALSE;
				rp->r_todisgmt = FALSE;
				*ep = '\0';
				break;
			case 'g':	/* Greenwich */
			case 'u':	/* Universal */
			case 'z':	/* Zulu */
				rp->r_todisstd = TRUE;
				rp->r_todisgmt = TRUE;
				*ep = '\0';
				break;
		}
	}
	rp->r_tod = gethms(dp, _("invalid time of day"), FALSE);
	ifree(dp);
	/*
	** Year work.
	*/
	cp = loyearp;
	lp = byword(cp, begin_years);
	rp->r_lowasnum = lp == NULL;
	if (!rp->r_lowasnum) switch ((int) lp->l_value) {
		case YR_MINIMUM:
			rp->r_loyear = INT_MIN;
			break;
		case YR_MAXIMUM:
			rp->r_loyear = INT_MAX;
			break;
		default:	/* "cannot happen" */
			(void) fprintf(stderr,
				_("%s: panic: Invalid l_value %d\n"),
				progname, lp->l_value);
			exit(EXIT_FAILURE);
	} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_loyear) != 1) {
		error(_("invalid starting year"));
		return;
	}
	cp = hiyearp;
	lp = byword(cp, end_years);
	rp->r_hiwasnum = lp == NULL;
	if (!rp->r_hiwasnum) switch ((int) lp->l_value) {
		case YR_MINIMUM:
			rp->r_hiyear = INT_MIN;
			break;
		case YR_MAXIMUM:
			rp->r_hiyear = INT_MAX;
			break;
		case YR_ONLY:
			rp->r_hiyear = rp->r_loyear;
			break;
		default:	/* "cannot happen" */
			(void) fprintf(stderr,
				_("%s: panic: Invalid l_value %d\n"),
				progname, lp->l_value);
			exit(EXIT_FAILURE);
	} else if (sscanf(cp, scheck(cp, "%d"), &rp->r_hiyear) != 1) {
		error(_("invalid ending year"));
		return;
	}
	if (rp->r_loyear > rp->r_hiyear) {
		error(_("starting year greater than ending year"));
		return;
	}
	if (*typep == '\0')
		rp->r_yrtype = NULL;
	else {
		if (rp->r_loyear == rp->r_hiyear) {
			error(_("typed single year"));
			return;
		}
		rp->r_yrtype = ecpyalloc(typep);
	}
	/*
	** Day work.
	** Accept things such as:
	**	1
	**	last-Sunday
	**	Sun<=20
	**	Sun>=7
	*/
	dp = ecpyalloc(dayp);
	if ((lp = byword(dp, lasts)) != NULL) {
		rp->r_dycode = DC_DOWLEQ;
		rp->r_wday = lp->l_value;
		rp->r_dayofmonth = len_months[1][rp->r_month];
	} else {
		if ((ep = strchr(dp, '<')) != 0)
			rp->r_dycode = DC_DOWLEQ;
		else if ((ep = strchr(dp, '>')) != 0)
			rp->r_dycode = DC_DOWGEQ;
		else {
			ep = dp;
			rp->r_dycode = DC_DOM;
		}
		if (rp->r_dycode != DC_DOM) {
			*ep++ = 0;
			if (*ep++ != '=') {
				error(_("invalid day of month"));
				ifree(dp);
				return;
			}
			if ((lp = byword(dp, wday_names)) == NULL) {
				error(_("invalid weekday name"));
				ifree(dp);
				return;
			}
			rp->r_wday = lp->l_value;
		}
		if (sscanf(ep, scheck(ep, "%d"), &rp->r_dayofmonth) != 1 ||
			rp->r_dayofmonth <= 0 ||
			(rp->r_dayofmonth > len_months[1][rp->r_month])) {
				error(_("invalid day of month"));
				ifree(dp);
				return;
		}
	}
	ifree(dp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movq %rcx, %r15
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbx
movq 0x40(%rsp), %r14
leaq 0x7b23(%rip), %rsi      # 0xdb60
movq %r8, %rdi
callq 0x5be6
testq %rax, %rax
je 0x6283
movl 0x8(%rax), %eax
movl %eax, 0x30(%rbx)
movq $0x0, 0x48(%rbx)
movq %r14, %rdi
callq 0x9c6b
movq %rax, %rbp
movq %rax, %rdi
callq 0x58e3
cmpb $0x0, (%rbp)
je 0x60cc
movq %rbp, %rdi
callq 0x20e0
movq %rax, %r14
movsbl -0x1(%rbp,%rax), %edi
callq 0x674d
leal -0x73(%rax), %ecx
cmpl $0x7, %ecx
ja 0x60ab
leaq 0x3faf(%rip), %rax      # 0xa048
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
xorl %ecx, %ecx
movl $0x1, %eax
jmp 0x60c0
cmpl $0x67, %eax
jne 0x60cc
movl $0x1, %eax
movl $0x1, %ecx
jmp 0x60c0
xorl %eax, %eax
xorl %ecx, %ecx
movl %eax, 0x48(%rbx)
movl %ecx, 0x4c(%rbx)
movb $0x0, -0x1(%rbp,%r14)
leaq 0x4568(%rip), %rsi      # 0xa63b
movq %rbp, %rdi
xorl %edx, %edx
callq 0x5a35
movq %rax, 0x40(%rbx)
movq %rbp, %rdi
callq 0x9c75
leaq 0x7b40(%rip), %rsi      # 0xdc30
movq %r13, %rdi
callq 0x5be6
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, 0x28(%rbx)
je 0x6124
movl 0x8(%rax), %edi
movl $0x80000000, %eax       # imm = 0x80000000
testl %edi, %edi
je 0x611f
cmpl $0x1, %edi
jne 0x6367
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, 0x18(%rbx)
jmp 0x614d
leaq 0x49c0(%rip), %rsi      # 0xaaeb
movq %r13, %rdi
callq 0x9a58
leaq 0x18(%rbx), %rdx
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2210
cmpl $0x1, %eax
jne 0x6344
leaq 0x7b0c(%rip), %rsi      # 0xdc60
movq %r12, %rdi
callq 0x5be6
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, 0x2c(%rbx)
je 0x6185
movl 0x8(%rax), %edi
testl %edi, %edi
je 0x61bb
cmpl $0x2, %edi
je 0x61b6
cmpl $0x1, %edi
jne 0x636c
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jmp 0x61c0
leaq 0x495f(%rip), %rsi      # 0xaaeb
movq %r12, %rdi
callq 0x9a58
leaq 0x1c(%rbx), %rdx
movq %r12, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2210
cmpl $0x1, %eax
je 0x61c3
leaq 0x44b4(%rip), %rdi      # 0xa665
jmp 0x634b
movl 0x18(%rbx), %eax
jmp 0x61c0
movl $0x80000000, %eax       # imm = 0x80000000
movl %eax, 0x1c(%rbx)
movl 0x18(%rbx), %eax
movl 0x1c(%rbx), %ecx
cmpl %ecx, %eax
jg 0x628f
cmpb $0x0, (%r15)
je 0x61f4
cmpl %ecx, %eax
je 0x633b
movq %r15, %rdi
callq 0x9c6b
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
jmp 0x61f7
xorl %r14d, %r14d
movq %r14, 0x20(%rbx)
movq (%rsp), %rdi
callq 0x9c6b
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
leaq 0x7a8a(%rip), %rsi      # 0xdca0
movq %r14, %rdi
callq 0x5be6
testq %rax, %rax
je 0x6247
movl $0x2, 0x34(%rbx)
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rbx)
movslq 0x30(%rbx), %rax
leaq 0x3e35(%rip), %rcx      # 0xa070
movl 0x30(%rcx,%rax,4), %eax
movl %eax, 0x38(%rbx)
jmp 0x6325
movq %r14, %rdi
movl $0x3c, %esi
callq 0x2100
testq %rax, %rax
je 0x6265
movq %rax, %r15
movl $0x2, 0x34(%rbx)
jmp 0x62a5
movq %r14, %rdi
movl $0x3e, %esi
callq 0x2100
testq %rax, %rax
je 0x629b
movq %rax, %r15
movl $0x1, 0x34(%rbx)
jmp 0x62a5
leaq 0x439e(%rip), %rdi      # 0xa628
jmp 0x634b
leaq 0x43e3(%rip), %rdi      # 0xa679
jmp 0x634b
movl $0x0, 0x34(%rbx)
movq %r14, %r15
cmpl $0x0, 0x34(%rbx)
je 0x62d8
movb $0x0, (%r15)
cmpb $0x3d, 0x1(%r15)
jne 0x6319
leaq 0x7a63(%rip), %rsi      # 0xdd20
movq %r14, %rdi
callq 0x5be6
testq %rax, %rax
je 0x635e
addq $0x2, %r15
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rbx)
leaq 0x480c(%rip), %rsi      # 0xaaeb
movq %r15, %rdi
callq 0x9a58
leaq 0x38(%rbx), %r12
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2210
cmpl $0x1, %eax
jne 0x6319
movl (%r12), %eax
testl %eax, %eax
jle 0x6319
movslq 0x30(%rbx), %rcx
leaq 0x3d5d(%rip), %rdx      # 0xa070
cmpl 0x30(%rdx,%rcx,4), %eax
jle 0x6325
leaq 0x4392(%rip), %rdi      # 0xa6b2
callq 0x2300
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9c75
leaq 0x435e(%rip), %rdi      # 0xa6a0
jmp 0x634b
leaq 0x4304(%rip), %rdi      # 0xa64f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2300
leaq 0x4362(%rip), %rdi      # 0xa6c7
jmp 0x6320
callq 0x26dc
callq 0x2706