// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/6/gengas.c
// Function: gengas
void
gengas(FILE *fd)
{
	Htab *globls, *strtab;
	Node *n, **blob;
	Func **fn;
	char dir[1024], *path;
	size_t nfn, nblob;
	size_t i;

	/* ensure that all physical registers have a loc created before any
	 * other locs, so that locmap[Physreg] maps to the Loc for the physreg
	 * in question */
	for (i = 0; i < Nreg; i++)
		locphysreg(i);

	fn = NULL;
	nfn = 0;
	blob = NULL;
	nblob = 0;
	globls = mkht(varhash, vareq);
	initconsts(globls);

	/* We need to define all global variables before use */
	fillglobls(file.globls, globls);

	pushstab(file.globls);
	for (i = 0; i < file.nstmts; i++) {
		n = file.stmts[i];
		switch (n->type) {
		case Nuse: /* nothing to do */
		case Nimpl:
			break;
		case Ndecl:
			n = flattenfn(n);
			simpglobl(n, globls, &fn, &nfn, &blob, &nblob);
			break;
		default:
			die("Bad node %s in toplevel", nodestr[n->type]);
			break;
		}
	}
	popstab();

	if (!getcwd(dir, sizeof dir))
		die("could not get cwd: %s\n", strerror(errno));
	for (i = 0; i < file.nfiles; i++) {
		path = file.files[i];
		fprintf(fd, ".file %zd \"%s/%s\"\n", i + 1, dir, path);
	}

	strtab = mkht(strlithash, strliteq);
	fprintf(fd, ".data\n");
	for (i = 0; i < nblob; i++)
		genblob(fd, blob[i], globls, strtab);
	fprintf(fd, "\n");

	fprintf(fd, ".text\n");
	for (i = 0; i < nfn; i++)
		genfunc(fd, fn[i], globls, strtab);
	gentypes(fd);
	fprintf(fd, "\n");

	genstrings(fd, strtab);
	fprintf(fd, "\n");

	fclose(fd);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd08, %rsp            # imm = 0xD08
movq %rdi, %rbx
xorl %r14d, %r14d
movl %r14d, %edi
callq 0xa93c
incq %r14
cmpq $0x66, %r14
jne 0x633a
xorl %eax, %eax
movq %rax, 0x20(%rsp)
movq %rax, 0x10(%rsp)
movq %rax, 0x28(%rsp)
movq %rax, 0x8(%rsp)
leaq 0x182e6(%rip), %rdi     # 0x1e64e
leaq 0x1834e(%rip), %rsi     # 0x1e6bd
callq 0x2d678
movq %rax, %r14
movq %rax, %rdi
callq 0x5629
leaq 0x5aef2(%rip), %rbp     # 0x61278
movq 0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x5404
movq 0x90(%rbp), %rdi
callq 0x1fe30
movq 0x48(%rbp), %rax
testq %rax, %rax
je 0x6406
movq 0x40(%rbp), %rcx
xorl %r12d, %r12d
leaq 0x28(%rsp), %r13
leaq 0x8(%rsp), %r15
movq (%rcx,%r12,8), %rdi
movl 0x8(%rdi), %edx
cmpq $0x7, %rdx
je 0x63fe
cmpl $0xd, %edx
je 0x63fe
cmpl $0xb, %edx
jne 0x6721
callq 0x288c4
movq %rax, %rdi
movq %r14, %rsi
leaq 0x20(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r13, %r8
movq %r15, %r9
callq 0xf011
movq 0x40(%rbp), %rcx
movq 0x48(%rbp), %rax
incq %r12
cmpq %rax, %r12
jb 0x63bb
callq 0x1fe76
leaq 0x500(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x41b0
testq %rax, %rax
je 0x673a
cmpq $0x0, (%rbp)
je 0x6463
leaq 0x292d4(%rip), %r15     # 0x2f708
leaq 0x500(%rsp), %r12
xorl %r13d, %r13d
movq 0x8(%rbp), %rax
movq (%rax,%r13,8), %r8
incq %r13
movq %rbx, %rdi
movq %r15, %rsi
movq %r13, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0x4240
cmpq (%rbp), %r13
jb 0x643f
leaq 0x27702(%rip), %rdi     # 0x2db6c
leaq 0x27712(%rip), %rsi     # 0x2db83
callq 0x2d678
movq %rax, %r12
leaq 0x2929b(%rip), %rdi     # 0x2f71b
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x4330
cmpq $0x0, 0x8(%rsp)
je 0x64be
xorl %r15d, %r15d
movq 0x28(%rsp), %rax
movq (%rax,%r15,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x5f75
incq %r15
cmpq 0x8(%rsp), %r15
jb 0x649d
movq %r12, 0x18(%rsp)
movl $0xa, %edi
movq %rbx, %rsi
callq 0x41f0
leaq 0x2924b(%rip), %rdi     # 0x2f722
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x4330
cmpq $0x0, 0x10(%rsp)
je 0x6606
xorl %r15d, %r15d
leaq 0x900(%rsp), %r13
leaq 0x30(%rsp), %rbp
movq 0x20(%rsp), %rax
movq (%rax,%r15,8), %r12
movl $0x4b8, %edx            # imm = 0x4B8
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x41a0
callq 0xa8ce
movl $0x400, %esi            # imm = 0x400
movq %r13, %rdi
callq 0x41b0
testq %rax, %rax
je 0x6710
leaq 0x1810d(%rip), %rdi     # 0x1e64e
leaq 0x18175(%rip), %rsi     # 0x1e6bd
callq 0x2d678
movq %rax, 0x78(%rsp)
movq (%r12), %rax
movq %rax, 0x30(%rsp)
movups 0x28(%r12), %xmm0
movups %xmm0, 0x80(%rsp)
movq %r14, 0x90(%rsp)
movq 0x40(%r12), %rax
movq %rax, 0x60(%rsp)
movl 0x48(%r12), %eax
movl %eax, 0x68(%rsp)
movq 0x50(%r12), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
callq 0x4340
movq %rax, 0x38(%rsp)
cmpb $0x0, 0x59(%r12)
je 0x65b5
movl $0x4, %edi
callq 0xa8da
movq %rax, 0x98(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq 0x18(%rsp), %rcx
callq 0x99ae
leaq 0x5ac11(%rip), %rax     # 0x611e0
cmpb $0x0, 0x69(%rax)
je 0x65ea
movq 0x3d9f4(%rip), %rax     # 0x43fd0
movq (%rax), %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x675c
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x675c
incq %r15
cmpq 0x10(%rsp), %r15
jb 0x6505
leaq 0x5bbdb(%rip), %r15     # 0x621e8
cmpq $0x20, (%r15)
jb 0x66c2
movl $0x1f, %r13d
leaq 0x5bbb4(%rip), %rbp     # 0x621d8
leaq 0x5ab9d(%rip), %r14     # 0x611c8
movq (%rbp), %rax
movq (%rax,%r13,8), %rdi
cmpb $0x0, 0x95(%rdi)
je 0x66b6
callq 0x22851
cmpb $0x0, 0x96(%rax)
jne 0x66b6
cmpb $0x0, 0x94(%rax)
jne 0x66b6
movq %rax, %rdi
callq 0x22851
cmpl $0x19, (%rax)
je 0x66b6
cmpb $0x0, 0x96(%rax)
jne 0x66b6
movb $0x1, 0x96(%rax)
movq %rax, %rdi
callq 0x1234a
movq %rax, %r12
cmpb $0x0, 0x18(%rax)
je 0x6687
movb $0x1, 0x19(%r12)
cmpl $0x0, (%r14)
jne 0x66a3
movq 0x10(%r12), %rdx
movq %rbx, %rdi
leaq 0x29001(%rip), %rsi     # 0x2f69d
xorl %eax, %eax
callq 0x4240
movq %rbx, %rdi
movq %r12, %rsi
callq 0x6091
movq %r12, %rdi
callq 0x49f2
incq %r13
cmpq (%r15), %r13
jb 0x662b
movl $0xa, %edi
movq %rbx, %rsi
callq 0x41f0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x41f0
movq %rbx, %rdi
movq 0x18(%rsp), %rsi
callq 0x5dfd
movl $0xa, %edi
movq %rbx, %rsi
callq 0x41f0
movq %rbx, %rdi
callq 0x4110
addq $0xd08, %rsp            # imm = 0xD08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29702(%rip), %rdi     # 0x2fe19
leaq 0x900(%rsp), %rsi
jmp 0x6733
leaq 0x5a578(%rip), %rax     # 0x60ca0
movq (%rax,%rdx,8), %rsi
leaq 0x28fa6(%rip), %rdi     # 0x2f6d9
xorl %eax, %eax
callq 0x13844
callq 0x4070
movl (%rax), %edi
callq 0x4350
leaq 0x28fa4(%rip), %rdi     # 0x2f6f1
movq %rax, %rsi
jmp 0x6733