+ // construct arg stack
+ for (i = argc_repush - 1; i >= 0; i--) {
+ if (pp->arg[i].reg == NULL) {
+ fprintf(f, "\tmovl %d(%%esp), %%ecx\n",
+ (sarg_ofs + stack_args - 1) * 4);
+ fprintf(f, "\tpushl %%ecx\n");
+ stack_args--;
+ }
+ else {
+ if (IS(pp->arg[i].reg, "ecx"))
+ // must reload original ecx
+ fprintf(f, "\tmovl %d(%%esp), %%ecx\n",
+ (sarg_ofs - 2) * 4);
+
+ fprintf(f, "\tpushl %%%s\n", pp->arg[i].reg);
+ }
+ sarg_ofs++;
+ }
+
+ // no worries about calling conventions - always __cdecl
+ fprintf(f, "\n\tcall _%s\n\n", sym);
+
+ if (sarg_ofs > saved_regs + 1)
+ fprintf(f, "\tadd $%d,%%esp\n",
+ (sarg_ofs - (saved_regs + 1)) * 4);
+
+ if (!ret64)
+ fprintf(f, "\tpopl %%edx\n");
+ fprintf(f, "\tpopl %%ecx\n");
+
+ if (pp->is_stdcall && pp->argc_stack)
+ fprintf(f, "\tret $%d\n\n", pp->argc_stack * 4);
+ else
+ fprintf(f, "\tret\n\n");