// File: /workspace/github_c_makefile_star2_O1/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 0x56c3
movq %rbx, %rdi
callq 0x9c6b
jmp 0x56ff
movq 0x8b0e(%rip), %rdi      # 0xe1d8
callq 0x9c6b
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
leaq 0x4c4b(%rip), %rsi      # 0xa32c
movq %r14, %rdi
callq 0x9bf4
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x9bf4
movq %rax, %rbx
movq %rax, %rdi
callq 0x58e3
cmpb $0x2f, (%r15)
jne 0x571a
movq %r15, %rdi
callq 0x9c6b
jmp 0x5756
movq 0x8ab7(%rip), %rdi      # 0xe1d8
callq 0x9c6b
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
leaq 0x4bf4(%rip), %rsi      # 0xa32c
movq %r14, %rdi
callq 0x9bf4
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
movq %r14, %rdi
movq %r15, %rsi
callq 0x9bf4
movq %rax, %r14
movq %rax, %rdi
callq 0x58e3
movq %r14, %rdi
callq 0x58f2
testl %eax, %eax
jne 0x5775
movq %r14, %rdi
callq 0x2070
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
testl %eax, %eax
je 0x585b
movq %r14, %rdi
callq 0x5941
testl %eax, %eax
jne 0x5874
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22a0
testl %eax, %eax
je 0x585b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2250
testl %eax, %eax
jne 0x5886
movq %rbx, %rdi
callq 0x58f2
testl %eax, %eax
jne 0x5886
incq %r15
movq %r15, %rdi
movl $0x2f, %esi
callq 0x2100
testq %rax, %rax
je 0x581f
movq %rax, %r12
xorl %r15d, %r15d
leaq 0x4b3b(%rip), %r13      # 0xa32a
movq %r15, %rdi
movq %r13, %rsi
callq 0x9bf4
movq %rax, %r15
movq %rax, %rdi
callq 0x58e3
incq %r12
movq %r12, %rdi
movl $0x2f, %esi
callq 0x2100
movq %rax, %r12
testq %rax, %rax
jne 0x57ef
jmp 0x5822
xorl %r15d, %r15d
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9bf4
movq %rax, %r15
movq %rax, %rdi
callq 0x58e3
movq %r15, %rdi
movq %r14, %rsi
callq 0x2120
testl %eax, %eax
jne 0x587e
leaq 0x4ae0(%rip), %rdi      # 0xa32e
callq 0x5891
movq %r15, %rdi
callq 0x9c75
movq %rbx, %rdi
callq 0x9c75
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x9c75
movl $0x1, %edi
callq 0x22b0
movq %r15, %rdi
callq 0x9c75
movq %rbx, %rdi
movq %r14, %rsi
callq 0x265f