// File: /workspace/github_c_makefile_star2_O2/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
cmpq $0x66, %r14
je 0x5c59
movl %r14d, %edi
callq 0x9e02
incq %r14
jmp 0x5c46
leaq 0x18(%rsp), %rax
andq $0x0, (%rax)
leaq 0x10(%rsp), %rax
andq $0x0, (%rax)
leaq 0x28(%rsp), %r13
andq $0x0, (%r13)
leaq 0x20(%rsp), %r15
andq $0x0, (%r15)
leaq 0x16552(%rip), %rdi     # 0x1c1d7
leaq 0x165c4(%rip), %rsi     # 0x1c250
callq 0x2a188
movq %rax, %r14
movq %rax, %rdi
callq 0x4fbd
leaq 0x585d5(%rip), %rbp     # 0x5e278
movq 0x90(%rbp), %rdi
movq %r14, %rsi
callq 0x4db0
movq 0x90(%rbp), %rdi
callq 0x1d890
movq 0x48(%rbp), %rax
xorl %r12d, %r12d
cmpq %rax, %r12
jae 0x5d12
movq 0x40(%rbp), %rcx
movq (%rcx,%r12,8), %rdi
movl 0x8(%rdi), %ecx
cmpq $0x7, %rcx
je 0x5d0d
cmpl $0xd, %ecx
je 0x5d0d
cmpl $0xb, %ecx
jne 0x6003
callq 0x25834
movq %rax, %rdi
movq %r14, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x10(%rsp), %rcx
movq %r13, %r8
movq %r15, %r9
callq 0xdc1f
movq 0x48(%rbp), %rax
incq %r12
jmp 0x5cc5
callq 0x1d8d4
leaq 0x500(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x41b0
testq %rax, %rax
je 0x601c
leaq 0x259cf(%rip), %r15     # 0x2b708
leaq 0x500(%rsp), %r12
xorl %r13d, %r13d
cmpq (%rbp), %r13
jae 0x5d6a
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
jmp 0x5d44
leaq 0x248e4(%rip), %rdi     # 0x2a655
leaq 0x248f4(%rip), %rsi     # 0x2a66c
callq 0x2a188
movq %rax, %r12
leaq 0x25994(%rip), %rdi     # 0x2b71b
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x4330
xorl %r15d, %r15d
cmpq 0x20(%rsp), %r15
jae 0x5dbb
movq 0x28(%rsp), %rax
movq (%rax,%r15,8), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %r12, %rcx
callq 0x58bd
incq %r15
jmp 0x5d98
movq %r12, 0x8(%rsp)
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x41f0
leaq 0x25950(%rip), %rdi     # 0x2b722
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x4330
xorl %r15d, %r15d
leaq 0x900(%rsp), %r13
leaq 0x30(%rsp), %rbp
cmpq 0x10(%rsp), %r15
jae 0x5ef4
movq 0x18(%rsp), %rax
movq (%rax,%r15,8), %r12
movl $0x4b8, %edx            # imm = 0x4B8
leaq 0x48(%rsp), %rdi
xorl %esi, %esi
callq 0x41a0
callq 0x9d96
movl $0x400, %esi            # imm = 0x400
movq %r13, %rdi
callq 0x41b0
testq %rax, %rax
je 0x5ff2
leaq 0x163a0(%rip), %rdi     # 0x1c1d7
leaq 0x16412(%rip), %rsi     # 0x1c250
callq 0x2a188
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 0x5ea9
pushq $0x4
popq %rdi
callq 0x9da2
movq %rax, 0x98(%rsp)
movq %rbp, %rdi
movq %r12, %rsi
movq %r14, %rdx
movq 0x8(%rsp), %rcx
callq 0x8fb4
leaq 0x5831d(%rip), %rax     # 0x5e1e0
cmpb $0x0, 0x69(%rax)
je 0x5ede
movq 0x3b100(%rip), %rax     # 0x40fd0
movq (%rax), %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x603e
movq %rbx, %rdi
movq %rbp, %rsi
movq %r12, %rdx
callq 0x603e
incq %r15
jmp 0x5df0
pushq $0x1f
popq %r15
leaq 0x592e9(%rip), %r13     # 0x5f1e8
leaq 0x592d2(%rip), %rbp     # 0x5f1d8
leaq 0x582bb(%rip), %r14     # 0x5e1c8
cmpq (%r13), %r15
jae 0x5faa
movq (%rbp), %rax
movq (%rax,%r15,8), %rdi
cmpb $0x0, 0x95(%rdi)
je 0x5fa2
callq 0x1fd76
cmpb $0x0, 0x96(%rax)
jne 0x5fa2
cmpb $0x0, 0x94(%rax)
jne 0x5fa2
movq %rax, %rdi
callq 0x1fd76
cmpl $0x19, (%rax)
je 0x5fa2
cmpb $0x0, 0x96(%rax)
jne 0x5fa2
movb $0x1, 0x96(%rax)
movq %rax, %rdi
callq 0x10c8f
movq %rax, %r12
cmpb $0x0, 0x18(%rax)
je 0x5f73
movb $0x1, 0x19(%r12)
cmpl $0x0, (%r14)
jne 0x5f8f
movq 0x10(%r12), %rdx
movq %rbx, %rdi
leaq 0x25715(%rip), %rsi     # 0x2b69d
xorl %eax, %eax
callq 0x4240
movq %rbx, %rdi
movq %r12, %rsi
callq 0x59d9
movq %r12, %rdi
callq 0x4568
incq %r15
jmp 0x5f0d
pushq $0xa
popq %rbp
movl %ebp, %edi
movq %rbx, %rsi
callq 0x41f0
movl %ebp, %edi
movq %rbx, %rsi
callq 0x41f0
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x5764
movl %ebp, %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 0x25e20(%rip), %rdi     # 0x2be19
leaq 0x900(%rsp), %rsi
jmp 0x6015
leaq 0x57c96(%rip), %rax     # 0x5dca0
movq (%rax,%rcx,8), %rsi
leaq 0x256c4(%rip), %rdi     # 0x2b6d9
xorl %eax, %eax
callq 0x1205c
callq 0x4070
movl (%rax), %edi
callq 0x4350
leaq 0x256c2(%rip), %rdi     # 0x2b6f1
movq %rax, %rsi
jmp 0x6015