// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
cmpb $0x2f, (%rdi)
jne 0x4fe0
movq %rbx, %rdi
callq 0x8d51
jmp 0x501c
movq 0x81e1(%rip), %rdi      # 0xd1c8
callq 0x8d51
movq %rax, %r15
movq %rax, %rdi
callq 0x5211
leaq 0x4350(%rip), %rsi      # 0x934e
movq %r15, %rdi
callq 0x8cd6
movq %rax, %r15
movq %rax, %rdi
callq 0x5211
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8cd6
movq %rax, %rbx
movq %rax, %rdi
callq 0x5211
cmpb $0x2f, (%r14)
jne 0x5037
movq %r14, %rdi
callq 0x8d51
jmp 0x5073
movq 0x818a(%rip), %rdi      # 0xd1c8
callq 0x8d51
movq %rax, %r15
movq %rax, %rdi
callq 0x5211
leaq 0x42f9(%rip), %rsi      # 0x934e
movq %r15, %rdi
callq 0x8cd6
movq %rax, %r15
movq %rax, %rdi
callq 0x5211
movq %r15, %rdi
movq %r14, %rsi
callq 0x8cd6
movq %rax, %r15
movq %rax, %rdi
callq 0x5211
movq %r15, %rdi
callq 0x52b2
testl %eax, %eax
jne 0x5092
movq %r15, %rdi
callq 0x2070
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2290
testl %eax, %eax
je 0x515d
movq %r15, %rdi
callq 0x5301
testl %eax, %eax
jne 0x51b7
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2290
testl %eax, %eax
je 0x515d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2240
testl %eax, %eax
jne 0x5183
movq %rbx, %rdi
callq 0x52b2
testl %eax, %eax
jne 0x5183
xorl %r12d, %r12d
pushq $0x2f
popq %rbp
leaq 0x4255(%rip), %r13      # 0x934c
incq %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x2100
testq %rax, %rax
je 0x5124
movq %rax, %r14
movq %r12, %rdi
movq %r13, %rsi
callq 0x8cd6
movq %rax, %r12
movq %rax, %rdi
callq 0x5211
jmp 0x50f7
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8cd6
movq %rax, %r14
movq %rax, %rdi
callq 0x5211
movq %r14, %rdi
movq %r15, %rsi
callq 0x2120
testl %eax, %eax
jne 0x517b
leaq 0x4200(%rip), %rdi      # 0x9350
callq 0x51bf
movq %r14, %rdi
callq 0x8d5b
movq %rbx, %rdi
callq 0x8d5b
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x8d5b
movq %r14, %rdi
callq 0x8d5b
callq 0x2050
movl (%rax), %edi
callq 0x22c0
movq 0x7e62(%rip), %rcx      # 0xcff8
movq (%rcx), %rdi
movq 0x8020(%rip), %rdx      # 0xd1c0
leaq 0x41ce(%rip), %rsi      # 0x9375
movq %rbx, %rcx
movq %r15, %r8
movq %rax, %r9
xorl %eax, %eax
callq 0x21b0
pushq $0x1
popq %rdi
callq 0x22a0