// File: /workspace/github_c_makefile_star2_O2/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 %rsi, (%rsp)
leaq 0x18(%rdi), %rax
movq %rax, 0x10(%rsp)
movq %rdi, 0x8(%rsp)
leaq 0x20(%rdi), %r15
xorl %ebx, %ebx
pushq $0x58
popq %r12
movq (%rsp), %rdx
movq 0x50(%rdx), %rax
cmpq 0x20(%rax), %rbx
jae 0x905f
movq 0x8(%rax), %rax
movq (%rax,%rbx,8), %r14
testq %r14, %r14
je 0x9047
movq %r12, %rdi
callq 0x29a78
movq %rax, %r13
movl (%r14), %eax
movl %eax, (%r13)
movq 0x28(%r14), %rdi
callq 0x29d7c
movq %rax, 0x28(%r13)
movq 0x30(%r14), %rdi
callq 0x29d7c
movq %rax, 0x30(%r13)
movq 0x8(%r14), %rdi
movq 0x10(%r14), %rsi
shlq $0x3, %rsi
callq 0x29d0d
movq %rax, 0x8(%r13)
movq 0x10(%r14), %rax
movq %rax, 0x10(%r13)
jmp 0x904a
xorl %r13d, %r13d
movq 0x10(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x29b2d
incq %rbx
jmp 0x8fe1
movq 0x8(%rsp), %rcx
movq 0x18(%rcx), %rax
movq (%rax), %rax
movq %rax, 0x28(%rcx)
movslq 0xc(%rdx), %rbx
testq %rbx, %rbx
js 0x9115
movl 0x8(%rdx), %r9d
testl %r9d, %r9d
jle 0x9115
leaq 0x551e8(%rip), %rax     # 0x5e278
movq 0x8(%rax), %rax
movq (%rax,%rbx,8), %r8
movq 0x8(%rsp), %r14
movq 0x8(%r14), %rcx
leaq 0x23a3c(%rip), %rdx     # 0x2cae4
leaq 0x20(%rsp), %r15
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2a9bf
movq %r15, %rdi
callq 0x9cb7
pushq $0x43
popq %rsi
movq %r14, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8633
leal 0x1(%rbx), %ecx
movq (%rsp), %rax
movl 0x8(%rax), %r8d
leaq 0x23a05(%rip), %rdx     # 0x2caed
movl $0x80, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x2a9bf
movq %r15, %rdi
callq 0x9cb7
pushq $0x42
popq %rsi
movq %r14, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8633
movq (%rsp), %rdx
movq 0x10(%rdx), %rdi
callq 0x11211
movq %rax, %r15
xorl %ebx, %ebx
leaq 0x238c6(%rip), %r14     # 0x2c9f0
pushq $0x8
popq %r12
movq (%rsp), %rbp
movq (%rsp), %rax
cmpq 0x20(%rax), %rbx
jae 0x919f
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %rdi
callq 0x1bf2d
cmpq %r15, %rbx
jae 0x919a
movq %rax, %rdi
callq 0x11260
addl $-0x2, %eax
cmpl $0x5, %eax
ja 0x919a
movl %eax, %eax
movq (%r14,%rax,8), %rdi
movq 0x38(%rbp), %r13
addq %rdi, %r13
movq %r13, 0x38(%rbp)
movq %r12, %rsi
callq 0x2ac08
movq %r13, %rdi
movq %rax, %rsi
callq 0x2ac13
movq %rax, 0x38(%rbp)
movq 0x18(%rbp), %rcx
movq 0x28(%rbp), %rdi
movq (%rcx,%rbx,8), %rsi
movq %rax, %rdx
callq 0x2a22a
incq %rbx
jmp 0x9132
movq 0x38(%rax), %r15
pushq $0x3b
popq %rdi
callq 0x9e02
movq %rax, %r12
pushq $0x3c
popq %rdi
callq 0x9e02
movq %rax, %r13
pushq $0x4
popq %rsi
movq %r15, %rdi
callq 0x9eed
movq %rax, %r15
pushq $0x1b
popq %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8633
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %r13, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
pushq $0x7
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
movq %r12, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
leaq 0x384df(%rip), %r14     # 0x416f0
xorl %ebx, %ebx
movq 0x8(%rsp), %r13
movl (%r14), %edi
testl %edi, %edi
je 0x9267
callq 0x9e02
movq %rax, %r12
movl 0x4(%rax), %edi
callq 0x9da2
movq %rax, 0x78(%r13,%rbx,8)
movl 0x4(%r12), %edi
callq 0x9cab
testl %eax, %eax
movq 0x78(%r13,%rbx,8), %rcx
pushq $0x27
popq %rsi
pushq $0x1
popq %rax
cmovel %eax, %esi
movq %r13, %rdi
movq %r12, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
incq %rbx
addq $0x4, %r14
jmp 0x9218
movq 0x8(%rsp), %r12
cmpq $0x0, 0x68(%r12)
je 0x9294
pushq $0x35
popq %rdi
callq 0x9e02
movq 0x68(%r12), %rcx
pushq $0x1
popq %rsi
movq %r12, %rdi
movq %rax, %rdx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
movq %r12, %rdi
movq (%rsp), %r14
movq %r14, %rsi
callq 0x8b5b
movq %r14, %rdi
movq %rbx, 0x3a8(%r12)
movq %r15, 0x70(%r12)
pushq $-0x1
popq %r14
xorl %r8d, %r8d
movq %r12, %rbx
movq 0x50(%rdi), %rax
movq 0x20(%rax), %rdx
decq %rdx
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
cmpq %rdx, %r8
jae 0x9417
movq (%rcx,%r8,8), %rcx
movq %rcx, 0x28(%rbx)
testq %rcx, %rcx
je 0x940f
movq 0x8(%rax), %rax
movq (%rax,%r8,8), %r12
xorl %ebx, %ebx
movq %r8, 0x18(%rsp)
cmpq 0x20(%r12), %rbx
jae 0x940a
movq 0x18(%r12), %rax
movq (%rax,%rbx,8), %r13
movslq 0x4(%r13), %r15
testq %r15, %r15
js 0x93ca
movl (%r13), %ebp
cmpl $-0x1, %ebp
sete %al
cmpl %r14d, %ebp
sete %cl
orb %al, %cl
jne 0x93ca
leaq 0x54f3f(%rip), %rax     # 0x5e278
movq 0x8(%rax), %rax
movq (%rax,%r15,8), %r8
movq 0x8(%rsp), %r14
movq 0x8(%r14), %rcx
movl $0x80, %esi
leaq 0x20(%rsp), %rdi
leaq 0x23789(%rip), %rdx     # 0x2cae4
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2a9bf
leaq 0x20(%rsp), %rdi
callq 0x9cb7
movq %r14, %rdi
pushq $0x43
popq %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8633
leal 0x1(%r15), %ecx
movl (%r13), %r8d
movl $0x80, %esi
leaq 0x20(%rsp), %r15
movq %r15, %rdi
leaq 0x23750(%rip), %rdx     # 0x2caed
xorl %eax, %eax
callq 0x2a9bf
movq %r15, %rdi
callq 0x9cb7
movq %r14, %rdi
pushq $0x42
popq %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8633
movq 0x18(%rsp), %r8
movq (%rsp), %rdi
movl %ebp, %r14d
movq 0x50(%rdi), %rax
movq 0x8(%rax), %rax
movq (%rax,%r8,8), %rax
movq 0x18(%rax), %rax
movq (%rax,%rbx,8), %rsi
movl 0x8(%rsi), %eax
cmpl $0xb, %eax
je 0x9402
cmpl $0x8, %eax
jne 0x974b
movq 0x8(%rsp), %rdi
callq 0x6f5d
movq 0x18(%rsp), %r8
movq (%rsp), %rdi
incq %rbx
jmp 0x92f9
movq 0x8(%rsp), %rbx
incq %r8
jmp 0x92bd
movq 0x20(%rbx), %rax
movq -0x8(%rcx,%rax,8), %rax
movq %rax, 0x28(%rbx)
pushq $0x3b
popq %rdi
callq 0x9e02
movq %rax, (%rsp)
pushq $0x3c
popq %rdi
callq 0x9e02
movq %rax, %r14
movl 0x38(%rbx), %eax
decl %eax
cmpl $0x7, %eax
ja 0x967b
leaq 0x234fc(%rip), %rcx     # 0x2c94c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
movq %rax, %r12
movq 0x30(%rbx), %rdi
callq 0x1bf90
movq %rax, %rdi
callq 0x204b9
movl 0x4(%r12), %esi
testl %eax, %eax
je 0x9567
pushq $0x55
popq %rdi
callq 0x9f13
pushq $0x27
jmp 0x9571
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
movq %rax, %r12
pushq $0x6
popq %rbp
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r13
movl 0x37d92(%rip), %edi     # 0x41250
movl %ebp, %esi
callq 0x9f13
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x9759
pushq $0x8
popq %rdi
pushq $0x4
popq %rbp
movq %r12, %rsi
jmp 0x959e
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
pushq $0x6
popq %rbp
xorl %edi, %edi
movq %rax, %rsi
jmp 0x95fc
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
movq %rax, %r12
pushq $0x4
popq %rbp
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r13
movl 0x37d3d(%rip), %edi     # 0x41260
movl %ebp, %esi
callq 0x9f13
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x9759
pushq $0x8
popq %rdi
movq %r12, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r12
movl 0x37d18(%rip), %edi     # 0x41268
jmp 0x9666
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
movq %rax, %r12
movl 0x4(%rax), %esi
pushq $0x15
popq %rdi
callq 0x9f13
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
jmp 0x967b
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
pushq $0x4
popq %rbp
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r12
movl 0x37cb0(%rip), %edi     # 0x41260
jmp 0x9666
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
movq %rax, %r12
pushq $0x4
popq %rbp
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r13
movl 0x37c82(%rip), %edi     # 0x41260
movl %ebp, %esi
callq 0x9f13
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x9759
pushq $0x8
popq %rdi
pushq $0x6
popq %rbp
movq %r12, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r12
movl 0x37c42(%rip), %edi     # 0x41250
jmp 0x9666
movq 0x30(%rbx), %rsi
movq %rbx, %rdi
callq 0x8925
movq %rax, %r12
pushq $0x6
popq %rbp
xorl %edi, %edi
movq %rax, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r13
movl 0x37c17(%rip), %edi     # 0x41250
movl %ebp, %esi
callq 0x9f13
movq %rbx, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x9759
pushq $0x8
popq %rdi
movq %r12, %rsi
xorl %edx, %edx
movl %ebp, %ecx
callq 0x9e39
movq %rax, %r12
movl 0x37bf2(%rip), %edi     # 0x41258
movl %ebp, %esi
callq 0x9f13
movq %rbx, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x9759
leaq 0x3806e(%rip), %rbx     # 0x416f0
xorl %r13d, %r13d
movq 0x8(%rsp), %r15
cmpl $0x0, (%r13,%rbx)
je 0x96d4
movq 0x78(%r15,%r13,2), %rax
movl 0x4(%rax), %edi
callq 0x9cab
movl %eax, %ebp
movq 0x78(%r15,%r13,2), %r12
movl (%r13,%rbx), %edi
callq 0x9e02
testl %ebp, %ebp
pushq $0x27
popq %rsi
pushq $0x1
popq %rcx
cmovel %ecx, %esi
movq %r15, %rdi
movq %r12, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
addq $0x4, %r13
jmp 0x968a
pushq $0x1
popq %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
movq %r14, %rdx
movq (%rsp), %rcx
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x8633
pushq $0x1c
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8633
pushq $0x3f
popq %rsi
movq %rbx, %rdi
xorl %edx, %edx
xorl %eax, %eax
callq 0x8633
movq %rbx, %rdi
callq 0xd79c
movq %rbx, %rdi
callq 0xa9a0
movq 0x70(%rbx), %rax
movq 0x10(%rax), %rdi
pushq $0x10
popq %rsi
callq 0x2ac13
movq 0x70(%rbx), %rcx
movq %rax, 0x10(%rcx)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x235be(%rip), %rdi     # 0x2cd10
xorl %eax, %eax
callq 0x1205c