// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/parse/type.c
// Function: iterableinit
void
iterableinit(Stab *st, Trait *tr)
{
	Node *func, *arg, **args;
	Type *ty;
	size_t nargs;

	/* trait iter @a -> @b = ... */
	tr->param = mktyparam(Zloc, "a");
	tr->aux = malloc(sizeof(Type*));
	tr->aux[0] = mktyparam(Zloc, "b");
	tr->naux = 1;

	/* __iternext__ : (it : @a#, outval : @b# -> bool) */
	args = NULL;
	nargs = 0;
	arg = mkdecl(Zloc, mkname(Zloc, "iter"), mktyptr(Zloc, mktyparam(Zloc, "a")));
	lappend(&args, &nargs, arg);
	arg = mkdecl(Zloc, mkname(Zloc, "ret"), mktyptr(Zloc, mktyparam(Zloc, "b")));
	lappend(&args, &nargs, arg);
	ty = mktyfunc(Zloc, args, nargs, mktype(Zloc, Tybool));

	func = mkdecl(Zloc, mkname(Zloc, "__iternext__"), ty);
	func->decl.trait = tr;
	func->decl.impls = mkht(tyhash, tyeq);
	func->decl.isgeneric = 1;
	func->decl.isconst = 1;
	func->decl.isglobl = 1;
	func->decl.isextern = 1;

	lappend(&tr->proto, &tr->nproto, func);
	putdcl(st, func);

	/* __iterfin__ : (it : @a#, outval : @b# -> void) */
	args = NULL;
	nargs = 0;
	arg = mkdecl(Zloc, mkname(Zloc, "iter"), mktyptr(Zloc, mktyparam(Zloc, "a")));
	lappend(&args, &nargs, arg);
	arg = mkdecl(Zloc, mkname(Zloc, "val"), mktyptr(Zloc, mktyparam(Zloc, "b")));
	lappend(&args, &nargs, arg);
	ty = mktyfunc(Zloc, args, nargs, mktype(Zloc, Tyvoid));

	func = mkdecl(Zloc, mkname(Zloc, "__iterfin__"), ty);
	func->decl.trait = tr;
	func->decl.impls = mkht(tyhash, tyeq);
	func->decl.isgeneric = 1;
	func->decl.isconst = 1;
	func->decl.isglobl = 1;
	func->decl.isextern = 1;

	lappend(&tr->proto, &tr->nproto, func);
	putdcl(st, func);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, (%rsp)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x2289d
movq %rax, %rbx
leaq 0x1113d(%rip), %rbp     # 0x35612
movq %rbp, %rdi
callq 0x4340
movq %rax, 0x88(%rbx)
movq %rbx, 0x18(%r14)
movl $0x8, %edi
callq 0x4280
movq %rax, 0x20(%r14)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x2289d
movq %rax, %rbx
leaq 0xb376(%rip), %rdi      # 0x2f885
callq 0x4340
movq %rax, 0x88(%rbx)
movq 0x20(%r14), %rax
movq %rbx, (%rax)
movl $0x1, %eax
movq %rax, 0x28(%r14)
xorl %eax, %eax
leaq 0x18(%rsp), %r15
movq %rax, (%r15)
leaq 0x20(%rsp), %r12
movq %rax, (%r12)
leaq 0x138bf(%rip), %rsi     # 0x37e04
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d6f5
movq %rax, %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x2289d
movq %rax, %r13
movq %rbp, %rdi
callq 0x4340
movq %rax, 0x88(%r13)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x2289d
movq %rax, %rbp
movl $0x1, %eax
movq %rax, 0x70(%rbp)
movl $0x8, %edi
callq 0x2ce79
movq %rax, 0x68(%rbp)
movq %r13, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x1e04f
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
leaq 0x12665(%rip), %rsi     # 0x36c29
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d6f5
movq %rax, %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x2289d
movq %rax, %r13
leaq 0xb29b(%rip), %rdi      # 0x2f885
callq 0x4340
movq %rax, 0x88(%r13)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x2289d
movq %rax, %rbp
movl $0x1, %eax
movq %rax, 0x70(%rbp)
movl $0x8, %edi
callq 0x2ce79
movq %rax, 0x68(%rbp)
movq %r13, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x1e04f
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2ceff
movq (%r15), %rbx
movq (%r12), %r13
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x2, %esi
callq 0x2289d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x22d97
movq %rax, %rbx
leaq 0x13796(%rip), %rsi     # 0x37e09
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d6f5
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1e04f
movq %rax, %rbp
movq %r14, 0x40(%rax)
leaq -0xcc3(%rip), %rdi      # 0x239d8
leaq -0x666(%rip), %rsi      # 0x2403c
callq 0x2d678
movq %rax, 0x48(%rbp)
leaq 0x30(%r14), %rdi
movq %rdi, 0x10(%rsp)
leaq 0x38(%r14), %rsi
movq %rsi, 0x8(%rsp)
movl $0x1010101, %eax        # imm = 0x1010101
movl %eax, 0x71(%rbp)
movq %rbp, %rdx
callq 0x2ceff
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x204de
xorl %eax, %eax
movq %r15, %r13
movq %rax, (%r15)
movq %r12, %rbx
movq %rax, (%r12)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x13710(%rip), %rsi     # 0x37e04
callq 0x1d6f5
movq %rax, %rbp
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x2289d
movq %rax, %r15
leaq 0x10efd(%rip), %rdi     # 0x35612
callq 0x4340
movq %rax, 0x88(%r15)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x2289d
movq %rax, %r12
movl $0x1, %eax
movq %rax, 0x70(%r12)
movl $0x8, %edi
callq 0x2ce79
movq %rax, 0x68(%r12)
movq %r15, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbp, %rsi
movq %r12, %rdx
callq 0x1e04f
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2ceff
leaq 0x136a2(%rip), %rsi     # 0x37e16
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d6f5
movq %rax, %r15
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x2289d
movq %rax, %r12
leaq 0xb0eb(%rip), %rdi      # 0x2f885
callq 0x4340
movq %rax, 0x88(%r12)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x2289d
movq %rax, %rbp
movl $0x1, %eax
movq %rax, 0x70(%rbp)
movl $0x8, %edi
callq 0x2ce79
movq %rax, 0x68(%rbp)
movq %r12, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1e04f
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2ceff
movq (%r15), %r15
movq (%rbx), %r12
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %esi
callq 0x2289d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x22d97
movq %rax, %r15
leaq 0x135f2(%rip), %rsi     # 0x37e1a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d6f5
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rsi
movq %r15, %rdx
callq 0x1e04f
movq %rax, %r15
movq %r14, 0x40(%rax)
leaq -0xe78(%rip), %rdi      # 0x239d8
leaq -0x81b(%rip), %rsi      # 0x2403c
callq 0x2d678
movq %rax, 0x48(%r15)
movl $0x1010101, %eax        # imm = 0x1010101
movl %eax, 0x71(%r15)
movq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %r15, %rdx
callq 0x2ceff
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x204de
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq