// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/6/isel.c
// Function: selfunc
void
selfunc(Isel *is, Func *fn, Htab *globls, Htab *strtab)
{
	int fileid, lastline;
	Node *n;
	Bb *bb;
	size_t i, j;
	char buf[128];
	char *path;


	for (i = 0; i < fn->cfg->nbb; i++)
		lappend(&is->bb, &is->nbb, mkasmbb(fn->cfg->bb[i]));

	is->curbb = is->bb[0];

	fileid = fn->loc.file;
	if (fileid >= 0 && fn->loc.line > 0) {
		path = file.files[fileid];
		bprintf(buf, sizeof buf, "%s/%s:%d", is->cwd, path, fn->loc.line);
		g(is, Icomment, locstrlbl(buf), NULL);
		bprintf(buf, sizeof buf, "%zd %d", fileid + 1, fn->loc.line);
		g(is, Iloc, locstrlbl(buf), NULL);
	}

	handlesmallstructargs(is, fn);
	prologue(is, fn, fn->stksz);
	lastline = -1;
	for (j = 0; j < fn->cfg->nbb - 1; j++) {
		is->curbb = is->bb[j];
		if (!is->bb[j])
			continue;
		bb = fn->cfg->bb[j];
		for (i = 0; i < bb->nnl; i++) {
			/* put in a comment that says where this line comes from */
			n = bb->nl[i];
			fileid = n->loc.file;
			if (n->loc.file >= 0 && n->loc.line != -1 && n->loc.line != lastline) {
				lastline = n->loc.line;
				path = file.files[fileid];
				bprintf(buf, sizeof buf, "%s/%s:%d", is->cwd, path, n->loc.line);
				g(is, Icomment, locstrlbl(buf), NULL);
				bprintf(buf, sizeof buf, "%zd %d", fileid + 1, n->loc.line);
				g(is, Iloc, locstrlbl(buf), NULL);
			}
			isel(is, fn->cfg->bb[j]->nl[i]);
		}
	}
	is->curbb = is->bb[is->nbb - 1];
	epilogue(is);
	peep(is);
	regalloc(is);
	is->stksz->lit = align(is->stksz->lit, 16);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
cmpq 0x20(%rcx), %rax
jae 0xe270
movq -0x8(%rbp), %rax
addq $0x18, %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rax
movq %rax, -0xe0(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0xe610
movq -0xe8(%rbp), %rdi
movq -0xe0(%rbp), %rsi
movq %rax, %rdx
callq 0x48290
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xe203
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jl 0xe37a
movq -0x10(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jle 0xe37a
leaq 0x6eaec(%rip), %rax     # 0x7cd98
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0xd8(%rbp), %r8
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r9d
movl $0x80, %esi
leaq 0x3e41b(%rip), %rdx     # 0x4c704
movb $0x0, %al
callq 0x4a230
movq -0x8(%rbp), %rax
movq %rax, -0xf8(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xfda0
movq -0xf8(%rbp), %rdi
movq %rax, %rdx
movl $0x43, %esi
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0xbf80
leaq -0xd0(%rbp), %rdi
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x10(%rbp), %rax
movl 0x8(%rax), %r8d
movl $0x80, %esi
leaq 0x3e3cb(%rip), %rdx     # 0x4c70d
movb $0x0, %al
callq 0x4a230
movq -0x8(%rbp), %rax
movq %rax, -0xf0(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xfda0
movq -0xf0(%rbp), %rdi
movq %rax, %rdx
movl $0x42, %esi
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0xbf80
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0xe6c0
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rdx
callq 0xe8b0
movl $0xffffffff, -0x28(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x50(%rcx), %rcx
movq 0x20(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0xe59b
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x48(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jne 0xe3f8
jmp 0xe58a
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq 0x20(%rcx), %rax
jae 0xe588
movq -0x38(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x4(%rax)
jl 0xe54e
movq -0x30(%rbp), %rax
cmpl $-0x1, (%rax)
je 0xe54e
movq -0x30(%rbp), %rax
movl (%rax), %eax
cmpl -0x28(%rbp), %eax
je 0xe54e
movq -0x30(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x28(%rbp)
leaq 0x6e916(%rip), %rax     # 0x7cd98
movq 0x8(%rax), %rax
movslq -0x24(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0xd8(%rbp), %r8
movq -0x30(%rbp), %rax
movl (%rax), %r9d
movl $0x80, %esi
leaq 0x3e246(%rip), %rdx     # 0x4c704
movb $0x0, %al
callq 0x4a230
movq -0x8(%rbp), %rax
movq %rax, -0x108(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xfda0
movq -0x108(%rbp), %rdi
movq %rax, %rdx
movl $0x43, %esi
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0xbf80
leaq -0xd0(%rbp), %rdi
movl -0x24(%rbp), %ecx
addl $0x1, %ecx
movq -0x30(%rbp), %rax
movl (%rax), %r8d
movl $0x80, %esi
leaq 0x3e1f7(%rip), %rdx     # 0x4c70d
movb $0x0, %al
callq 0x4a230
movq -0x8(%rbp), %rax
movq %rax, -0x100(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xfda0
movq -0x100(%rbp), %rdi
movq %rax, %rdx
movl $0x42, %esi
xorl %eax, %eax
movl %eax, %ecx
movb $0x0, %al
callq 0xbf80
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rax
movq -0x48(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq 0x18(%rax), %rax
movq -0x40(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0xea80
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0xe418
jmp 0xe58a
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0xe3ab
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x8(%rbp), %rcx
movq 0x20(%rcx), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rdi
callq 0xead0
movq -0x8(%rbp), %rdi
callq 0x16540
movq -0x8(%rbp), %rdi
callq 0x112e0
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movq 0x10(%rax), %rdi
movl $0x10, %esi
callq 0x4a5b0
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq 0x70(%rax), %rax
movq %rcx, 0x10(%rax)
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
nopw %cs:(%rax,%rax)