// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
movq -0x28(%rbp), %rdi
leaq 0xc1de(%rip), %rsi      # 0x11b60
callq 0x4960
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x59a2
leaq 0x8daa(%rip), %rdi      # 0xe742
callq 0x4110
jmp 0x5ef5
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x30(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq 0x10(%rbp), %rdi
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x5a93
movq -0x48(%rbp), %rdi
movq %rdi, -0x60(%rbp)
callq 0x20d0
movq %rax, %rcx
movq -0x60(%rbp), %rax
leaq -0x1(%rax,%rcx), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movsbl (%rax), %edi
callq 0x63e0
addl $-0x67, %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x13, %eax
ja 0x5a91
movq -0x58(%rbp), %rax
leaq 0x86ab(%rip), %rcx      # 0xe0d8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movl $0x1, 0x48(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq -0x50(%rbp), %rax
movb $0x0, (%rax)
jmp 0x5a91
movq -0x8(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x4c(%rax)
movq -0x50(%rbp), %rax
movb $0x0, (%rax)
jmp 0x5a91
movq -0x8(%rbp), %rax
movl $0x1, 0x48(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x4c(%rax)
movq -0x50(%rbp), %rax
movb $0x0, (%rax)
jmp 0x5a93
movq -0x48(%rbp), %rdi
leaq 0x8cb7(%rip), %rsi      # 0xe755
xorl %edx, %edx
callq 0x4370
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x48(%rbp), %rdi
callq 0xd160
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq 0xc164(%rip), %rsi      # 0x11c30
callq 0x4960
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x28(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x28(%rax)
jne 0x5b59
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x64(%rbp)
testl %eax, %eax
je 0x5b0d
jmp 0x5b03
movl -0x64(%rbp), %eax
subl $0x1, %eax
je 0x5b1a
jmp 0x5b27
movq -0x8(%rbp), %rax
movl $0x80000000, 0x18(%rax) # imm = 0x80000000
jmp 0x5b57
movq -0x8(%rbp), %rax
movl $0x7fffffff, 0x18(%rax) # imm = 0x7FFFFFFF
jmp 0x5b57
movq 0xc4ca(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc678(%rip), %rdx      # 0x121b0
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
leaq 0x8ab8(%rip), %rsi      # 0xe5fe
movb $0x0, %al
callq 0x2180
movl $0x1, %edi
callq 0x2270
jmp 0x5b9f
movq -0x40(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x40(%rbp), %rdi
leaq 0x90ac(%rip), %rsi      # 0xec18
callq 0xcd40
movq -0x70(%rbp), %rdi
movq %rax, %rsi
movq -0x8(%rbp), %rdx
addq $0x18, %rdx
movb $0x0, %al
callq 0x21d0
cmpl $0x1, %eax
je 0x5b9d
leaq 0x8bd6(%rip), %rdi      # 0xe769
callq 0x4110
jmp 0x5ef5
jmp 0x5b9f
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
leaq 0xc0ae(%rip), %rsi      # 0x11c60
callq 0x4960
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x2c(%rax)
movq -0x8(%rbp), %rax
cmpl $0x0, 0x2c(%rax)
jne 0x5c5d
movq -0x38(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x74(%rbp)
testl %eax, %eax
je 0x5c01
jmp 0x5bed
movl -0x74(%rbp), %eax
subl $0x1, %eax
je 0x5c0e
jmp 0x5bf7
movl -0x74(%rbp), %eax
subl $0x2, %eax
je 0x5c1b
jmp 0x5c2b
movq -0x8(%rbp), %rax
movl $0x80000000, 0x1c(%rax) # imm = 0x80000000
jmp 0x5c5b
movq -0x8(%rbp), %rax
movl $0x7fffffff, 0x1c(%rax) # imm = 0x7FFFFFFF
jmp 0x5c5b
movq -0x8(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x1c(%rax)
jmp 0x5c5b
movq 0xc3c6(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movq 0xc574(%rip), %rdx      # 0x121b0
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
leaq 0x89b4(%rip), %rsi      # 0xe5fe
movb $0x0, %al
callq 0x2180
movl $0x1, %edi
callq 0x2270
jmp 0x5ca3
movq -0x40(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x40(%rbp), %rdi
leaq 0x8fa8(%rip), %rsi      # 0xec18
callq 0xcd40
movq -0x80(%rbp), %rdi
movq %rax, %rsi
movq -0x8(%rbp), %rdx
addq $0x1c, %rdx
movb $0x0, %al
callq 0x21d0
cmpl $0x1, %eax
je 0x5ca1
leaq 0x8ae8(%rip), %rdi      # 0xe77f
callq 0x4110
jmp 0x5ef5
jmp 0x5ca3
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jle 0x5cc4
leaq 0x8ad9(%rip), %rdi      # 0xe793
callq 0x4110
jmp 0x5ef5
movq -0x20(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x5cde
movq -0x8(%rbp), %rax
movq $0x0, 0x20(%rax)
jmp 0x5d1b
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jne 0x5cff
leaq 0x8ac5(%rip), %rdi      # 0xe7ba
callq 0x4110
jmp 0x5ef5
movq -0x20(%rbp), %rdi
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x30(%rbp), %rdi
callq 0xd140
movq %rax, %rdi
callq 0x40b0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
leaq 0xbf65(%rip), %rsi      # 0x11ca0
callq 0x4960
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x5d82
movq -0x8(%rbp), %rax
movl $0x2, 0x34(%rax)
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x8(%rbp), %rax
movslq 0x30(%rax), %rcx
leaq 0x83be(%rip), %rax      # 0xe130
movl 0x30(%rax,%rcx,4), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x38(%rax)
jmp 0x5eec
movq -0x48(%rbp), %rdi
movl $0x3c, %esi
callq 0x20f0
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x5da7
movq -0x8(%rbp), %rax
movl $0x2, 0x34(%rax)
jmp 0x5de1
movq -0x48(%rbp), %rdi
movl $0x3e, %esi
callq 0x20f0
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x5dcc
movq -0x8(%rbp), %rax
movl $0x1, 0x34(%rax)
jmp 0x5ddf
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movl $0x0, 0x34(%rax)
jmp 0x5de1
movq -0x8(%rbp), %rax
cmpl $0x0, 0x34(%rax)
je 0x5e74
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x50(%rbp)
movb $0x0, (%rax)
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x50(%rbp)
movsbl (%rax), %eax
cmpl $0x3d, %eax
je 0x5e32
leaq 0x89ad(%rip), %rdi      # 0xe7cc
callq 0x4110
movq -0x48(%rbp), %rdi
callq 0xd160
jmp 0x5ef5
movq -0x48(%rbp), %rdi
leaq 0xbee3(%rip), %rsi      # 0x11d20
callq 0x4960
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
jne 0x5e66
leaq 0x898e(%rip), %rdi      # 0xe7e1
callq 0x4110
movq -0x48(%rbp), %rdi
callq 0xd160
jmp 0x5ef5
movq -0x38(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x3c(%rax)
movq -0x50(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x50(%rbp), %rdi
leaq 0x8d8e(%rip), %rsi      # 0xec18
callq 0xcd40
movq -0x88(%rbp), %rdi
movq %rax, %rsi
movq -0x8(%rbp), %rdx
addq $0x38, %rdx
movb $0x0, %al
callq 0x21d0
cmpl $0x1, %eax
jne 0x5ed3
movq -0x8(%rbp), %rax
cmpl $0x0, 0x38(%rax)
jle 0x5ed3
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movq -0x8(%rbp), %rcx
movslq 0x30(%rcx), %rdx
leaq 0x8263(%rip), %rcx      # 0xe130
cmpl 0x30(%rcx,%rdx,4), %eax
jle 0x5eea
leaq 0x88f2(%rip), %rdi      # 0xe7cc
callq 0x4110
movq -0x48(%rbp), %rdi
callq 0xd160
jmp 0x5ef5
jmp 0x5eec
movq -0x48(%rbp), %rdi
callq 0xd160
addq $0x90, %rsp
popq %rbp
retq
nop