// File: /workspace/github_c_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, (%rsp)
movq %rsi, 0x8(%rsp)
movq 0x50(%rsi), %rax
cmpq $0x0, 0x20(%rax)
je 0x9b73
movq (%rsp), %rcx
leaq 0x18(%rcx), %r15
leaq 0x20(%rcx), %r12
xorl %ebx, %ebx
movq 0x8(%rax), %rax
movq (%rax,%rbx,8), %r14
testq %r14, %r14
je 0x9b50
movl $0x58, %edi
callq 0x2d348
movq %rax, %r13
movl (%r14), %eax
movl %eax, (%r13)
movq 0x28(%r14), %rdi
callq 0x2d680
movq %rax, 0x28(%r13)
movq 0x30(%r14), %rdi
callq 0x2d680
movq %rax, 0x30(%r13)
movq 0x8(%r14), %rdi
movq 0x10(%r14), %rsi
shlq $0x3, %rsi
callq 0x2d60b
movq %rax, 0x8(%r13)
movq 0x10(%r14), %rax
movq %rax, 0x10(%r13)
jmp 0x9b53
xorl %r13d, %r13d
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2d3ff
incq %rbx
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
cmpq 0x20(%rax), %rbx
jb 0x9af6
movq (%rsp), %r14
movq 0x18(%r14), %rax
movq (%rax), %rax
movq %rax, 0x28(%r14)
movq 0x8(%rsp), %r15
movslq 0xc(%r15), %rbx
testq %rbx, %rbx
js 0x9c2e
movl 0x8(%r15), %r9d
testl %r9d, %r9d
jle 0x9c2e
leaq 0x576d0(%rip), %rax     # 0x61278
movq 0x8(%rax), %rax
movq (%rax,%rbx,8), %r8
movq 0x8(%r14), %rcx
leaq 0x26f19(%rip), %rdx     # 0x30ad4
leaq 0x20(%rsp), %r15
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2e42e
movq %r15, %rdi
callq 0xa8e3
movq %r14, %rdi
movl $0x43, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8eb0
leal 0x1(%rbx), %ecx
movq 0x8(%rsp), %rax
movl 0x8(%rax), %r8d
leaq 0x26edf(%rip), %rdx     # 0x30add
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2e42e
movq %r15, %rdi
movq 0x8(%rsp), %r15
callq 0xa8e3
movq %r14, %rdi
movl $0x42, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8eb0
movq 0x10(%r15), %rdi
callq 0x12b29
movq %r15, %rcx
cmpq $0x0, 0x20(%r15)
je 0x9cc9
movq %rax, %r15
xorl %ebx, %ebx
leaq 0x26d8f(%rip), %r14     # 0x309e0
movq 0x8(%rsp), %r13
movq 0x18(%rcx), %rax
movq (%rax,%rbx,8), %rdi
callq 0x1e56c
movq %rax, %rdi
movl $0x6, %eax
cmpq %r15, %rbx
jae 0x9c78
callq 0x12b78
addl $-0x2, %eax
cmpl $0x5, %eax
ja 0x9cbb
movl %eax, %eax
movq (%r14,%rax,8), %rdi
movq 0x38(%r13), %r12
addq %rdi, %r12
movq %r12, 0x38(%r13)
movl $0x8, %esi
callq 0x2e68c
movq %r12, %rdi
movq %rax, %rsi
callq 0x2e697
movq %rax, 0x38(%r13)
movq 0x18(%r13), %rcx
movq 0x28(%r13), %rdi
movq (%rcx,%rbx,8), %rsi
movq %rax, %rdx
callq 0x2dbc2
incq %rbx
movq 0x8(%rsp), %rcx
cmpq 0x20(%rcx), %rbx
jb 0x9c56
movq 0x38(%rcx), %r15
movl $0x3b, %edi
callq 0xaa70
movq %rax, %r12
movl $0x3c, %edi
callq 0xaa70
movq %rax, %r13
movq %r15, %rdi
movl $0x4, %esi
callq 0xabd9
movq %rax, %r15
xorl %ebx, %ebx
movq (%rsp), %r14
movq %r14, %rdi
movl $0x1b, %esi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8eb0
movl $0x1, %ebp
movq %r14, %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %r13, %rcx
movq %r14, %r13
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
movq %r14, %rdi
movl $0x7, %esi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
movl 0x3a9a1(%rip), %edi     # 0x446f0
testl %edi, %edi
je 0x9da6
leaq 0x3a996(%rip), %r14     # 0x446f0
xorl %ebx, %ebx
callq 0xaa70
movq %rax, %r12
movl 0x4(%rax), %edi
callq 0xaa0e
movq %rax, 0x78(%r13,%rbx,8)
movl 0x4(%r12), %edi
callq 0xa8d7
testl %eax, %eax
movq 0x78(%r13,%rbx,8), %rcx
movl $0x27, %esi
cmovel %ebp, %esi
movq %r13, %rdi
movq %r12, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
movl 0x4(%r14,%rbx,4), %edi
incq %rbx
testl %edi, %edi
jne 0x9d5c
cmpq $0x0, 0x68(%r13)
je 0x9dd0
movl $0x35, %edi
callq 0xaa70
movq 0x68(%r13), %rcx
movq %r13, %rdi
movl $0x1, %esi
movq %rax, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
movq %r13, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x9623
movq %rbx, 0x3a8(%r13)
movq %r15, 0x70(%r13)
movq 0x50(%r14), %rax
cmpq $0x1, 0x20(%rax)
je 0x9f5f
movq %r14, %r15
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
xorl %edi, %edi
movq 0x18(%r13), %rcx
movq (%rcx,%rdi,8), %rdx
movq %rdx, 0x28(%r13)
cmpq $0x0, (%rcx,%rdi,8)
je 0x9f44
movq 0x8(%rax), %rax
movq (%rax,%rdi,8), %r13
cmpq $0x0, 0x20(%r13)
je 0x9f44
xorl %ebx, %ebx
movq %rdi, 0x10(%rsp)
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %r12
movslq 0x4(%r12), %r14
testq %r14, %r14
js 0x9f04
movl (%r12), %ebp
cmpl $-0x1, %ebp
sete %al
cmpl 0x18(%rsp), %ebp
sete %cl
orb %al, %cl
jne 0x9f04
leaq 0x5740a(%rip), %rax     # 0x61278
movq 0x8(%rax), %rax
movq (%rax,%r14,8), %r8
movq (%rsp), %r15
movq 0x8(%r15), %rcx
movl $0x80, %esi
leaq 0x20(%rsp), %rdi
leaq 0x26c45(%rip), %rdx     # 0x30ad4
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2e42e
leaq 0x20(%rsp), %rdi
callq 0xa8e3
movq %r15, %rdi
movl $0x43, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8eb0
leal 0x1(%r14), %ecx
movl (%r12), %r8d
movl $0x80, %esi
leaq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0x26c0a(%rip), %rdx     # 0x30add
xorl %eax, %eax
callq 0x2e42e
movq %r14, %rdi
callq 0xa8e3
movq %r15, %rdi
movq 0x8(%rsp), %r15
movl $0x42, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8eb0
movq 0x10(%rsp), %rdi
movl %ebp, 0x18(%rsp)
movq 0x50(%r15), %rax
movq 0x8(%rax), %rax
movq (%rax,%rdi,8), %rax
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %rsi
movl 0x8(%rsi), %eax
cmpl $0xb, %eax
je 0x9f37
cmpl $0x8, %eax
jne 0xa2ed
movq (%rsp), %rdi
callq 0x7857
movq 0x10(%rsp), %rdi
incq %rbx
cmpq 0x20(%r13), %rbx
jb 0x9e38
incq %rdi
movq 0x50(%r15), %rax
movq 0x20(%rax), %rcx
decq %rcx
cmpq %rcx, %rdi
movq (%rsp), %r13
jb 0x9e07
movq 0x18(%r13), %rax
movq 0x20(%r13), %rcx
movq -0x8(%rax,%rcx,8), %rax
movq %rax, 0x28(%r13)
movl $0x3b, %edi
callq 0xaa70
movq %rax, 0x10(%rsp)
movl $0x3c, %edi
callq 0xaa70
movq %rax, 0x18(%rsp)
movl 0x38(%r13), %eax
decl %eax
cmpl $0x7, %eax
ja 0xa208
leaq 0x269a8(%rip), %rcx     # 0x3094c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
movq %rax, %r12
movq 0x30(%r13), %rdi
callq 0x1e5d4
movq %rax, %rdi
callq 0x234b0
movl 0x4(%r12), %esi
testl %eax, %eax
je 0xa0d1
movl $0x55, %edi
callq 0xac01
movq %r13, %rdi
movl $0x27, %esi
jmp 0xa0e3
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xaaa7
movq %rax, %r13
movl 0x3a236(%rip), %edi     # 0x44250
movl $0x6, %esi
callq 0xac01
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa2fb
movl $0x8, %edi
movq %r12, %rsi
jmp 0xa109
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
xorl %edi, %edi
movq %rax, %rsi
jmp 0xa176
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xaaa7
movq %rax, %r13
movl 0x3a1dd(%rip), %edi     # 0x44260
movl $0x4, %esi
callq 0xac01
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa2fb
movl $0x8, %edi
movq %r12, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xaaa7
movq %rax, %r12
movl 0x3a1ab(%rip), %edi     # 0x44268
jmp 0xa11e
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
movq %rax, %r12
movl 0x4(%rax), %esi
movl $0x15, %edi
callq 0xac01
movq %r13, %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
jmp 0xa208
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xaaa7
movq %rax, %r12
movl 0x3a142(%rip), %edi     # 0x44260
movl $0x4, %esi
jmp 0xa1f5
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xaaa7
movq %rax, %r13
movl 0x3a10f(%rip), %edi     # 0x44260
movl $0x4, %esi
callq 0xac01
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa2fb
movl $0x8, %edi
movq %r12, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xaaa7
movq %rax, %r12
movl 0x3a0c5(%rip), %edi     # 0x44250
jmp 0xa1f0
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x92d0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xaaa7
movq %rax, %r13
movl 0x3a09a(%rip), %edi     # 0x44250
movl $0x6, %esi
callq 0xac01
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa2fb
movl $0x8, %edi
movq %r12, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xaaa7
movq %rax, %r12
movl 0x3a068(%rip), %edi     # 0x44258
movl $0x6, %esi
callq 0xac01
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xa2fb
cmpl $0x0, 0x3a4e1(%rip)     # 0x446f0
movq %r13, %r14
je 0xa26d
movl $0x3c, %r13d
leaq 0x3a4cf(%rip), %rbx     # 0x446f0
movl $0x1, %r15d
movq (%r14,%r13,2), %rax
movl 0x4(%rax), %edi
callq 0xa8d7
movl %eax, %ebp
movq (%r14,%r13,2), %r12
movl -0x3c(%r13,%rbx), %edi
callq 0xaa70
testl %ebp, %ebp
movl $0x27, %esi
cmovel %r15d, %esi
movq %r14, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
cmpl $0x0, -0x38(%r13,%rbx)
leaq 0x4(%r13), %r13
jne 0xa227
movq %r14, %rdi
movl $0x1, %esi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8eb0
movq %r14, %rdi
movl $0x1c, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8eb0
movq %r14, %rdi
movl $0x3f, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x8eb0
movq %r14, %rdi
callq 0xed20
movq %r14, %rdi
callq 0xb6c8
movq 0x70(%r14), %rax
movq 0x10(%rax), %rdi
movl $0x10, %esi
callq 0x2e697
movq 0x70(%r14), %rcx
movq %rax, 0x10(%rcx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x26a0c(%rip), %rdi     # 0x30d00
xorl %eax, %eax
callq 0x13a00