// File: /workspace/github_c_makefile_star2_O3/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 0x9a62
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 0x9a3f
movl $0x58, %edi
callq 0x2ce48
movq %rax, %r13
movl (%r14), %eax
movl %eax, (%r13)
movq 0x28(%r14), %rdi
callq 0x2d180
movq %rax, 0x28(%r13)
movq 0x30(%r14), %rdi
callq 0x2d180
movq %rax, 0x30(%r13)
movq 0x8(%r14), %rdi
movq 0x10(%r14), %rsi
shlq $0x3, %rsi
callq 0x2d10d
movq %rax, 0x8(%r13)
movq 0x10(%r14), %rax
movq %rax, 0x10(%r13)
jmp 0x9a42
xorl %r13d, %r13d
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2ceff
incq %rbx
movq 0x8(%rsp), %rax
movq 0x50(%rax), %rax
cmpq 0x20(%rax), %rbx
jb 0x99e5
movq (%rsp), %r14
movq 0x18(%r14), %rax
movq (%rax), %rax
movq %rax, 0x28(%r14)
movq 0x8(%rsp), %r13
movslq 0xc(%r13), %rbx
testq %rbx, %rbx
js 0x9b1d
movl 0x8(%r13), %r9d
testl %r9d, %r9d
jle 0x9b1d
leaq 0x577e1(%rip), %rax     # 0x61278
movq 0x8(%rax), %rax
movq (%rax,%rbx,8), %r8
movq 0x8(%r14), %rcx
leaq 0x2703a(%rip), %rdx     # 0x30ae4
leaq 0x20(%rsp), %r15
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2dfae
movq %r15, %rdi
callq 0xa7af
movq %r14, %rdi
movl $0x43, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8dc2
leal 0x1(%rbx), %ecx
movq 0x8(%rsp), %rax
movl 0x8(%rax), %r8d
leaq 0x27000(%rip), %rdx     # 0x30aed
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2dfae
movq %r15, %rdi
movq 0x8(%rsp), %r13
callq 0xa7af
movq %r14, %rdi
movl $0x42, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8dc2
movq 0x10(%r13), %rdi
callq 0x12965
cmpq $0x0, 0x20(%r13)
je 0x9ba2
movq %rax, %r15
xorl %ebx, %ebx
leaq 0x26eb7(%rip), %r14     # 0x309f0
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %rdi
callq 0x1e31c
cmpq %r15, %rbx
jae 0x9b99
movq %rax, %rdi
callq 0x129b4
addl $-0x2, %eax
cmpl $0x5, %eax
ja 0x9b99
movl %eax, %eax
movq (%r14,%rax,8), %rdi
movq 0x38(%r13), %r12
addq %rdi, %r12
movq %r12, 0x38(%r13)
movl $0x8, %esi
callq 0x2e20c
movq %r12, %rdi
movq %rax, %rsi
callq 0x2e217
movq %rax, 0x38(%r13)
movq 0x18(%r13), %rcx
movq 0x28(%r13), %rdi
movq (%rcx,%rbx,8), %rsi
movq %rax, %rdx
callq 0x2d71e
incq %rbx
cmpq 0x20(%r13), %rbx
jb 0x9b39
movq 0x38(%r13), %r15
movl $0x3b, %edi
callq 0xa93c
movq %rax, %r12
movl $0x3c, %edi
callq 0xa93c
movq %rax, %r13
movq %r15, %rdi
movl $0x4, %esi
callq 0xaaa5
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 0x8dc2
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 0x8dc2
movq %r14, %rdi
movl $0x7, %esi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movl 0x3aac8(%rip), %edi     # 0x446f0
testl %edi, %edi
je 0x9c7f
leaq 0x3aabd(%rip), %r14     # 0x446f0
xorl %ebx, %ebx
callq 0xa93c
movq %rax, %r12
movl 0x4(%rax), %edi
callq 0xa8da
movq %rax, 0x78(%r13,%rbx,8)
movl 0x4(%r12), %edi
callq 0xa7a3
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 0x8dc2
movl 0x4(%r14,%rbx,4), %edi
incq %rbx
testl %edi, %edi
jne 0x9c35
cmpq $0x0, 0x68(%r13)
je 0x9ca9
movl $0x35, %edi
callq 0xa93c
movq 0x68(%r13), %rcx
movq %r13, %rdi
movl $0x1, %esi
movq %rax, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movq %r13, %rdi
movq 0x8(%rsp), %r14
movq %r14, %rsi
callq 0x9503
movq %rbx, 0x3a8(%r13)
movq %r15, 0x70(%r13)
movq 0x50(%r14), %rax
cmpq $0x1, 0x20(%rax)
je 0x9e36
movq %r14, %r15
movl $0xffffffff, 0x18(%rsp) # imm = 0xFFFFFFFF
xorl %edx, %edx
movq 0x18(%r13), %rcx
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x28(%r13)
testq %rcx, %rcx
je 0x9e23
movq 0x8(%rax), %rcx
movq (%rcx,%rdx,8), %r13
cmpq $0x0, 0x20(%r13)
je 0x9e1f
xorl %ebx, %ebx
movq %rdx, 0x10(%rsp)
movq 0x18(%r13), %rax
movq (%rax,%rbx,8), %r12
movslq 0x4(%r12), %r14
testq %r14, %r14
js 0x9ddb
movl (%r12), %ebp
cmpl $-0x1, %ebp
sete %al
cmpl 0x18(%rsp), %ebp
sete %cl
orb %al, %cl
jne 0x9ddb
leaq 0x57533(%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 0x26d7e(%rip), %rdx     # 0x30ae4
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2dfae
leaq 0x20(%rsp), %rdi
callq 0xa7af
movq %r15, %rdi
movl $0x43, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8dc2
leal 0x1(%r14), %ecx
movl (%r12), %r8d
movl $0x80, %esi
leaq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0x26d43(%rip), %rdx     # 0x30aed
xorl %eax, %eax
callq 0x2dfae
movq %r14, %rdi
callq 0xa7af
movq %r15, %rdi
movq 0x8(%rsp), %r15
movl $0x42, %esi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8dc2
movq 0x10(%rsp), %rdx
movl %ebp, 0x18(%rsp)
movq 0x50(%r15), %rax
movq 0x8(%rax), %rax
movq (%rax,%rdx,8), %rax
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %rsi
movl 0x8(%rsi), %eax
cmpl $0xb, %eax
je 0x9e0e
cmpl $0x8, %eax
jne 0xa1c4
movq (%rsp), %rdi
callq 0x775b
movq 0x10(%rsp), %rdx
incq %rbx
cmpq 0x20(%r13), %rbx
jb 0x9d0f
movq 0x50(%r15), %rax
movq (%rsp), %r13
incq %rdx
movq 0x20(%rax), %rcx
decq %rcx
cmpq %rcx, %rdx
jb 0x9ce0
movq 0x18(%r13), %rax
movq 0x20(%r13), %rcx
movq -0x8(%rax,%rcx,8), %rax
movq %rax, 0x28(%r13)
movl $0x3b, %edi
callq 0xa93c
movq %rax, 0x10(%rsp)
movl $0x3c, %edi
callq 0xa93c
movq %rax, 0x18(%rsp)
movl 0x38(%r13), %eax
decl %eax
cmpl $0x7, %eax
ja 0xa0df
leaq 0x26ad1(%rip), %rcx     # 0x3094c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
movq %rax, %r12
movq 0x30(%r13), %rdi
callq 0x1e384
movq %rax, %rdi
callq 0x23002
movl 0x4(%r12), %esi
testl %eax, %eax
je 0x9fa8
movl $0x55, %edi
callq 0xaacd
movq %r13, %rdi
movl $0x27, %esi
jmp 0x9fba
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xa973
movq %rax, %r13
movl 0x3a35f(%rip), %edi     # 0x44250
movl $0x6, %esi
callq 0xaacd
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa1d2
movl $0x8, %edi
movq %r12, %rsi
jmp 0x9fe0
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
xorl %edi, %edi
movq %rax, %rsi
jmp 0xa04d
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xa973
movq %rax, %r13
movl 0x3a306(%rip), %edi     # 0x44260
movl $0x4, %esi
callq 0xaacd
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa1d2
movl $0x8, %edi
movq %r12, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xa973
movq %rax, %r12
movl 0x3a2d4(%rip), %edi     # 0x44268
jmp 0x9ff5
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
movq %rax, %r12
movl 0x4(%rax), %esi
movl $0x15, %edi
callq 0xaacd
movq %r13, %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
jmp 0xa0df
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xa973
movq %rax, %r12
movl 0x3a26b(%rip), %edi     # 0x44260
movl $0x4, %esi
jmp 0xa0cc
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x4, %ecx
callq 0xa973
movq %rax, %r13
movl 0x3a238(%rip), %edi     # 0x44260
movl $0x4, %esi
callq 0xaacd
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa1d2
movl $0x8, %edi
movq %r12, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xa973
movq %rax, %r12
movl 0x3a1ee(%rip), %edi     # 0x44250
jmp 0xa0c7
movq 0x30(%r13), %rsi
movq %r13, %rdi
callq 0x91b0
movq %rax, %r12
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xa973
movq %rax, %r13
movl 0x3a1c3(%rip), %edi     # 0x44250
movl $0x6, %esi
callq 0xaacd
movq (%rsp), %rdi
movq %r13, %rsi
movq (%rsp), %r13
movq %rax, %rdx
callq 0xa1d2
movl $0x8, %edi
movq %r12, %rsi
xorl %edx, %edx
movl $0x6, %ecx
callq 0xa973
movq %rax, %r12
movl 0x3a191(%rip), %edi     # 0x44258
movl $0x6, %esi
callq 0xaacd
movq %r13, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0xa1d2
cmpl $0x0, 0x3a60a(%rip)     # 0x446f0
movq %r13, %r14
je 0xa144
movl $0x3c, %r13d
leaq 0x3a5f8(%rip), %rbx     # 0x446f0
movl $0x1, %r15d
movq (%r14,%r13,2), %rax
movl 0x4(%rax), %edi
callq 0xa7a3
movl %eax, %ebp
movq (%r14,%r13,2), %r12
movl -0x3c(%r13,%rbx), %edi
callq 0xa93c
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 0x8dc2
cmpl $0x0, -0x38(%r13,%rbx)
leaq 0x4(%r13), %r13
jne 0xa0fe
movq %r14, %rdi
movl $0x1, %esi
movq 0x18(%rsp), %rbx
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8dc2
movq %r14, %rdi
movl $0x1c, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8dc2
movq %r14, %rdi
movl $0x3f, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x8dc2
movq %r14, %rdi
callq 0xeb20
movq %r14, %rdi
callq 0xb584
movq 0x70(%r14), %rax
movq 0x10(%rax), %rdi
movl $0x10, %esi
callq 0x2e217
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 0x26b45(%rip), %rdi     # 0x30d10
xorl %eax, %eax
callq 0x13844