// File: /workspace/github_c_makefile_star2_O2/lyda[P]tz/zic.c
// Function: rpytime
static zic_t
rpytime(rp, wantedy)
register const struct rule * const	rp;
register const int			wantedy;
{
	register int	y, m, i;
	register long	dayoff;			/* with a nod to Margaret O. */
	register zic_t	t;

	if (wantedy == INT_MIN)
		return min_time;
	if (wantedy == INT_MAX)
		return max_time;
	dayoff = 0;
	m = TM_JANUARY;
	y = EPOCH_YEAR;
	while (wantedy != y) {
		if (wantedy > y) {
			i = len_years[isleap(y)];
			++y;
		} else {
			--y;
			i = -len_years[isleap(y)];
		}
		dayoff = oadd(dayoff, eitol(i));
	}
	while (m != rp->r_month) {
		i = len_months[isleap(y)][m];
		dayoff = oadd(dayoff, eitol(i));
		++m;
	}
	i = rp->r_dayofmonth;
	if (m == TM_FEBRUARY && i == 29 && !isleap(y)) {
		if (rp->r_dycode == DC_DOWLEQ)
			--i;
		else {
			error(_("use of 2/29 in non leap-year"));
			exit(EXIT_FAILURE);
		}
	}
	--i;
	dayoff = oadd(dayoff, eitol(i));
	if (rp->r_dycode == DC_DOWGEQ || rp->r_dycode == DC_DOWLEQ) {
		register long	wday;

#define LDAYSPERWEEK	((long) DAYSPERWEEK)
		wday = eitol(EPOCH_WDAY);
		/*
		** Don't trust mod of negative numbers.
		*/
		if (dayoff >= 0)
			wday = (wday + dayoff) % LDAYSPERWEEK;
		else {
			wday -= ((-dayoff) % LDAYSPERWEEK);
			if (wday < 0)
				wday += LDAYSPERWEEK;
		}
		while (wday != eitol(rp->r_wday))
			if (rp->r_dycode == DC_DOWGEQ) {
				dayoff = oadd(dayoff, (long) 1);
				if (++wday >= LDAYSPERWEEK)
					wday = 0;
				++i;
			} else {
				dayoff = oadd(dayoff, (long) -1);
				if (--wday < 0)
					wday = LDAYSPERWEEK - 1;
				--i;
			}
		if (i < 0 || i >= len_months[isleap(y)][m]) {
			if (noise)
				warning(_("rule goes past start/end of month--\
will not work with pre-2004 versions of zic"));
		}
	}
	if (dayoff < min_time / SECSPERDAY)
		return min_time;
	if (dayoff > max_time / SECSPERDAY)
		return max_time;
	t = (zic_t) dayoff * SECSPERDAY;
	return tadd(t, rp->r_tod);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %eax
negl %eax
jo 0x5d25
cmpl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
jne 0x5d44
xorl %eax, %eax
cmpb $0x0, 0x752e(%rip)      # 0xd240
movabsq $0x7fffffffffffffff, %rcx # imm = 0x7FFFFFFFFFFFFFFF
cmoveq %rax, %rcx
jmp 0x5f7f
movabsq $0x7fffffffffffffff, %rax # imm = 0x7FFFFFFFFFFFFFFF
incq %rax
xorl %ecx, %ecx
cmpb $0x0, 0x74fd(%rip)      # 0xd238
cmovneq %rax, %rcx
jmp 0x5f7f
movq %rdi, %rbx
movl $0x7b2, %ecx            # imm = 0x7B2
xorl %r9d, %r9d
pushq $0x64
popq %rdi
pushq $0x1
popq %r8
movl $0x190, %r10d           # imm = 0x190
leaq 0x4089(%rip), %r11      # 0x9dec
cmpl %esi, %ecx
je 0x5dc5
jge 0x5d72
testb $0x3, %cl
je 0x5d7d
xorl %eax, %eax
jmp 0x5d96
decl %ecx
testb $0x3, %cl
je 0x5d9e
xorl %eax, %eax
jmp 0x5db7
movl %ecx, %eax
cltd
idivl %edi
movq %r8, %rax
testl %edx, %edx
jne 0x5d96
movl %ecx, %eax
cltd
idivl %r10d
xorl %eax, %eax
testl %edx, %edx
sete %al
movl (%r11,%rax,4), %edx
incl %ecx
jmp 0x5dbd
movl %ecx, %eax
cltd
idivl %edi
movq %r8, %rax
testl %edx, %edx
jne 0x5db7
movl %ecx, %eax
cltd
idivl %r10d
xorl %eax, %eax
testl %edx, %edx
sete %al
xorl %edx, %edx
subl (%r11,%rax,4), %edx
movslq %edx, %rax
addq %rax, %r9
jmp 0x5d63
movl 0x30(%rbx), %r8d
testb $0x3, %sil
sete %cl
movl %esi, %eax
cltd
idivl %edi
movl %edx, %ebp
testl %edx, %edx
setne %r10b
movl $0x190, %edi            # imm = 0x190
movl %esi, %eax
cltd
idivl %edi
movl %edx, %edi
testl %edx, %edx
sete %al
orb %r10b, %al
andb %cl, %al
movzbl %al, %eax
imulq $0x30, %rax, %rax
xorl %edx, %edx
leaq 0x326d(%rip), %r10      # 0x9070
cmpq %rdx, %r8
je 0x5e18
leaq (%rax,%rdx,4), %rcx
movslq (%r10,%rcx), %rcx
addq %rcx, %r9
incq %rdx
jmp 0x5e03
movl 0x38(%rbx), %r11d
movl %r8d, %eax
xorl $0x1, %eax
movl %r11d, %ecx
xorl $0x1d, %ecx
orl %eax, %ecx
jne 0x5e52
testl %edi, %edi
sete %al
testl %ebp, %ebp
setne %cl
testb $0x3, %sil
jne 0x5e44
orb %al, %cl
je 0x5e44
pushq $0x1d
jmp 0x5e50
cmpl $0x2, 0x34(%rbx)
jne 0x5fbe
pushq $0x1c
popq %r11
movslq %r11d, %rax
leaq (%rax,%r9), %r14
decq %r14
movl 0x34(%rbx), %r9d
leal -0x1(%r9), %eax
cmpl $0x1, %eax
ja 0x5f35
testq %r14, %r14
movl %ebp, 0x4(%rsp)
js 0x5e84
leaq 0x4(%r14), %rax
pushq $0x7
popq %rcx
xorl %edx, %edx
divq %rcx
jmp 0x5ea6
movq %r14, %rax
negq %rax
pushq $0x7
popq %rcx
xorl %edx, %edx
divq %rcx
movq %rdx, %rax
cmpq $0x5, %rdx
pushq $0xb
popq %rcx
pushq $0x4
popq %rdx
cmovaeq %rcx, %rdx
subq %rax, %rdx
decl %r11d
movslq 0x3c(%rbx), %rax
xorl %r15d, %r15d
pushq $0x1
popq %rbp
pushq $0x6
popq %r12
pushq $-0x1
popq %rcx
cmpq %rax, %rdx
je 0x5eef
cmpl $0x1, %r9d
jne 0x5ed9
incq %r14
cmpq $0x6, %rdx
leaq 0x1(%rdx), %rdx
cmovgeq %r15, %rdx
movl %ebp, %r13d
jmp 0x5eea
decq %r14
testq %rdx, %rdx
leaq -0x1(%rdx), %rdx
cmovleq %r12, %rdx
movl %ecx, %r13d
addl %r13d, %r11d
jmp 0x5eba
testl %r11d, %r11d
js 0x5fac
testl %edi, %edi
sete %al
testb $0x3, %sil
sete %cl
cmpl $0x0, 0x4(%rsp)
setne %dl
orb %al, %dl
andb %cl, %dl
movzbl %dl, %eax
imulq $0x30, %rax, %rax
addq %rax, %r10
cmpl (%r10,%r8,4), %r11d
jl 0x5f35
testb $0x1, 0x72c9(%rip)      # 0xd1f0
je 0x5f35
leaq 0x38ad(%rip), %rdi      # 0x97dd
callq 0x51bf
movabsq $0x7fffffffffffffff, %rsi # imm = 0x7FFFFFFFFFFFFFFF
leaq 0x1(%rsi), %rax
xorl %ecx, %ecx
cmpb $0x0, 0x72ec(%rip)      # 0xd238
cmovneq %rax, %rcx
movl $0x15180, %edi          # imm = 0x15180
movq %rcx, %rax
cqto
idivq %rdi
cmpq %rax, %r14
jl 0x5f7f
xorl %eax, %eax
cmpb $0x0, 0x72d5(%rip)      # 0xd240
cmoveq %rax, %rsi
movq %rsi, %rax
xorl %edx, %edx
divq %rdi
movq %rsi, %rcx
cmpq %rax, %r14
jle 0x5f91
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
imulq $0x15180, %r14, %rdi    # imm = 0x15180
movq 0x40(%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5ff8
cmpb $0x1, 0x723d(%rip)      # 0xd1f0
je 0x5f29
jmp 0x5f35
leaq 0x37fb(%rip), %rdi      # 0x97c0
callq 0x5251
pushq $0x1
popq %rdi
callq 0x22a0