// File: /workspace/github_c_makefile_star2_O3/lyda[P]tz/zic.c
// Function: dolink
static void
dolink(fromfield, tofield)
const char * const	fromfield;
const char * const	tofield;
{
	register char *	fromname;
	register char *	toname;

	if (fromfield[0] == '/')
		fromname = ecpyalloc(fromfield);
	else {
		fromname = ecpyalloc(directory);
		fromname = ecatalloc(fromname, "/");
		fromname = ecatalloc(fromname, fromfield);
	}
	if (tofield[0] == '/')
		toname = ecpyalloc(tofield);
	else {
		toname = ecpyalloc(directory);
		toname = ecatalloc(toname, "/");
		toname = ecatalloc(toname, tofield);
	}
	/*
	** We get to be careful here since
	** there's a fair chance of root running us.
	*/
	if (!itsdir(toname))
		(void) remove(toname);
	if (link(fromname, toname) != 0) {
		int	result;

		if (mkdirs(toname) != 0)
			exit(EXIT_FAILURE);

		result = link(fromname, toname);
#if HAVE_SYMLINK
		if (result != 0 &&
			access(fromname, F_OK) == 0 &&
			!itsdir(fromname)) {
				const char *s = tofield;
				register char * symlinkcontents = NULL;

				while ((s = strchr(s+1, '/')) != NULL)
					symlinkcontents =
						ecatalloc(symlinkcontents,
						"../");
				symlinkcontents =
					ecatalloc(symlinkcontents,
					fromname);
				result = symlink(symlinkcontents,
					toname);
				if (result == 0)
warning(_("hard link failed, symbolic link used"));
				ifree(symlinkcontents);
		}
#endif /* HAVE_SYMLINK */
		if (result != 0) {
			const char *e = strerror(errno);

			(void) fprintf(stderr,
				_("%s: Can't link from %s to %s: %s\n"),
				progname, fromname, toname, e);
			exit(EXIT_FAILURE);
		}
	}
	ifree(fromname);
	ifree(toname);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %r15
movq %rdi, %rbx
cmpb $0x2f, (%rdi)
jne 0x58bf
movq %rbx, %rdi
callq 0x9d64
jmp 0x58fb
movq 0x8912(%rip), %rdi      # 0xe1d8
callq 0x9d64
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
leaq 0x4ac1(%rip), %rsi      # 0xa39e
movq %r14, %rdi
callq 0x9cc8
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9cc8
movq %rax, %rbx
movq %rax, %rdi
callq 0x5adf
cmpb $0x2f, (%r15)
jne 0x5916
movq %r15, %rdi
callq 0x9d64
jmp 0x5952
movq 0x88bb(%rip), %rdi      # 0xe1d8
callq 0x9d64
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
leaq 0x4a6a(%rip), %rsi      # 0xa39e
movq %r14, %rdi
callq 0x9cc8
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
movq %r14, %rdi
movq %r15, %rsi
callq 0x9cc8
movq %rax, %r14
movq %rax, %rdi
callq 0x5adf
movq %r14, %rdi
callq 0x5aee
testl %eax, %eax
jne 0x5971
movq %r14, %rdi
callq 0x2070
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
testl %eax, %eax
je 0x5a57
movq %r14, %rdi
callq 0x5b3d
testl %eax, %eax
jne 0x5a70
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
testl %eax, %eax
je 0x5a57
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2250
testl %eax, %eax
jne 0x5a82
movq %rbx, %rdi
callq 0x5aee
testl %eax, %eax
jne 0x5a82
incq %r15
movq %r15, %rdi
movl $0x2f, %esi
callq 0x2100
testq %rax, %rax
je 0x5a1b
movq %rax, %r12
xorl %r15d, %r15d
leaq 0x49b1(%rip), %r13      # 0xa39c
movq %r15, %rdi
movq %r13, %rsi
callq 0x9cc8
movq %rax, %r15
movq %rax, %rdi
callq 0x5adf
incq %r12
movq %r12, %rdi
movl $0x2f, %esi
callq 0x2100
movq %rax, %r12
testq %rax, %rax
jne 0x59eb
jmp 0x5a1e
xorl %r15d, %r15d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9cc8
movq %rax, %r15
movq %rax, %rdi
callq 0x5adf
movq %r15, %rdi
movq %r14, %rsi
callq 0x2120
testl %eax, %eax
jne 0x5a7a
leaq 0x4956(%rip), %rdi      # 0xa3a0
callq 0x5a8d
movq %r15, %rdi
callq 0x9d6e
movq %rbx, %rdi
callq 0x9d6e
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x9d6e
movl $0x1, %edi
callq 0x22b0
movq %r15, %rdi
callq 0x9d6e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x265f