// File: /workspace/github_c_makefile_star2_O1/oridb[P]mc/parse/specialize.c
// Function: genautocall
void
genautocall(Node **call, size_t ncall, Node *local, char *fn)
{
	Node *name, *decl, *func, *block, *init;
	Type *tyvoid, *tyvoidfn;
	size_t i;

	name = mkname(Zloc, fn);
	decl = mkdecl(Zloc, name, mktyvar(Zloc));
	block = mkblock(Zloc, mkstab(0));
	tyvoid = mktype(Zloc, Tyvoid);
	tyvoidfn = mktyfunc(Zloc, NULL, 0, tyvoid);

	for (i = 0; i < ncall; i++) {
		init = initdecl(call[i], tyvoidfn);
		callinit(block, init, tyvoid, tyvoidfn);
	}
	if (local)
		callinit(block, local, tyvoid, tyvoidfn);

	func = mkfunc(Zloc, NULL, 0, mktype(Zloc, Tyvoid), block);
	init = mkexpr(Zloc, Olit, func, NULL);
	init->expr.type = tyvoidfn;

	decl->decl.init = init;
	decl->decl.isconst = 1;
	decl->decl.isglobl = 1;
	decl->decl.type = tyvoidfn;
	decl->decl.vis = Vishidden;

	func->lit.fnval->func.scope->super = file.globls;
	block->block.scope->super = func->lit.fnval->func.scope->super;

	lappend(&file.stmts, &file.nstmts, decl);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdx, 0x10(%rsp)
movq %rsi, %r12
movq %rdi, 0x20(%rsp)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rcx, %rsi
callq 0x1d945
movq %rax, %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x22fd7
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1e29f
movq %rax, 0x18(%rsp)
xorl %edi, %edi
callq 0x1ff11
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rsi
callq 0x1dd87
movq %rax, %r14
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %esi
callq 0x22d38
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
xorl %edx, %edx
movq %rax, 0x8(%rsp)
movq %rax, %rcx
callq 0x23245
movq %rax, %rbp
testq %r12, %r12
je 0x1fd92
movq %r12, %r15
xorl %r13d, %r13d
movq %r14, %r12
movq 0x20(%rsp), %rax
movq (%rax,%r13,8), %r14
leaq 0x41559(%rip), %rax     # 0x61278
movq 0x90(%rax), %rdi
movq %r14, %rsi
callq 0x2048b
movq %rax, %rbx
testq %rax, %rax
jne 0x1fd70
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r14, %rsi
movq %rbp, %rdx
callq 0x1e29f
movq %rax, %rbx
movw $0x101, 0x71(%rax)      # imm = 0x101
movb $0x1, %al
movb %al, 0x7a(%rbx)
movb %al, 0x74(%rbx)
movb %al, 0x76(%rbx)
leaq 0x41517(%rip), %rax     # 0x61278
movq 0x90(%rax), %rdi
movq %rbx, %rsi
callq 0x2071e
movq %r12, %r14
movq %r12, %rdi
movq %rbx, %rsi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
callq 0x1fe49
incq %r13
cmpq %r13, %r15
jne 0x1fd0c
movq 0x10(%rsp), %rsi
testq %rsi, %rsi
je 0x1fdac
movq %r14, %rdi
movq 0x8(%rsp), %rdx
movq %rbp, %rcx
callq 0x1fe49
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %esi
callq 0x22d38
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
xorl %edx, %edx
movq %rax, %rcx
movq %r14, %r8
callq 0x1dc7e
movq %rax, %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x35, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x1d832
movq %rbp, 0x20(%rax)
movq 0x18(%rsp), %rdx
movq %rax, 0x30(%rdx)
movb $0x1, 0x72(%rdx)
movq %rbp, 0x28(%rdx)
movw $0x102, 0x70(%rdx)      # imm = 0x102
leaq 0x4146e(%rip), %rsi     # 0x61278
movq 0x90(%rsi), %rax
movq 0x30(%rbx), %rcx
movq 0x20(%rcx), %rcx
movq %rax, (%rcx)
movq 0x30(%rbx), %rax
movq 0x20(%rax), %rax
movq (%rax), %rax
movq 0x18(%r14), %rcx
movq %rax, (%rcx)
leaq 0x40(%rsi), %rdi
addq $0x48, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2d3ff