// File: /workspace/github_c_makefile_star2_O3/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 0x7907(%rip), %rsi      # 0xdb60
movq %r8, %rdi
callq 0x5e02
testq %rax, %rax
je 0x653a
movl 0x8(%rax), %eax
movl %eax, 0x30(%rbx)
movq $0x0, 0x48(%rbx)
movq %r14, %rdi
callq 0x9d64
movq %rax, %rbp
movq %rax, %rdi
callq 0x5adf
cmpb $0x0, (%rbp)
je 0x62e3
movq %rbp, %rdi
callq 0x20e0
movq %rax, %r14
movsbl -0x1(%rbp,%rax), %edi
callq 0x697c
leal -0x73(%rax), %ecx
cmpl $0x7, %ecx
ja 0x62c8
leaq 0x3e03(%rip), %rax      # 0xa0b8
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movss 0x3e7a(%rip), %xmm0     # 0xa140
jmp 0x62d9
cmpl $0x67, %eax
jne 0x62e3
movaps 0x3d9c(%rip), %xmm0     # 0xa070
jmp 0x62d9
xorps %xmm0, %xmm0
movlps %xmm0, 0x48(%rbx)
movb $0x0, -0x1(%rbp,%r14)
leaq 0x43c3(%rip), %rsi      # 0xa6ad
movq %rbp, %rdi
xorl %edx, %edx
callq 0x5c31
movq %rax, 0x40(%rbx)
movq %rbp, %rdi
callq 0x9d6e
leaq 0x7929(%rip), %rsi      # 0xdc30
movq %r13, %rdi
callq 0x5e02
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, 0x28(%rbx)
je 0x633b
movl 0x8(%rax), %edi
movl $0x80000000, %eax       # imm = 0x80000000
testl %edi, %edi
je 0x6336
cmpl $0x1, %edi
jne 0x658d
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, 0x18(%rbx)
jmp 0x6364
leaq 0x4815(%rip), %rsi      # 0xab57
movq %r13, %rdi
callq 0x9b34
leaq 0x18(%rbx), %rdx
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2210
cmpl $0x1, %eax
jne 0x6561
leaq 0x78f5(%rip), %rsi      # 0xdc60
movq %r12, %rdi
callq 0x5e02
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, 0x2c(%rbx)
je 0x63a3
movl 0x8(%rax), %edi
cmpl $0x2, %edi
je 0x63e5
cmpl $0x1, %edi
je 0x63d4
testl %edi, %edi
jne 0x6592
movl $0x80000000, 0x1c(%rbx) # imm = 0x80000000
movl $0x80000000, %eax       # imm = 0x80000000
jmp 0x63eb
leaq 0x47ad(%rip), %rsi      # 0xab57
movq %r12, %rdi
callq 0x9b34
leaq 0x1c(%rbx), %r14
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2210
cmpl $0x1, %eax
jne 0x656a
movl (%r14), %eax
jmp 0x63eb
movl $0x7fffffff, 0x1c(%rbx) # imm = 0x7FFFFFFF
movl 0x18(%rbx), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jmp 0x63f6
movl 0x18(%rbx), %eax
movl %eax, 0x1c(%rbx)
movl 0x18(%rbx), %ecx
cmpl %eax, %ecx
jg 0x654f
cmpb $0x0, (%r15)
je 0x6419
cmpl %eax, %ecx
je 0x6558
movq %r15, %rdi
callq 0x9d64
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
jmp 0x641c
xorl %r14d, %r14d
movq %r14, 0x20(%rbx)
movq (%rsp), %rdi
callq 0x9d64
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
leaq 0x7865(%rip), %rsi      # 0xdca0
movq %r14, %rdi
callq 0x5e02
testq %rax, %rax
je 0x646c
movl $0x2, 0x34(%rbx)
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rbx)
movslq 0x30(%rbx), %rax
leaq 0x3c80(%rip), %rcx      # 0xa0e0
movl 0x30(%rcx,%rax,4), %eax
movl %eax, 0x38(%rbx)
jmp 0x6524
movq %r14, %rdi
movl $0x3c, %esi
callq 0x2100
testq %rax, %rax
je 0x648a
movq %rax, %r15
movl $0x2, 0x34(%rbx)
jmp 0x64aa
movq %r14, %rdi
movl $0x3e, %esi
callq 0x2100
testq %rax, %rax
je 0x6543
movq %rax, %r15
movl $0x1, 0x34(%rbx)
movb $0x0, (%r15)
cmpb $0x3d, 0x1(%r15)
jne 0x6518
leaq 0x7864(%rip), %rsi      # 0xdd20
movq %r14, %rdi
callq 0x5e02
testq %rax, %rax
je 0x6584
addq $0x2, %r15
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rbx)
leaq 0x4679(%rip), %rsi      # 0xab57
movq %r15, %rdi
callq 0x9b34
leaq 0x38(%rbx), %r12
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2210
cmpl $0x1, %eax
jne 0x6518
movl (%r12), %eax
testl %eax, %eax
jle 0x6518
movslq 0x30(%rbx), %rcx
leaq 0x3bce(%rip), %rdx      # 0xa0e0
cmpl 0x30(%rdx,%rcx,4), %eax
jle 0x6524
leaq 0x4205(%rip), %rdi      # 0xa724
callq 0x2300
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x9d6e
leaq 0x4159(%rip), %rdi      # 0xa69a
jmp 0x6571
movl $0x0, 0x34(%rbx)
movq %r14, %r15
jmp 0x64d7
leaq 0x4195(%rip), %rdi      # 0xa6eb
jmp 0x6571
leaq 0x41b3(%rip), %rdi      # 0xa712
jmp 0x6571
leaq 0x4159(%rip), %rdi      # 0xa6c1
jmp 0x6571
leaq 0x4166(%rip), %rdi      # 0xa6d7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2300
leaq 0x41ae(%rip), %rdi      # 0xa739
jmp 0x651f
callq 0x26dc
callq 0x2706