// File: /workspace/github_c_makefile_star2_O2/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 0x71a8(%rip), %rsi      # 0xcb60
movq %r8, %rdi
callq 0x55ab
testq %rax, %rax
je 0x5a20
movl 0x8(%rax), %eax
movl %eax, 0x30(%rbx)
andq $0x0, 0x48(%rbx)
movq %r14, %rdi
callq 0x8d51
movq %rax, %rbp
movq %rax, %rdi
callq 0x5211
cmpb $0x0, (%rbp)
je 0x5a47
movq %rbp, %rdi
callq 0x20e0
movq %rax, %r14
movsbl -0x1(%rbp,%rax), %edi
callq 0x5fd2
leal -0x73(%rax), %ecx
cmpl $0x7, %ecx
ja 0x5a2c
leaq 0x363b(%rip), %rax      # 0x9048
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movss 0x36d2(%rip), %xmm0     # 0x90f0
jmp 0x5a3d
leaq 0x3c23(%rip), %rdi      # 0x964a
jmp 0x5b7f
cmpl $0x67, %eax
jne 0x5a47
movaps 0x36a8(%rip), %xmm0     # 0x90e0
jmp 0x5a3d
xorps %xmm0, %xmm0
movlps %xmm0, 0x48(%rbx)
movb $0x0, -0x1(%rbp,%r14)
leaq 0x3c0f(%rip), %rsi      # 0x965d
movq %rbp, %rdi
xorl %edx, %edx
callq 0x53df
movq %rax, 0x40(%rbx)
movq %rbp, %rdi
callq 0x8d5b
leaq 0x71c5(%rip), %rsi      # 0xcc30
movq %r13, %rdi
callq 0x55ab
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, 0x28(%rbx)
je 0x5a9f
movl 0x8(%rax), %ecx
movl $0x80000000, %eax       # imm = 0x80000000
testl %ecx, %ecx
je 0x5a9a
cmpl $0x1, %ecx
jne 0x5cc9
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, 0x18(%rbx)
jmp 0x5ac4
leaq 0x4061(%rip), %rsi      # 0x9b07
movq %r13, %rdi
callq 0x8b4c
leaq 0x18(%rbx), %rdx
movq %r13, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x2200
cmpl $0x1, %eax
jne 0x5b30
leaq 0x7195(%rip), %rsi      # 0xcc60
movq %r12, %rdi
callq 0x55ab
xorl %ecx, %ecx
testq %rax, %rax
sete %cl
movl %ecx, 0x2c(%rbx)
je 0x5b03
movl 0x8(%rax), %ecx
cmpl $0x2, %ecx
je 0x5b4a
cmpl $0x1, %ecx
je 0x5b39
testl %ecx, %ecx
jne 0x5cc9
movl $0x80000000, 0x1c(%rbx) # imm = 0x80000000
movl $0x80000000, %eax       # imm = 0x80000000
jmp 0x5b50
leaq 0x3ffd(%rip), %rsi      # 0x9b07
movq %r12, %rdi
callq 0x8b4c
leaq 0x1c(%rbx), %r14
movq %r12, %rdi
movq %rax, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x2200
cmpl $0x1, %eax
jne 0x5b78
movl (%r14), %eax
jmp 0x5b50
leaq 0x3b3a(%rip), %rdi      # 0x9671
jmp 0x5b7f
movl $0x7fffffff, 0x1c(%rbx) # imm = 0x7FFFFFFF
movl 0x18(%rbx), %ecx
movl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
jmp 0x5b60
movl 0x18(%rbx), %eax
movl %eax, 0x1c(%rbx)
movl 0x18(%rbx), %ecx
cmpl %eax, %ecx
jle 0x5b60
leaq 0x3b3d(%rip), %rdi      # 0x969b
jmp 0x5b7f
cmpb $0x0, (%r15)
je 0x5b73
cmpl %eax, %ecx
jne 0x5b92
leaq 0x3b51(%rip), %rdi      # 0x96c2
jmp 0x5b7f
xorl %r14d, %r14d
jmp 0x5ba5
leaq 0x3b08(%rip), %rdi      # 0x9687
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5251
movq %r15, %rdi
callq 0x8d51
movq %rax, %r14
movq %rax, %rdi
callq 0x5211
movq %r14, 0x20(%rbx)
movq (%rsp), %rdi
callq 0x8d51
movq %rax, %r14
movq %rax, %rdi
callq 0x5211
leaq 0x70dc(%rip), %rsi      # 0xcca0
movq %r14, %rdi
callq 0x55ab
testq %rax, %rax
je 0x5bf5
movl $0x2, 0x34(%rbx)
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rbx)
movslq 0x30(%rbx), %rax
leaq 0x3487(%rip), %rcx      # 0x9070
movl 0x30(%rcx,%rax,4), %eax
movl %eax, 0x38(%rbx)
jmp 0x5cb3
pushq $0x3c
popq %rsi
movq %r14, %rdi
callq 0x2100
testq %rax, %rax
je 0x5c11
movq %rax, %r15
movl $0x2, 0x34(%rbx)
jmp 0x5c2b
pushq $0x3e
popq %rsi
movq %r14, %rdi
callq 0x2100
testq %rax, %rax
je 0x5c5f
movq %rax, %r15
movl $0x1, 0x34(%rbx)
movb $0x0, (%r15)
cmpb $0x3d, 0x1(%r15)
jne 0x5ca7
leaq 0x70e3(%rip), %rsi      # 0xcd20
movq %r14, %rdi
callq 0x55ab
testq %rax, %rax
je 0x5c56
addq $0x2, %r15
movl 0x8(%rax), %eax
movl %eax, 0x3c(%rbx)
jmp 0x5c66
leaq 0x3a8c(%rip), %rdi      # 0x96e9
jmp 0x5cae
andl $0x0, 0x34(%rbx)
movq %r14, %r15
leaq 0x3e9a(%rip), %rsi      # 0x9b07
movq %r15, %rdi
callq 0x8b4c
leaq 0x38(%rbx), %r12
movq %r15, %rdi
movq %rax, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2200
cmpl $0x1, %eax
jne 0x5ca7
movl (%r12), %eax
testl %eax, %eax
jle 0x5ca7
movslq 0x30(%rbx), %rcx
leaq 0x33cf(%rip), %rdx      # 0x9070
cmpl 0x30(%rdx,%rcx,4), %eax
jle 0x5cb3
leaq 0x3a26(%rip), %rdi      # 0x96d4
callq 0x5251
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8d5b
movq 0x7328(%rip), %rax      # 0xcff8
movq (%rax), %rdi
movq 0x74e6(%rip), %rdx      # 0xd1c0
leaq 0x3825(%rip), %rsi      # 0x9506
xorl %eax, %eax
callq 0x21b0
pushq $0x1
popq %rdi
callq 0x22a0