// File: /workspace/github_c_makefile_star2_O1/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 0x22d38
movq %rax, %rbx
leaq 0x10cb5(%rip), %rbp     # 0x35602
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 0x22d38
movq %rax, %rbx
leaq 0xaefe(%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 0x13477(%rip), %rsi     # 0x37e34
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d945
movq %rax, %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x22d38
movq %rax, %r13
movq %rbp, %rdi
callq 0x4340
movq %rax, 0x88(%r13)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x22d38
movq %rax, %rbp
movl $0x1, %eax
movq %rax, 0x70(%rbp)
movl $0x8, %edi
callq 0x2d379
movq %rax, 0x68(%rbp)
movq %r13, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x1e29f
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2d3ff
leaq 0x121dd(%rip), %rsi     # 0x36c19
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d945
movq %rax, %rbx
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x22d38
movq %rax, %r13
leaq 0xae23(%rip), %rdi      # 0x2f885
callq 0x4340
movq %rax, 0x88(%r13)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x22d38
movq %rax, %rbp
movl $0x1, %eax
movq %rax, 0x70(%rbp)
movl $0x8, %edi
callq 0x2d379
movq %rax, 0x68(%rbp)
movq %r13, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x1e29f
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x2d3ff
movq (%r15), %rbx
movq (%r12), %r13
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x2, %esi
callq 0x22d38
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbx, %rsi
movq %r13, %rdx
movq %rax, %rcx
callq 0x23245
movq %rax, %rbx
leaq 0x1334e(%rip), %rsi     # 0x37e39
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d945
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rsi
movq %rbx, %rdx
callq 0x1e29f
movq %rax, %rbp
movq %r14, 0x40(%rax)
leaq -0xc85(%rip), %rdi      # 0x23e8e
leaq -0x666(%rip), %rsi      # 0x244b4
callq 0x2db1c
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 0x2d3ff
movq (%rsp), %rdi
movq %rbp, %rsi
callq 0x2071e
xorl %eax, %eax
movq %r15, %r13
movq %rax, (%r15)
movq %r12, %rbx
movq %rax, (%r12)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
leaq 0x132c8(%rip), %rsi     # 0x37e34
callq 0x1d945
movq %rax, %rbp
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x22d38
movq %rax, %r15
leaq 0x10a75(%rip), %rdi     # 0x35602
callq 0x4340
movq %rax, 0x88(%r15)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x22d38
movq %rax, %r12
movl $0x1, %eax
movq %rax, 0x70(%r12)
movl $0x8, %edi
callq 0x2d379
movq %rax, 0x68(%r12)
movq %r15, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rbp, %rsi
movq %r12, %rdx
callq 0x1e29f
movq %r13, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2d3ff
leaq 0x1325a(%rip), %rsi     # 0x37e46
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d945
movq %rax, %r15
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1a, %esi
callq 0x22d38
movq %rax, %r12
leaq 0xac73(%rip), %rdi      # 0x2f885
callq 0x4340
movq %rax, 0x88(%r12)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x12, %esi
callq 0x22d38
movq %rax, %rbp
movl $0x1, %eax
movq %rax, 0x70(%rbp)
movl $0x8, %edi
callq 0x2d379
movq %rax, 0x68(%rbp)
movq %r12, (%rax)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r15, %rsi
movq %rbp, %rdx
callq 0x1e29f
leaq 0x18(%rsp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x2d3ff
movq (%r15), %r15
movq (%rbx), %r12
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movl $0x1, %esi
callq 0x22d38
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %r15, %rsi
movq %r12, %rdx
movq %rax, %rcx
callq 0x23245
movq %rax, %r15
leaq 0x131aa(%rip), %rsi     # 0x37e4a
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x1d945
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
movq %rax, %rsi
movq %r15, %rdx
callq 0x1e29f
movq %rax, %r15
movq %r14, 0x40(%rax)
leaq -0xe3a(%rip), %rdi      # 0x23e8e
leaq -0x81b(%rip), %rsi      # 0x244b4
callq 0x2db1c
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 0x2d3ff
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x2071e
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq