// File: /workspace/github_c_makefile_star2_O0/blakemcbride[P]LISP9/ls9.c
// Function: dumpimg
char *dumpimg(char *path) {
	FILE		*f;
	cell		n, **v;
	int		i;
	struct imghdr	m;
	char		*s;

	saveimg(path);
	f = fopen(path, "wb");
	if (NULL == f) return "cannot create image file";
	memset(&m, '_', sizeof(m));
	strncpy(m.magic, "LISP9", sizeof(m.magic));
	strncpy(m.version, VERSION, sizeof(m.version));
	m.cell_size[0] = sizeof(cell)+'0';
	n = 0x31323334L;
	memcpy(m.byte_order, &n, 4);
	if ((s = xfwrite(&m, sizeof(m), 1, f)) != NULL) {
		fclose(f);
		return s;
	}
	i = NNODES;
	if ((s = xfwrite(&i, sizeof(int), 1, f)) != NULL) {
		fclose(f);
		return s;
	}
	i = NVCELLS;
	if ((s = xfwrite(&i, sizeof(int), 1, f)) != NULL) {
		fclose(f);
		return s;
	}
	i = 0;
	v = Imagevars;
	while (v && v[i]) {
		if ((s = xfwrite(v[i], sizeof(cell), 1, f)) != NULL) {
			fclose(f);
			return s;
		}
		i++;
	}
	if (	fwrite(Car, 1, sizeof(cell) * NNODES, f)
		 != sizeof(cell) * NNODES ||
		fwrite(Cdr, 1, sizeof(cell) * NNODES, f)
		 != sizeof(cell) * NNODES ||
		fwrite(Tag, 1, NNODES, f) != NNODES||
		fwrite(Vectors, 1, sizeof(cell) * NVCELLS, f)
		 != sizeof(cell) * NVCELLS)
	{
		fclose(f);
		return "image dump failed";
	}
	fclose(f);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x11d20
movq -0x10(%rbp), %rdi
leaq 0x9e0d(%rip), %rsi      # 0x1bbfd
callq 0x21c0
movq %rax, -0x18(%rbp)
xorl %eax, %eax
cmpq -0x18(%rbp), %rax
jne 0x11e11
leaq 0x9df8(%rip), %rax      # 0x1bc00
movq %rax, -0x8(%rbp)
jmp 0x12049
leaq -0x4c(%rbp), %rdi
movl $0x5f, %esi
movl $0x20, %edx
callq 0x20d0
leaq -0x4c(%rbp), %rdi
leaq 0x9dea(%rip), %rsi      # 0x1bc19
movl $0x5, %edx
callq 0x2030
leaq -0x4c(%rbp), %rdi
addq $0x5, %rdi
leaq 0x9dd7(%rip), %rsi      # 0x1bc1f
movl $0x8, %edx
callq 0x2030
movb $0x34, -0x3f(%rbp)
movl $0x31323334, -0x1c(%rbp) # imm = 0x31323334
movl -0x1c(%rbp), %eax
movl %eax, -0x3e(%rbp)
movq -0x18(%rbp), %rcx
leaq -0x4c(%rbp), %rdi
movl $0x20, %esi
movl $0x1, %edx
callq 0x11cc0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x11e9a
movq -0x18(%rbp), %rdi
callq 0x2080
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12049
movl $0x40000, -0x2c(%rbp)   # imm = 0x40000
movq -0x18(%rbp), %rcx
leaq -0x2c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11cc0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x11ed8
movq -0x18(%rbp), %rdi
callq 0x2080
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12049
movl $0x40000, -0x2c(%rbp)   # imm = 0x40000
movq -0x18(%rbp), %rcx
leaq -0x2c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11cc0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x11f16
movq -0x18(%rbp), %rdi
callq 0x2080
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12049
movl $0x0, -0x2c(%rbp)
leaq 0xe2bc(%rip), %rax      # 0x201e0
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x59(%rbp)
je 0x11f47
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
setne %al
movb %al, -0x59(%rbp)
movb -0x59(%rbp), %al
testb $0x1, %al
jne 0x11f50
jmp 0x11f9a
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x11cc0
movq %rax, -0x58(%rbp)
cmpq $0x0, %rax
je 0x11f8f
movq -0x18(%rbp), %rdi
callq 0x2080
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x12049
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x11f28
movq 0xe39f(%rip), %rdi      # 0x20340
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x2210
cmpq $0x100000, %rax         # imm = 0x100000
jne 0x12022
movq 0xe385(%rip), %rdi      # 0x20348
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x2210
cmpq $0x100000, %rax         # imm = 0x100000
jne 0x12022
movq 0xe36b(%rip), %rdi      # 0x20350
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x40000, %edx          # imm = 0x40000
callq 0x2210
cmpq $0x40000, %rax          # imm = 0x40000
jne 0x12022
movq 0xe351(%rip), %rdi      # 0x20358
movq -0x18(%rbp), %rcx
movl $0x1, %esi
movl $0x100000, %edx         # imm = 0x100000
callq 0x2210
cmpq $0x100000, %rax         # imm = 0x100000
je 0x12038
movq -0x18(%rbp), %rdi
callq 0x2080
leaq 0x9bf6(%rip), %rax      # 0x1bc28
movq %rax, -0x8(%rbp)
jmp 0x12049
movq -0x18(%rbp), %rdi
callq 0x2080
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)