// File: /workspace/github_c_makefile_star2_O0/lyda[P]tz/localtime.c
// Function: time1
static time_t
time1(tmp, funcp, offset)
struct tm * const	tmp;
struct tm * (* const	funcp)(const time_t *, long, struct tm *);
const long		offset;
{
	register time_t			t;
	register const struct state *	sp;
	register int			samei, otheri;
	register int			sameind, otherind;
	register int			i;
	register int			nseen;
	int				seen[TZ_MAX_TYPES];
	int				types[TZ_MAX_TYPES];
	int				okay;

	if (tmp == NULL) {
		errno = EINVAL;
		return WRONG;
	}
	if (tmp->tm_isdst > 1)
		tmp->tm_isdst = 1;
	t = time2(tmp, funcp, offset, &okay);
#ifdef PCTS
	/*
	** PCTS code courtesy Grant Sullivan.
	*/
	if (okay)
		return t;
	if (tmp->tm_isdst < 0)
		tmp->tm_isdst = 0;	/* reset to std and try again */
#endif /* defined PCTS */
#ifndef PCTS
	if (okay || tmp->tm_isdst < 0)
		return t;
#endif /* !defined PCTS */
	/*
	** We're supposed to assume that somebody took a time of one type
	** and did some math on it that yielded a "struct tm" that's bad.
	** We try to divine the type they started from and adjust to the
	** type they need.
	*/
	sp = (const struct state *) ((funcp == localsub) ?  lclptr : gmtptr);
#ifdef ALL_STATE
	if (sp == NULL)
		return WRONG;
#endif /* defined ALL_STATE */
	for (i = 0; i < sp->typecnt; ++i)
		seen[i] = FALSE;
	nseen = 0;
	for (i = sp->timecnt - 1; i >= 0; --i)
		if (!seen[sp->types[i]]) {
			seen[sp->types[i]] = TRUE;
			types[nseen++] = sp->types[i];
		}
	for (sameind = 0; sameind < nseen; ++sameind) {
		samei = types[sameind];
		if (sp->ttis[samei].tt_isdst != tmp->tm_isdst)
			continue;
		for (otherind = 0; otherind < nseen; ++otherind) {
			otheri = types[otherind];
			if (sp->ttis[otheri].tt_isdst == tmp->tm_isdst)
				continue;
			tmp->tm_sec += sp->ttis[otheri].tt_gmtoff -
					sp->ttis[samei].tt_gmtoff;
			tmp->tm_isdst = !tmp->tm_isdst;
			t = time2(tmp, funcp, offset, &okay);
			if (okay)
				return t;
			tmp->tm_sec -= sp->ttis[otheri].tt_gmtoff -
					sp->ttis[samei].tt_gmtoff;
			tmp->tm_isdst = !tmp->tm_isdst;
		}
	}
	return WRONG;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x860, %rsp            # imm = 0x860
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x4536
callq 0x1050
movl $0x16, (%rax)
movq $-0x1, -0x8(%rbp)
jmp 0x47e5
movq -0x10(%rbp), %rax
cmpl $0x1, 0x20(%rax)
jle 0x454b
movq -0x10(%rbp), %rax
movl $0x1, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x854(%rbp), %rcx
callq 0x5ab0
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x854(%rbp)
jne 0x457a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jge 0x4587
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x47e5
movq -0x18(%rbp), %rdx
leaq -0x592(%rip), %rsi      # 0x4000
leaq 0x98d7(%rip), %rax      # 0xde70
leaq 0x5110(%rip), %rcx      # 0x96b0
cmpq %rsi, %rdx
cmoveq %rcx, %rax
movq %rax, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x45d8
movslq -0x44(%rbp), %rax
movl $0x0, -0x450(%rbp,%rax,4)
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x45b2
movl $0x0, -0x48(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
subl $0x1, %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
jl 0x4658
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl 0x2598(%rax,%rcx), %eax
cmpl $0x0, -0x450(%rbp,%rax,4)
jne 0x464b
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl 0x2598(%rax,%rcx), %eax
movl $0x1, -0x450(%rbp,%rax,4)
movq -0x30(%rbp), %rax
movslq -0x44(%rbp), %rcx
movzbl 0x2598(%rax,%rcx), %ecx
movl -0x48(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x48(%rbp)
cltq
movl %ecx, -0x850(%rbp,%rax,4)
jmp 0x464d
movl -0x44(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x45ec
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x47dd
movslq -0x3c(%rbp), %rax
movl -0x850(%rbp,%rax,4), %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
addq $0x2a48, %rax           # imm = 0x2A48
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
je 0x469f
jmp 0x47cf
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x48(%rbp), %eax
jge 0x47cd
movslq -0x40(%rbp), %rax
movl -0x850(%rbp,%rax,4), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rax
addq $0x2a48, %rax           # imm = 0x2A48
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %eax
movq -0x10(%rbp), %rcx
cmpl 0x20(%rcx), %eax
jne 0x46e6
jmp 0x47bf
movq -0x30(%rbp), %rax
addq $0x2a48, %rax           # imm = 0x2A48
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
addq $0x2a48, %rax           # imm = 0x2A48
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subq (%rax), %rdx
movq -0x10(%rbp), %rax
movslq (%rax), %rcx
addq %rdx, %rcx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
leaq -0x854(%rbp), %rcx
callq 0x5ab0
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x854(%rbp)
je 0x476a
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x47e5
movq -0x30(%rbp), %rax
addq $0x2a48, %rax           # imm = 0x2A48
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
addq $0x2a48, %rax           # imm = 0x2A48
movslq -0x34(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
subq (%rax), %rdx
movq -0x10(%rbp), %rax
movslq (%rax), %rcx
subq %rdx, %rcx
movl %ecx, (%rax)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x20(%rax)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x46a6
jmp 0x47cf
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x465f
movq $-0x1, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x860, %rsp            # imm = 0x860
popq %rbp
retq
nopw %cs:(%rax,%rax)