original_code:
static playbackstatus MV_GetNextVorbisBlock
(
 VoiceNode *voice
 )
{
   vorbis_data * vd = (vorbis_data *) voice->extra;
   int bytes = 0, bytesread = 0;
   int bitstream = 0, err = 0;
   voice->Playing = ( 1 == 1 );
   bytesread = 0;
   do {
      bytes = ov_read(&vd->vf, vd->block + bytesread, sizeof(vd->block) - bytesread, 0, 2, 1, &bitstream);
      if (bytes == -3) continue;
      if (bytes == 0) {
         if (voice->LoopStart) {
            err = ov_pcm_seek_page(&vd->vf, 0);
            if (err != 0) {
               fprintf(stderr, "MV_GetNextVorbisBlock ov_pcm_seek_page_lap: err %d\n", err);
            } else {
               continue;
            }
         } else {
           break;
         }
      } else if (bytes < 0) {
         fprintf(stderr, "MV_GetNextVorbisBlock ov_read: err %d\n", bytes);
         voice->Playing = ( !( 1 == 1 ) );
         return NoMoreData;
      }
      bytesread += bytes;
   } while (bytesread < sizeof(vd->block));
   if (bytesread == 0) {
      voice->Playing = ( !( 1 == 1 ) );
      return NoMoreData;
   }
   if (bitstream != vd->lastbitstream) {
      vorbis_info * vi = 0;
      vi = ov_info(&vd->vf, -1);
      if (!vi) {
         voice->Playing = ( !( 1 == 1 ) );
         return NoMoreData;
      }
      if (vi->channels != 1 && vi->channels != 2) {
         voice->Playing = ( !( 1 == 1 ) );
         return NoMoreData;
      }
      voice->channels = vi->channels;
      voice->SamplingRate = vi->rate;
      voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
      voice->FixedPointBufferSize = ( voice->RateScale * 256 ) -
         voice->RateScale;
      MV_SetVoiceMixMode( voice );
   }
   vd->lastbitstream = bitstream;
   bytesread /= 2 * voice->channels;
   voice->position = 0;
   voice->sound = vd->block;
   voice->BlockLength = 0;
   voice->length = bytesread << 16;
   return( KeepPlaying );
}

canonical_original_code:
static enum playbackstatus MV_GetNextVorbisBlock(struct VoiceNode *voice)
{
   struct vorbis_data *vd = (vorbis_data *) voice->extra;
   int bytes = 0; int bytesread = 0;
   int bitstream = 0; int err = 0;
   voice->Playing = ( 1 == 1 );
   bytesread = 0;
   do {
      bytes = ov_read(&vd->vf, vd->block + bytesread, sizeof(vd->block) - bytesread, 0, 2, 1, &bitstream);
      if (bytes == -3) continue;
      if (bytes == 0) {
         if (voice->LoopStart) {
            err = ov_pcm_seek_page(&vd->vf, 0);
            if (err != 0) {
               fprintf(stderr, "MV_GetNextVorbisBlock ov_pcm_seek_page_lap: err %d\n", err);
            } else {
               continue;
            }
         } else {
           break;
         }
      } else if (bytes < 0) {
         fprintf(stderr, "MV_GetNextVorbisBlock ov_read: err %d\n", bytes);
         voice->Playing = ( !( 1 == 1 ) );
         return NoMoreData;
      }
      bytesread += bytes;
   } while (bytesread < sizeof(vd->block));
   if (bytesread == 0) {
      voice->Playing = ( !( 1 == 1 ) );
      return NoMoreData;
   }
   if (bitstream != vd->lastbitstream) {
      struct vorbis_info *vi = 0;
      vi = ov_info(&vd->vf, -1);
      if (!vi) {
         voice->Playing = ( !( 1 == 1 ) );
         return NoMoreData;
      }
      if (vi->channels != 1 && vi->channels != 2) {
         voice->Playing = ( !( 1 == 1 ) );
         return NoMoreData;
      }
      voice->channels = vi->channels;
      voice->SamplingRate = vi->rate;
      voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
      voice->FixedPointBufferSize = ( voice->RateScale * 256 ) -
         voice->RateScale;
      MV_SetVoiceMixMode( voice );
   }
   vd->lastbitstream = bitstream;
   bytesread /= 2 * voice->channels;
   voice->position = 0;
   voice->sound = vd->block;
   voice->BlockLength = 0;
   voice->length = bytesread << 16;
   return( KeepPlaying );
}

variable_types: struct VoiceNode { struct VoiceNode *next; struct VoiceNode *prev; enum wavedata { Raw=0, VOC=1, DemandFeed=2, WAV=3, Vorbis=4 } wavetype; char bits; char channels; enum playbackstatus { NoMoreData=0, KeepPlaying=1 } (*GetSound)(struct VoiceNode *voice); void (*mix)(unsigned int position, unsigned int rate, char *start, unsigned int length); char *NextBlock; char *LoopStart; char *LoopEnd; unsigned int LoopCount; unsigned int LoopSize; unsigned int BlockLength; unsigned int PitchScale; unsigned int FixedPointBufferSize; char *sound; unsigned int length; unsigned int SamplingRate; unsigned int RateScale; unsigned int position; int Playing; int Paused; int handle; int priority; void (*DemandFeed)(char **ptr, unsigned int *length); void *extra; short *LeftVolume; short *RightVolume; unsigned int callbackval; } *

variable_types: bytes int

variable_types: bytesread int

variable_types: bitstream int

variable_types: err int

variable_types: struct vorbis_info { int version; int channels; long rate; long bitrate_upper; long bitrate_nominal; long bitrate_lower; long bitrate_window; void *codec_setup; } *

user_defined_types: struct VoiceNode { struct VoiceNode *next; struct VoiceNode *prev; enum wavedata wavetype; char bits; char channels; enum playbackstatus (*GetSound)(struct VoiceNode *voice); void (*mix)(unsigned int position, unsigned int rate, char *start, unsigned int length); char *NextBlock; char *LoopStart; char *LoopEnd; unsigned int LoopCount; unsigned int LoopSize; unsigned int BlockLength; unsigned int PitchScale; unsigned int FixedPointBufferSize; char *sound; unsigned int length; unsigned int SamplingRate; unsigned int RateScale; unsigned int position; int Playing; int Paused; int handle; int priority; void (*DemandFeed)(char **ptr, unsigned int *length); void *extra; short *LeftVolume; short *RightVolume; unsigned int callbackval; }


repo: TermiT/sw-redux

original_code:
static size_t read_vorbis(void * ptr, size_t size, size_t nmemb, void * datasource)
{
   vorbis_data * vorb = (vorbis_data *) datasource;
   size_t nread = 0;
   size_t bytes;
   (*__errno_location ()) = 0;
   if (vorb->length == vorb->pos) {
      return 0;
   }
   for (; nmemb > 0; nmemb--, nread++) {
      bytes = vorb->length - vorb->pos;
      if (size < bytes) {
         bytes = size;
      }
      memcpy(ptr, vorb->ptr + vorb->pos, bytes);
      vorb->pos += bytes;
      ptr += bytes;
      if (vorb->length == vorb->pos) {
         nread++;
         break;
      }
   }
   return nread;
}

canonical_original_code:
static unsigned long read_vorbis(void *ptr, unsigned long size, unsigned long nmemb, void *datasource)
{
   struct vorbis_data *vorb = (vorbis_data *) datasource;
   unsigned long nread = 0;
   unsigned long bytes;
   (*__errno_location ()) = 0;
   if (vorb->length == vorb->pos) {
      return 0;
   }
   for (; nmemb > 0; nmemb--, nread++) {
      bytes = vorb->length - vorb->pos;
      if (size < bytes) {
         bytes = size;
      }
      memcpy(ptr, vorb->ptr + vorb->pos, bytes);
      vorb->pos += bytes;
      ptr += bytes;
      if (vorb->length == vorb->pos) {
         nread++;
         break;
      }
   }
   return nread;
}

variable_types:
ptr
void *

variable_types:
size
unsigned long

variable_types:
nmemb
unsigned long

variable_types:
datasource
void *

variable_types: struct vorbis_data { void *ptr; unsigned long length; unsigned long pos; struct OggVorbis_File { void *datasource; int seekable; long offset; long end; struct ogg_sync_state { unsigned char *data; int storage; int fill; int returned; int unsynced; int headerbytes; int bodybytes; } oy; int links; long *offsets; long *dataoffsets; long *serialnos; long *pcmlengths; struct vorbis_info { int version; int channels; long rate; long bitrate_upper; long bitrate_nominal; long bitrate_lower; long bitrate_window; void *codec_setup; } *vi; struct vorbis_comment { char **user_comments; int *comment_lengths; int comments; char *vendor; } *vc; long pcm_offset; int ready_state; long current_serialno; int current_link; double bittrack; double samptrack; struct ogg_stream_state { unsigned char *body_data; long body_storage; long body_fill; long body_returned; int *lacing_vals; long *granule_vals; long lacing_storage; long lacing_fill; long lacing_packet; long lacing_returned; unsigned char header[282]; int header_fill; int e_o_s; int b_o_s; long serialno; long pageno; long packetno; long granulepos; } os; struct vorbis_dsp_state { int analysisp; struct vorbis_info *vi; float **pcm; float **pcmret; int pcm_storage; int pcm_current; int pcm_returned; int preextrapolate; int eofflag; long lW; long W; long nW; long centerW; long granulepos; long sequence; long glue_bits; long time_bits; long floor_bits; long res_bits; void *backend_state; } vd; struct vorbis_block { float **pcm; struct oggpack_buffer { long endbyte; int endbit; unsigned char *buffer; unsigned char *ptr; long storage; } opb; long lW; long W; long nW; int pcmend; int mode; int eofflag; long granulepos; long sequence; struct vorbis_dsp_state *vd; void *localstore; long localtop; long localalloc; long totaluse; struct alloc_chain { void *ptr; struct alloc_chain *next; } *reap; long glue_bits; long time_bits; long floor_bits; long res_bits; void *internal; } vb; struct ov_callbacks { unsigned long (*read_func)(void *ptr, unsigned long size, unsigned long nmemb, void *datasource); int (*seek_func)(void *datasource, long offset, int whence); int (*close_func)(void *datasource); long (*tell_func)(void *datasource); } callbacks; } vf; char block[32768]; int lastbitstream; } *

variable_types:
nread
unsigned long

variable_types:
bytes
unsigned long

return_type: unsigned long

user_defined_types: struct vorbis_data { void *ptr; unsigned long length; unsigned long pos; struct OggVorbis_File vf; char block[32768]; int lastbitstream; }

user_defined_types: struct OggVorbis_File { void *datasource; int seekable; long offset; long end; struct ogg_sync_state oy; int links; long *offsets; long *dataoffsets; long *serialnos; long *pcmlengths; struct vorbis_info *vi; struct vorbis_comment *vc; long pcm_offset; int ready_state; long current_serialno; int current_link; double bittrack; double samptrack; struct ogg_stream_state os; struct vorbis_dsp_state vd; struct vorbis_block vb; struct ov_callbacks callbacks; }

user_defined_types: struct vorbis_block { float **pcm; struct oggpack_buffer opb; long lW; long W; long nW; int pcmend; int mode; int eofflag; long granulepos; long sequence; struct vorbis_dsp_state *vd; void *localstore; long localtop; long localalloc; long totaluse; struct alloc_chain *reap; long glue_bits; long time_bits; long floor_bits; long res_bits; void *internal; }


decompiled_code:
__int64 __fastcall MV_PlayLoopedVorbis(__int64 a1, unsigned int a2, int a3, __int64 a4, unsigned int a5, unsigned int a6, unsigned int a7, unsigned int a8, unsigned int a9, int a10)
{
char *v12; // rax
char *v13; // rbp
int v14; // eax
__int64 v15; // rax
__int64 v16; // r15
__int64 v17; // rax
__int64 v18; // rbx
int v19; // eax
int v20; // ecx
__int64 v21; // rax
__int64 result; // rax

if ( !MV_Installed )
{
MV_ErrorCode = 2;
return 0xFFFFFFFFLL;
}
v12 = (char *)calloc(0x83D0uLL, 1uLL);
v13 = v12;
if ( !v12 )
goto LABEL_10;
*(_QWORD *)v12 = a1;
*((_QWORD *)v12 + 1) = a2;
*((_DWORD *)v12 + 8434) = -1;
v14 = ov_open_callbacks(v12, v12 + 24, 0LL, 0LL);
if ( v14 < 0 )
{
fprintf(stderr, "MV_PlayLoopedVorbis: err %d\n", (unsigned int)v14);
result = 0xFFFFFFFFLL;
MV_ErrorCode = 9;
return result;
}
v15 = ov_info(v13 + 24, 0LL);
v16 = v15;
if ( !v15 || (unsigned int)(*(_DWORD *)(v15 + 4) - 1) > 1 )
{
ov_clear(v13 + 24);
free(v13);
LABEL_10:
MV_ErrorCode = 9;
return 0xFFFFFFFFLL;
}
v17 = MV_AllocVoice(a9);
v18 = v17;
if ( v17 )
{
*(_BYTE *)(v17 + 20) = 16;
*(_DWORD *)(v17 + 16) = 4;
v19 = *(_DWORD *)(v16 + 4);
*(_QWORD *)(v18 + 40) = v13 + 968;
*(_QWORD *)(v18 + 136) = v13;
*(_BYTE *)(v18 + 21) = v19;
*(_QWORD *)(v18 + 24) = MV_GetNextVorbisBlock;
*(_QWORD *)(v18 + 128) = 0LL;
*(_DWORD *)(v18 + 64) = 0;
*(_DWORD *)(v18 + 72) = 0;
v20 = PITCH_GetScale(a5);
*(_DWORD *)(v18 + 76) = v20;
*(_DWORD *)(v18 + 96) = 0;
*(_DWORD *)(v18 + 124) = a9;
*(_QWORD *)v18 = 0LL;
*(_DWORD *)(v18 + 160) = a10;
v21 = *(_QWORD *)(v16 + 8);
*(_QWORD *)(v18 + 8) = 0LL;
*(_DWORD *)(v18 + 100) = v21;
*(_QWORD *)(v18 + 48) = a3 >= 0LL;
*(_QWORD *)(v18 + 56) = 0LL;
LODWORD(v21) = (unsigned int)(v20 * v21) / MV_MixRate;
*(_DWORD *)(v18 + 68) = 0;
*(_QWORD *)(v18 + 112) = 1LL;
*(_DWORD *)(v18 + 104) = v21;
*(_DWORD *)(v18 + 80) = 255 * v21;
MV_SetVoiceMixMode(v18);
MV_SetVoiceVolume(v18, a6, a7, a8);
MV_PlayVoice(v18);
result = *(unsigned int *)(v18 + 120);
}
else
{
ov_clear(v13 + 24);
free(v13);
result = 0xFFFFFFFFLL;
MV_ErrorCode = 4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, unsigned int a2, int a3, __int64 a4, unsigned int a5, unsigned int a6, unsigned int a7, unsigned int a8, unsigned int a9, int a10)
{
char *v12; // rax
char *v13; // rbp
int v14; // eax
__int64 v15; // rax
__int64 v16; // r15
__int64 v17; // rax
__int64 v18; // rbx
int v19; // eax
int v20; // ecx
__int64 v21; // rax
__int64 result; // rax

if ( !MV_Installed )
{
MV_ErrorCode = 2;
return 0xFFFFFFFFLL;
}
v12 = (char *)calloc(0x83D0uLL, 1uLL);
v13 = v12;
if ( !v12 )
goto LABEL_10;
*(_QWORD *)v12 = a1;
*((_QWORD *)v12 + 1) = a2;
*((_DWORD *)v12 + 8434) = -1;
v14 = ov_open_callbacks(v12, v12 + 24, 0LL, 0LL);
if ( v14 < 0 )
{
fprintf(stderr, "MV_PlayLoopedVorbis: err %d\n", (unsigned int)v14);
result = 0xFFFFFFFFLL;
MV_ErrorCode = 9;
return result;
}
v15 = ov_info(v13 + 24, 0LL);
v16 = v15;
if ( !v15 || (unsigned int)(*(_DWORD *)(v15 + 4) - 1) > 1 )
{
ov_clear(v13 + 24);
free(v13);
LABEL_10:
MV_ErrorCode = 9;
return 0xFFFFFFFFLL;
}
v17 = MV_AllocVoice(a9);
v18 = v17;
if ( v17 )
{
*(_BYTE *)(v17 + 20) = 16;
*(_DWORD *)(v17 + 16) = 4;
v19 = *(_DWORD *)(v16 + 4);
*(_QWORD *)(v18 + 40) = v13 + 968;
*(_QWORD *)(v18 + 136) = v13;
*(_BYTE *)(v18 + 21) = v19;
*(_QWORD *)(v18 + 24) = MV_GetNextVorbisBlock;
*(_QWORD *)(v18 + 128) = 0LL;
*(_DWORD *)(v18 + 64) = 0;
*(_DWORD *)(v18 + 72) = 0;
v20 = PITCH_GetScale(a5);
*(_DWORD *)(v18 + 76) = v20;
*(_DWORD *)(v18 + 96) = 0;
*(_DWORD *)(v18 + 124) = a9;
*(_QWORD *)v18 = 0LL;
*(_DWORD *)(v18 + 160) = a10;
v21 = *(_QWORD *)(v16 + 8);
*(_QWORD *)(v18 + 8) = 0LL;
*(_DWORD *)(v18 + 100) = v21;
*(_QWORD *)(v18 + 48) = a3 >= 0LL;
*(_QWORD *)(v18 + 56) = 0LL;
LODWORD(v21) = (unsigned int)(v20 * v21) / MV_MixRate;
*(_DWORD *)(v18 + 68) = 0;
*(_QWORD *)(v18 + 112) = 1LL;
*(_DWORD *)(v18 + 104) = v21;
*(_DWORD *)(v18 + 80) = 255 * v21;
MV_SetVoiceMixMode(v18);
MV_SetVoiceVolume(v18, a6, a7, a8);
MV_PlayVoice(v18);
result = *(unsigned int *)(v18 + 120);
}
else
{
ov_clear(v13 + 24);
free(v13);
result = 0xFFFFFFFFLL;
MV_ErrorCode = 4;
}
return result;
}

original_code:
int MV_PlayLoopedVorbis
(
 char *ptr,
 unsigned int ptrlength,
 int loopstart,
 int loopend,
 int pitchoffset,
 int vol,
 int left,
 int right,
 int priority,
 unsigned int callbackval
 )
{
   VoiceNode *voice;
   int status;
   vorbis_data * vd = 0;
   vorbis_info * vi = 0;
   if ( !MV_Installed )
   {
      MV_ErrorCode = ( MV_NotInstalled );;
      return( MV_Error );
   }
   vd = (vorbis_data *) malloc( sizeof(vorbis_data) );
   if (!vd) {
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   memset(vd, 0, sizeof(vorbis_data));
   vd->ptr = ptr;
   vd->pos = 0;
   vd->length = ptrlength;
   vd->lastbitstream = -1;
   status = ov_open_callbacks((void *) vd, &vd->vf, 0, 0, vorbis_callbacks);
   if (status < 0) {
      fprintf(stderr, "MV_PlayLoopedVorbis: err %d\n", status);
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   vi = ov_info(&vd->vf, 0);
   if (!vi) {
      ov_clear(&vd->vf);
      free(vd);
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   if (vi->channels != 1 && vi->channels != 2) {
      ov_clear(&vd->vf);
      free(vd);
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   voice = MV_AllocVoice( priority );
   if ( voice == ((void *)0) )
   {
      ov_clear(&vd->vf);
      free(vd);
      MV_ErrorCode = ( MV_NoVoices );;
      return( MV_Error );
   }
   voice->wavetype = Vorbis;
   voice->bits = 16;
   voice->channels = vi->channels;
   voice->extra = (void *) vd;
   voice->GetSound = MV_GetNextVorbisBlock;
   voice->NextBlock = vd->block;
   voice->DemandFeed = ((void *)0);
   voice->LoopCount = 0;
   voice->BlockLength = 0;
   voice->PitchScale = PITCH_GetScale( pitchoffset );
   voice->length = 0;
   voice->next = ((void *)0);
   voice->prev = ((void *)0);
   voice->priority = priority;
   voice->callbackval = callbackval;
   voice->LoopStart = (char *) (loopstart >= 0 ? ( 1 == 1 ) : ( !( 1 == 1 ) ));
   voice->LoopEnd = 0;
   voice->LoopSize = 0;
   voice->Playing = ( 1 == 1 );
   voice->Paused = ( !( 1 == 1 ) );
   voice->SamplingRate = vi->rate;
   voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
   voice->FixedPointBufferSize = ( voice->RateScale * 256 ) -
      voice->RateScale;
   MV_SetVoiceMixMode( voice );
   MV_SetVoiceVolume( voice, vol, left, right );
   MV_PlayVoice( voice );
   return( voice->handle );
}

canonical_original_code:
int MV_PlayLoopedVorbis(char *ptr, unsigned int ptrlength, int loopstart, int loopend, int pitchoffset, int vol, int left, int right, int priority, unsigned int callbackval)
{
   struct VoiceNode *voice;
   int status;
   struct vorbis_data *vd = 0;
   struct vorbis_info *vi = 0;
   if ( !MV_Installed )
   {
      MV_ErrorCode = ( MV_NotInstalled );;
      return( MV_Error );
   }
   vd = (struct vorbis_data *) malloc( sizeof(vorbis_data) );
   if (!vd) {
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   memset(vd, 0, sizeof(vorbis_data));
   vd->ptr = ptr;
   vd->pos = 0;
   vd->length = ptrlength;
   vd->lastbitstream = -1;
   status = ov_open_callbacks((void *) vd, &vd->vf, 0, 0, vorbis_callbacks);
   if (status < 0) {
      fprintf(stderr, "MV_PlayLoopedVorbis: err %d\n", status);
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   vi = ov_info(&vd->vf, 0);
   if (!vi) {
      ov_clear(&vd->vf);
      free(vd);
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   if (vi->channels != 1 && vi->channels != 2) {
      ov_clear(&vd->vf);
      free(vd);
      MV_ErrorCode = ( MV_InvalidVorbisFile );;
      return MV_Error;
   }
   voice = MV_AllocVoice( priority );
   if ( voice == ((void *)0) )
   {
      ov_clear(&vd->vf);
      free(vd);
      MV_ErrorCode = ( MV_NoVoices );;
      return( MV_Error );
   }
   voice->wavetype = Vorbis;
   voice->bits = 16;
   voice->channels = vi->channels;
   voice->extra = (void *) vd;
   voice->GetSound = MV_GetNextVorbisBlock;
   voice->NextBlock = vd->block;
   voice->DemandFeed = ((void *)0);
   voice->LoopCount = 0;
   voice->BlockLength = 0;
   voice->PitchScale = PITCH_GetScale( pitchoffset );
   voice->length = 0;
   voice->next = ((void *)0);
   voice->prev = ((void *)0);
   voice->priority = priority;
   voice->callbackval = callbackval;
   voice->LoopStart = (char *) (loopstart >= 0 ? ( 1 == 1 ) : ( !( 1 == 1 ) ));
   voice->LoopEnd = 0;
   voice->LoopSize = 0;
   voice->Playing = ( 1 == 1 );
   voice->Paused = ( !( 1 == 1 ) );
   voice->SamplingRate = vi->rate;
   voice->RateScale = ( voice->SamplingRate * voice->PitchScale ) / MV_MixRate;
   voice->FixedPointBufferSize = ( voice->RateScale * 256 ) -
      voice->RateScale;
   MV_SetVoiceMixMode( voice );
   MV_SetVoiceVolume( voice, vol, left, right );
   MV_PlayVoice( voice );
   return( voice->handle );
}

variable_types:
ptr
char *

variable_types:
ptrlength
unsigned int

variable_types: loopstart int

variable_types: loopend int

variable_types: pitchoffset int

variable_types: vol int

variable_types: left int

variable_types: right int

variable_types: priority int

variable_types:
callbackval
unsigned int

variable_types: status int

return_type: int

user_defined_types: struct vorbis_info { int version; int channels; long rate; long bitrate_upper; long bitrate_nominal; long bitrate_lower; long bitrate_window; void *codec_setup; }

user_defined_types: enum wavedata { Raw=0, VOC=1, DemandFeed=2, WAV=3, Vorbis=4 }

user_defined_types: struct ogg_sync_state { unsigned char *data; int storage; int fill; int returned; int unsynced; int headerbytes; int bodybytes; }

user_defined_types: struct ogg_stream_state { unsigned char *body_data; long body_storage; long body_fill; long body_returned; int *lacing_vals; long *granule_vals; long lacing_storage; long lacing_fill; long lacing_packet; long lacing_returned; unsigned char header[282]; int header_fill; int e_o_s; int b_o_s; long serialno; long pageno; long packetno; long granulepos; }

user_defined_types: struct vorbis_dsp_state { int analysisp; struct vorbis_info *vi; float **pcm; float **pcmret; int pcm_storage; int pcm_current; int pcm_returned; int preextrapolate; int eofflag; long lW; long W; long nW; long centerW; long granulepos; long sequence; long glue_bits; long time_bits; long floor_bits; long res_bits; void *backend_state; }

user_defined_types: struct ov_callbacks { unsigned long (*read_func)(void *ptr, unsigned long size, unsigned long nmemb, void *datasource); int (*seek_func)(void *datasource, long offset, int whence); int (*close_func)(void *datasource); long (*tell_func)(void *datasource); }

user_defined_types: enum playbackstatus { NoMoreData=0, KeepPlaying=1 }

user_defined_types: struct vorbis_comment { char **user_comments; int *comment_lengths; int comments; char *vendor; }

user_defined_types: struct oggpack_buffer { long endbyte; int endbit; unsigned char *buffer; unsigned char *ptr; long storage; }

user_defined_types: struct alloc_chain { void *ptr; struct alloc_chain *next; }


decompiled_code:
__int64 __fastcall MV_PlayVorbis(__int64 a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5, unsigned int a6, unsigned int a7, int a8)
{
return MV_PlayLoopedVorbis(a1, a2, -1, 0xFFFFFFFFLL, a3, a4, a5, a6, a7, a8);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5, unsigned int a6, unsigned int a7, int a8)
{
return func5(a1, a2, -1, 0xFFFFFFFFLL, a3, a4, a5, a6, a7, a8);
}

original_code:
int MV_PlayVorbis
(
 char *ptr,
 unsigned int ptrlength,
 int pitchoffset,
 int vol,
 int left,
 int right,
 int priority,
 unsigned int callbackval
 )
{
   int status;
   status = MV_PlayLoopedVorbis( ptr, ptrlength, -1, -1, pitchoffset, vol, left, right,
                                 priority, callbackval );
   return( status );
}

canonical_original_code:
int MV_PlayVorbis(char *ptr, unsigned int ptrlength, int pitchoffset, int vol, int left, int right, int priority, unsigned int callbackval)
{
   int status;
   status = MV_PlayLoopedVorbis( ptr, ptrlength, -1, -1, pitchoffset, vol, left, right,
                                 priority, callbackval );
   return( status );
}


decompiled_code:
__int64 __fastcall MV_PlayVorbis3D(__int64 a1, unsigned int a2, unsigned int a3, char a4, int a5, unsigned int a6, int a7)
{
int v7; // er11
unsigned __int64 v8; // rax
unsigned int v9; // ecx
__int64 result; // rax

if ( MV_Installed )
{
if ( a5 < 0 )
{
a5 = -a5;
a4 += 16;
}
v7 = 255;
if ( a5 <= 255 )
v7 = a5;
v8 = ((unsigned __int64)(a4 & 0x1F) << 6) + ((v7 * (MV_MaxVolume + 1)) >> 8);
v9 = 255 - a5;
if ( 255 - a5 < 0 )
v9 = 0;
result = MV_PlayVorbis(
a1,
a2,
a3,
v9,
*((unsigned __int8 *)&MV_PanTable + 2 * v8),
*((unsigned __int8 *)&MV_PanTable + 2 * v8 + 1),
a6,
a7);
}
else
{
MV_ErrorCode = 2;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, unsigned int a2, unsigned int a3, char a4, int a5, unsigned int a6, int a7)
{
int v7; // er11
unsigned __int64 v8; // rax
unsigned int v9; // ecx
__int64 result; // rax

if ( MV_Installed )
{
if ( a5 < 0 )
{
a5 = -a5;
a4 += 16;
}
v7 = 255;
if ( a5 <= 255 )
v7 = a5;
v8 = ((unsigned __int64)(a4 & 0x1F) << 6) + ((v7 * (MV_MaxVolume + 1)) >> 8);
v9 = 255 - a5;
if ( 255 - a5 < 0 )
v9 = 0;
result = func6(
a1,
a2,
a3,
v9,
*((unsigned __int8 *)&MV_PanTable + 2 * v8),
*((unsigned __int8 *)&MV_PanTable + 2 * v8 + 1),
a6,
a7);
}
else
{
MV_ErrorCode = 2;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int MV_PlayVorbis3D
(
 char *ptr,
 unsigned int ptrlength,
 int pitchoffset,
 int angle,
 int distance,
 int priority,
 unsigned int callbackval
 )
{
   int left;
   int right;
   int mid;
   int volume;
   int status;
   if ( !MV_Installed )
   {
      MV_ErrorCode = ( MV_NotInstalled );;
      return( MV_Error );
   }
   if ( distance < 0 )
   {
      distance = -distance;
      angle += ( 31 + 1 ) / 2;
   }
   volume = ( ( ((0) > (((( distance )) < (255) ? (( distance )) : (255))) ? (0) : (((( distance )) < (255) ? (( distance )) : (255)))) * ( MV_MaxVolume + 1 ) ) >> 8 );
   angle &= 31;
   left = MV_PanTable[ angle ][ volume ].left;
   right = MV_PanTable[ angle ][ volume ].right;
   mid = ((0) > (255 - distance) ? (0) : (255 - distance));
   status = MV_PlayVorbis( ptr, ptrlength, pitchoffset, mid, left, right, priority,
                           callbackval );
   return( status );
}

canonical_original_code:
int MV_PlayVorbis3D(char *ptr, unsigned int ptrlength, int pitchoffset, int angle, int distance, int priority, unsigned int callbackval)
{
   int left;
   int right;
   int mid;
   int volume;
   int status;
   if ( !MV_Installed )
   {
      MV_ErrorCode = ( MV_NotInstalled );;
      return( MV_Error );
   }
   if ( distance < 0 )
   {
      distance = -distance;
      angle += ( 31 + 1 ) / 2;
   }
   volume = ( ( ((0) > (((( distance )) < (255) ? (( distance )) : (255))) ? (0) : (((( distance )) < (255) ? (( distance )) : (255)))) * ( MV_MaxVolume + 1 ) ) >> 8 );
   angle &= 31;
   left = MV_PanTable[ angle ][ volume ].left;
   right = MV_PanTable[ angle ][ volume ].right;
   mid = ((0) > (255 - distance) ? (0) : (255 - distance));
   status = MV_PlayVorbis( ptr, ptrlength, pitchoffset, mid, left, right, priority,
                           callbackval );
   return( status );
}

variable_types: angle int

variable_types: distance int

variable_types: mid int

variable_types: volume int


decompiled_code:
void __fastcall MV_ReleaseVorbisVoice(__int64 a1)
{
char *v1; // rbp

if ( *(_DWORD *)(a1 + 16) == 4 )
{
v1 = *(char **)(a1 + 136);
ov_clear(v1 + 24);
free(v1);
*(_QWORD *)(a1 + 136) = 0LL;
}
}

original_code:
void MV_ReleaseVorbisVoice( VoiceNode * voice )
{
   vorbis_data * vd = (vorbis_data *) voice->extra;
   if (voice->wavetype != Vorbis) {
      return;
   }
   ov_clear(&vd->vf);
   free(vd);
   voice->extra = 0;
}

canonical_original_code:
void MV_ReleaseVorbisVoice(struct VoiceNode *voice)
{
   struct vorbis_data *vd = (vorbis_data *) voice->extra;
   if (voice->wavetype != Vorbis) {
      return;
   }
   ov_clear(&vd->vf);
   free(vd);
   voice->extra = 0;
}

variable_types: struct VoiceNode { struct VoiceNode *next; struct VoiceNode *prev; enum wavedata { Raw=0, VOC=1, DemandFeed=2, WAV=3, Vorbis=4 } wavetype; char bits; char channels; enum playbackstatus { NoMoreData=0, KeepPlaying=1 } (*GetSound)(struct VoiceNode *voice); void (*mix)(unsigned int position, unsigned int rate, char *start, unsigned int length); char *NextBlock; char *LoopStart; char *LoopEnd; unsigned int LoopCount; unsigned int LoopSize; unsigned int BlockLength; unsigned int PitchScale; unsigned int FixedPointBufferSize; char *sound; unsigned int length; unsigned int SamplingRate; unsigned int RateScale; unsigned int position; int Playing; int Paused; int handle; int priority; void (*DemandFeed)(char **ptr, unsigned int *length); void *extra; short *LeftVolume; short *RightVolume; unsigned int callbackval; } *

variable_types: struct vorbis_data { void *ptr; unsigned long length; unsigned long pos; struct OggVorbis_File { void *datasource; int seekable; long offset; long end; struct ogg_sync_state { unsigned char *data; int storage; int fill; int returned; int unsynced; int headerbytes; int bodybytes; } oy; int links; long *offsets; long *dataoffsets; long *serialnos; long *pcmlengths; struct vorbis_info { int version; int channels; long rate; long bitrate_upper; long bitrate_nominal; long bitrate_lower; long bitrate_window; void *codec_setup; } *vi; struct vorbis_comment { char **user_comments; int *comment_lengths; int comments; char *vendor; } *vc; long pcm_offset; int ready_state; long current_serialno; int current_link; double bittrack; double samptrack; struct ogg_stream_state { unsigned char *body_data; long body_storage; long body_fill; long body_returned; int *lacing_vals; long *granule_vals; long lacing_storage; long lacing_fill; long lacing_packet; long lacing_returned; unsigned char header[282]; int header_fill; int e_o_s; int b_o_s; long serialno; long pageno; long packetno; long granulepos; } os; struct vorbis_dsp_state { int analysisp; struct vorbis_info *vi; float **pcm; float **pcmret; int pcm_storage; int pcm_current; int pcm_returned; int preextrapolate; int eofflag; long lW; long W; long nW; long centerW; long granulepos; long sequence; long glue_bits; long time_bits; long floor_bits; long res_bits; void *backend_state; } vd; struct vorbis_block { float **pcm; struct oggpack_buffer { long endbyte; int endbit; unsigned char *buffer; unsigned char *ptr; long storage; } opb; long lW; long W; long nW; int pcmend; int mode; int eofflag; long granulepos; long sequence; struct vorbis_dsp_state *vd; void *localstore; long localtop; long localalloc; long totaluse; struct alloc_chain { void *ptr; struct alloc_chain *next; } *reap; long glue_bits; long time_bits; long floor_bits; long res_bits; void *internal; } vb; struct ov_callbacks { unsigned long (*read_func)(void *ptr, unsigned long size, unsigned long nmemb, void *datasource); int (*seek_func)(void *datasource, long offset, int whence); int (*close_func)(void *datasource); long (*tell_func)(void *datasource); } callbacks; } vf; char block[32768]; int lastbitstream; } *

return_type: void


decompiled_code:
const char *__fastcall MUSIC_ErrorString(int a1)
{
const char *result; // rax
unsigned int v2; // eax

while ( 2 )
{
switch ( a1 )
{
case -2:
case -1:
a1 = MUSIC_ErrorCode;
continue;
case 0:
result = "Music ok.";
break;
case 1:
v2 = SoundDriver_MIDI_GetError();
result = (const char *)SoundDriver_MIDI_ErrorString(v2);
break;
case 2:
result = "Invalid Music device.";
break;
case 3:
result = "Error playing MIDI file.";
break;
default:
result = "Unknown Music error code.";
break;
}
break;
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func0(int a1)
{
const char *result; // rax
unsigned int v2; // eax

while ( 2 )
{
switch ( a1 )
{
case -2:
case -1:
a1 = MUSIC_ErrorCode;
continue;
case 0:
result = "Music ok.";
break;
case 1:
v2 = SoundDriver_MIDI_GetError();
result = (const char *)SoundDriver_MIDI_ErrorString(v2);
break;
case 2:
result = "Invalid Music device.";
break;
case 3:
result = "Error playing MIDI file.";
break;
default:
result = "Unknown Music error code.";
break;
}
break;
}
return result;
}

original_code:
const char *MUSIC_ErrorString
   (
   int ErrorNumber
   )
   {
   const char *ErrorString;
   switch( ErrorNumber )
      {
      case MUSIC_Warning :
      case MUSIC_Error :
         ErrorString = MUSIC_ErrorString( MUSIC_ErrorCode );
         break;
      case MUSIC_Ok :
         ErrorString = "Music ok.";
         break;
      case MUSIC_DriverError :
         ErrorString = SoundDriver_MIDI_ErrorString(SoundDriver_MIDI_GetError());
         break;
      case MUSIC_InvalidCard :
         ErrorString = "Invalid Music device.";
         break;
      case MUSIC_MidiError :
         ErrorString = "Error playing MIDI file.";
         break;
      default :
         ErrorString = "Unknown Music error code.";
         break;
      }
   return( ErrorString );
   }

canonical_original_code:
char *MUSIC_ErrorString(int ErrorNumber)
   {
   char *ErrorString;
   switch( ErrorNumber )
      {
      case MUSIC_Warning :
      case MUSIC_Error :
         ErrorString = MUSIC_ErrorString( MUSIC_ErrorCode );
         break;
      case MUSIC_Ok :
         ErrorString = "Music ok.";
         break;
      case MUSIC_DriverError :
         ErrorString = SoundDriver_MIDI_ErrorString(SoundDriver_MIDI_GetError());
         break;
      case MUSIC_InvalidCard :
         ErrorString = "Invalid Music device.";
         break;
      case MUSIC_MidiError :
         ErrorString = "Error playing MIDI file.";
         break;
      default :
         ErrorString = "Unknown Music error code.";
         break;
      }
   return( ErrorString );
   }

variable_types: ErrorNumber int

variable_types:
ErrorString
char *

return_type: char *


decompiled_code:
__int64 __fastcall MUSIC_Init(unsigned int a1)
{
__int64 v1; // rax
unsigned int v2; // ebx
unsigned int v3; // er12

v1 = 0LL;
v2 = a1;
do
{
*((_BYTE *)&MIDI_PatchMap + v1) = v1;
++v1;
}
while ( v1 != 128 );
if ( a1 == -2 )
{
v2 = 6;
}
else if ( a1 > 6 )
{
LABEL_10:
MUSIC_ErrorCode = 2;
return (unsigned int)-1;
}
if ( !(unsigned int)SoundDriver_IsMIDISupported(v2) )
goto LABEL_10;
ASS_MIDISoundDriver = v2;
v3 = SoundDriver_MIDI_Init(&MUSIC_MidiFunctions);
if ( v3 )
{
MUSIC_ErrorCode = 1;
v3 = -1;
}
else
{
MIDI_SetMidiFuncs(&MUSIC_MidiFunctions);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int a1)
{
__int64 v1; // rax
unsigned int v2; // ebx
unsigned int v3; // er12

v1 = 0LL;
v2 = a1;
do
{
*((_BYTE *)&MIDI_PatchMap + v1) = v1;
++v1;
}
while ( v1 != 128 );
if ( a1 == -2 )
{
v2 = 6;
}
else if ( a1 > 6 )
{
LABEL_10:
MUSIC_ErrorCode = 2;
return (unsigned int)-1;
}
if ( !(unsigned int)SoundDriver_IsMIDISupported(v2) )
goto LABEL_10;
ASS_MIDISoundDriver = v2;
v3 = SoundDriver_MIDI_Init(&MUSIC_MidiFunctions);
if ( v3 )
{
MUSIC_ErrorCode = 1;
v3 = -1;
}
else
{
MIDI_SetMidiFuncs(&MUSIC_MidiFunctions);
}
return v3;
}

original_code:
int MUSIC_Init
   (
   int SoundCard,
   int Address
   )
   {
   int i;
   int status;
   for( i = 0; i < 128; i++ )
      {
      MIDI_PatchMap[ i ] = i;
      }
 if (SoundCard == ASS_AutoDetect) {
        SoundCard = ASS_ALSA;
 }
 if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards) {
  MUSIC_ErrorCode = MUSIC_InvalidCard;
  return MUSIC_Error;
 }
    if (!SoundDriver_IsMIDISupported(SoundCard))
      {
      MUSIC_ErrorCode = MUSIC_InvalidCard;
      return MUSIC_Error;
      }
   ASS_MIDISoundDriver = SoundCard;
   status = SoundDriver_MIDI_Init(&MUSIC_MidiFunctions);
   if (status != MUSIC_Ok)
      {
      MUSIC_ErrorCode = MUSIC_DriverError;
      return MUSIC_Error;
      }
   MIDI_SetMidiFuncs( &MUSIC_MidiFunctions );
   return MUSIC_Ok;
   }

canonical_original_code:
int MUSIC_Init(int SoundCard, int Address)
   {
   int i;
   int status;
   for( i = 0; i < 128; i++ )
      {
      MIDI_PatchMap[ i ] = i;
      }
 if (SoundCard == ASS_AutoDetect) {
        SoundCard = ASS_ALSA;
 }
 if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards) {
  MUSIC_ErrorCode = MUSIC_InvalidCard;
  return MUSIC_Error;
 }
    if (!SoundDriver_IsMIDISupported(SoundCard))
      {
      MUSIC_ErrorCode = MUSIC_InvalidCard;
      return MUSIC_Error;
      }
   ASS_MIDISoundDriver = SoundCard;
   status = SoundDriver_MIDI_Init(&MUSIC_MidiFunctions);
   if (status != MUSIC_Ok)
      {
      MUSIC_ErrorCode = MUSIC_DriverError;
      return MUSIC_Error;
      }
   MIDI_SetMidiFuncs( &MUSIC_MidiFunctions );
   return MUSIC_Ok;
   }

variable_types: SoundCard int

variable_types: Address int

variable_types: i int


decompiled_code:
__int64 MUSIC_Shutdown()
{
MIDI_StopSong();
SoundDriver_MIDI_Shutdown();
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
MIDI_StopSong();
SoundDriver_MIDI_Shutdown();
return 0LL;
}

original_code:
int MUSIC_Shutdown
   (
   void
   )
   {
   MIDI_StopSong();
   SoundDriver_MIDI_Shutdown();
   return MUSIC_Ok;
   }

canonical_original_code:
int MUSIC_Shutdown()
   {
   MIDI_StopSong();
   SoundDriver_MIDI_Shutdown();
   return MUSIC_Ok;
   }


decompiled_code:
void MUSIC_SetMaxFMMidiChannel()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
void MUSIC_SetMaxFMMidiChannel
   (
   int channel
   )
   {
   }

canonical_original_code:
void MUSIC_SetMaxFMMidiChannel(int channel)
   {
   }

variable_types: channel int


decompiled_code:
void MUSIC_SetVolume()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code:
void MUSIC_SetVolume
   (
   int volume
   )
   {
   volume = ((0) > (volume) ? (0) : (volume));
   volume = ((volume) < (255) ? (volume) : (255));
   }

canonical_original_code:
void MUSIC_SetVolume(int volume)
   {
   volume = ((0) > (volume) ? (0) : (volume));
   volume = ((volume) < (255) ? (volume) : (255));
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_SetMidiChannelVolume()
{
return MIDI_SetUserChannelVolume();
}

canonical_decompiled_code:
__int64 func5()
{
return MIDI_SetUserChannelVolume();
}

original_code:
void MUSIC_SetMidiChannelVolume
   (
   int channel,
   int volume
   )
   {
   MIDI_SetUserChannelVolume( channel, volume );
   }

canonical_original_code:
void MUSIC_SetMidiChannelVolume(int channel, int volume)
   {
   MIDI_SetUserChannelVolume( channel, volume );
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_ResetMidiChannelVolumes()
{
return MIDI_ResetUserChannelVolume();
}

canonical_decompiled_code:
__int64 func6()
{
return MIDI_ResetUserChannelVolume();
}

original_code:
void MUSIC_ResetMidiChannelVolumes
   (
   void
   )
   {
   MIDI_ResetUserChannelVolume();
   }

canonical_original_code:
void MUSIC_ResetMidiChannelVolumes()
   {
   MIDI_ResetUserChannelVolume();
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_GetVolume()
{
return MIDI_GetVolume();
}

canonical_decompiled_code:
__int64 func7()
{
return MIDI_GetVolume();
}

original_code:
int MUSIC_GetVolume
   (
   void
   )
   {
   return( MIDI_GetVolume() );
   }

canonical_original_code:
int MUSIC_GetVolume()
   {
   return( MIDI_GetVolume() );
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_SetLoopFlag()
{
return MIDI_SetLoopFlag();
}

canonical_decompiled_code:
__int64 func8()
{
return MIDI_SetLoopFlag();
}

original_code:
void MUSIC_SetLoopFlag
   (
   int loopflag
   )
   {
   MIDI_SetLoopFlag( loopflag );
   }

canonical_original_code:
void MUSIC_SetLoopFlag(int loopflag)
   {
   MIDI_SetLoopFlag( loopflag );
   }

variable_types: loopflag int


decompiled_code:
// attributes: thunk
__int64 MUSIC_SongPlaying()
{
return MIDI_SongPlaying();
}

canonical_decompiled_code:
__int64 func9()
{
return MIDI_SongPlaying();
}

original_code:
int MUSIC_SongPlaying
   (
   void
   )
   {
   return( MIDI_SongPlaying() );
   }

canonical_original_code:
int MUSIC_SongPlaying()
   {
   return( MIDI_SongPlaying() );
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_Continue()
{
return MIDI_ContinueSong();
}

canonical_decompiled_code:
__int64 func10()
{
return MIDI_ContinueSong();
}

original_code:
void MUSIC_Continue
   (
   void
   )
   {
   MIDI_ContinueSong();
   }

canonical_original_code:
void MUSIC_Continue()
   {
   MIDI_ContinueSong();
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_Pause()
{
return MIDI_PauseSong();
}

canonical_decompiled_code:
__int64 func11()
{
return MIDI_PauseSong();
}

original_code:
void MUSIC_Pause
   (
   void
   )
   {
   MIDI_PauseSong();
   }

canonical_original_code:
void MUSIC_Pause()
   {
   MIDI_PauseSong();
   }


decompiled_code:
__int64 MUSIC_StopSong()
{
__int64 result; // rax

MIDI_StopSong();
result = 0LL;
MUSIC_ErrorCode = 0;
return result;
}

canonical_decompiled_code:
__int64 func12()
{
__int64 result; // rax

MIDI_StopSong();
result = 0LL;
MUSIC_ErrorCode = 0;
return result;
}

original_code:
int MUSIC_StopSong
   (
   void
   )
   {
   MUSIC_StopFade();
   MIDI_StopSong();
   MUSIC_ErrorCode = ( MUSIC_Ok );;
   return( MUSIC_Ok );
   }

canonical_original_code:
int MUSIC_StopSong()
   {
   MUSIC_StopFade();
   MIDI_StopSong();
   MUSIC_ErrorCode = ( MUSIC_Ok );;
   return( MUSIC_Ok );
   }


decompiled_code:
__int64 __fastcall MUSIC_PlaySong(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 result; // rax

MIDI_StopSong();
result = MIDI_PlaySong(a1, a3);
if ( (_DWORD)result )
{
MUSIC_ErrorCode = 3;
result = 4294967294LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2, unsigned int a3)
{
__int64 result; // rax

MIDI_StopSong();
result = MIDI_PlaySong(a1, a3);
if ( (_DWORD)result )
{
MUSIC_ErrorCode = 3;
result = 4294967294LL;
}
return result;
}

original_code:
int MUSIC_PlaySong
   (
   unsigned char *song,
   unsigned int length,
   int loopflag
   )
   {
   int status;
   MIDI_StopSong();
   status = MIDI_PlaySong( song, loopflag );
   if ( status != MIDI_Ok )
      {
      MUSIC_ErrorCode = ( MUSIC_MidiError );;
      return( MUSIC_Warning );
      }
   return( MUSIC_Ok );
   }

canonical_original_code:
int MUSIC_PlaySong(unsigned char *song, unsigned int length, int loopflag)
   {
   int status;
   MIDI_StopSong();
   status = MIDI_PlaySong( song, loopflag );
   if ( status != MIDI_Ok )
      {
      MUSIC_ErrorCode = ( MUSIC_MidiError );;
      return( MUSIC_Warning );
      }
   return( MUSIC_Ok );
   }

variable_types:
song
unsigned char *

variable_types:
length
unsigned int


decompiled_code:
// attributes: thunk
__int64 MUSIC_SetContext()
{
return MIDI_SetContext();
}

canonical_decompiled_code:
__int64 func14()
{
return MIDI_SetContext();
}

original_code:
void MUSIC_SetContext
   (
   int context
   )
   {
   MIDI_SetContext( context );
   }

canonical_original_code:
void MUSIC_SetContext(int context)
   {
   MIDI_SetContext( context );
   }

variable_types: context int


decompiled_code:
// attributes: thunk
__int64 MUSIC_GetContext()
{
return MIDI_GetContext();
}

canonical_decompiled_code:
__int64 func15()
{
return MIDI_GetContext();
}

original_code:
int MUSIC_GetContext
   (
   void
   )
   {
   return MIDI_GetContext();
   }

canonical_original_code:
int MUSIC_GetContext()
   {
   return MIDI_GetContext();
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_SetSongTick()
{
return MIDI_SetSongTick();
}

canonical_decompiled_code:
__int64 func16()
{
return MIDI_SetSongTick();
}

original_code:
void MUSIC_SetSongTick
   (
   unsigned long PositionInTicks
   )
   {
   MIDI_SetSongTick( PositionInTicks );
   }

canonical_original_code:
void MUSIC_SetSongTick(unsigned long PositionInTicks)
   {
   MIDI_SetSongTick( PositionInTicks );
   }

variable_types:
PositionInTicks
unsigned long


decompiled_code:
// attributes: thunk
__int64 MUSIC_SetSongTime()
{
return MIDI_SetSongTime();
}

canonical_decompiled_code:
__int64 func17()
{
return MIDI_SetSongTime();
}

original_code:
void MUSIC_SetSongTime
   (
   unsigned long milliseconds
   )
   {
   MIDI_SetSongTime( milliseconds );
   }

canonical_original_code:
void MUSIC_SetSongTime(unsigned long milliseconds)
   {
   MIDI_SetSongTime( milliseconds );
   }

variable_types:
milliseconds
unsigned long


decompiled_code:
// attributes: thunk
__int64 MUSIC_SetSongPosition()
{
return MIDI_SetSongPosition();
}

canonical_decompiled_code:
__int64 func18()
{
return MIDI_SetSongPosition();
}

original_code:
void MUSIC_SetSongPosition
   (
   int measure,
   int beat,
   int tick
   )
   {
   MIDI_SetSongPosition( measure, beat, tick );
   }

canonical_original_code:
void MUSIC_SetSongPosition(int measure, int beat, int tick)
   {
   MIDI_SetSongPosition( measure, beat, tick );
   }

variable_types: measure int

variable_types: beat int

variable_types: tick int


decompiled_code:
// attributes: thunk
__int64 MUSIC_GetSongPosition()
{
return MIDI_GetSongPosition();
}

canonical_decompiled_code:
__int64 func19()
{
return MIDI_GetSongPosition();
}

original_code:
void MUSIC_GetSongPosition
   (
   songposition *pos
   )
   {
   MIDI_GetSongPosition( pos );
   }

canonical_original_code:
void MUSIC_GetSongPosition(struct songposition *pos)
   {
   MIDI_GetSongPosition( pos );
   }

variable_types: struct songposition { unsigned long tickposition; unsigned long milliseconds; unsigned int measure; unsigned int beat; unsigned int tick; } *


decompiled_code:
// attributes: thunk
__int64 MUSIC_GetSongLength()
{
return MIDI_GetSongLength();
}

canonical_decompiled_code:
__int64 func20()
{
return MIDI_GetSongLength();
}

original_code:
void MUSIC_GetSongLength
   (
   songposition *pos
   )
   {
   MIDI_GetSongLength( pos );
   }

canonical_original_code:
void MUSIC_GetSongLength(struct songposition *pos)
   {
   MIDI_GetSongLength( pos );
   }

user_defined_types: struct songposition { unsigned long tickposition; unsigned long milliseconds; unsigned int measure; unsigned int beat; unsigned int tick; }


decompiled_code:
__int64 MUSIC_FadeVolume()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func21()
{
return 0LL;
}

original_code:
int MUSIC_FadeVolume
   (
   int tovolume,
   int milliseconds
   )
   {
   return( MUSIC_Ok );
   }

canonical_original_code:
int MUSIC_FadeVolume(int tovolume, int milliseconds)
   {
   return( MUSIC_Ok );
   }

variable_types: tovolume int

variable_types: milliseconds int


decompiled_code:
__int64 MUSIC_FadeActive()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func22()
{
return 0LL;
}

original_code:
int MUSIC_FadeActive
   (
   void
   )
   {
   return 0;
   }

canonical_original_code:
int MUSIC_FadeActive()
   {
   return 0;
   }


decompiled_code:
void MUSIC_StopFade()
{
;
}

canonical_decompiled_code:
void func23()
{
;
}

original_code:
void MUSIC_StopFade
   (
   void
   )
   {
   }

canonical_original_code:
void MUSIC_StopFade()
   {
   }


decompiled_code:
// attributes: thunk
__int64 MUSIC_RerouteMidiChannel()
{
return MIDI_RerouteMidiChannel();
}

canonical_decompiled_code:
__int64 func24()
{
return MIDI_RerouteMidiChannel();
}

original_code:
void MUSIC_RerouteMidiChannel
   (
   int channel,
   int ( *function )( int event, int c1, int c2 )
   )
   {
   MIDI_RerouteMidiChannel( channel, function );
   }

canonical_original_code:
void MUSIC_RerouteMidiChannel(int channel, int (*function)(int event, int c1, int c2))
   {
   MIDI_RerouteMidiChannel( channel, function );
   }

variable_types:
function
int (*)(int event, int c1, int c2)


decompiled_code:
void MUSIC_RegisterTimbreBank()
{
;
}

canonical_decompiled_code:
void func25()
{
;
}

original_code:
void MUSIC_RegisterTimbreBank
   (
   unsigned char *timbres
   )
   {
   }

canonical_original_code:
void MUSIC_RegisterTimbreBank(unsigned char *timbres)
   {
   }

variable_types:
timbres
unsigned char *


decompiled_code:
__int64 CD_GetError()
{
return (unsigned int)ErrorCode;
}

canonical_decompiled_code:
__int64 func0()
{
return (unsigned int)ErrorCode;
}

original_code:
int CD_GetError(void)
{
    return ErrorCode;
}

canonical_original_code:
int CD_GetError()
{
    return ErrorCode;
}


decompiled_code:
const char *__fastcall CD_ErrorString(int a1)
{
bool v1; // cc
const char *result; // rax
unsigned int v3; // eax

v1 = a1 <= 1;
if ( a1 == 1 )
return "Invalid or unsupported card.";
while ( v1 )
{
if ( a1 != -1 )
{
result = "Unknown error code.";
if ( !a1 )
result = "No error.";
return result;
}
a1 = ErrorCode;
v1 = ErrorCode <= 1;
if ( ErrorCode == 1 )
return "Invalid or unsupported card.";
}
if ( a1 != 2 )
return "Unknown error code.";
v3 = SoundDriver_CD_GetError();
return (const char *)SoundDriver_CD_ErrorString(v3);
}

canonical_decompiled_code:
const char *__fastcall func1(int a1)
{
bool v1; // cc
const char *result; // rax
unsigned int v3; // eax

v1 = a1 <= 1;
if ( a1 == 1 )
return "Invalid or unsupported card.";
while ( v1 )
{
if ( a1 != -1 )
{
result = "Unknown error code.";
if ( !a1 )
result = "No error.";
return result;
}
a1 = ErrorCode;
v1 = ErrorCode <= 1;
if ( ErrorCode == 1 )
return "Invalid or unsupported card.";
}
if ( a1 != 2 )
return "Unknown error code.";
v3 = SoundDriver_CD_GetError();
return (const char *)SoundDriver_CD_ErrorString(v3);
}

original_code:
const char * CD_ErrorString(int code)
{
    switch (code) {
        case CD_Error:
            return CD_ErrorString(ErrorCode);
        case CD_Ok:
            return "No error.";
        case CD_InvalidCard:
            return "Invalid or unsupported card.";
        case CD_DriverError:
            return SoundDriver_CD_ErrorString(SoundDriver_CD_GetError());
        default:
            return "Unknown error code.";
    }
}

canonical_original_code:
char *CD_ErrorString(int code)
{
    switch (code) {
        case CD_Error:
            return CD_ErrorString(ErrorCode);
        case CD_Ok:
            return "No error.";
        case CD_InvalidCard:
            return "Invalid or unsupported card.";
        case CD_DriverError:
            return SoundDriver_CD_ErrorString(SoundDriver_CD_GetError());
        default:
            return "Unknown error code.";
    }
}

variable_types: code int


decompiled_code:
__int64 __fastcall CD_Init(unsigned int a1)
{
unsigned int v1; // ebx
__int64 result; // rax

if ( a1 == -2 )
{
v1 = 1;
}
else
{
v1 = a1;
if ( a1 > 6 )
{
ErrorCode = 1;
return 0xFFFFFFFFLL;
}
}
if ( !(unsigned int)SoundDriver_IsCDSupported(v1) )
v1 = 0;
ASS_CDSoundDriver = v1;
result = SoundDriver_CD_Init();
if ( (_DWORD)result )
{
ErrorCode = 2;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int a1)
{
unsigned int v1; // ebx
__int64 result; // rax

if ( a1 == -2 )
{
v1 = 1;
}
else
{
v1 = a1;
if ( a1 > 6 )
{
ErrorCode = 1;
return 0xFFFFFFFFLL;
}
}
if ( !(unsigned int)SoundDriver_IsCDSupported(v1) )
v1 = 0;
ASS_CDSoundDriver = v1;
result = SoundDriver_CD_Init();
if ( (_DWORD)result )
{
ErrorCode = 2;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int CD_Init(int SoundCard)
{
    int err;
 if (SoundCard == ASS_AutoDetect) {
  SoundCard = ASS_SDL;
 }
 if (SoundCard < 0 || SoundCard >= ASS_NumSoundCards) {
  ErrorCode = CD_InvalidCard;
  return CD_Error;
 }
 if (SoundDriver_IsCDSupported(SoundCard) == 0) {
  SoundCard = ASS_NoSound;
 }
    ASS_CDSoundDriver = SoundCard;
    err = SoundDriver_CD_Init();
    if (err != CD_Ok) {
        ErrorCode = CD_DriverError;
        return CD_Error;
    }
    return CD_Ok;
}

variable_types: SoundCard int

variable_types: err int


decompiled_code:
// attributes: thunk
__int64 CD_Shutdown()
{
return SoundDriver_CD_Shutdown();
}

canonical_decompiled_code:
__int64 func3()
{
return SoundDriver_CD_Shutdown();
}

original_code:
void CD_Shutdown(void)
{
    SoundDriver_CD_Shutdown();
}

canonical_original_code:
void CD_Shutdown()
{
    SoundDriver_CD_Shutdown();
}


decompiled_code:
__int64 CD_Play()
{
__int64 result; // rax

result = SoundDriver_CD_Play();
if ( (_DWORD)result )
{
ErrorCode = result;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 func4()
{
__int64 result; // rax

result = SoundDriver_CD_Play();
if ( (_DWORD)result )
{
ErrorCode = result;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int CD_Play(int track, int loop)
{
    int err;
    err = SoundDriver_CD_Play(track, loop);
    if (err != CD_Ok) {
        ErrorCode = err;
        return CD_Error;
    }
    return CD_Ok;
}

variable_types: track int

variable_types: loop int


decompiled_code:
// attributes: thunk
__int64 CD_Stop()
{
return SoundDriver_CD_Stop();
}

canonical_decompiled_code:
__int64 func5()
{
return SoundDriver_CD_Stop();
}

original_code:
void CD_Stop(void)
{
    SoundDriver_CD_Stop();
}

canonical_original_code:
void CD_Stop()
{
    SoundDriver_CD_Stop();
}


decompiled_code:
// attributes: thunk
__int64 CD_Pause()
{
return SoundDriver_CD_Pause();
}

canonical_decompiled_code:
__int64 func6()
{
return SoundDriver_CD_Pause();
}

original_code:
void CD_Pause(int pauseon)
{
    SoundDriver_CD_Pause(pauseon);
}

variable_types: pauseon int


decompiled_code:
// attributes: thunk
__int64 CD_IsPlaying()
{
return SoundDriver_CD_IsPlaying();
}

canonical_decompiled_code:
__int64 func7()
{
return SoundDriver_CD_IsPlaying();
}

original_code:
int CD_IsPlaying(void)
{
    return SoundDriver_CD_IsPlaying();
}

canonical_original_code:
int CD_IsPlaying()
{
    return SoundDriver_CD_IsPlaying();
}


decompiled_code:
// attributes: thunk
__int64 CD_SetVolume()
{
return SoundDriver_CD_SetVolume();
}

canonical_decompiled_code:
__int64 func8()
{
return SoundDriver_CD_SetVolume();
}

original_code:
void CD_SetVolume(int volume)
{
    SoundDriver_CD_SetVolume(volume);
}

variable_types: volume int


decompiled_code:
__int64 NoSoundDrv_GetError()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0LL;
}

original_code:
int NoSoundDrv_GetError(void)
{
 return 0;
}

canonical_original_code:
int NoSoundDrv_GetError()
{
 return 0;
}


decompiled_code:
const char *NoSoundDrv_ErrorString()
{
return "No sound, Ok.";
}

canonical_decompiled_code:
const char *func1()
{
return "No sound, Ok.";
}

original_code:
const char *NoSoundDrv_ErrorString( int ErrorNumber )
{
 return "No sound, Ok.";
}

canonical_original_code:
char *NoSoundDrv_ErrorString(int ErrorNumber)
{
 return "No sound, Ok.";
}

variable_types: ErrorNumber int


decompiled_code:
__int64 NoSoundDrv_PCM_Init()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func2()
{
return 0LL;
}

original_code:
int NoSoundDrv_PCM_Init(int * mixrate, int * numchannels, int * samplebits, void * initdata)
{
 return 0;
}

canonical_original_code:
int NoSoundDrv_PCM_Init(int *mixrate, int *numchannels, int *samplebits, void *initdata)
{
 return 0;
}

variable_types:
mixrate
int *

variable_types:
numchannels
int *

variable_types:
samplebits
int *

variable_types:
initdata
void *


decompiled_code:
void NoSoundDrv_PCM_Shutdown()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
void NoSoundDrv_PCM_Shutdown(void)
{
}

canonical_original_code:
void NoSoundDrv_PCM_Shutdown()
{
}


decompiled_code:
__int64 NoSoundDrv_PCM_BeginPlayback()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func4()
{
return 0LL;
}

original_code:
int NoSoundDrv_PCM_BeginPlayback(char *BufferStart, int BufferSize,
      int NumDivisions, void ( *CallBackFunc )( void ) )
{
 return 0;
}

canonical_original_code:
int NoSoundDrv_PCM_BeginPlayback(char *BufferStart, int BufferSize, int NumDivisions, void (*CallBackFunc)())
{
 return 0;
}

variable_types:
BufferStart
char *

variable_types: BufferSize int

variable_types: NumDivisions int

variable_types:
CallBackFunc
void (*)()


decompiled_code:
void NoSoundDrv_PCM_StopPlayback()
{
;
}

canonical_decompiled_code:
void func5()
{
;
}

original_code:
void NoSoundDrv_PCM_StopPlayback(void)
{
}

canonical_original_code:
void NoSoundDrv_PCM_StopPlayback()
{
}


decompiled_code:
void NoSoundDrv_PCM_Lock()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code:
void NoSoundDrv_PCM_Lock(void)
{
}

canonical_original_code:
void NoSoundDrv_PCM_Lock()
{
}


decompiled_code:
void NoSoundDrv_PCM_Unlock()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code:
void NoSoundDrv_PCM_Unlock(void)
{
}

canonical_original_code:
void NoSoundDrv_PCM_Unlock()
{
}


decompiled_code:
// attributes: thunk
__int64 NoSoundDrv_CD_Init()
{
return NoSoundDrv_GetError();
}

canonical_decompiled_code:
__int64 func8()
{
return func0();
}

original_code:
int NoSoundDrv_CD_Init(void)
{
    return 0;
}

canonical_original_code:
int NoSoundDrv_CD_Init()
{
    return 0;
}


decompiled_code:
void NoSoundDrv_CD_Shutdown()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code:
void NoSoundDrv_CD_Shutdown(void)
{
}

canonical_original_code:
void NoSoundDrv_CD_Shutdown()
{
}


decompiled_code:
__int64 NoSoundDrv_CD_Play()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func10()
{
return 0LL;
}

original_code:
int NoSoundDrv_CD_Play(int track, int loop)
{
    return 0;
}


decompiled_code:
void NoSoundDrv_CD_Stop()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code:
void NoSoundDrv_CD_Stop(void)
{
}

canonical_original_code:
void NoSoundDrv_CD_Stop()
{
}


decompiled_code:
void NoSoundDrv_CD_Pause()
{
;
}

canonical_decompiled_code:
void func12()
{
;
}

original_code:
void NoSoundDrv_CD_Pause(int pauseon)
{
}


decompiled_code:
// attributes: thunk
__int64 NoSoundDrv_CD_IsPlaying()
{
return NoSoundDrv_GetError();
}

canonical_decompiled_code:
__int64 func13()
{
return func0();
}

original_code:
int NoSoundDrv_CD_IsPlaying(void)
{
    return 0;
}

canonical_original_code:
int NoSoundDrv_CD_IsPlaying()
{
    return 0;
}


decompiled_code:
void NoSoundDrv_CD_SetVolume()
{
;
}

canonical_decompiled_code:
void func14()
{
;
}

original_code:
void NoSoundDrv_CD_SetVolume(int volume)
{
}


decompiled_code:
__int64 __fastcall NoSoundDrv_MIDI_Init(_QWORD *a1)
{
int v1; // ecx
unsigned __int64 v2; // rdi
__int64 result; // rax

*a1 = 0LL;
v1 = (int)a1;
v2 = (unsigned __int64)(a1 + 1);
result = 0LL;
*(_QWORD *)(v2 + 80) = 0LL;
memset((void *)(v2 & 0xFFFFFFFFFFFFFFF8LL), 0, 8 * ((v1 - (v2 & 0xFFFFFFF8) + 96) >> 3));
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(_QWORD *a1)
{
int v1; // ecx
unsigned __int64 v2; // rdi
__int64 result; // rax

*a1 = 0LL;
v1 = (int)a1;
v2 = (unsigned __int64)(a1 + 1);
result = 0LL;
*(_QWORD *)(v2 + 80) = 0LL;
memset((void *)(v2 & 0xFFFFFFFFFFFFFFF8LL), 0, 8 * ((v1 - (v2 & 0xFFFFFFF8) + 96) >> 3));
return result;
}

original_code:
int NoSoundDrv_MIDI_Init(midifuncs *funcs)
{
    memset(funcs, 0, sizeof(midifuncs));
    return 0;
}

canonical_original_code:
int NoSoundDrv_MIDI_Init(struct midifuncs *funcs)
{
    memset(funcs, 0, sizeof(midifuncs));
    return 0;
}

variable_types: struct midifuncs { void (*NoteOff)(int channel, int key, int velocity); void (*NoteOn)(int channel, int key, int velocity); void (*PolyAftertouch)(int channel, int key, int pressure); void (*ControlChange)(int channel, int number, int value); void (*ProgramChange)(int channel, int program); void (*ChannelAftertouch)(int channel, int pressure); void (*PitchBend)(int channel, int lsb, int msb); void (*ReleasePatches)(); void (*LoadPatch)(int number); void (*SetVolume)(int volume); int (*GetVolume)(); void (*SysEx)(unsigned char *data, int length); } *


decompiled_code:
void NoSoundDrv_MIDI_Shutdown()
{
;
}

canonical_decompiled_code:
void func16()
{
;
}

original_code:
void NoSoundDrv_MIDI_Shutdown(void)
{
}

canonical_original_code:
void NoSoundDrv_MIDI_Shutdown()
{
}


decompiled_code:
__int64 NoSoundDrv_MIDI_StartPlayback()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func17()
{
return 0LL;
}

original_code:
int NoSoundDrv_MIDI_StartPlayback(void (*service)(void))
{
    return 0;
}

canonical_original_code:
int NoSoundDrv_MIDI_StartPlayback(void (*service)())
{
    return 0;
}

variable_types:
service
void (*)()


decompiled_code:
void NoSoundDrv_MIDI_HaltPlayback()
{
;
}

canonical_decompiled_code:
void func18()
{
;
}

original_code:
void NoSoundDrv_MIDI_HaltPlayback(void)
{
}

canonical_original_code:
void NoSoundDrv_MIDI_HaltPlayback()
{
}


decompiled_code:
__int64 NoSoundDrv_MIDI_GetTick()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func19()
{
return 0LL;
}

original_code:
unsigned int NoSoundDrv_MIDI_GetTick(void)
{
    return 0;
}

canonical_original_code:
unsigned int NoSoundDrv_MIDI_GetTick()
{
    return 0;
}

return_type: unsigned int


decompiled_code:
void NoSoundDrv_MIDI_SetTempo()
{
;
}

canonical_decompiled_code:
void func20()
{
;
}

original_code:
void NoSoundDrv_MIDI_SetTempo(int tempo, int division)
{
}

variable_types: tempo int

variable_types: division int


decompiled_code:
void NoSoundDrv_MIDI_Lock()
{
;
}

canonical_decompiled_code:
void func21()
{
;
}

original_code:
void NoSoundDrv_MIDI_Lock(void)
{
}

canonical_original_code:
void NoSoundDrv_MIDI_Lock()
{
}


decompiled_code:
void NoSoundDrv_MIDI_Unlock()
{
;
}

canonical_decompiled_code:
void func22()
{
;
}

original_code:
void NoSoundDrv_MIDI_Unlock(void)
{
}

canonical_original_code:
void NoSoundDrv_MIDI_Unlock()
{
}


decompiled_code:
__int64 ALSADrv_GetError()
{
return (unsigned int)ErrorCode;
}

canonical_decompiled_code:
__int64 func10()
{
return (unsigned int)ErrorCode;
}

original_code:
int ALSADrv_GetError(void)
{
 return ErrorCode;
}

canonical_original_code:
int ALSADrv_GetError()
{
 return ErrorCode;
}


decompiled_code:
const char *__fastcall ALSADrv_ErrorString(int a1)
{
const char *result; // rax

while ( 2 )
{
switch ( a1 )
{
case -2:
case -1:
a1 = ErrorCode;
continue;
case 0:
result = "ALSA ok.";
break;
case 1:
result = "ALSA uninitialised.";
break;
case 2:
result = "ALSA error: failed in snd_seq_open.\n";
break;
case 3:
result = "ALSA error: failed in snd_seq_create_simple_port.\n";
break;
case 4:
result = "ALSA error: failed in snd_seq_alloc_queue.\n";
break;
case 5:
result = "ALSA error: failed in snd_seq_connect_to.\n";
break;
default:
result = "Unknown ALSA error.";
break;
}
break;
}
return result;
}

canonical_decompiled_code:
const char *__fastcall func11(int a1)
{
const char *result; // rax

while ( 2 )
{
switch ( a1 )
{
case -2:
case -1:
a1 = ErrorCode;
continue;
case 0:
result = "ALSA ok.";
break;
case 1:
result = "ALSA uninitialised.";
break;
case 2:
result = "ALSA error: failed in snd_seq_open.\n";
break;
case 3:
result = "ALSA error: failed in snd_seq_create_simple_port.\n";
break;
case 4:
result = "ALSA error: failed in snd_seq_alloc_queue.\n";
break;
case 5:
result = "ALSA error: failed in snd_seq_connect_to.\n";
break;
default:
result = "Unknown ALSA error.";
break;
}
break;
}
return result;
}

original_code:
const char *ALSADrv_ErrorString( int ErrorNumber )
{
 const char *ErrorString;
    switch( ErrorNumber )
 {
        case ALSAErr_Warning :
        case ALSAErr_Error :
            ErrorString = ALSADrv_ErrorString( ErrorCode );
            break;
        case ALSAErr_Ok :
            ErrorString = "ALSA ok.";
            break;
  case ALSAErr_Uninitialised:
   ErrorString = "ALSA uninitialised.";
   break;
        case ALSAErr_SeqOpen:
            ErrorString = "ALSA error: failed in snd_seq_open.\n";
            break;
        case ALSAErr_CreateSimplePort:
            ErrorString = "ALSA error: failed in snd_seq_create_simple_port.\n";
            break;
        case ALSAErr_AllocQueue:
            ErrorString = "ALSA error: failed in snd_seq_alloc_queue.\n";
            break;
        case ALSAErr_ConnectTo:
            ErrorString = "ALSA error: failed in snd_seq_connect_to.\n";
            break;
        default:
            ErrorString = "Unknown ALSA error.";
            break;
    }
 return ErrorString;
}

canonical_original_code:
char *ALSADrv_ErrorString(int ErrorNumber)
{
 char *ErrorString;
    switch( ErrorNumber )
 {
        case ALSAErr_Warning :
        case ALSAErr_Error :
            ErrorString = ALSADrv_ErrorString( ErrorCode );
            break;
        case ALSAErr_Ok :
            ErrorString = "ALSA ok.";
            break;
  case ALSAErr_Uninitialised:
   ErrorString = "ALSA uninitialised.";
   break;
        case ALSAErr_SeqOpen:
            ErrorString = "ALSA error: failed in snd_seq_open.\n";
            break;
        case ALSAErr_CreateSimplePort:
            ErrorString = "ALSA error: failed in snd_seq_create_simple_port.\n";
            break;
        case ALSAErr_AllocQueue:
            ErrorString = "ALSA error: failed in snd_seq_alloc_queue.\n";
            break;
        case ALSAErr_ConnectTo:
            ErrorString = "ALSA error: failed in snd_seq_connect_to.\n";
            break;
        default:
            ErrorString = "Unknown ALSA error.";
            break;
    }
 return ErrorString;
}

variable_types:
ErrorString
char *


decompiled_code:
__int64 ALSADrv_MIDI_HaltPlayback()
{
__int64 result; // rax
int v1; // eax
void *thread_return; // [rsp+0h] [rbp-10h] BYREF

result = (unsigned int)threadRunning;
if ( threadRunning )
{
threadQuit = 1;
if ( pthread_join(thread, &thread_return) )
fwrite("ALSA pthread_join returned error\n", 1uLL, 0x21uLL, stderr);
do
v1 = snd_seq_drain_output(seq);
while ( v1 > 0 );
if ( v1 )
fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)v1);
result = snd_seq_sync_output_queue(seq);
threadRunning = 0;
}
return result;
}

canonical_decompiled_code:
__int64 func12()
{
__int64 result; // rax
int v1; // eax
void *thread_return; // [rsp+0h] [rbp-10h] BYREF

result = (unsigned int)threadRunning;
if ( threadRunning )
{
threadQuit = 1;
if ( pthread_join(thread, &thread_return) )
fwrite("ALSA pthread_join returned error\n", 1uLL, 0x21uLL, stderr);
do
v1 = snd_seq_drain_output(seq);
while ( v1 > 0 );
if ( v1 )
fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)v1);
result = snd_seq_sync_output_queue(seq);
threadRunning = 0;
}
return result;
}

original_code:
void ALSADrv_MIDI_HaltPlayback(void)
{
    int result;
    void * ret;
    if (!threadRunning) {
        return;
    }
    threadQuit = 1;
    if (pthread_join(thread, &ret)) {
        fprintf(stderr, "ALSA pthread_join returned error\n");
    }
    if (queueRunning) {
    }
    while ((result = snd_seq_drain_output(seq)) > 0) ;
    if (result < 0) {
        fprintf(stderr, "ALSA could not drain output: err %d\n", result);
    }
    snd_seq_sync_output_queue(seq);
    threadRunning = 0;
}

canonical_original_code:
void ALSADrv_MIDI_HaltPlayback()
{
    int result;
    void *ret;
    if (!threadRunning) {
        return;
    }
    threadQuit = 1;
    if (pthread_join(thread, &ret)) {
        fprintf(stderr, "ALSA pthread_join returned error\n");
    }
    if (queueRunning) {
    }
    while ((result = snd_seq_drain_output(seq)) > 0) ;
    if (result < 0) {
        fprintf(stderr, "ALSA could not drain output: err %d\n", result);
    }
    snd_seq_sync_output_queue(seq);
    threadRunning = 0;
}

variable_types: result int

variable_types:
ret
void *


decompiled_code:
__int64 ALSADrv_MIDI_Shutdown()
{
__int64 result; // rax

result = ALSADrv_MIDI_HaltPlayback();
if ( seq_queue >= 0 )
result = snd_seq_free_queue(seq);
if ( seq_port >= 0 )
result = snd_seq_delete_simple_port(seq);
if ( seq )
result = snd_seq_close();
seq_queue = -1;
seq_port = -1;
seq = 0LL;
return result;
}

canonical_decompiled_code:
__int64 func13()
{
__int64 result; // rax

result = func12();
if ( seq_queue >= 0 )
result = snd_seq_free_queue(seq);
if ( seq_port >= 0 )
result = snd_seq_delete_simple_port(seq);
if ( seq )
result = snd_seq_close();
seq_queue = -1;
seq_port = -1;
seq = 0LL;
return result;
}

original_code:
void ALSADrv_MIDI_Shutdown(void)
{
    ALSADrv_MIDI_HaltPlayback();
    if (seq_queue >= 0) {
        snd_seq_free_queue(seq, seq_queue);
    }
    if (seq_port >= 0) {
        snd_seq_delete_simple_port(seq, seq_port);
    }
    if (seq) {
        snd_seq_close(seq);
    }
    seq_queue = -1;
    seq_port = -1;
    seq = 0;
}

canonical_original_code:
void ALSADrv_MIDI_Shutdown()
{
    ALSADrv_MIDI_HaltPlayback();
    if (seq_queue >= 0) {
        snd_seq_free_queue(seq, seq_queue);
    }
    if (seq_port >= 0) {
        snd_seq_delete_simple_port(seq, seq_port);
    }
    if (seq) {
        snd_seq_close(seq);
    }
    seq_queue = -1;
    seq_port = -1;
    seq = 0;
}


decompiled_code:
__int64 __fastcall ALSADrv_MIDI_Init(int (__fastcall **a1)(unsigned __int8 a1, char a2, char a3))
{
int v1; // eax
int v2; // eax
__int64 result; // rax
unsigned int v4; // [rsp+Ch] [rbp-Ch]

ALSADrv_MIDI_Shutdown();
*a1 = 0LL;
a1[11] = 0LL;
memset(
(void *)((unsigned __int64)(a1 + 1) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL * (((unsigned int)a1 - (((_DWORD)a1 + 8) & 0xFFFFFFF8) + 96) >> 3));
v1 = snd_seq_open(&seq, "default", 3LL);
if ( v1 < 0 )
{
fprintf(stderr, "ALSA snd_seq_open err %d\n", (unsigned int)v1);
result = 0xFFFFFFFFLL;
ErrorCode = 2;
}
else
{
seq_port = snd_seq_create_simple_port(seq, "output", 3LL, 0x100000LL);
if ( seq_port < 0 )
{
ALSADrv_MIDI_Shutdown();
fprintf(stderr, "ALSA snd_seq_create_simple_port err %d\n", (unsigned int)seq_port);
result = 0xFFFFFFFFLL;
ErrorCode = 3;
}
else
{
snd_seq_set_client_name(seq, "JFAudioLib application");
seq_queue = snd_seq_alloc_queue(seq);
if ( seq_queue < 0 )
{
ALSADrv_MIDI_Shutdown();
fprintf(stderr, "ALSA snd_seq_alloc_queue err %d\n", (unsigned int)seq_queue);
result = 0xFFFFFFFFLL;
ErrorCode = 4;
}
else
{
v2 = snd_seq_connect_to(seq, (unsigned int)seq_port, 128LL, 0LL);
if ( v2 < 0 )
{
v4 = v2;
ALSADrv_MIDI_Shutdown();
fprintf(stderr, "ALSA snd_seq_connect_to err %d\n", v4);
result = 0xFFFFFFFFLL;
ErrorCode = 5;
}
else
{
*a1 = Func_NoteOff;
result = 0LL;
a1[1] = Func_NoteOn;
a1[2] = Func_PolyAftertouch;
a1[3] = (int (__fastcall *)(unsigned __int8, char, char))Func_ControlChange;
a1[4] = (int (__fastcall *)(unsigned __int8, char, char))Func_ProgramChange;
a1[5] = (int (__fastcall *)(unsigned __int8, char, char))Func_ChannelAftertouch;
a1[6] = (int (__fastcall *)(unsigned __int8, char, char))Func_PitchBend;
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(int (__fastcall **a1)(unsigned __int8 a1, char a2, char a3))
{
int v1; // eax
int v2; // eax
__int64 result; // rax
unsigned int v4; // [rsp+Ch] [rbp-Ch]

func13();
*a1 = 0LL;
a1[11] = 0LL;
memset(
(void *)((unsigned __int64)(a1 + 1) & 0xFFFFFFFFFFFFFFF8LL),
0,
8LL * (((unsigned int)a1 - (((_DWORD)a1 + 8) & 0xFFFFFFF8) + 96) >> 3));
v1 = snd_seq_open(&seq, "default", 3LL);
if ( v1 < 0 )
{
fprintf(stderr, "ALSA snd_seq_open err %d\n", (unsigned int)v1);
result = 0xFFFFFFFFLL;
ErrorCode = 2;
}
else
{
seq_port = snd_seq_create_simple_port(seq, "output", 3LL, 0x100000LL);
if ( seq_port < 0 )
{
func13();
fprintf(stderr, "ALSA snd_seq_create_simple_port err %d\n", (unsigned int)seq_port);
result = 0xFFFFFFFFLL;
ErrorCode = 3;
}
else
{
snd_seq_set_client_name(seq, "JFAudioLib application");
seq_queue = snd_seq_alloc_queue(seq);
if ( seq_queue < 0 )
{
func13();
fprintf(stderr, "ALSA snd_seq_alloc_queue err %d\n", (unsigned int)seq_queue);
result = 0xFFFFFFFFLL;
ErrorCode = 4;
}
else
{
v2 = snd_seq_connect_to(seq, (unsigned int)seq_port, 128LL, 0LL);
if ( v2 < 0 )
{
v4 = v2;
func13();
fprintf(stderr, "ALSA snd_seq_connect_to err %d\n", v4);
result = 0xFFFFFFFFLL;
ErrorCode = 5;
}
else
{
*a1 = Func_NoteOff;
result = 0LL;
a1[1] = Func_NoteOn;
a1[2] = Func_PolyAftertouch;
a1[3] = (int (__fastcall *)(unsigned __int8, char, char))Func_ControlChange;
a1[4] = (int (__fastcall *)(unsigned __int8, char, char))Func_ProgramChange;
a1[5] = (int (__fastcall *)(unsigned __int8, char, char))Func_ChannelAftertouch;
a1[6] = (int (__fastcall *)(unsigned __int8, char, char))Func_PitchBend;
}
}
}
}
return result;
}

original_code:
int ALSADrv_MIDI_Init(midifuncs *funcs)
{
    int result;
    ALSADrv_MIDI_Shutdown();
    memset(funcs, 0, sizeof(midifuncs));
    result = snd_seq_open(&seq, "default", (1|2), 0);
    if (result < 0) {
        fprintf(stderr, "ALSA snd_seq_open err %d\n", result);
        ErrorCode = ALSAErr_SeqOpen;
        return ALSAErr_Error;
    }
    seq_port = snd_seq_create_simple_port(seq, "output",
                  (1<<0) | (1<<1),
                  (1<<20));
    if (seq_port < 0) {
        ALSADrv_MIDI_Shutdown();
        fprintf(stderr, "ALSA snd_seq_create_simple_port err %d\n", seq_port);
        ErrorCode = ALSAErr_CreateSimplePort;
        return ALSAErr_Error;
    }
    snd_seq_set_client_name(seq, "JFAudioLib application");
    seq_queue = snd_seq_alloc_queue(seq);
    if (seq_queue < 0) {
        ALSADrv_MIDI_Shutdown();
        fprintf(stderr, "ALSA snd_seq_alloc_queue err %d\n", seq_queue);
        ErrorCode = ALSAErr_AllocQueue;
        return ALSAErr_Error;
    }
    result = snd_seq_connect_to(seq, seq_port, 128, 0);
    if (result < 0) {
        ALSADrv_MIDI_Shutdown();
        fprintf(stderr, "ALSA snd_seq_connect_to err %d\n", result);
        ErrorCode = ALSAErr_ConnectTo;
        return ALSAErr_Error;
    }
    funcs->NoteOff = Func_NoteOff;
    funcs->NoteOn = Func_NoteOn;
    funcs->PolyAftertouch = Func_PolyAftertouch;
    funcs->ControlChange = Func_ControlChange;
    funcs->ProgramChange = Func_ProgramChange;
    funcs->ChannelAftertouch = Func_ChannelAftertouch;
    funcs->PitchBend = Func_PitchBend;
    return ALSAErr_Ok;
}

canonical_original_code:
int ALSADrv_MIDI_Init(struct midifuncs *funcs)
{
    int result;
    ALSADrv_MIDI_Shutdown();
    memset(funcs, 0, sizeof(midifuncs));
    result = snd_seq_open(&seq, "default", (1|2), 0);
    if (result < 0) {
        fprintf(stderr, "ALSA snd_seq_open err %d\n", result);
        ErrorCode = ALSAErr_SeqOpen;
        return ALSAErr_Error;
    }
    seq_port = snd_seq_create_simple_port(seq, "output",
                  (1<<0) | (1<<1),
                  (1<<20));
    if (seq_port < 0) {
        ALSADrv_MIDI_Shutdown();
        fprintf(stderr, "ALSA snd_seq_create_simple_port err %d\n", seq_port);
        ErrorCode = ALSAErr_CreateSimplePort;
        return ALSAErr_Error;
    }
    snd_seq_set_client_name(seq, "JFAudioLib application");
    seq_queue = snd_seq_alloc_queue(seq);
    if (seq_queue < 0) {
        ALSADrv_MIDI_Shutdown();
        fprintf(stderr, "ALSA snd_seq_alloc_queue err %d\n", seq_queue);
        ErrorCode = ALSAErr_AllocQueue;
        return ALSAErr_Error;
    }
    result = snd_seq_connect_to(seq, seq_port, 128, 0);
    if (result < 0) {
        ALSADrv_MIDI_Shutdown();
        fprintf(stderr, "ALSA snd_seq_connect_to err %d\n", result);
        ErrorCode = ALSAErr_ConnectTo;
        return ALSAErr_Error;
    }
    funcs->NoteOff = Func_NoteOff;
    funcs->NoteOn = Func_NoteOn;
    funcs->PolyAftertouch = Func_PolyAftertouch;
    funcs->ControlChange = Func_ControlChange;
    funcs->ProgramChange = Func_ProgramChange;
    funcs->ChannelAftertouch = Func_ChannelAftertouch;
    funcs->PitchBend = Func_PitchBend;
    return ALSAErr_Ok;
}

user_defined_types: struct midifuncs { void (*NoteOff)(int channel, int key, int velocity); void (*NoteOn)(int channel, int key, int velocity); void (*PolyAftertouch)(int channel, int key, int pressure); void (*ControlChange)(int channel, int number, int value); void (*ProgramChange)(int channel, int program); void (*ChannelAftertouch)(int channel, int pressure); void (*PitchBend)(int channel, int lsb, int msb); void (*ReleasePatches)(); void (*LoadPatch)(int number); void (*SetVolume)(int volume); int (*GetVolume)(); void (*SysEx)(unsigned char *data, int length); }


decompiled_code:
int __fastcall ALSADrv_MIDI_StartPlayback(__int64 (__fastcall *a1)(_QWORD, _QWORD, _QWORD, _QWORD))
{
int v1; // eax
int v2; // eax
int result; // eax
int v4; // eax

ALSADrv_MIDI_HaltPlayback();
threadService = a1;
threadQuit = 0;
if ( !queueRunning )
{
v1 = snd_seq_control_queue(seq, (unsigned int)seq_queue, 30LL, 0LL, 0LL);
if ( v1 < 0 )
{
fprintf(stderr, "ALSA snd_seq_start_queue err %d\n", (unsigned int)v1);
return 6;
}
do
v2 = snd_seq_drain_output(seq);
while ( v2 > 0 );
if ( v2 )
fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)v2);
}
queueRunning = 1;
result = pthread_create(&thread, 0LL, threadProc, 0LL);
if ( result )
{
fwrite("ALSA pthread_create returned error\n", 1uLL, 0x23uLL, stderr);
snd_seq_control_queue(seq, (unsigned int)seq_queue, 32LL, 0LL, 0LL);
do
v4 = snd_seq_drain_output(seq);
while ( v4 > 0 );
if ( v4 )
fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)v4);
queueRunning = 0;
result = 8;
}
else
{
threadRunning = 1;
}
return result;
}

canonical_decompiled_code:
int __fastcall func15(__int64 (__fastcall *a1)(_QWORD, _QWORD, _QWORD, _QWORD))
{
int v1; // eax
int v2; // eax
int result; // eax
int v4; // eax

func12();
threadService = a1;
threadQuit = 0;
if ( !queueRunning )
{
v1 = snd_seq_control_queue(seq, (unsigned int)seq_queue, 30LL, 0LL, 0LL);
if ( v1 < 0 )
{
fprintf(stderr, "ALSA snd_seq_start_queue err %d\n", (unsigned int)v1);
return 6;
}
do
v2 = snd_seq_drain_output(seq);
while ( v2 > 0 );
if ( v2 )
fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)v2);
}
queueRunning = 1;
result = pthread_create(&thread, 0LL, threadProc, 0LL);
if ( result )
{
fwrite("ALSA pthread_create returned error\n", 1uLL, 0x23uLL, stderr);
snd_seq_control_queue(seq, (unsigned int)seq_queue, 32LL, 0LL, 0LL);
do
v4 = snd_seq_drain_output(seq);
while ( v4 > 0 );
if ( v4 )
fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)v4);
queueRunning = 0;
result = 8;
}
else
{
threadRunning = 1;
}
return result;
}

original_code:
int ALSADrv_MIDI_StartPlayback(void (*service)(void))
{
    int result;
    ALSADrv_MIDI_HaltPlayback();
    threadService = service;
    threadQuit = 0;
    if (!queueRunning) {
        result = snd_seq_control_queue(seq, seq_queue, SND_SEQ_EVENT_START, 0, ((void *)0));
        if (result < 0) {
            fprintf(stderr, "ALSA snd_seq_start_queue err %d\n", result);
            return ALSAErr_StartQueue;
        }
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
    }
    queueRunning = 1;
    if (pthread_create(&thread, ((void *)0), threadProc, ((void *)0))) {
        fprintf(stderr, "ALSA pthread_create returned error\n");
        snd_seq_control_queue(seq, seq_queue, SND_SEQ_EVENT_STOP, 0, ((void *)0));
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
        queueRunning = 0;
        return ALSAErr_PlayThread;
    }
    threadRunning = 1;
    return 0;
}

canonical_original_code:
int ALSADrv_MIDI_StartPlayback(void (*service)())
{
    int result;
    ALSADrv_MIDI_HaltPlayback();
    threadService = service;
    threadQuit = 0;
    if (!queueRunning) {
        result = snd_seq_control_queue(seq, seq_queue, SND_SEQ_EVENT_START, 0, ((void *)0));
        if (result < 0) {
            fprintf(stderr, "ALSA snd_seq_start_queue err %d\n", result);
            return ALSAErr_StartQueue;
        }
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
    }
    queueRunning = 1;
    if (pthread_create(&thread, ((void *)0), threadProc, ((void *)0))) {
        fprintf(stderr, "ALSA pthread_create returned error\n");
        snd_seq_control_queue(seq, seq_queue, SND_SEQ_EVENT_STOP, 0, ((void *)0));
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
        queueRunning = 0;
        return ALSAErr_PlayThread;
    }
    threadRunning = 1;
    return 0;
}


decompiled_code:
void ALSADrv_MIDI_Lock()
{
;
}

canonical_decompiled_code:
void func17()
{
;
}

original_code:
void ALSADrv_MIDI_Lock(void)
{
}

canonical_original_code:
void ALSADrv_MIDI_Lock()
{
}


decompiled_code:
void ALSADrv_MIDI_Unlock()
{
;
}

original_code:
void ALSADrv_MIDI_Unlock(void)
{
}

canonical_original_code:
void ALSADrv_MIDI_Unlock()
{
}


decompiled_code:
int __fastcall sequence_event(__int64 a1)
{
int v1; // eax
int result; // eax

*(_BYTE *)(a1 + 1) &= 0xFCu;
*(_WORD *)(a1 + 14) = -514;
*(_BYTE *)(a1 + 13) = seq_port;
*(_DWORD *)(a1 + 4) = threadTimer;
*(_BYTE *)(a1 + 3) = seq_queue;
v1 = snd_seq_event_output(seq, a1);
if ( v1 < 0 )
return fprintf(stderr, "ALSA could not queue event: err %d\n", (unsigned int)v1);
do
result = snd_seq_drain_output(seq);
while ( result > 0 );
if ( result )
result = fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)result);
return result;
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1)
{
int v1; // eax
int result; // eax

*(_BYTE *)(a1 + 1) &= 0xFCu;
*(_WORD *)(a1 + 14) = -514;
*(_BYTE *)(a1 + 13) = seq_port;
*(_DWORD *)(a1 + 4) = threadTimer;
*(_BYTE *)(a1 + 3) = seq_queue;
v1 = snd_seq_event_output(seq, a1);
if ( v1 < 0 )
return fprintf(stderr, "ALSA could not queue event: err %d\n", (unsigned int)v1);
do
result = snd_seq_drain_output(seq);
while ( result > 0 );
if ( result )
result = fprintf(stderr, "ALSA could not drain output: err %d\n", (unsigned int)result);
return result;
}

original_code:
static inline void sequence_event(snd_seq_event_t * ev)
{
    int result = 0;
    ((ev)->dest.client = 254, (ev)->dest.port = 253);
    ((ev)->source.port = (seq_port));
    ((ev)->flags &= ~((1<<0) | (1<<1)), (ev)->flags |= (0<<0), (ev)->flags |= (0) ? (1<<1) : (0<<1), (ev)->time.tick = (threadTimer), (ev)->queue = (seq_queue));
    result = snd_seq_event_output(seq, ev);
    if (result < 0) {
        fprintf(stderr, "ALSA could not queue event: err %d\n", result);
    } else {
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
    }
}

canonical_original_code:
static inline void sequence_event(struct snd_seq_event *ev)
{
    int result = 0;
    ((ev)->dest.client = 254, (ev)->dest.port = 253);
    ((ev)->source.port = (seq_port));
    ((ev)->flags &= ~((1<<0) | (1<<1)), (ev)->flags |= (0<<0), (ev)->flags |= (0) ? (1<<1) : (0<<1), (ev)->time.tick = (threadTimer), (ev)->queue = (seq_queue));
    result = snd_seq_event_output(seq, ev);
    if (result < 0) {
        fprintf(stderr, "ALSA could not queue event: err %d\n", result);
    } else {
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
    }
}

variable_types: struct snd_seq_event { unsigned char type; unsigned char flags; unsigned char tag; unsigned char queue; union snd_seq_timestamp { unsigned int tick; struct snd_seq_real_time { unsigned int tv_sec; unsigned int tv_nsec; } time; } time; struct snd_seq_addr { unsigned char client; unsigned char port; } source; struct snd_seq_addr dest; union { struct snd_seq_ev_note { unsigned char channel; unsigned char note; unsigned char velocity; unsigned char off_velocity; unsigned int duration; } note; struct snd_seq_ev_ctrl { unsigned char channel; unsigned char unused[3]; unsigned int param; int value; } control; struct snd_seq_ev_raw8 { unsigned char d[12]; } raw8; struct snd_seq_ev_raw32 { unsigned int d[3]; } raw32; struct snd_seq_ev_ext { unsigned int len; void *ptr; } ext; struct snd_seq_ev_queue_control { unsigned char queue; unsigned char unused[3]; union { int value; union snd_seq_timestamp time; unsigned int position; struct snd_seq_queue_skew { unsigned int value; unsigned int base; } skew; unsigned int d32[2]; unsigned char d8[8]; } param; } queue; union snd_seq_timestamp time; struct snd_seq_addr addr; struct snd_seq_connect { struct snd_seq_addr sender; struct snd_seq_addr dest; } connect; struct snd_seq_result { int event; int result; } result; } data; } *

user_defined_types: struct snd_seq_event { unsigned char type; unsigned char flags; unsigned char tag; unsigned char queue; union snd_seq_timestamp time; struct snd_seq_addr source; struct snd_seq_addr dest; union { struct snd_seq_ev_note note; struct snd_seq_ev_ctrl control; struct snd_seq_ev_raw8 raw8; struct snd_seq_ev_raw32 raw32; struct snd_seq_ev_ext ext; struct snd_seq_ev_queue_control queue; union snd_seq_timestamp time; struct snd_seq_addr addr; struct snd_seq_connect connect; struct snd_seq_result result; } data; }

user_defined_types: union snd_seq_timestamp { unsigned int tick; struct snd_seq_real_time time; }

user_defined_types: struct snd_seq_ev_queue_control { unsigned char queue; unsigned char unused[3]; union { int value; union snd_seq_timestamp time; unsigned int position; struct snd_seq_queue_skew skew; unsigned int d32[2]; unsigned char d8[8]; } param; }


decompiled_code:
int __fastcall Func_PitchBend(unsigned __int8 a1, int a2, int a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v4 = 0LL;
v5 = a1;
LOBYTE(v4) = 13;
v6 = (a2 | (a3 << 7)) - 0x2000;
return sequence_event((__int64)&v4);
}

original_code:
static void Func_PitchBend( int channel, int lsb, int msb )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_PITCHBEND, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.value = ((lsb | (msb << 7)) - 8192));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_PitchBend(int channel, int lsb, int msb)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_PITCHBEND, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.value = ((lsb | (msb << 7)) - 8192));
    sequence_event(&ev);
}

variable_types: channel int

variable_types: lsb int

variable_types: msb int

variable_types: struct snd_seq_event { unsigned char type; unsigned char flags; unsigned char tag; unsigned char queue; union snd_seq_timestamp { unsigned int tick; struct snd_seq_real_time { unsigned int tv_sec; unsigned int tv_nsec; } time; } time; struct snd_seq_addr { unsigned char client; unsigned char port; } source; struct snd_seq_addr dest; union { struct snd_seq_ev_note { unsigned char channel; unsigned char note; unsigned char velocity; unsigned char off_velocity; unsigned int duration; } note; struct snd_seq_ev_ctrl { unsigned char channel; unsigned char unused[3]; unsigned int param; int value; } control; struct snd_seq_ev_raw8 { unsigned char d[12]; } raw8; struct snd_seq_ev_raw32 { unsigned int d[3]; } raw32; struct snd_seq_ev_ext { unsigned int len; void *ptr; } ext; struct snd_seq_ev_queue_control { unsigned char queue; unsigned char unused[3]; union { int value; union snd_seq_timestamp time; unsigned int position; struct snd_seq_queue_skew { unsigned int value; unsigned int base; } skew; unsigned int d32[2]; unsigned char d8[8]; } param; } queue; union snd_seq_timestamp time; struct snd_seq_addr addr; struct snd_seq_connect { struct snd_seq_addr sender; struct snd_seq_addr dest; } connect; struct snd_seq_result { int event; int result; } result; } data; }


decompiled_code:
int __fastcall Func_ChannelAftertouch(unsigned __int8 a1, int a2)
{
__int128 v3; // [rsp+0h] [rbp-28h] BYREF
__int64 v4; // [rsp+10h] [rbp-18h]
int v5; // [rsp+18h] [rbp-10h]

v4 = a1;
v3 = 0LL;
v5 = a2;
LOBYTE(v3) = 12;
return sequence_event((__int64)&v3);
}

canonical_decompiled_code:
int __fastcall func2(unsigned __int8 a1, int a2)
{
__int128 v3; // [rsp+0h] [rbp-28h] BYREF
__int64 v4; // [rsp+10h] [rbp-18h]
int v5; // [rsp+18h] [rbp-10h]

v4 = a1;
v3 = 0LL;
v5 = a2;
LOBYTE(v3) = 12;
return func0((__int64)&v3);
}

original_code:
static void Func_ChannelAftertouch( int channel, int pressure )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_CHANPRESS, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.value = (pressure));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_ChannelAftertouch(int channel, int pressure)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_CHANPRESS, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.value = (pressure));
    sequence_event(&ev);
}

variable_types: pressure int

user_defined_types: struct snd_seq_addr { unsigned char client; unsigned char port; }

user_defined_types: struct snd_seq_real_time { unsigned int tv_sec; unsigned int tv_nsec; }

user_defined_types: struct snd_seq_ev_note { unsigned char channel; unsigned char note; unsigned char velocity; unsigned char off_velocity; unsigned int duration; }

user_defined_types: struct snd_seq_ev_ctrl { unsigned char channel; unsigned char unused[3]; unsigned int param; int value; }

user_defined_types: struct snd_seq_ev_raw8 { unsigned char d[12]; }

user_defined_types: struct snd_seq_ev_raw32 { unsigned int d[3]; }

user_defined_types: struct snd_seq_ev_ext { unsigned int len; void *ptr; }

user_defined_types: struct snd_seq_connect { struct snd_seq_addr sender; struct snd_seq_addr dest; }

user_defined_types: struct snd_seq_result { int event; int result; }

user_defined_types: struct snd_seq_queue_skew { unsigned int value; unsigned int base; }


decompiled_code:
int __fastcall Func_ProgramChange(unsigned __int8 a1, int a2)
{
__int128 v3; // [rsp+0h] [rbp-28h] BYREF
__int64 v4; // [rsp+10h] [rbp-18h]
int v5; // [rsp+18h] [rbp-10h]

v4 = a1;
v3 = 0LL;
v5 = a2;
LOBYTE(v3) = 11;
return sequence_event((__int64)&v3);
}

canonical_decompiled_code:
int __fastcall func3(unsigned __int8 a1, int a2)
{
__int128 v3; // [rsp+0h] [rbp-28h] BYREF
__int64 v4; // [rsp+10h] [rbp-18h]
int v5; // [rsp+18h] [rbp-10h]

v4 = a1;
v3 = 0LL;
v5 = a2;
LOBYTE(v3) = 11;
return func0((__int64)&v3);
}

original_code:
static void Func_ProgramChange( int channel, int program )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_PGMCHANGE, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.value = (program));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_ProgramChange(int channel, int program)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_PGMCHANGE, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.value = (program));
    sequence_event(&ev);
}

variable_types: program int


decompiled_code:
int __fastcall Func_ControlChange(unsigned __int8 a1, int a2, int a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
int v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+14h] [rbp-14h]
int v7; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = a2;
LOBYTE(v4) = 10;
v7 = a3;
return sequence_event((__int64)&v4);
}

canonical_decompiled_code:
int __fastcall func4(unsigned __int8 a1, int a2, int a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
int v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+14h] [rbp-14h]
int v7; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = a2;
LOBYTE(v4) = 10;
v7 = a3;
return func0((__int64)&v4);
}

original_code:
static void Func_ControlChange( int channel, int number, int value )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_CONTROLLER, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.param = (number), (&ev)->data.control.value = (value));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_ControlChange(int channel, int number, int value)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_CONTROLLER, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.control.channel = (channel), (&ev)->data.control.param = (number), (&ev)->data.control.value = (value));
    sequence_event(&ev);
}

variable_types: number int

variable_types: value int


decompiled_code:
int __fastcall Func_PolyAftertouch(unsigned __int8 a1, char a2, char a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = 0;
LOBYTE(v4) = 8;
BYTE1(v5) = a2;
BYTE2(v5) = a3;
return sequence_event((__int64)&v4);
}

canonical_decompiled_code:
int __fastcall func5(unsigned __int8 a1, char a2, char a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = 0;
LOBYTE(v4) = 8;
BYTE1(v5) = a2;
BYTE2(v5) = a3;
return func0((__int64)&v4);
}

original_code:
static void Func_PolyAftertouch( int channel, int key, int pressure )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_KEYPRESS, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.note.channel = (channel), (&ev)->data.note.note = (key), (&ev)->data.note.velocity = (pressure));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_PolyAftertouch(int channel, int key, int pressure)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_KEYPRESS, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.note.channel = (channel), (&ev)->data.note.note = (key), (&ev)->data.note.velocity = (pressure));
    sequence_event(&ev);
}

variable_types: key int


decompiled_code:
int __fastcall Func_NoteOn(unsigned __int8 a1, char a2, char a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = 0;
LOBYTE(v4) = 6;
BYTE1(v5) = a2;
BYTE2(v5) = a3;
return sequence_event((__int64)&v4);
}

canonical_decompiled_code:
int __fastcall func6(unsigned __int8 a1, char a2, char a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = 0;
LOBYTE(v4) = 6;
BYTE1(v5) = a2;
BYTE2(v5) = a3;
return func0((__int64)&v4);
}

original_code:
static void Func_NoteOn( int channel, int key, int velocity )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_NOTEON, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.note.channel = (channel), (&ev)->data.note.note = (key), (&ev)->data.note.velocity = (velocity));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_NoteOn(int channel, int key, int velocity)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_NOTEON, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.note.channel = (channel), (&ev)->data.note.note = (key), (&ev)->data.note.velocity = (velocity));
    sequence_event(&ev);
}

variable_types: velocity int


decompiled_code:
int __fastcall Func_NoteOff(unsigned __int8 a1, char a2, char a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = 0;
LOBYTE(v4) = 7;
BYTE1(v5) = a2;
BYTE2(v5) = a3;
return sequence_event((__int64)&v4);
}

canonical_decompiled_code:
int __fastcall func7(unsigned __int8 a1, char a2, char a3)
{
__int128 v4; // [rsp+0h] [rbp-28h] BYREF
__int64 v5; // [rsp+10h] [rbp-18h]
int v6; // [rsp+18h] [rbp-10h]

v5 = a1;
v4 = 0LL;
v6 = 0;
LOBYTE(v4) = 7;
BYTE1(v5) = a2;
BYTE2(v5) = a3;
return func0((__int64)&v4);
}

original_code:
static void Func_NoteOff( int channel, int key, int velocity )
{
    snd_seq_event_t ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_NOTEOFF, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.note.channel = (channel), (&ev)->data.note.note = (key), (&ev)->data.note.velocity = (velocity));
    sequence_event(&ev);
}

canonical_original_code:
static void Func_NoteOff(int channel, int key, int velocity)
{
    struct snd_seq_event ev;
    memset(&ev, 0, sizeof(snd_seq_event_t));
    ((&ev)->type = SND_SEQ_EVENT_NOTEOFF, ((&ev)->flags &= ~(3<<2), (&ev)->flags |= (0<<2)), (&ev)->data.note.channel = (channel), (&ev)->data.note.note = (key), (&ev)->data.note.velocity = (velocity));
    sequence_event(&ev);
}


threadProc

decompiled_code:
void *__fastcall threadProc(void *a1)
{
__int64 v1; // rcx
int v2; // eax
__int64 v3; // rsi
__int64 v4; // rdx
__int64 v5; // rdi
struct timeval v7; // [rsp+0h] [rbp-18h] BYREF

threadTimer = get_tick(a1);
for ( threadQueueTimer = threadTimer + threadQueueTicks; threadTimer < (unsigned int)threadQueueTimer; ++threadTimer )
{
if ( threadService )
((void (*)(void))threadService)();
}
LABEL_5:
LODWORD(v1) = 50000;
while ( !threadQuit )
{
v7.tv_usec = (unsigned int)v1;
v7.tv_sec = 0LL;
select(0, 0LL, 0LL, 0LL, &v7);
v2 = get_tick(0LL);
v3 = (unsigned int)threadTimer;
v4 = (unsigned int)threadQueueTicks;
v1 = 25000LL;
v5 = (unsigned int)(threadTimer - v2);
if ( (int)v5 <= threadQueueTicks )
{
for ( threadQueueTimer = threadQueueTicks + v2; threadTimer < (unsigned int)threadQueueTimer; ++threadTimer )
{
if ( threadService )
threadService(v5, v3, v4, v1);
}
goto LABEL_5;
}
}
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func9(void *a1)
{
__int64 v1; // rcx
int v2; // eax
__int64 v3; // rsi
__int64 v4; // rdx
__int64 v5; // rdi
struct timeval v7; // [rsp+0h] [rbp-18h] BYREF

threadTimer = func8(a1);
for ( threadQueueTimer = threadTimer + threadQueueTicks; threadTimer < (unsigned int)threadQueueTimer; ++threadTimer )
{
if ( threadService )
((void (*)(void))threadService)();
}
LABEL_5:
LODWORD(v1) = 50000;
while ( !threadQuit )
{
v7.tv_usec = (unsigned int)v1;
v7.tv_sec = 0LL;
select(0, 0LL, 0LL, 0LL, &v7);
v2 = func8(0LL);
v3 = (unsigned int)threadTimer;
v4 = (unsigned int)threadQueueTicks;
v1 = 25000LL;
v5 = (unsigned int)(threadTimer - v2);
if ( (int)v5 <= threadQueueTicks )
{
for ( threadQueueTimer = threadQueueTicks + v2; threadTimer < (unsigned int)threadQueueTimer; ++threadTimer )
{
if ( threadService )
threadService(v5, v3, v4, v1);
}
goto LABEL_5;
}
}
return 0LL;
}

original_code:
static void * threadProc(void * parm)
{
    struct timeval tv;
    int sleepAmount = 1000000 / 20;
    unsigned int sequenceTime;
    threadTimer = get_tick();
    threadQueueTimer = threadTimer + threadQueueTicks;
    while (threadTimer < threadQueueTimer) {
        if (threadService) {
            threadService();
        }
        threadTimer++;
    }
    while (!threadQuit) {
        tv.tv_sec = 0;
        tv.tv_usec = sleepAmount;
        select(0, ((void *)0), ((void *)0), ((void *)0), &tv);
        sequenceTime = get_tick();
        sleepAmount = 1000000 / 20;
        if ((int)(threadTimer - sequenceTime) > threadQueueTicks) {
            sleepAmount /= 2;
            continue;
        }
        threadQueueTimer = sequenceTime + threadQueueTicks;
        while (threadTimer < threadQueueTimer) {
            if (threadService) {
                threadService();
            }
            threadTimer++;
        }
    }
    return ((void *)0);
}

canonical_original_code:
static void *threadProc(void *parm)
{
    struct timeval tv;
    int sleepAmount = 1000000 / 20;
    unsigned int sequenceTime;
    threadTimer = get_tick();
    threadQueueTimer = threadTimer + threadQueueTicks;
    while (threadTimer < threadQueueTimer) {
        if (threadService) {
            threadService();
        }
        threadTimer++;
    }
    while (!threadQuit) {
        tv.tv_sec = 0;
        tv.tv_usec = sleepAmount;
        select(0, ((void *)0), ((void *)0), ((void *)0), &tv);
        sequenceTime = get_tick();
        sleepAmount = 1000000 / 20;
        if ((int)(threadTimer - sequenceTime) > threadQueueTicks) {
            sleepAmount /= 2;
            continue;
        }
        threadQueueTimer = sequenceTime + threadQueueTicks;
        while (threadTimer < threadQueueTimer) {
            if (threadService) {
                threadService();
            }
            threadTimer++;
        }
    }
    return ((void *)0);
}

variable_types:
parm
void *

variable_types: struct timeval { long tv_sec; long tv_usec; }

variable_types: sleepAmount int

variable_types:
sequenceTime
unsigned int

return_type: void *


decompiled_code:
__int64 FluidSynthDrv_GetError()
{
return (unsigned int)ErrorCode;
}

canonical_decompiled_code:
__int64 func9()
{
return (unsigned int)ErrorCode;
}

original_code:
int FluidSynthDrv_GetError(void)
{
 return ErrorCode;
}

canonical_original_code:
int FluidSynthDrv_GetError()
{
 return ErrorCode;
}