// File: /workspace/github_c_makefile_star2_O0/azhai[P]mlite/mlite.c
// Function: dump_image
void dump_image(char *p) {
	FILE		*f;
	cell		n, **v;
	int		i, k;
	struct magic	m;
	char		buf[100];

	f = fopen(p, "wb");
	if (f == NULL) {
		error("cannot create image file",
			make_string(p, (int) strlen(p)));
		return;
	}
	memset(&m, '_', sizeof(m));
	strncpy(m.id, "mL", sizeof(m.id));
	strncpy(m.version, VERSION, sizeof(m.version));
	m.cell_size[0] = sizeof(cell)+'0';
	m.mantissa_size[0] = MANTISSA_SEGMENTS+'0';
	n = ENDIANNESS;
	memcpy(m.byte_order, &n, sizeof(n)>8? 8: sizeof(n));
	n = Last_prim;
	memcpy(m.prim_slots, &n, sizeof(n)>8? 8: sizeof(n));
	fwrite(&m, sizeof(m), 1, f);
	i = Cons_pool_size;
	fwrite(&i, sizeof(int), 1, f);
	i = Vec_pool_size;
	fwrite(&i, sizeof(int), 1, f);
	v = Image_vars;
	i = 0;
	while (v[i]) {
		fwrite(v[i], sizeof(cell), 1, f);
		i++;
	}
	if (	fwrite(Car, 1, Cons_pool_size*sizeof(cell), f)
		 != Cons_pool_size*sizeof(cell) ||
		fwrite(Cdr, 1, Cons_pool_size*sizeof(cell), f)
		 != Cons_pool_size*sizeof(cell) ||
		fwrite(Tag, 1, Cons_pool_size, f) != Cons_pool_size ||
		fwrite(Vectors, 1, Vec_pool_size*sizeof(cell), f)
		 != Vec_pool_size*sizeof(cell)
	) {
		fclose(f);
		error("image dump failed", NOEXPR);
		return;
	}
	fclose(f);
	k = gc();
	if (!Quiet_mode) {
		sprintf(buf, "image dumped: %d nodes used, %d free",
				Cons_pool_size-k, k);
		pr(buf); nl();
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x6e04(%rip), %rsi      # 0x2128e
callq 0x31c0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1a4d0
movq -0x8(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x30a0
movq -0xb8(%rbp), %rdi
movl %eax, %esi
callq 0xa160
movq %rax, %rsi
leaq 0x6dcb(%rip), %rdi      # 0x21291
callq 0x34b0
jmp 0x1a70b
leaq -0x46(%rbp), %rdi
movl $0x5f, %esi
movl $0x1e, %edx
callq 0x30e0
leaq -0x46(%rbp), %rdi
leaq 0x6dbc(%rip), %rsi      # 0x212aa
movl $0x2, %edx
callq 0x3050
leaq -0x46(%rbp), %rdi
addq $0x2, %rdi
leaq 0x6da6(%rip), %rsi      # 0x212ad
movl $0xa, %edx
callq 0x3050
movb $0x38, -0x3a(%rbp)
movb $0x34, -0x39(%rbp)
movq $0x31323334, -0x18(%rbp) # imm = 0x31323334
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movslq 0xe6f0(%rip), %rax      # 0x28c20
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x46(%rbp), %rdi
movl $0x1e, %esi
movl $0x1, %edx
callq 0x3220
movl 0xe08b(%rip), %eax      # 0x285e4
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3220
movl 0xe087(%rip), %eax      # 0x28600
movl %eax, -0x24(%rbp)
movq -0x10(%rbp), %rcx
leaq -0x24(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x3220
leaq 0xda06(%rip), %rax      # 0x27fa0
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
je 0x1a5de
movq -0x20(%rbp), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x3220
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x1a5a5
movq 0xdb9b(%rip), %rdi      # 0x28180
movslq 0xdff8(%rip), %rdx      # 0x285e4
shlq $0x3, %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x3220
movslq 0xdfdf(%rip), %rcx      # 0x285e4
shlq $0x3, %rcx
cmpq %rcx, %rax
jne 0x1a69a
movq 0xdfb7(%rip), %rdi      # 0x285d0
movslq 0xdfc4(%rip), %rdx      # 0x285e4
shlq $0x3, %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x3220
movslq 0xdfab(%rip), %rcx      # 0x285e4
shlq $0x3, %rcx
cmpq %rcx, %rax
jne 0x1a69a
movq 0xdfa7(%rip), %rdi      # 0x285f0
movslq 0xdf94(%rip), %rdx      # 0x285e4
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x3220
movslq 0xdf7f(%rip), %rcx      # 0x285e4
cmpq %rcx, %rax
jne 0x1a69a
movq 0xdf87(%rip), %rdi      # 0x285f8
movslq 0xdf88(%rip), %rdx      # 0x28600
shlq $0x3, %rdx
movq -0x10(%rbp), %rcx
movl $0x1, %esi
callq 0x3220
movslq 0xdf6f(%rip), %rcx      # 0x28600
shlq $0x3, %rcx
cmpq %rcx, %rax
je 0x1a6b8
movq -0x10(%rbp), %rdi
callq 0x3090
leaq 0x6c0e(%rip), %rdi      # 0x212b8
movq $-0x8, %rsi
callq 0x34b0
jmp 0x1a70b
movq -0x10(%rbp), %rdi
callq 0x3090
callq 0x43d0
movl %eax, -0x28(%rbp)
cmpl $0x0, 0xdef8(%rip)      # 0x285c8
jne 0x1a70b
leaq -0xb0(%rbp), %rdi
movl 0xdf05(%rip), %edx      # 0x285e4
subl -0x28(%rbp), %edx
movl -0x28(%rbp), %ecx
leaq 0x6bde(%rip), %rsi      # 0x212ca
movb $0x0, %al
callq 0x3200
leaq -0xb0(%rbp), %rdi
callq 0x3ab0
leaq 0x72cd(%rip), %rdi      # 0x219d3
callq 0x3ab0
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)