#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "prescheme.h"
#include "scheme48vm-prelude.h"
#include "scheme48vm.h"
#include "scheme48heap.h"

struct image_location {
  long new_descriptor;
  long next;
};
struct table {
  long *keys;
  struct image_location **values;
  long count;
  long size;
};
static struct image_location *table_ref(struct table*, long);
static char resumer_recordP(long);
static long trace_image_value(long);
long s48_write_image(long, long, FILE *);
static long SstatusS;
static FILE * Simage_portS;
static char * Simage_bufferS;
static char * Simage_buffer_pointerS;
static struct table *Sstob_tableS;
static long Sfirst_stobS;
static struct image_location *Slast_stobS;
static char * Simage_beginS;
static char * Simage_hpS;
static long Sresumer_countS;
static long Sresumer_recordsS;
static long Sundumpable_recordsS;
static long Sundumpable_countS;

static struct image_location *table_ref(struct table *table_0X, long key_1X)
{
  long arg0K0;
  long next_5X;
  long i_4X;
  long *keys_3X;
  long size_2X;
 {  if ((0 < (table_0X->size))) {
    size_2X = table_0X->size;
    keys_3X = table_0X->keys;
    arg0K0 = ((key_1X ^ ((((key_1X)<<1)) ^ (((key_1X)>>10)))) & (-1 + size_2X));
    goto L1601;}
  else {
    return (NULL);}}
 L1601: {
  i_4X = arg0K0;
  next_5X = *(keys_3X + i_4X);
  if ((key_1X == next_5X)) {
    return (*((table_0X->values) + i_4X));}
  else {
    if ((0 == next_5X)) {
      if ((i_4X == (table_0X->size))) {
        arg0K0 = 0;
        goto L1601;}
      else {
        return (NULL);}}
    else {
      arg0K0 = (1 + i_4X);
      goto L1601;}}}
}
static char resumer_recordP(long stob_6X)
{
  long type_7X;
 {  if ((3 == (3 & stob_6X))) {
    if ((9 == (31 & ((((*((long *) ((((char *) (-3 + stob_6X))) + -4))))>>2))))) {
      type_7X = *((long *) (((char *) (-3 + stob_6X))));
      if ((3 == (3 & type_7X))) {
        if ((9 == (31 & ((((*((long *) ((((char *) (-3 + type_7X))) + -4))))>>2))))) {
          return (3 == (3 & (*((long *) ((((char *) (-3 + type_7X))) + 4)))));}
        else {
          return 0;}}
      else {
        return 0;}}
    else {
      return 0;}}
  else {
    return 0;}}
}
static long trace_image_value(long thing_8X)
{
  long arg0K0;
  struct image_location *arg1K0;
  struct image_location *merged_arg1K2;
  long merged_arg0K0;
  long merged_arg0K1;
  struct table *merged_arg2K0;

  int table_setB_return_tag;
  int gc_recordP_return_tag;
  char gc_recordP0_return_value;
  struct table *table_9X;
  long key_10X;
  struct image_location *value_11X;
  long x_12X;
  long i_47X;
  struct image_location *value_46X;
  long key_45X;
  long i_44X;
  long i_43X;
  struct image_location **new_values_42X;
  long *new_keys_41X;
  long new_size_40X;
  struct image_location **old_values_39X;
  long v_38X;
  long old_size_37X;
  long *old_keys_36X;
  long next_35X;
  long i_34X;
  long *keys_33X;
  long size_32X;
  long header_31X;
  char v_30X;
  long x_29X;
  struct image_location *new_28X;
  struct image_location *new_27X;
  struct image_location *image_location_26X;
  long new_descriptor_25X;
  char * data_addr_24X;
  long h_23X;
  long stob_22X;
  struct image_location *image_location_21X;
  long new_alias_20X;
  long i_19X;
  long len_18X;
  long vector_17X;
  char v_16X;
  long type_15X;
  char v_14X;
  struct image_location *have_13X;
 {  if ((3 == (3 & thing_8X))) {
    have_13X = table_ref((Sstob_tableS), thing_8X);
    if ((NULL == have_13X)) {
      merged_arg0K0 = thing_8X;
      gc_recordP_return_tag = 0;
      goto gc_recordP;
     gc_recordP_return_0:
      v_14X = gc_recordP0_return_value;
      if (v_14X) {
        type_15X = *((long *) (((char *) (-3 + thing_8X))));
        merged_arg0K0 = type_15X;
        gc_recordP_return_tag = 1;
        goto gc_recordP;
       gc_recordP_return_1:
        v_16X = gc_recordP0_return_value;
        if (v_16X) {
          if ((1 == (*((long *) ((((char *) (-3 + type_15X))) + 4))))) {
            if (((Sundumpable_countS) < ((((3 + ((long)(((unsigned long)(*((long *) ((((char *) (-3 + (Sundumpable_recordsS)))) + -4))))>>8))))>>2)))) {
              vector_17X = Sundumpable_recordsS;
              len_18X = (((3 + ((long)(((unsigned long)(*((long *) ((((char *) (-3 + vector_17X))) + -4))))>>8))))>>2);
              arg0K0 = 0;
              goto L3814;}
            else {
              goto L5065;}}
          else {
            arg0K0 = thing_8X;
            goto L4165;}}
        else {
          arg0K0 = thing_8X;
          goto L4165;}}
      else {
        arg0K0 = thing_8X;
        goto L4165;}}
    else {
      return (have_13X->new_descriptor);}}
  else {
    return thing_8X;}}
 L3814: {
  i_19X = arg0K0;
  if ((i_19X == len_18X)) {
    *((long *) ((((char *) (-3 + (Sundumpable_recordsS)))) + ((((Sundumpable_countS))<<2)))) = (long) (thing_8X);
    Sundumpable_countS = (1 + (Sundumpable_countS));
    goto L5065;}
  else {
    if (((*((long *) ((((char *) (-3 + vector_17X))) + (((i_19X)<<2))))) == thing_8X)) {
      goto L5065;}
    else {
      arg0K0 = (1 + i_19X);
      goto L3814;}}}
 L5065: {
  new_alias_20X = trace_image_value((*((long *) ((((char *) (-3 + thing_8X))) + 4))));
  image_location_21X = (struct image_location*)malloc(sizeof(struct image_location));
  if ((NULL == image_location_21X)) {
    arg1K0 = image_location_21X;
    goto L5069;}
  else {
    image_location_21X->new_descriptor = new_alias_20X;
    image_location_21X->next = 0;
    arg1K0 = image_location_21X;
    goto L5069;}}
 L4165: {
  stob_22X = arg0K0;
  h_23X = *((long *) ((((char *) (-3 + stob_22X))) + -4));
  data_addr_24X = (Simage_hpS) + 4;
  Simage_hpS = (data_addr_24X + (-4 & (3 + ((long)(((unsigned long)h_23X)>>8)))));
  new_descriptor_25X = 3 + (((long) data_addr_24X));
  image_location_26X = (struct image_location*)malloc(sizeof(struct image_location));
  if ((NULL == image_location_26X)) {
    arg1K0 = image_location_26X;
    goto L4175;}
  else {
    image_location_26X->new_descriptor = new_descriptor_25X;
    image_location_26X->next = 0;
    arg1K0 = image_location_26X;
    goto L4175;}}
 L5069: {
  new_27X = arg1K0;
  if ((NULL == new_27X)) {
    (Sstob_tableS)->size = 0;
    return new_alias_20X;}
  else {
    merged_arg2K0 = (Sstob_tableS);
    merged_arg0K1 = thing_8X;
    merged_arg1K2 = new_27X;
    table_setB_return_tag = 0;
    goto table_setB;
   table_setB_return_0:
    return new_alias_20X;}}
 L4175: {
  new_28X = arg1K0;
  if ((NULL == new_28X)) {
    (Sstob_tableS)->size = 0;
    return new_descriptor_25X;}
  else {
    x_29X = Sfirst_stobS;
    if ((1 == x_29X)) {
      Sfirst_stobS = stob_22X;
      goto L4194;}
    else {
      (Slast_stobS)->next = stob_22X;
      goto L4194;}}}
 L4194: {
  Slast_stobS = new_28X;
  new_28X->next = 1;
  merged_arg2K0 = (Sstob_tableS);
  merged_arg0K1 = stob_22X;
  merged_arg1K2 = new_28X;
  table_setB_return_tag = 1;
  goto table_setB;
 table_setB_return_1:
  v_30X = resumer_recordP(stob_22X);
  if (v_30X) {
    Sresumer_countS = (1 + (Sresumer_countS));
    return new_descriptor_25X;}
  else {
    return new_descriptor_25X;}}
 gc_recordP: {
  x_12X = merged_arg0K0;{
  if ((3 == (3 & x_12X))) {
    header_31X = *((long *) ((((char *) (-3 + x_12X))) + -4));
    if ((3 == (3 & header_31X))) {
      if ((3 == (3 & header_31X))) {
        gc_recordP0_return_value = (9 == (31 & ((((*((long *) ((((char *) (-3 + header_31X))) + -4))))>>2))));
        goto gc_recordP_return;}
      else {
        gc_recordP0_return_value = 0;
        goto gc_recordP_return;}}
    else {
      if ((3 == (3 & x_12X))) {
        gc_recordP0_return_value = (9 == (31 & ((((*((long *) ((((char *) (-3 + x_12X))) + -4))))>>2))));
        goto gc_recordP_return;}
      else {
        gc_recordP0_return_value = 0;
        goto gc_recordP_return;}}}
  else {
    gc_recordP0_return_value = 0;
    goto gc_recordP_return;}}
 gc_recordP_return:
  switch (gc_recordP_return_tag) {
  case 0: goto gc_recordP_return_0;
  default: goto gc_recordP_return_1;
  }}

 table_setB: {
  table_9X = merged_arg2K0;
  key_10X = merged_arg0K1;
  value_11X = merged_arg1K2;{
  if ((0 < (table_9X->size))) {
    size_32X = table_9X->size;
    keys_33X = table_9X->keys;
    arg0K0 = ((key_10X ^ ((((key_10X)<<1)) ^ (((key_10X)>>10)))) & (-1 + size_32X));
    goto L2696;}
  else {
    goto table_setB_return;}}
 L2696: {
  i_34X = arg0K0;
  next_35X = *(keys_33X + i_34X);
  if ((key_10X == next_35X)) {
    *((table_9X->values) + i_34X) = value_11X;
    goto table_setB_return;}
  else {
    if ((0 == next_35X)) {
      if ((i_34X == (table_9X->size))) {
        arg0K0 = 0;
        goto L2696;}
      else {
        *((table_9X->keys) + i_34X) = key_10X;
        *((table_9X->values) + i_34X) = value_11X;
        table_9X->count = (1 + (table_9X->count));
        if (((table_9X->count) == ((table_9X->size) / 3))) {
          old_keys_36X = table_9X->keys;
          old_size_37X = table_9X->size;
          v_38X = table_9X->size;
          old_values_39X = table_9X->values;
          new_size_40X = ((v_38X)<<1);
          new_keys_41X = (long*)malloc(sizeof(long) * (1 + new_size_40X));
          new_values_42X = (struct image_location**)malloc(sizeof(struct image_location*) * new_size_40X);
          if ((NULL == new_keys_41X)) {
            goto L1874;}
          else {
            if ((NULL == new_values_42X)) {
              goto L1874;}
            else {
              table_9X->keys = new_keys_41X;
              table_9X->values = new_values_42X;
              table_9X->size = new_size_40X;
              table_9X->count = 0;
              arg0K0 = 0;
              goto L2027;}}}
        else {
          goto table_setB_return;}}}
    else {
      arg0K0 = (1 + i_34X);
      goto L2696;}}}
 L1874: {
  if ((NULL == new_keys_41X)) {
    goto L1882;}
  else {
    free(new_keys_41X);
    goto L1882;}}
 L2027: {
  i_43X = arg0K0;
  if ((i_43X < (1 + new_size_40X))) {
    *(new_keys_41X + i_43X) = 0;
    arg0K0 = (1 + i_43X);
    goto L2027;}
  else {
    arg0K0 = 0;
    goto L1905;}}
 L1882: {
  if ((NULL == new_values_42X)) {
    goto L1890;}
  else {
    free(new_values_42X);
    goto L1890;}}
 L1905: {
  i_44X = arg0K0;
  if ((i_44X == old_size_37X)) {
    free(old_keys_36X);
    free(old_values_39X);
    goto table_setB_return;}
  else {
    key_45X = *(old_keys_36X + i_44X);
    if ((0 == key_45X)) {
      goto L1921;}
    else {
      value_46X = *(old_values_39X + i_44X);
      arg0K0 = ((key_45X ^ ((((key_45X)<<1)) ^ (((key_45X)>>10)))) & (-1 + new_size_40X));
      goto L2049;}}}
 L1890: {
  table_9X->size = 0;
  goto table_setB_return;}
 L1921: {
  arg0K0 = (1 + i_44X);
  goto L1905;}
 L2049: {
  i_47X = arg0K0;
  if ((0 == (*(new_keys_41X + i_47X)))) {
    if ((i_47X == new_size_40X)) {
      arg0K0 = 0;
      goto L2049;}
    else {
      *(new_keys_41X + i_47X) = key_45X;
      *(new_values_42X + i_47X) = value_46X;
      goto L1921;}}
  else {
    arg0K0 = (1 + i_47X);
    goto L2049;}}
 table_setB_return:
  switch (table_setB_return_tag) {
  case 0: goto table_setB_return_0;
  default: goto table_setB_return_1;
  }}

}
long s48_write_image(long resume_proc_48X, long undumpables_49X, FILE * port_50X)
{
  struct table *arg2K0;
  long arg0K0;
  char * arg3K0;
  long merged_arg0K0;
  long merged_arg0K1;
  char * merged_arg3K0;

  int copy_image_data_return_tag;
  int write_descriptor_return_tag;
  int write_shared_table_return_tag;
  char write_shared_table0_return_value;
  char * start_51X;
  long size_52X;
  long descriptor_53X;
  long table_54X;
  long have_193X;
  long have_192X;
  long v_191X;
  long value_190X;
  struct image_location *have_189X;
  long thing_188X;
  long link_187X;
  struct image_location *v_186X;
  long next_185X;
  long shared_184X;
  long link_183X;
  char temp_182X;
  long i_181X;
  long value_180X;
  long v_179X;
  struct image_location *have_178X;
  long v_177X;
  long v_176X;
  struct image_location *have_175X;
  long thing_174X;
  struct image_location *have_173X;
  long thing_172X;
  long x_171X;
  char * addr_170X;
  long v_169X;
  long value_168X;
  struct image_location *have_167X;
  long thing_166X;
  char * addr_165X;
  char * start_164X;
  long header_163X;
  long next_162X;
  struct image_location *have_161X;
  long thing_160X;
  struct image_location *have_159X;
  char * addr_158X;
  long v_157X;
  long link_156X;
  struct image_location *v_155X;
  long next_154X;
  char * start_153X;
  long header_152X;
  long next_151X;
  long value_150X;
  long have_149X;
  long available_148X;
  long size_147X;
  char * start_146X;
  long header_145X;
  long shared_144X;
  long link_143X;
  struct image_location *v_142X;
  long next_141X;
  struct image_location *have_140X;
  long thing_139X;
  long i_138X;
  long link_137X;
  long symbol_136X;
  long v_135X;
  long link_134X;
  struct image_location *v_133X;
  long next_132X;
  struct image_location **values_131X;
  long *keys_130X;
  struct table *table_129X;
  long link_128X;
  struct image_location *have_127X;
  long thing_126X;
  long id_125X;
  char * addr_124X;
  long symbol_123X;
  long have_122X;
  char v_121X;
  struct image_location *location_120X;
  long stob_119X;
  char * start_118X;
  long header_117X;
  struct image_location *have_116X;
  long thing_115X;
  long link_114X;
  long v_113X;
  long v_112X;
  long i_111X;
  struct image_location *v_110X;
  long thing_109X;
  long table_108X;
  struct image_location *location_107X;
  long stob_106X;
  long v_105X;
  long v_104X;
  long v_103X;
  long n_102X;
  long v_101X;
  long n_100X;
  struct image_location *have_99X;
  long thing_98X;
  long v_97X;
  long n_96X;
  struct image_location *have_95X;
  long thing_94X;
  long v_93X;
  long n_92X;
  struct image_location *have_91X;
  long thing_90X;
  long v_89X;
  long v_88X;
  long v_87X;
  long v_86X;
  long v_85X;
  long v_84X;
  long i_83X;
  long v_82X;
  struct image_location **values_81X;
  long *keys_80X;
  struct table *table_79X;
  long v_78X;
  char * data_addr_77X;
  long cells_76X;
  long v_75X;
  long v_74X;
  long v_73X;
  struct image_location *last_72X;
  char * addr_71X;
  long next_70X;
  struct image_location *image_location_69X;
  char * start_68X;
  long link_67X;
  long entry_66X;
  long header_65X;
  long stob_64X;
  long link_63X;
  long i_62X;
  long table_61X;
  long resume_proc_60X;
  struct table *v_59X;
  struct table *table_58X;
  long i_57X;
  long *keys_56X;
  char * start_address_55X;
 {  start_address_55X = ((char *) 0);
  keys_56X = (long*)malloc(sizeof(long) * 4097);
  arg0K0 = 0;
  goto L2617;}
 L2617: {
  i_57X = arg0K0;
  if ((i_57X < 4097)) {
    *(keys_56X + i_57X) = 0;
    arg0K0 = (1 + i_57X);
    goto L2617;}
  else {
    table_58X = (struct table*)malloc(sizeof(struct table));
    if ((NULL == table_58X)) {
      arg2K0 = table_58X;
      goto L2586;}
    else {
      table_58X->keys = keys_56X;
      table_58X->values = ((struct image_location**)malloc(sizeof(struct image_location*) * 4096));
      table_58X->count = 0;
      table_58X->size = 4096;
      arg2K0 = table_58X;
      goto L2586;}}}
 L2586: {
  v_59X = arg2K0;
  Sstob_tableS = v_59X;
  Sfirst_stobS = 1;
  Slast_stobS = (NULL);
  Simage_beginS = start_address_55X;
  Simage_hpS = start_address_55X;
  Sundumpable_recordsS = undumpables_49X;
  Sundumpable_countS = 0;
  Sresumer_countS = 0;
  Simage_portS = port_50X;
  Simage_bufferS = ((char *)malloc(4096));
  Simage_buffer_pointerS = (Simage_bufferS);
  SstatusS = NO_ERRORS;
  if (((Simage_bufferS) == NULL)) {
    return ENOMEM;}
  else {
    resume_proc_60X = trace_image_value(resume_proc_48X);
    table_61X = s48_exported_bindings();
    arg0K0 = 0;
    goto L3414;}}
 L3414: {
  i_62X = arg0K0;
  if ((1024 == i_62X)) {
    arg0K0 = (Sfirst_stobS);
    goto L4863;}
  else {
    link_63X = *((long *) ((((char *) (-3 + table_61X))) + (((i_62X)<<2))));
    if ((0 == (3 & link_63X))) {
      arg0K0 = (3 + (-4 & link_63X));
      goto L3388;}
    else {
      arg0K0 = link_63X;
      goto L3388;}}}
 L4863: {
  stob_64X = arg0K0;
  header_65X = *((long *) ((((char *) (-3 + stob_64X))) + -4));
  if ((2 == (3 & header_65X))) {
    if (((31 & (((header_65X)>>2))) < 16)) {
      goto L4727;}
    else {
      goto L4865;}}
  else {
    goto L4727;}}
 L3388: {
  entry_66X = arg0K0;
  if ((1 == entry_66X)) {
    arg0K0 = (1 + i_62X);
    goto L3414;}
  else {trace_image_value(entry_66X);
    link_67X = *((long *) ((((char *) (-3 + entry_66X))) + 12));
    if ((0 == (3 & link_67X))) {
      arg0K0 = (3 + (-4 & link_67X));
      goto L3388;}
    else {
      arg0K0 = link_67X;
      goto L3388;}}}
 L4727: {
  if ((1078 == header_65X)) {
    goto L4865;}
  else {
    start_68X = ((char *) (-3 + stob_64X));
    arg3K0 = start_68X;
    goto L4746;}}
 L4865: {
  if ((0 < ((Sstob_tableS)->size))) {
    image_location_69X = table_ref((Sstob_tableS), stob_64X);
    next_70X = image_location_69X->next;
    if ((3 == (3 & next_70X))) {
      arg0K0 = next_70X;
      goto L4863;}
    else {
      goto L4934;}}
  else {
    goto L4934;}}
 L4746: {
  addr_71X = arg3K0;
  if ((addr_71X == (start_68X + (-4 & (3 + ((long)(((unsigned long)header_65X)>>8))))))) {
    goto L4865;}
  else {trace_image_value((*((long *) addr_71X)));
    arg3K0 = (addr_71X + 4);
    goto L4746;}}
 L4934: {
  last_72X = Slast_stobS;
  v_73X = s48_symbol_table();trace_image_value(v_73X);
  v_74X = s48_imported_bindings();trace_image_value(v_74X);
  v_75X = s48_exported_bindings();trace_image_value(v_75X);
  last_72X->next = 1;
  cells_76X = Sresumer_countS;
  data_addr_77X = (Simage_hpS) + 4;
  Simage_hpS = (data_addr_77X + (((cells_76X)<<2)));
  Sresumer_recordsS = (3 + (((long) data_addr_77X)));
  if ((0 < ((Sstob_tableS)->size))) {
    if (((SstatusS) == NO_ERRORS)) {
      PS_WRITE_CHAR(10, port_50X, v_78X)
      SstatusS = v_78X;
      goto L2290;}
    else {
      goto L2290;}}
  else {
    table_79X = Sstob_tableS;
    keys_80X = table_79X->keys;
    values_81X = table_79X->values;
    arg0K0 = 0;
    goto L5246;}}
 L2290: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(12, (Simage_portS), v_82X)
    SstatusS = v_82X;
    goto L2292;}
  else {
    goto L2292;}}
 L5246: {
  i_83X = arg0K0;
  if ((i_83X == (table_79X->size))) {
    free(keys_80X);
    free(values_81X);
    free(table_79X);
    free((Simage_bufferS));
    return ENOMEM;}
  else {
    if ((0 == (*(keys_80X + i_83X)))) {
      goto L5248;}
    else {
      free((*(values_81X + i_83X)));
      goto L5248;}}}
 L2292: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, port_50X, v_84X)
    SstatusS = v_84X;
    goto L2301;}
  else {
    goto L2301;}}
 L5248: {
  arg0K0 = (1 + i_83X);
  goto L5246;}
 L2301: {
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_string("Vanilla 32", port_50X));
    goto L2308;}
  else {
    goto L2308;}}
 L2308: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, port_50X, v_85X)
    SstatusS = v_85X;
    goto L2317;}
  else {
    goto L2317;}}
 L2317: {
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(4, (Simage_portS)));
    goto L2362;}
  else {
    goto L2362;}}
 L2362: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_86X)
    SstatusS = v_86X;
    goto L2319;}
  else {
    goto L2319;}}
 L2319: {
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(0, (Simage_portS)));
    goto L2379;}
  else {
    goto L2379;}}
 L2379: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_87X)
    SstatusS = v_87X;
    goto L2323;}
  else {
    goto L2323;}}
 L2323: {
  v_88X = (Simage_hpS) - (Simage_beginS);
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer((((v_88X)>>2)), (Simage_portS)));
    goto L2398;}
  else {
    goto L2398;}}
 L2398: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_89X)
    SstatusS = v_89X;
    goto L2329;}
  else {
    goto L2329;}}
 L2329: {
  thing_90X = s48_symbol_table();
  if ((3 == (3 & thing_90X))) {
    have_91X = table_ref((Sstob_tableS), thing_90X);
    if ((NULL == have_91X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L2416;}
    else {
      goto L2416;}}
  else {
    arg0K0 = thing_90X;
    goto L2333;}}
 L2416: {
  arg0K0 = (have_91X->new_descriptor);
  goto L2333;}
 L2333: {
  n_92X = arg0K0;
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(n_92X, (Simage_portS)));
    goto L2426;}
  else {
    goto L2426;}}
 L2426: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_93X)
    SstatusS = v_93X;
    goto L2335;}
  else {
    goto L2335;}}
 L2335: {
  thing_94X = s48_imported_bindings();
  if ((3 == (3 & thing_94X))) {
    have_95X = table_ref((Sstob_tableS), thing_94X);
    if ((NULL == have_95X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L2444;}
    else {
      goto L2444;}}
  else {
    arg0K0 = thing_94X;
    goto L2339;}}
 L2444: {
  arg0K0 = (have_95X->new_descriptor);
  goto L2339;}
 L2339: {
  n_96X = arg0K0;
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(n_96X, (Simage_portS)));
    goto L2454;}
  else {
    goto L2454;}}
 L2454: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_97X)
    SstatusS = v_97X;
    goto L2341;}
  else {
    goto L2341;}}
 L2341: {
  thing_98X = s48_exported_bindings();
  if ((3 == (3 & thing_98X))) {
    have_99X = table_ref((Sstob_tableS), thing_98X);
    if ((NULL == have_99X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L2472;}
    else {
      goto L2472;}}
  else {
    arg0K0 = thing_98X;
    goto L2345;}}
 L2472: {
  arg0K0 = (have_99X->new_descriptor);
  goto L2345;}
 L2345: {
  n_100X = arg0K0;
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(n_100X, (Simage_portS)));
    goto L2482;}
  else {
    goto L2482;}}
 L2482: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_101X)
    SstatusS = v_101X;
    goto L2347;}
  else {
    goto L2347;}}
 L2347: {
  n_102X = Sresumer_recordsS;
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(n_102X, (Simage_portS)));
    goto L2496;}
  else {
    goto L2496;}}
 L2496: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_103X)
    SstatusS = v_103X;
    goto L2349;}
  else {
    goto L2349;}}
 L2349: {
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_integer(resume_proc_60X, (Simage_portS)));
    goto L2510;}
  else {
    goto L2510;}}
 L2510: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(10, (Simage_portS), v_104X)
    SstatusS = v_104X;
    goto L2351;}
  else {
    goto L2351;}}
 L2351: {
  if (((SstatusS) == NO_ERRORS)) {
    PS_WRITE_CHAR(12, (Simage_portS), v_105X)
    SstatusS = v_105X;
    goto L5151;}
  else {
    goto L5151;}}
 L5151: {
  merged_arg0K0 = 1;
  write_descriptor_return_tag = 0;
  goto write_descriptor;
 write_descriptor_return_0:
  arg0K0 = (Sfirst_stobS);
  goto L4592;}
 L4592: {
  stob_106X = arg0K0;
  if ((3 == (3 & stob_106X))) {
    location_107X = table_ref((Sstob_tableS), stob_106X);
    if ((NULL == location_107X)) {
      ps_error("traced stob has no image-table entry", 0);
      goto L4607;}
    else {
      goto L4607;}}
  else {
    table_108X = s48_symbol_table();
    merged_arg0K0 = (*((long *) ((((char *) (-3 + table_108X))) + -4)));
    write_descriptor_return_tag = 1;
    goto write_descriptor;
   write_descriptor_return_1:
    arg0K0 = 0;
    goto L3587;}}
 L4607: {
  if ((3 == (3 & stob_106X))) {
    if ((13 == (31 & ((((*((long *) ((((char *) (-3 + stob_106X))) + -4))))>>2))))) {
      merged_arg0K0 = 1078;
      write_descriptor_return_tag = 2;
      goto write_descriptor;
     write_descriptor_return_2:
      thing_109X = *((long *) (((char *) (-3 + stob_106X))));
      if ((3 == (3 & thing_109X))) {
        v_110X = table_ref((Sstob_tableS), thing_109X);
        if ((NULL == v_110X)) {
          merged_arg0K0 = 1;
          write_descriptor_return_tag = 3;
          goto write_descriptor;
         write_descriptor_return_3:
          goto L4609;}
        else {
          goto L4338;}}
      else {
        goto L4338;}}
    else {
      goto L4344;}}
  else {
    goto L4344;}}
 L3587: {
  i_111X = arg0K0;
  if ((i_111X == ((((3 + ((long)(((unsigned long)(*((long *) ((((char *) (-3 + table_108X))) + -4))))>>8))))>>2)))) {
    v_112X = s48_imported_bindings();
    merged_arg0K0 = v_112X;
    write_shared_table_return_tag = 0;
    goto write_shared_table;
   write_shared_table_return_0:
    v_113X = s48_exported_bindings();
    merged_arg0K0 = v_113X;
    write_shared_table_return_tag = 1;
    goto write_shared_table;
   write_shared_table_return_1:
    merged_arg0K0 = (10 + ((((Sresumer_countS))<<10)));
    write_descriptor_return_tag = 4;
    goto write_descriptor;
   write_descriptor_return_4:
    arg0K0 = (Sfirst_stobS);
    goto L4687;}
  else {
    link_114X = *((long *) ((((char *) (-3 + table_108X))) + (((i_111X)<<2))));
    if ((0 == (3 & link_114X))) {
      arg0K0 = (3 + (-4 & link_114X));
      goto L3597;}
    else {
      arg0K0 = link_114X;
      goto L3597;}}}
 L4609: {
  arg0K0 = (location_107X->next);
  goto L4592;}
 L4338: {
  thing_115X = *((long *) (((char *) (-3 + stob_106X))));
  if ((3 == (3 & thing_115X))) {
    have_116X = table_ref((Sstob_tableS), thing_115X);
    if ((NULL == have_116X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L4402;}
    else {
      goto L4402;}}
  else {
    merged_arg0K0 = thing_115X;
    write_descriptor_return_tag = 5;
    goto write_descriptor;
   write_descriptor_return_5:
    goto L4609;}}
 L4344: {
  if ((3 == (3 & stob_106X))) {
    if ((6 == (31 & ((((*((long *) ((((char *) (-3 + stob_106X))) + -4))))>>2))))) {
      header_117X = *((long *) ((((char *) (-3 + stob_106X))) + -4));
      merged_arg0K0 = header_117X;
      write_descriptor_return_tag = 6;
      goto write_descriptor;
     write_descriptor_return_6:
      merged_arg0K0 = 0;
      write_descriptor_return_tag = 7;
      goto write_descriptor;
     write_descriptor_return_7:
      start_118X = (((char *) (-3 + stob_106X))) + 4;
      arg3K0 = start_118X;
      goto L3094;}
    else {
      goto L4348;}}
  else {
    goto L4348;}}
 L4687: {
  stob_119X = arg0K0;
  if ((3 == (3 & stob_119X))) {
    location_120X = table_ref((Sstob_tableS), stob_119X);
    v_121X = resumer_recordP(stob_119X);
    if (v_121X) {
      merged_arg0K0 = (location_120X->new_descriptor);
      write_descriptor_return_tag = 8;
      goto write_descriptor;
     write_descriptor_return_8:
      goto L4699;}
    else {
      goto L4699;}}
  else {
    have_122X = (Simage_buffer_pointerS) - (Simage_bufferS);
    if ((0 < have_122X)) {
      if (((SstatusS) == NO_ERRORS)) {
        SstatusS = (ps_write_block((Simage_portS), ((char *) (Simage_bufferS)), have_122X));
        goto L5194;}
      else {
        goto L5194;}}
    else {
      goto L5157;}}}
 L3597: {
  symbol_123X = arg0K0;
  arg0K0 = symbol_123X;
  goto L3631;}
 L4402: {
  merged_arg0K0 = (have_116X->new_descriptor);
  write_descriptor_return_tag = 9;
  goto write_descriptor;
 write_descriptor_return_9:
  goto L4609;}
 L3094: {
  addr_124X = arg3K0;
  if ((addr_124X == (start_118X + (-4 + (-4 & (3 + ((long)(((unsigned long)header_117X)>>8)))))))) {
    ps_write_string("Channel closed in dumped image: ", (stderr));
    id_125X = *((long *) ((((char *) (-3 + stob_106X))) + 4));
    if ((0 == (3 & id_125X))) {
      ps_write_integer((((id_125X)>>2)), (stderr));
      goto L3071;}
    else {
      ps_write_string((((char *)(((char *) (-3 + id_125X))))), (stderr));
      goto L3071;}}
  else {
    thing_126X = *((long *) addr_124X);
    if ((3 == (3 & thing_126X))) {
      have_127X = table_ref((Sstob_tableS), thing_126X);
      if ((NULL == have_127X)) {
        ps_error("traced object has no descriptor in image", 0);
        goto L3108;}
      else {
        goto L3108;}}
    else {
      arg0K0 = thing_126X;
      goto L3099;}}}
 L4348: {
  if ((3 == (3 & stob_106X))) {
    if ((1 == (31 & ((((*((long *) ((((char *) (-3 + stob_106X))) + -4))))>>2))))) {
      link_128X = *((long *) ((((char *) (-3 + stob_106X))) + 4));
      if ((0 == (3 & link_128X))) {
        arg0K0 = (3 + (-4 & link_128X));
        goto L4030;}
      else {
        arg0K0 = link_128X;
        goto L4030;}}
    else {
      goto L4352;}}
  else {
    goto L4352;}}
 L4699: {
  arg0K0 = (location_120X->next);
  goto L4687;}
 L5194: {
  Simage_buffer_pointerS = (Simage_bufferS);
  goto L5157;}
 L5157: {
  table_129X = Sstob_tableS;
  keys_130X = table_129X->keys;
  values_131X = table_129X->values;
  arg0K0 = 0;
  goto L5212;}
 L3631: {
  next_132X = arg0K0;
  if ((3 == (3 & next_132X))) {
    v_133X = table_ref((Sstob_tableS), next_132X);
    if ((NULL == v_133X)) {
      link_134X = *((long *) ((((char *) (-3 + next_132X))) + 4));
      if ((0 == (3 & link_134X))) {
        arg0K0 = (3 + (-4 & link_134X));
        goto L3631;}
      else {
        arg0K0 = link_134X;
        goto L3631;}}
    else {
      arg0K0 = next_132X;
      goto L3599;}}
  else {
    arg0K0 = next_132X;
    goto L3599;}}
 L3071: {
  { long ignoreXX;
  PS_WRITE_CHAR(10, (stderr), ignoreXX) }
  goto L4609;}
 L3108: {
  arg0K0 = (have_127X->new_descriptor);
  goto L3099;}
 L3099: {
  v_135X = arg0K0;
  merged_arg0K0 = v_135X;
  write_descriptor_return_tag = 10;
  goto write_descriptor;
 write_descriptor_return_10:
  arg3K0 = (addr_124X + 4);
  goto L3094;}
 L4030: {
  symbol_136X = arg0K0;
  arg0K0 = symbol_136X;
  goto L4063;}
 L4352: {
  if ((3 == (3 & stob_106X))) {
    if ((14 == (31 & ((((*((long *) ((((char *) (-3 + stob_106X))) + -4))))>>2))))) {
      link_137X = *((long *) ((((char *) (-3 + stob_106X))) + 12));
      if ((0 == (3 & link_137X))) {
        arg0K0 = (3 + (-4 & link_137X));
        goto L3873;}
      else {
        arg0K0 = link_137X;
        goto L3873;}}
    else {
      goto L4356;}}
  else {
    goto L4356;}}
 L5212: {
  i_138X = arg0K0;
  if ((i_138X == (table_129X->size))) {
    free(keys_130X);
    free(values_131X);
    free(table_129X);
    free((Simage_bufferS));
    return (SstatusS);}
  else {
    if ((0 == (*(keys_130X + i_138X)))) {
      goto L5214;}
    else {
      free((*(values_131X + i_138X)));
      goto L5214;}}}
 L3599: {
  thing_139X = arg0K0;
  if ((3 == (3 & thing_139X))) {
    have_140X = table_ref((Sstob_tableS), thing_139X);
    if ((NULL == have_140X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L3650;}
    else {
      goto L3650;}}
  else {
    arg0K0 = thing_139X;
    goto L3601;}}
 L4063: {
  next_141X = arg0K0;
  if ((3 == (3 & next_141X))) {
    v_142X = table_ref((Sstob_tableS), next_141X);
    if ((NULL == v_142X)) {
      link_143X = *((long *) ((((char *) (-3 + next_141X))) + 4));
      if ((0 == (3 & link_143X))) {
        arg0K0 = (3 + (-4 & link_143X));
        goto L4063;}
      else {
        arg0K0 = link_143X;
        goto L4063;}}
    else {
      arg0K0 = next_141X;
      goto L4032;}}
  else {
    arg0K0 = next_141X;
    goto L4032;}}
 L3873: {
  shared_144X = arg0K0;
  arg0K0 = shared_144X;
  goto L3922;}
 L4356: {
  header_145X = *((long *) ((((char *) (-3 + stob_106X))) + -4));
  start_146X = ((char *) (-3 + stob_106X));
  merged_arg0K0 = header_145X;
  write_descriptor_return_tag = 11;
  goto write_descriptor;
 write_descriptor_return_11:
  if ((2 == (3 & header_145X))) {
    if (((31 & (((header_145X)>>2))) < 16)) {
      goto L4372;}
    else {
      size_147X = -4 & (3 + ((long)(((unsigned long)header_145X)>>8)));
      available_148X = 4096 - ((Simage_buffer_pointerS) - (Simage_bufferS));
      if ((available_148X < size_147X)) {
        if ((4096 < size_147X)) {
          have_149X = (Simage_buffer_pointerS) - (Simage_bufferS);
          if ((0 < have_149X)) {
            if (((SstatusS) == NO_ERRORS)) {
              SstatusS = (ps_write_block((Simage_portS), ((char *) (Simage_bufferS)), have_149X));
              goto L2922;}
            else {
              goto L2922;}}
          else {
            goto L2896;}}
        else {
          merged_arg3K0 = start_146X;
          merged_arg0K1 = available_148X;
          copy_image_data_return_tag = 0;
          goto copy_image_data;
         copy_image_data_return_0:
          merged_arg3K0 = (start_146X + available_148X);
          merged_arg0K1 = (size_147X - available_148X);
          copy_image_data_return_tag = 1;
          goto copy_image_data;
         copy_image_data_return_1:
          goto L4609;}}
      else {
        merged_arg3K0 = start_146X;
        merged_arg0K1 = size_147X;
        copy_image_data_return_tag = 2;
        goto copy_image_data;
       copy_image_data_return_2:
        goto L4609;}}}
  else {
    goto L4372;}}
 L5214: {
  arg0K0 = (1 + i_138X);
  goto L5212;}
 L3650: {
  arg0K0 = (have_140X->new_descriptor);
  goto L3601;}
 L3601: {
  value_150X = arg0K0;
  if ((3 == (3 & value_150X))) {
    arg0K0 = (-4 & value_150X);
    goto L3603;}
  else {
    arg0K0 = value_150X;
    goto L3603;}}
 L4032: {
  next_151X = arg0K0;
  header_152X = *((long *) ((((char *) (-3 + stob_106X))) + -4));
  merged_arg0K0 = header_152X;
  write_descriptor_return_tag = 12;
  goto write_descriptor;
 write_descriptor_return_12:
  start_153X = ((char *) (-3 + stob_106X));
  arg3K0 = start_153X;
  goto L4092;}
 L3922: {
  next_154X = arg0K0;
  if ((3 == (3 & next_154X))) {
    v_155X = table_ref((Sstob_tableS), next_154X);
    if ((NULL == v_155X)) {
      link_156X = *((long *) ((((char *) (-3 + next_154X))) + 12));
      if ((0 == (3 & link_156X))) {
        arg0K0 = (3 + (-4 & link_156X));
        goto L3922;}
      else {
        arg0K0 = link_156X;
        goto L3922;}}
    else {
      arg0K0 = next_154X;
      goto L3875;}}
  else {
    arg0K0 = next_154X;
    goto L3875;}}
 L4372: {
  arg3K0 = start_146X;
  goto L4474;}
 L2922: {
  Simage_buffer_pointerS = (Simage_bufferS);
  goto L2896;}
 L2896: {
  if (((SstatusS) == NO_ERRORS)) {
    SstatusS = (ps_write_block((Simage_portS), ((char *) start_146X), size_147X));
    goto L4609;}
  else {
    goto L4609;}}
 L3603: {
  v_157X = arg0K0;
  merged_arg0K0 = v_157X;
  write_descriptor_return_tag = 13;
  goto write_descriptor;
 write_descriptor_return_13:
  arg0K0 = (1 + i_111X);
  goto L3587;}
 L4092: {
  addr_158X = arg3K0;
  if ((addr_158X == (start_153X + (-4 + (-4 & (3 + ((long)(((unsigned long)header_152X)>>8)))))))) {
    if ((3 == (3 & next_151X))) {
      have_159X = table_ref((Sstob_tableS), next_151X);
      if ((NULL == have_159X)) {
        ps_error("traced object has no descriptor in image", 0);
        goto L4122;}
      else {
        goto L4122;}}
    else {
      arg0K0 = next_151X;
      goto L4045;}}
  else {
    thing_160X = *((long *) addr_158X);
    if ((3 == (3 & thing_160X))) {
      have_161X = table_ref((Sstob_tableS), thing_160X);
      if ((NULL == have_161X)) {
        ps_error("traced object has no descriptor in image", 0);
        goto L4106;}
      else {
        goto L4106;}}
    else {
      arg0K0 = thing_160X;
      goto L4097;}}}
 L3875: {
  next_162X = arg0K0;
  header_163X = *((long *) ((((char *) (-3 + stob_106X))) + -4));
  merged_arg0K0 = header_163X;
  write_descriptor_return_tag = 14;
  goto write_descriptor;
 write_descriptor_return_14:
  start_164X = ((char *) (-3 + stob_106X));
  arg3K0 = start_164X;
  goto L3951;}
 L4474: {
  addr_165X = arg3K0;
  if ((addr_165X == (start_146X + (-4 & (3 + ((long)(((unsigned long)header_145X)>>8))))))) {
    goto L4609;}
  else {
    thing_166X = *((long *) addr_165X);
    if ((3 == (3 & thing_166X))) {
      have_167X = table_ref((Sstob_tableS), thing_166X);
      if ((NULL == have_167X)) {
        ps_error("traced object has no descriptor in image", 0);
        goto L4488;}
      else {
        goto L4488;}}
    else {
      arg0K0 = thing_166X;
      goto L4479;}}}
 L4122: {
  arg0K0 = (have_159X->new_descriptor);
  goto L4045;}
 L4045: {
  value_168X = arg0K0;
  if ((3 == (3 & value_168X))) {
    merged_arg0K0 = (-4 & value_168X);
    write_descriptor_return_tag = 15;
    goto write_descriptor;
   write_descriptor_return_15:
    goto L4609;}
  else {
    merged_arg0K0 = value_168X;
    write_descriptor_return_tag = 16;
    goto write_descriptor;
   write_descriptor_return_16:
    goto L4609;}}
 L4106: {
  arg0K0 = (have_161X->new_descriptor);
  goto L4097;}
 L4097: {
  v_169X = arg0K0;
  merged_arg0K0 = v_169X;
  write_descriptor_return_tag = 17;
  goto write_descriptor;
 write_descriptor_return_17:
  arg3K0 = (addr_158X + 4);
  goto L4092;}
 L3951: {
  addr_170X = arg3K0;
  if ((addr_170X == (start_164X + (-8 + (-4 & (3 + ((long)(((unsigned long)header_163X)>>8)))))))) {
    x_171X = *((long *) ((((char *) (-3 + stob_106X))) + 4));
    if ((5 == x_171X)) {
      arg0K0 = 529;
      goto L3900;}
    else {
      thing_172X = *((long *) ((((char *) (-3 + stob_106X))) + 8));
      if ((3 == (3 & thing_172X))) {
        have_173X = table_ref((Sstob_tableS), thing_172X);
        if ((NULL == have_173X)) {
          ps_error("traced object has no descriptor in image", 0);
          goto L4012;}
        else {
          goto L4012;}}
      else {
        arg0K0 = thing_172X;
        goto L3900;}}}
  else {
    thing_174X = *((long *) addr_170X);
    if ((3 == (3 & thing_174X))) {
      have_175X = table_ref((Sstob_tableS), thing_174X);
      if ((NULL == have_175X)) {
        ps_error("traced object has no descriptor in image", 0);
        goto L3965;}
      else {
        goto L3965;}}
    else {
      arg0K0 = thing_174X;
      goto L3956;}}}
 L4488: {
  arg0K0 = (have_167X->new_descriptor);
  goto L4479;}
 L4479: {
  v_176X = arg0K0;
  merged_arg0K0 = v_176X;
  write_descriptor_return_tag = 18;
  goto write_descriptor;
 write_descriptor_return_18:
  arg3K0 = (addr_165X + 4);
  goto L4474;}
 L3900: {
  v_177X = arg0K0;
  merged_arg0K0 = v_177X;
  write_descriptor_return_tag = 19;
  goto write_descriptor;
 write_descriptor_return_19:
  if ((3 == (3 & next_162X))) {
    have_178X = table_ref((Sstob_tableS), next_162X);
    if ((NULL == have_178X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L3988;}
    else {
      goto L3988;}}
  else {
    arg0K0 = next_162X;
    goto L3904;}}
 L4012: {
  arg0K0 = (have_173X->new_descriptor);
  goto L3900;}
 L3965: {
  arg0K0 = (have_175X->new_descriptor);
  goto L3956;}
 L3956: {
  v_179X = arg0K0;
  merged_arg0K0 = v_179X;
  write_descriptor_return_tag = 20;
  goto write_descriptor;
 write_descriptor_return_20:
  arg3K0 = (addr_170X + 4);
  goto L3951;}
 L3988: {
  arg0K0 = (have_178X->new_descriptor);
  goto L3904;}
 L3904: {
  value_180X = arg0K0;
  if ((3 == (3 & value_180X))) {
    merged_arg0K0 = (-4 & value_180X);
    write_descriptor_return_tag = 21;
    goto write_descriptor;
   write_descriptor_return_21:
    goto L4609;}
  else {
    merged_arg0K0 = value_180X;
    write_descriptor_return_tag = 22;
    goto write_descriptor;
   write_descriptor_return_22:
    goto L4609;}}
 write_shared_table: {
  table_54X = merged_arg0K0;{
  merged_arg0K0 = (*((long *) ((((char *) (-3 + table_54X))) + -4)));
  write_descriptor_return_tag = 23;
  goto write_descriptor;
 write_descriptor_return_23:
  arg0K0 = 0;
  goto L3497;}
 L3497: {
  i_181X = arg0K0;
  temp_182X = i_181X == ((((3 + ((long)(((unsigned long)(*((long *) ((((char *) (-3 + table_54X))) + -4))))>>8))))>>2));
  if (temp_182X) {
    write_shared_table0_return_value = temp_182X;
    goto write_shared_table_return;}
  else {
    link_183X = *((long *) ((((char *) (-3 + table_54X))) + (((i_181X)<<2))));
    if ((0 == (3 & link_183X))) {
      arg0K0 = (3 + (-4 & link_183X));
      goto L3507;}
    else {
      arg0K0 = link_183X;
      goto L3507;}}}
 L3507: {
  shared_184X = arg0K0;
  arg0K0 = shared_184X;
  goto L3541;}
 L3541: {
  next_185X = arg0K0;
  if ((3 == (3 & next_185X))) {
    v_186X = table_ref((Sstob_tableS), next_185X);
    if ((NULL == v_186X)) {
      link_187X = *((long *) ((((char *) (-3 + next_185X))) + 12));
      if ((0 == (3 & link_187X))) {
        arg0K0 = (3 + (-4 & link_187X));
        goto L3541;}
      else {
        arg0K0 = link_187X;
        goto L3541;}}
    else {
      arg0K0 = next_185X;
      goto L3509;}}
  else {
    arg0K0 = next_185X;
    goto L3509;}}
 L3509: {
  thing_188X = arg0K0;
  if ((3 == (3 & thing_188X))) {
    have_189X = table_ref((Sstob_tableS), thing_188X);
    if ((NULL == have_189X)) {
      ps_error("traced object has no descriptor in image", 0);
      goto L3560;}
    else {
      goto L3560;}}
  else {
    arg0K0 = thing_188X;
    goto L3511;}}
 L3560: {
  arg0K0 = (have_189X->new_descriptor);
  goto L3511;}
 L3511: {
  value_190X = arg0K0;
  if ((3 == (3 & value_190X))) {
    arg0K0 = (-4 & value_190X);
    goto L3513;}
  else {
    arg0K0 = value_190X;
    goto L3513;}}
 L3513: {
  v_191X = arg0K0;
  merged_arg0K0 = v_191X;
  write_descriptor_return_tag = 24;
  goto write_descriptor;
 write_descriptor_return_24:
  arg0K0 = (1 + i_181X);
  goto L3497;}
 write_shared_table_return:
  switch (write_shared_table_return_tag) {
  case 0: goto write_shared_table_return_0;
  default: goto write_shared_table_return_1;
  }}

 write_descriptor: {
  descriptor_53X = merged_arg0K0;{
  *((long *) (Simage_buffer_pointerS)) = (long) (descriptor_53X);
  Simage_buffer_pointerS = ((Simage_buffer_pointerS) + 4);
  if ((4096 == ((Simage_buffer_pointerS) - (Simage_bufferS)))) {
    have_192X = (Simage_buffer_pointerS) - (Simage_bufferS);
    if ((0 < have_192X)) {
      if (((SstatusS) == NO_ERRORS)) {
        SstatusS = (ps_write_block((Simage_portS), ((char *) (Simage_bufferS)), have_192X));
        goto L2173;}
      else {
        goto L2173;}}
    else {
      goto write_descriptor_return;}}
  else {
    goto write_descriptor_return;}}
 L2173: {
  Simage_buffer_pointerS = (Simage_bufferS);
  goto write_descriptor_return;}
 write_descriptor_return:
  switch (write_descriptor_return_tag) {
  case 0: goto write_descriptor_return_0;
  case 1: goto write_descriptor_return_1;
  case 2: goto write_descriptor_return_2;
  case 3: goto write_descriptor_return_3;
  case 4: goto write_descriptor_return_4;
  case 5: goto write_descriptor_return_5;
  case 6: goto write_descriptor_return_6;
  case 7: goto write_descriptor_return_7;
  case 8: goto write_descriptor_return_8;
  case 9: goto write_descriptor_return_9;
  case 10: goto write_descriptor_return_10;
  case 11: goto write_descriptor_return_11;
  case 12: goto write_descriptor_return_12;
  case 13: goto write_descriptor_return_13;
  case 14: goto write_descriptor_return_14;
  case 15: goto write_descriptor_return_15;
  case 16: goto write_descriptor_return_16;
  case 17: goto write_descriptor_return_17;
  case 18: goto write_descriptor_return_18;
  case 19: goto write_descriptor_return_19;
  case 20: goto write_descriptor_return_20;
  case 21: goto write_descriptor_return_21;
  case 22: goto write_descriptor_return_22;
  case 23: goto write_descriptor_return_23;
  default: goto write_descriptor_return_24;
  }}

 copy_image_data: {
  start_51X = merged_arg3K0;
  size_52X = merged_arg0K1;{
  memmove((void *)(Simage_buffer_pointerS), (void *)start_51X,size_52X);
  Simage_buffer_pointerS = ((Simage_buffer_pointerS) + size_52X);
  if ((4096 == ((Simage_buffer_pointerS) - (Simage_bufferS)))) {
    have_193X = (Simage_buffer_pointerS) - (Simage_bufferS);
    if ((0 < have_193X)) {
      if (((SstatusS) == NO_ERRORS)) {
        SstatusS = (ps_write_block((Simage_portS), ((char *) (Simage_bufferS)), have_193X));
        goto L2198;}
      else {
        goto L2198;}}
    else {
      goto copy_image_data_return;}}
  else {
    goto copy_image_data_return;}}
 L2198: {
  Simage_buffer_pointerS = (Simage_bufferS);
  goto copy_image_data_return;}
 copy_image_data_return:
  switch (copy_image_data_return_tag) {
  case 0: goto copy_image_data_return_0;
  case 1: goto copy_image_data_return_1;
  default: goto copy_image_data_return_2;
  }}

}void
s48_write_image_init(void)
{
SstatusS = NO_ERRORS;
}
