error

decompiled_code:
void __fastcall __noreturn error(const char *a1, const char *a2)
{
fprintf(stderr, "%s: error: (%s) %s\n", (const char *)program_name, a1, a2);
exit(1);
}

canonical_decompiled_code:
void __fastcall __noreturn func3(const char *a1, const char *a2)
{
fprintf(stderr, "%s: error: (%s) %s\n", (const char *)program_name, a1, a2);
exit(1);
}

original_code:
void error (const char* cause, const char* message)
{
  fprintf (stderr, "%s: error: (%s) %s\n", program_name, cause, message);
  exit (1);
}

canonical_original_code:
void error(char *cause, char *message)
{
  fprintf (stderr, "%s: error: (%s) %s\n", program_name, cause, message);
  exit (1);
}

variable_types:
cause
char *

variable_types:
message
char *


repo: wangyinfeng/system

decompiled_code:
void __fastcall __noreturn system_error(const char *a1)
{
int *v1; // rax
char *v2; // rax

v1 = _errno_location();
v2 = strerror(*v1);
error(a1, v2);
}

canonical_decompiled_code:
void __fastcall __noreturn func4(const char *a1)
{
int *v1; // rax
char *v2; // rax

v1 = _errno_location();
v2 = strerror(*v1);
func3(a1, v2);
}

original_code:
void system_error (const char* operation)
{
  error (operation, strerror ((*__errno_location ())));
}

canonical_original_code:
void system_error(char *operation)
{
  error (operation, strerror ((*__errno_location ())));
}

variable_types:
operation
char *

return_type: void


decompiled_code:
char *get_self_executable_directory()
{
int v0; // eax
char *v1; // rax
size_t v2; // rbx
char *v3; // rax
char *result; // rax
char vars0[1048]; // [rsp+0h] [rbp+0h] BYREF

v0 = readlink("/proc/self/exe", vars0, 0x3FFuLL);
if ( v0 == -1 || (vars0[v0] = 0, (v1 = strrchr(vars0, 47)) == 0LL) || v1 == vars0 )
get_self_executable_directory_cold();
v2 = v1 - vars0;
v3 = (char *)xmalloc(v1 - vars0 + 1);
result = strncpy(v3, vars0, v2);
result[v2] = 0;
return result;
}

canonical_decompiled_code:
char *func5()
{
int v0; // eax
char *v1; // rax
size_t v2; // rbx
char *v3; // rax
char *result; // rax
char vars0[1048]; // [rsp+0h] [rbp+0h] BYREF

v0 = readlink("/proc/self/exe", vars0, 0x3FFuLL);
if ( v0 == -1 || (vars0[v0] = 0, (v1 = strrchr(vars0, 47)) == 0LL) || v1 == vars0 )
func9();
v2 = v1 - vars0;
v3 = (char *)func0(v1 - vars0 + 1);
result = strncpy(v3, vars0, v2);
result[v2] = 0;
return result;
}

original_code:
char* get_self_executable_directory ()
{
  int rval;
  char link_target[1024];
  char* last_slash;
  size_t result_length;
  char* result;
  rval = readlink ("/proc/self/exe", link_target, sizeof (link_target) - 1);
  if (rval == -1)
    abort ();
  else
    link_target[rval] = '\0';
  last_slash = strrchr (link_target, '/');
  if (last_slash == ((void *)0) || last_slash == link_target)
    abort ();
  result_length = last_slash - link_target;
  result = (char*) xmalloc (result_length + 1);
  strncpy (result, link_target, result_length);
  result[result_length] = '\0';
  return result;
}

canonical_original_code:
char *get_self_executable_directory()
{
  int rval;
  char link_target[1024];
  char *last_slash;
  unsigned long result_length;
  char *result;
  rval = readlink ("/proc/self/exe", link_target, sizeof (link_target) - 1);
  if (rval == -1)
    abort ();
  else
    link_target[rval] = '\0';
  last_slash = strrchr (link_target, '/');
  if (last_slash == ((void *)0) || last_slash == link_target)
    abort ();
  result_length = last_slash - link_target;
  result = (char *) xmalloc (result_length + 1);
  strncpy (result, link_target, result_length);
  result[result_length] = '\0';
  return result;
}

variable_types: rval int

variable_types:
result
char *

return_type: char *


runMonoAmplifier

repo: war-immo/ladspa

decompiled_code:
float *__fastcall runMonoAmplifier(__int64 a1, float *a2)
{
float *result; // rax
__int64 v3; // rdx
__int64 v4; // rcx
float v5; // xmm1_4

result = *(float **)a1;
v3 = *(_QWORD *)(a1 + 8);
v4 = *(_QWORD *)(a1 + 16);
v5 = **(float **)a1;
if ( a2 )
{
for ( result = 0LL; result != a2; result = (float *)((char *)result + 1) )
*(float *)(v4 + 4LL * (_QWORD)result) = *(float *)(v3 + 4LL * (_QWORD)result) * v5;
}
return result;
}

canonical_decompiled_code:
float *__fastcall func1(__int64 a1, float *a2)
{
float *result; // rax
__int64 v3; // rdx
__int64 v4; // rcx
float v5; // xmm1_4

result = *(float **)a1;
v3 = *(_QWORD *)(a1 + 8);
v4 = *(_QWORD *)(a1 + 16);
v5 = **(float **)a1;
if ( a2 )
{
for ( result = 0LL; result != a2; result = (float *)((char *)result + 1) )
*(float *)(v4 + 4LL * (_QWORD)result) = *(float *)(v3 + 4LL * (_QWORD)result) * v5;
}
return result;
}

original_code:
void
runMonoAmplifier(LADSPA_Handle Instance,
   unsigned long SampleCount) {
  LADSPA_Data * pfInput;
  LADSPA_Data * pfOutput;
  LADSPA_Data fGain;
  Amplifier * psAmplifier;
  unsigned long lSampleIndex;
  psAmplifier = (Amplifier *)Instance;
  pfInput = psAmplifier->m_pfInputBuffer1;
  pfOutput = psAmplifier->m_pfOutputBuffer1;
  fGain = *(psAmplifier->m_pfControlValue);
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = *(pfInput++) * fGain;
}

canonical_original_code:
void runMonoAmplifier(void *Instance, unsigned long SampleCount) {
  float *pfInput;
  float *pfOutput;
  float fGain;
  struct Amplifier *psAmplifier;
  unsigned long lSampleIndex;
  psAmplifier = (struct Amplifier *)Instance;
  pfInput = psAmplifier->m_pfInputBuffer1;
  pfOutput = psAmplifier->m_pfOutputBuffer1;
  fGain = *(psAmplifier->m_pfControlValue);
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = *(pfInput++) * fGain;
}

variable_types:
Instance
void *

variable_types:
SampleCount
unsigned long

variable_types:
pfInput
float *

variable_types:
pfOutput
float *

variable_types: fGain float

variable_types: struct Amplifier { float *m_pfControlValue; float *m_pfInputBuffer1; float *m_pfOutputBuffer1; float *m_pfInputBuffer2; float *m_pfOutputBuffer2; } *

variable_types:
lSampleIndex
unsigned long


runStereoAmplifier

decompiled_code:
__int64 __fastcall runStereoAmplifier(__int64 a1, __int64 a2)
{
float *v2; // rax
__int64 v4; // rdi
__int64 v5; // rcx
float v6; // xmm0_4
__int64 result; // rax
__int64 v8; // rdx
__int64 v9; // rdi
__int64 v10; // rsi
__int64 v11; // rcx

v2 = *(float **)a1;
v4 = *(_QWORD *)(a1 + 8);
v5 = *(_QWORD *)(a1 + 16);
v6 = *v2;
result = 0LL;
if ( a2 )
{
do
{
v8 = result;
*(float *)(v5 + 4 * result) = *(float *)(v4 + 4 * result) * v6;
++result;
}
while ( a2 != result );
v9 = *(_QWORD *)(a1 + 24);
v10 = *(_QWORD *)(a1 + 32);
result = 0LL;
do
{
v11 = result;
*(float *)(v10 + 4 * result) = *(float *)(v9 + 4 * result) * v6;
++result;
}
while ( v8 != v11 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
float *v2; // rax
__int64 v4; // rdi
__int64 v5; // rcx
float v6; // xmm0_4
__int64 result; // rax
__int64 v8; // rdx
__int64 v9; // rdi
__int64 v10; // rsi
__int64 v11; // rcx

v2 = *(float **)a1;
v4 = *(_QWORD *)(a1 + 8);
v5 = *(_QWORD *)(a1 + 16);
v6 = *v2;
result = 0LL;
if ( a2 )
{
do
{
v8 = result;
*(float *)(v5 + 4 * result) = *(float *)(v4 + 4 * result) * v6;
++result;
}
while ( a2 != result );
v9 = *(_QWORD *)(a1 + 24);
v10 = *(_QWORD *)(a1 + 32);
result = 0LL;
do
{
v11 = result;
*(float *)(v10 + 4 * result) = *(float *)(v9 + 4 * result) * v6;
++result;
}
while ( v8 != v11 );
}
return result;
}

original_code:
void
runStereoAmplifier(LADSPA_Handle Instance,
     unsigned long SampleCount) {
  LADSPA_Data * pfInput;
  LADSPA_Data * pfOutput;
  LADSPA_Data fGain;
  Amplifier * psAmplifier;
  unsigned long lSampleIndex;
  psAmplifier = (Amplifier *)Instance;
  fGain = *(psAmplifier->m_pfControlValue);
  pfInput = psAmplifier->m_pfInputBuffer1;
  pfOutput = psAmplifier->m_pfOutputBuffer1;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = *(pfInput++) * fGain;
  pfInput = psAmplifier->m_pfInputBuffer2;
  pfOutput = psAmplifier->m_pfOutputBuffer2;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = *(pfInput++) * fGain;
}

canonical_original_code:
void runStereoAmplifier(void *Instance, unsigned long SampleCount) {
  float *pfInput;
  float *pfOutput;
  float fGain;
  struct Amplifier *psAmplifier;
  unsigned long lSampleIndex;
  psAmplifier = (struct Amplifier *)Instance;
  fGain = *(psAmplifier->m_pfControlValue);
  pfInput = psAmplifier->m_pfInputBuffer1;
  pfOutput = psAmplifier->m_pfOutputBuffer1;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = *(pfInput++) * fGain;
  pfInput = psAmplifier->m_pfInputBuffer2;
  pfOutput = psAmplifier->m_pfOutputBuffer2;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = *(pfInput++) * fGain;
}

user_defined_types: struct Amplifier { float *m_pfControlValue; float *m_pfInputBuffer1; float *m_pfOutputBuffer1; float *m_pfInputBuffer2; float *m_pfOutputBuffer2; }


instantiateAmplifier

decompiled_code:
void *instantiateAmplifier()
{
return malloc(0x28uLL);
}

canonical_decompiled_code:
void *func3()
{
return malloc(0x28uLL);
}

original_code:
LADSPA_Handle
instantiateAmplifier(const LADSPA_Descriptor * Descriptor,
       unsigned long SampleRate) {
  return malloc(sizeof(Amplifier));
}

canonical_original_code:
void *instantiateAmplifier(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate) {
  return malloc(sizeof(Amplifier));
}

variable_types: struct _LADSPA_Descriptor { unsigned long UniqueID; char *Label; int Properties; char *Name; char *Maker; char *Copyright; unsigned long PortCount; int *PortDescriptors; char **PortNames; struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; } *PortRangeHints; void *ImplementationData; void *(*instantiate)(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate); void (*connect_port)(void *Instance, unsigned long Port, float *DataLocation); void (*activate)(void *Instance); void (*run)(void *Instance, unsigned long SampleCount); void (*run_adding)(void *Instance, unsigned long SampleCount); void (*set_run_adding_gain)(void *Instance, float Gain); void (*deactivate)(void *Instance); void (*cleanup)(void *Instance); } *

variable_types:
SampleRate
unsigned long

return_type: void *

user_defined_types: struct _LADSPA_Descriptor { unsigned long UniqueID; char *Label; int Properties; char *Name; char *Maker; char *Copyright; unsigned long PortCount; int *PortDescriptors; char **PortNames; struct _LADSPA_PortRangeHint *PortRangeHints; void *ImplementationData; void *(*instantiate)(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate); void (*connect_port)(void *Instance, unsigned long Port, float *DataLocation); void (*activate)(void *Instance); void (*run)(void *Instance, unsigned long SampleCount); void (*run_adding)(void *Instance, unsigned long SampleCount); void (*set_run_adding_gain)(void *Instance, float Gain); void (*deactivate)(void *Instance); void (*cleanup)(void *Instance); }


cleanupAmplifier

decompiled_code:
// attributes: thunk
void cleanupAmplifier(void *ptr)
{
free(ptr);
}

canonical_decompiled_code:
void func4(void *ptr)
{
free(ptr);
}

original_code:
void
cleanupAmplifier(LADSPA_Handle Instance) {
  free(Instance);
}

canonical_original_code:
void cleanupAmplifier(void *Instance) {
  free(Instance);
}


deleteDescriptor

decompiled_code:
void __fastcall deleteDescriptor(void *ptr)
{
unsigned __int64 v2; // rbx
void *v3; // rdi

if ( ptr )
{
free(*((void **)ptr + 1));
free(*((void **)ptr + 3));
free(*((void **)ptr + 4));
free(*((void **)ptr + 5));
free(*((void **)ptr + 7));
if ( *((_QWORD *)ptr + 6) )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 8) + 8 * v2++);
free(v3);
}
while ( *((_QWORD *)ptr + 6) > v2 );
}
free(*((void **)ptr + 8));
free(*((void **)ptr + 9));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func5(void *ptr)
{
unsigned __int64 v2; // rbx
void *v3; // rdi

if ( ptr )
{
free(*((void **)ptr + 1));
free(*((void **)ptr + 3));
free(*((void **)ptr + 4));
free(*((void **)ptr + 5));
free(*((void **)ptr + 7));
if ( *((_QWORD *)ptr + 6) )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 8) + 8 * v2++);
free(v3);
}
while ( *((_QWORD *)ptr + 6) > v2 );
}
free(*((void **)ptr + 8));
free(*((void **)ptr + 9));
free(ptr);
}
}

original_code:
void
deleteDescriptor(LADSPA_Descriptor * psDescriptor) {
  unsigned long lIndex;
  if (psDescriptor) {
    free((char *)psDescriptor->Label);
    free((char *)psDescriptor->Name);
    free((char *)psDescriptor->Maker);
    free((char *)psDescriptor->Copyright);
    free((LADSPA_PortDescriptor *)psDescriptor->PortDescriptors);
    for (lIndex = 0; lIndex < psDescriptor->PortCount; lIndex++)
      free((char *)(psDescriptor->PortNames[lIndex]));
    free((char **)psDescriptor->PortNames);
    free((LADSPA_PortRangeHint *)psDescriptor->PortRangeHints);
    free(psDescriptor);
  }
}

canonical_original_code:
void deleteDescriptor(struct _LADSPA_Descriptor *psDescriptor) {
  unsigned long lIndex;
  if (psDescriptor) {
    free((char *)psDescriptor->Label);
    free((char *)psDescriptor->Name);
    free((char *)psDescriptor->Maker);
    free((char *)psDescriptor->Copyright);
    free((int *)psDescriptor->PortDescriptors);
    for (lIndex = 0; lIndex < psDescriptor->PortCount; lIndex++)
      free((char *)(psDescriptor->PortNames[lIndex]));
    free((char **)psDescriptor->PortNames);
    free((struct _LADSPA_PortRangeHint *)psDescriptor->PortRangeHints);
    free(psDescriptor);
  }
}

variable_types:
lIndex
unsigned long

user_defined_types: struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; }


activateSimpleFilter

decompiled_code:
void __fastcall activateSimpleFilter(__int64 a1)
{
*(_DWORD *)(a1 + 8) = 0;
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1)
{
*(_DWORD *)(a1 + 8) = 0;
}

original_code:
void
activateSimpleFilter(LADSPA_Handle Instance) {
  SimpleFilter * psSimpleFilter;
  psSimpleFilter = (SimpleFilter *)Instance;
  psSimpleFilter->m_fLastOutput = 0;
}

canonical_original_code:
void activateSimpleFilter(void *Instance) {
  struct SimpleFilter *psSimpleFilter;
  psSimpleFilter = (struct SimpleFilter *)Instance;
  psSimpleFilter->m_fLastOutput = 0;
}

variable_types: struct SimpleFilter { float m_fSampleRate; float m_fTwoPiOverSampleRate; float m_fLastOutput; float m_fLastCutoff; float m_fAmountOfCurrent; float m_fAmountOfLast; float *m_pfCutoff; float *m_pfInput; float *m_pfOutput; } *


instantiateSimpleFilter

decompiled_code:
float *__fastcall instantiateSimpleFilter(__int64 a1, __int64 a2)
{
float *result; // rax
float v3; // xmm0_4
float v4; // xmm1_4

result = (float *)malloc(0x30uLL);
if ( result )
{
if ( a2 < 0 )
v3 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v3 = (float)(int)a2;
*result = v3;
*((_QWORD *)result + 1) = 0LL;
*((_QWORD *)result + 2) = 0LL;
v4 = 6.283185307179586 / v3;
result[1] = v4;
}
return result;
}

canonical_decompiled_code:
float *__fastcall func2(__int64 a1, __int64 a2)
{
float *result; // rax
float v3; // xmm0_4
float v4; // xmm1_4

result = (float *)malloc(0x30uLL);
if ( result )
{
if ( a2 < 0 )
v3 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v3 = (float)(int)a2;
*result = v3;
*((_QWORD *)result + 1) = 0LL;
*((_QWORD *)result + 2) = 0LL;
v4 = 6.283185307179586 / v3;
result[1] = v4;
}
return result;
}

original_code:
LADSPA_Handle
instantiateSimpleFilter(const LADSPA_Descriptor * Descriptor,
   unsigned long SampleRate) {
  SimpleFilter * psFilter;
  psFilter = (SimpleFilter *)malloc(sizeof(SimpleFilter));
  if (psFilter) {
    psFilter->m_fSampleRate = (LADSPA_Data)SampleRate;
    psFilter->m_fTwoPiOverSampleRate = (2 * 3.14159265358979323846) / (LADSPA_Data)SampleRate;
    psFilter->m_fLastOutput = 0;
    psFilter->m_fLastCutoff = 0;
    psFilter->m_fAmountOfCurrent = 0;
    psFilter->m_fAmountOfLast = 0;
  }
  return psFilter;
}

canonical_original_code:
void *instantiateSimpleFilter(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate) {
  struct SimpleFilter *psFilter;
  psFilter = (struct SimpleFilter *)malloc(sizeof(SimpleFilter));
  if (psFilter) {
    psFilter->m_fSampleRate = (float)SampleRate;
    psFilter->m_fTwoPiOverSampleRate = (2 * 3.14159265358979323846) / (float)SampleRate;
    psFilter->m_fLastOutput = 0;
    psFilter->m_fLastCutoff = 0;
    psFilter->m_fAmountOfCurrent = 0;
    psFilter->m_fAmountOfLast = 0;
  }
  return psFilter;
}

user_defined_types: struct SimpleFilter { float m_fSampleRate; float m_fTwoPiOverSampleRate; float m_fLastOutput; float m_fLastCutoff; float m_fAmountOfCurrent; float m_fAmountOfLast; float *m_pfCutoff; float *m_pfInput; float *m_pfOutput; }


runSimpleLowPassFilter

original_code:
void
runSimpleLowPassFilter(LADSPA_Handle Instance,
         unsigned long SampleCount) {
  LADSPA_Data * pfInput;
  LADSPA_Data * pfOutput;
  LADSPA_Data fAmountOfCurrent;
  LADSPA_Data fAmountOfLast;
  LADSPA_Data fComp;
  LADSPA_Data fLastOutput;
  SimpleFilter * psFilter;
  unsigned long lSampleIndex;
  psFilter = (SimpleFilter *)Instance;
  pfInput = psFilter->m_pfInput;
  pfOutput = psFilter->m_pfOutput;
  if (*psFilter->m_pfCutoff !=
      psFilter->m_fLastCutoff) {
    psFilter->m_fLastCutoff = *psFilter->m_pfCutoff;
    if (psFilter->m_fLastCutoff <= 0) {
      psFilter->m_fAmountOfCurrent = psFilter->m_fAmountOfLast = 0;
    }
    else if (psFilter->m_fLastCutoff > psFilter->m_fSampleRate * 0.5) {
      psFilter->m_fAmountOfCurrent = 1;
      psFilter->m_fAmountOfLast = 0;
    }
    else {
      psFilter->m_fAmountOfLast = 0;
      fComp = 2 - cos(psFilter->m_fTwoPiOverSampleRate
        * psFilter->m_fLastCutoff);
      psFilter->m_fAmountOfLast = fComp - (LADSPA_Data)sqrt(fComp * fComp - 1);
      psFilter->m_fAmountOfCurrent = 1 - psFilter->m_fAmountOfLast;
    }
  }
  fAmountOfCurrent = psFilter->m_fAmountOfCurrent;
  fAmountOfLast = psFilter->m_fAmountOfLast;
  fLastOutput = psFilter->m_fLastOutput;
  for (lSampleIndex = 0;
       lSampleIndex < SampleCount;
       lSampleIndex++) {
    *(pfOutput++)
      = fLastOutput
      = (fAmountOfCurrent * *(pfInput++)
  + fAmountOfLast * fLastOutput);
  }
  psFilter->m_fLastOutput = fLastOutput;
}

canonical_original_code:
void runSimpleLowPassFilter(void *Instance, unsigned long SampleCount) {
  float *pfInput;
  float *pfOutput;
  float fAmountOfCurrent;
  float fAmountOfLast;
  float fComp;
  float fLastOutput;
  struct SimpleFilter *psFilter;
  unsigned long lSampleIndex;
  psFilter = (struct SimpleFilter *)Instance;
  pfInput = psFilter->m_pfInput;
  pfOutput = psFilter->m_pfOutput;
  if (*psFilter->m_pfCutoff !=
      psFilter->m_fLastCutoff) {
    psFilter->m_fLastCutoff = *psFilter->m_pfCutoff;
    if (psFilter->m_fLastCutoff <= 0) {
      psFilter->m_fAmountOfCurrent = psFilter->m_fAmountOfLast = 0;
    }
    else if (psFilter->m_fLastCutoff > psFilter->m_fSampleRate * 0.5) {
      psFilter->m_fAmountOfCurrent = 1;
      psFilter->m_fAmountOfLast = 0;
    }
    else {
      psFilter->m_fAmountOfLast = 0;
      fComp = 2 - cos(psFilter->m_fTwoPiOverSampleRate
        * psFilter->m_fLastCutoff);
      psFilter->m_fAmountOfLast = fComp - (float)sqrt(fComp * fComp - 1);
      psFilter->m_fAmountOfCurrent = 1 - psFilter->m_fAmountOfLast;
    }
  }
  fAmountOfCurrent = psFilter->m_fAmountOfCurrent;
  fAmountOfLast = psFilter->m_fAmountOfLast;
  fLastOutput = psFilter->m_fLastOutput;
  for (lSampleIndex = 0;
       lSampleIndex < SampleCount;
       lSampleIndex++) {
    *(pfOutput++)
      = fLastOutput
      = (fAmountOfCurrent * *(pfInput++)
  + fAmountOfLast * fLastOutput);
  }
  psFilter->m_fLastOutput = fLastOutput;
}

variable_types: fAmountOfCurrent float

variable_types: fAmountOfLast float

variable_types: fComp float

variable_types: fLastOutput float


runSimpleHighPassFilter

original_code:
void
runSimpleHighPassFilter(LADSPA_Handle Instance,
         unsigned long SampleCount) {
  LADSPA_Data * pfInput;
  LADSPA_Data * pfOutput;
  LADSPA_Data fAmountOfCurrent;
  LADSPA_Data fAmountOfLast;
  LADSPA_Data fComp;
  LADSPA_Data fLastOutput;
  SimpleFilter * psFilter;
  unsigned long lSampleIndex;
  psFilter = (SimpleFilter *)Instance;
  pfInput = psFilter->m_pfInput;
  pfOutput = psFilter->m_pfOutput;
  if (*psFilter->m_pfCutoff !=
      psFilter->m_fLastCutoff) {
    psFilter->m_fLastCutoff = *psFilter->m_pfCutoff;
    if (psFilter->m_fLastCutoff <= 0) {
      psFilter->m_fAmountOfCurrent = 1;
      psFilter->m_fAmountOfLast = 0;
    }
    else if (psFilter->m_fLastCutoff > psFilter->m_fSampleRate * 0.5) {
      psFilter->m_fAmountOfCurrent = psFilter->m_fAmountOfLast = 0;
    }
    else {
      psFilter->m_fAmountOfLast = 0;
      fComp = 2 - cos(psFilter->m_fTwoPiOverSampleRate
        * psFilter->m_fLastCutoff);
      psFilter->m_fAmountOfLast = fComp - (LADSPA_Data)sqrt(fComp * fComp - 1);
      psFilter->m_fAmountOfCurrent = 1 - psFilter->m_fAmountOfLast;
    }
  }
  fAmountOfCurrent = psFilter->m_fAmountOfCurrent;
  fAmountOfLast = psFilter->m_fAmountOfLast;
  fLastOutput = psFilter->m_fLastOutput;
  for (lSampleIndex = 0;
       lSampleIndex < SampleCount;
       lSampleIndex++) {
    fLastOutput
      = (fAmountOfCurrent * *pfInput
  + fAmountOfLast * fLastOutput);
    *(pfOutput++) = *(pfInput++) - fLastOutput;
  }
  psFilter->m_fLastOutput = fLastOutput;
}

canonical_original_code:
void runSimpleHighPassFilter(void *Instance, unsigned long SampleCount) {
  float *pfInput;
  float *pfOutput;
  float fAmountOfCurrent;
  float fAmountOfLast;
  float fComp;
  float fLastOutput;
  struct SimpleFilter *psFilter;
  unsigned long lSampleIndex;
  psFilter = (struct SimpleFilter *)Instance;
  pfInput = psFilter->m_pfInput;
  pfOutput = psFilter->m_pfOutput;
  if (*psFilter->m_pfCutoff !=
      psFilter->m_fLastCutoff) {
    psFilter->m_fLastCutoff = *psFilter->m_pfCutoff;
    if (psFilter->m_fLastCutoff <= 0) {
      psFilter->m_fAmountOfCurrent = 1;
      psFilter->m_fAmountOfLast = 0;
    }
    else if (psFilter->m_fLastCutoff > psFilter->m_fSampleRate * 0.5) {
      psFilter->m_fAmountOfCurrent = psFilter->m_fAmountOfLast = 0;
    }
    else {
      psFilter->m_fAmountOfLast = 0;
      fComp = 2 - cos(psFilter->m_fTwoPiOverSampleRate
        * psFilter->m_fLastCutoff);
      psFilter->m_fAmountOfLast = fComp - (float)sqrt(fComp * fComp - 1);
      psFilter->m_fAmountOfCurrent = 1 - psFilter->m_fAmountOfLast;
    }
  }
  fAmountOfCurrent = psFilter->m_fAmountOfCurrent;
  fAmountOfLast = psFilter->m_fAmountOfLast;
  fLastOutput = psFilter->m_fLastOutput;
  for (lSampleIndex = 0;
       lSampleIndex < SampleCount;
       lSampleIndex++) {
    fLastOutput
      = (fAmountOfCurrent * *pfInput
  + fAmountOfLast * fLastOutput);
    *(pfOutput++) = *(pfInput++) - fLastOutput;
  }
  psFilter->m_fLastOutput = fLastOutput;
}


cleanupSimpleFilter

decompiled_code:
// attributes: thunk
void cleanupSimpleFilter(void *ptr)
{
free(ptr);
}

canonical_decompiled_code:
void func5(void *ptr)
{
free(ptr);
}

original_code:
void
cleanupSimpleFilter(LADSPA_Handle Instance) {
  free(Instance);
}

canonical_original_code:
void cleanupSimpleFilter(void *Instance) {
  free(Instance);
}


deleteDescriptor

canonical_decompiled_code:
void __fastcall func6(void *ptr)
{
unsigned __int64 v2; // rbx
void *v3; // rdi

if ( ptr )
{
free(*((void **)ptr + 1));
free(*((void **)ptr + 3));
free(*((void **)ptr + 4));
free(*((void **)ptr + 5));
free(*((void **)ptr + 7));
if ( *((_QWORD *)ptr + 6) )
{
v2 = 0LL;
do
{
v3 = *(void **)(*((_QWORD *)ptr + 8) + 8 * v2++);
free(v3);
}
while ( *((_QWORD *)ptr + 6) > v2 );
}
free(*((void **)ptr + 8));
free(*((void **)ptr + 9));
free(ptr);
}
}


runSimpleDelayLine

original_code:
void
runSimpleDelayLine(LADSPA_Handle Instance,
     unsigned long SampleCount) {
  LADSPA_Data * pfBuffer;
  LADSPA_Data * pfInput;
  LADSPA_Data * pfOutput;
  LADSPA_Data fDry;
  LADSPA_Data fInputSample;
  LADSPA_Data fWet;
  SimpleDelayLine * psSimpleDelayLine;
  unsigned long lBufferReadOffset;
  unsigned long lBufferSizeMinusOne;
  unsigned long lBufferWriteOffset;
  unsigned long lDelay;
  unsigned long lSampleIndex;
  psSimpleDelayLine = (SimpleDelayLine *)Instance;
  lBufferSizeMinusOne = psSimpleDelayLine->m_lBufferSize - 1;
  lDelay = (unsigned long)
    ((((*(psSimpleDelayLine->m_pfDelay)) < 0) ? 0 : (((*(psSimpleDelayLine->m_pfDelay)) > 5) ? 5 : (*(psSimpleDelayLine->m_pfDelay))))
     * psSimpleDelayLine->m_fSampleRate);
  pfInput = psSimpleDelayLine->m_pfInput;
  pfOutput = psSimpleDelayLine->m_pfOutput;
  pfBuffer = psSimpleDelayLine->m_pfBuffer;
  lBufferWriteOffset = psSimpleDelayLine->m_lWritePointer;
  lBufferReadOffset
    = lBufferWriteOffset + psSimpleDelayLine->m_lBufferSize - lDelay;
  fWet = (((*(psSimpleDelayLine->m_pfDryWet)) < 0) ? 0 : (((*(psSimpleDelayLine->m_pfDryWet)) > 1) ? 1 : (*(psSimpleDelayLine->m_pfDryWet))));
  fDry = 1 - fWet;
  for (lSampleIndex = 0;
       lSampleIndex < SampleCount;
       lSampleIndex++) {
    fInputSample = *(pfInput++);
    *(pfOutput++) = (fDry * fInputSample
       + fWet * pfBuffer[((lSampleIndex + lBufferReadOffset)
     & lBufferSizeMinusOne)]);
    pfBuffer[((lSampleIndex + lBufferWriteOffset)
       & lBufferSizeMinusOne)] = fInputSample;
  }
  psSimpleDelayLine->m_lWritePointer
    = ((psSimpleDelayLine->m_lWritePointer + SampleCount)
       & lBufferSizeMinusOne);
}

canonical_original_code:
void runSimpleDelayLine(void *Instance, unsigned long SampleCount) {
  float *pfBuffer;
  float *pfInput;
  float *pfOutput;
  float fDry;
  float fInputSample;
  float fWet;
  struct SimpleDelayLine *psSimpleDelayLine;
  unsigned long lBufferReadOffset;
  unsigned long lBufferSizeMinusOne;
  unsigned long lBufferWriteOffset;
  unsigned long lDelay;
  unsigned long lSampleIndex;
  psSimpleDelayLine = (struct SimpleDelayLine *)Instance;
  lBufferSizeMinusOne = psSimpleDelayLine->m_lBufferSize - 1;
  lDelay = (unsigned long)
    ((((*(psSimpleDelayLine->m_pfDelay)) < 0) ? 0 : (((*(psSimpleDelayLine->m_pfDelay)) > 5) ? 5 : (*(psSimpleDelayLine->m_pfDelay))))
     * psSimpleDelayLine->m_fSampleRate);
  pfInput = psSimpleDelayLine->m_pfInput;
  pfOutput = psSimpleDelayLine->m_pfOutput;
  pfBuffer = psSimpleDelayLine->m_pfBuffer;
  lBufferWriteOffset = psSimpleDelayLine->m_lWritePointer;
  lBufferReadOffset
    = lBufferWriteOffset + psSimpleDelayLine->m_lBufferSize - lDelay;
  fWet = (((*(psSimpleDelayLine->m_pfDryWet)) < 0) ? 0 : (((*(psSimpleDelayLine->m_pfDryWet)) > 1) ? 1 : (*(psSimpleDelayLine->m_pfDryWet))));
  fDry = 1 - fWet;
  for (lSampleIndex = 0;
       lSampleIndex < SampleCount;
       lSampleIndex++) {
    fInputSample = *(pfInput++);
    *(pfOutput++) = (fDry * fInputSample
       + fWet * pfBuffer[((lSampleIndex + lBufferReadOffset)
     & lBufferSizeMinusOne)]);
    pfBuffer[((lSampleIndex + lBufferWriteOffset)
       & lBufferSizeMinusOne)] = fInputSample;
  }
  psSimpleDelayLine->m_lWritePointer
    = ((psSimpleDelayLine->m_lWritePointer + SampleCount)
       & lBufferSizeMinusOne);
}

variable_types:
pfBuffer
float *

variable_types: fDry float

variable_types: fInputSample float

variable_types: fWet float

variable_types: struct SimpleDelayLine { float m_fSampleRate; float *m_pfBuffer; unsigned long m_lBufferSize; unsigned long m_lWritePointer; float *m_pfDelay; float *m_pfDryWet; float *m_pfInput; float *m_pfOutput; } *

variable_types:
lBufferReadOffset
unsigned long

variable_types:
lBufferSizeMinusOne
unsigned long

variable_types:
lBufferWriteOffset
unsigned long

variable_types:
lDelay
unsigned long


instantiateSimpleDelayLine

decompiled_code:
float *__fastcall instantiateSimpleDelayLine(__int64 a1, __int64 a2)
{
float *v2; // r12
float v3; // xmm0_4
float v4; // xmm0_4
unsigned __int64 v5; // rax
size_t v6; // rdi
void *v7; // rax
float *v9; // rdi

v2 = (float *)malloc(0x40uLL);
if ( v2 )
{
if ( a2 < 0 )
v3 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v3 = (float)(int)a2;
*v2 = v3;
v4 = v3 * 5.0;
if ( v4 >= 9.223372e18 )
v5 = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
v5 = (unsigned int)(int)v4;
*((_QWORD *)v2 + 2) = 1LL;
v6 = 1LL;
if ( v5 > 1 )
{
do
v6 *= 2LL;
while ( v6 < v5 );
*((_QWORD *)v2 + 2) = v6;
}
v7 = calloc(v6, 4uLL);
*((_QWORD *)v2 + 1) = v7;
if ( v7 )
{
*((_QWORD *)v2 + 3) = 0LL;
}
else
{
v9 = v2;
v2 = 0LL;
free(v9);
}
}
return v2;
}

canonical_decompiled_code:
float *__fastcall func2(__int64 a1, __int64 a2)
{
float *v2; // r12
float v3; // xmm0_4
float v4; // xmm0_4
unsigned __int64 v5; // rax
size_t v6; // rdi
void *v7; // rax
float *v9; // rdi

v2 = (float *)malloc(0x40uLL);
if ( v2 )
{
if ( a2 < 0 )
v3 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v3 = (float)(int)a2;
*v2 = v3;
v4 = v3 * 5.0;
if ( v4 >= 9.223372e18 )
v5 = (unsigned int)(int)(float)(v4 - 9.223372e18) ^ 0x8000000000000000LL;
else
v5 = (unsigned int)(int)v4;
*((_QWORD *)v2 + 2) = 1LL;
v6 = 1LL;
if ( v5 > 1 )
{
do
v6 *= 2LL;
while ( v6 < v5 );
*((_QWORD *)v2 + 2) = v6;
}
v7 = calloc(v6, 4uLL);
*((_QWORD *)v2 + 1) = v7;
if ( v7 )
{
*((_QWORD *)v2 + 3) = 0LL;
}
else
{
v9 = v2;
v2 = 0LL;
free(v9);
}
}
return v2;
}

original_code:
LADSPA_Handle
instantiateSimpleDelayLine(const LADSPA_Descriptor * Descriptor,
      unsigned long SampleRate) {
  unsigned long lMinimumBufferSize;
  SimpleDelayLine * psDelayLine;
  psDelayLine
    = (SimpleDelayLine *)malloc(sizeof(SimpleDelayLine));
  if (psDelayLine == ((void *)0))
    return ((void *)0);
  psDelayLine->m_fSampleRate = (LADSPA_Data)SampleRate;
  lMinimumBufferSize = (unsigned long)((LADSPA_Data)SampleRate * 5);
  psDelayLine->m_lBufferSize = 1;
  while (psDelayLine->m_lBufferSize < lMinimumBufferSize)
    psDelayLine->m_lBufferSize <<= 1;
  psDelayLine->m_pfBuffer
    = (LADSPA_Data *)calloc(psDelayLine->m_lBufferSize, sizeof(LADSPA_Data));
  if (psDelayLine->m_pfBuffer == ((void *)0)) {
    free(psDelayLine);
    return ((void *)0);
  }
  psDelayLine->m_lWritePointer = 0;
  return psDelayLine;
}

canonical_original_code:
void *instantiateSimpleDelayLine(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate) {
  unsigned long lMinimumBufferSize;
  struct SimpleDelayLine *psDelayLine;
  psDelayLine
    = (struct SimpleDelayLine *)malloc(sizeof(SimpleDelayLine));
  if (psDelayLine == ((void *)0))
    return ((void *)0);
  psDelayLine->m_fSampleRate = (float)SampleRate;
  lMinimumBufferSize = (unsigned long)((float)SampleRate * 5);
  psDelayLine->m_lBufferSize = 1;
  while (psDelayLine->m_lBufferSize < lMinimumBufferSize)
    psDelayLine->m_lBufferSize <<= 1;
  psDelayLine->m_pfBuffer
    = (float *)calloc(psDelayLine->m_lBufferSize, sizeof(LADSPA_Data));
  if (psDelayLine->m_pfBuffer == ((void *)0)) {
    free(psDelayLine);
    return ((void *)0);
  }
  psDelayLine->m_lWritePointer = 0;
  return psDelayLine;
}

variable_types: struct _LADSPA_Descriptor { unsigned long UniqueID; char *Label; int Properties; char *Name; char *Maker; char *Copyright; unsigned long PortCount; int *PortDescriptors; char **PortNames; struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; } *PortRangeHints; void *ImplementationData; void *(*instantiate)(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate); void (*connect_port)(void *Instance, unsigned long Port, float *DataLocation); void (*activate)(void *Instance); void (*run)(void *Instance, unsigned long SampleCount); void (*run_adding)(void *Instance, unsigned long SampleCount); void (*set_run_adding_gain)(void *Instance, float Gain); void (*deactivate)(void *Instance); void (*cleanup)(void *Instance); } *

variable_types:
lMinimumBufferSize
unsigned long

user_defined_types: struct SimpleDelayLine { float m_fSampleRate; float *m_pfBuffer; unsigned long m_lBufferSize; unsigned long m_lWritePointer; float *m_pfDelay; float *m_pfDryWet; float *m_pfInput; float *m_pfOutput; }


cleanupSimpleDelayLine

decompiled_code:
void __fastcall cleanupSimpleDelayLine(void *ptr)
{
free(*((void **)ptr + 1));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
free(*((void **)ptr + 1));
free(ptr);
}

original_code:
void
cleanupSimpleDelayLine(LADSPA_Handle Instance) {
  SimpleDelayLine * psSimpleDelayLine;
  psSimpleDelayLine = (SimpleDelayLine *)Instance;
  free(psSimpleDelayLine->m_pfBuffer);
  free(psSimpleDelayLine);
}

canonical_original_code:
void cleanupSimpleDelayLine(void *Instance) {
  struct SimpleDelayLine *psSimpleDelayLine;
  psSimpleDelayLine = (struct SimpleDelayLine *)Instance;
  free(psSimpleDelayLine->m_pfBuffer);
  free(psSimpleDelayLine);
}

variable_types:
Instance
void *


activateSimpleDelayLine

decompiled_code:
void *__fastcall activateSimpleDelayLine(__int64 a1)
{
return memset(*(void **)(a1 + 8), 0, 4LL * *(_QWORD *)(a1 + 16));
}

canonical_decompiled_code:
void *__fastcall func4(__int64 a1)
{
return memset(*(void **)(a1 + 8), 0, 4LL * *(_QWORD *)(a1 + 16));
}

original_code:
void
activateSimpleDelayLine(LADSPA_Handle Instance) {
  SimpleDelayLine * psSimpleDelayLine;
  psSimpleDelayLine = (SimpleDelayLine *)Instance;
  memset(psSimpleDelayLine->m_pfBuffer,
  0,
  sizeof(LADSPA_Data) * psSimpleDelayLine->m_lBufferSize);
}

canonical_original_code:
void activateSimpleDelayLine(void *Instance) {
  struct SimpleDelayLine *psSimpleDelayLine;
  psSimpleDelayLine = (struct SimpleDelayLine *)Instance;
  memset(psSimpleDelayLine->m_pfBuffer,
  0,
  sizeof(LADSPA_Data) * psSimpleDelayLine->m_lBufferSize);
}


setNoiseSourceRunAddingGain

decompiled_code:
void __fastcall setNoiseSourceRunAddingGain(__int64 a1, float a2)
{
*(float *)(a1 + 16) = a2;
}

canonical_decompiled_code:
void __fastcall func1(__int64 a1, float a2)
{
*(float *)(a1 + 16) = a2;
}

original_code:
void
setNoiseSourceRunAddingGain(LADSPA_Handle Instance,
       LADSPA_Data Gain) {
  ((NoiseSource *)Instance)->m_fRunAddingGain = Gain;
}

canonical_original_code:
void setNoiseSourceRunAddingGain(void *Instance, float Gain) {
  ((struct NoiseSource *)Instance)->m_fRunAddingGain = Gain;
}

variable_types: Gain float

user_defined_types: struct NoiseSource { float *m_pfAmplitudeValue; float *m_pfOutputBuffer; float m_fRunAddingGain; }


instantiateNoiseSource

decompiled_code:
void *instantiateNoiseSource()
{
return malloc(0x18uLL);
}

canonical_decompiled_code:
void *func2()
{
return malloc(0x18uLL);
}

original_code:
LADSPA_Handle
instantiateNoiseSource(const LADSPA_Descriptor * Descriptor,
         unsigned long SampleRate) {
  return malloc(sizeof(NoiseSource));
}

canonical_original_code:
void *instantiateNoiseSource(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate) {
  return malloc(sizeof(NoiseSource));
}

variable_types:
SampleRate
unsigned long


runNoiseSource

decompiled_code:
float *__fastcall runNoiseSource(float **a1, __int64 a2)
{
float *result; // rax
float *v3; // r12
__int64 i; // rbx
float v5; // [rsp+Ch] [rbp-1Ch]

result = *a1;
v3 = a1[1];
v5 = 9.3132257e-10 * **a1;
if ( a2 )
{
for ( i = 0LL; i != a2; ++i )
{
result = (float *)(unsigned int)(rand() - 0x3FFFFFFF);
v3[i] = (float)(int)result * v5;
}
}
return result;
}

canonical_decompiled_code:
float *__fastcall func3(float **a1, __int64 a2)
{
float *result; // rax
float *v3; // r12
__int64 i; // rbx
float v5; // [rsp+Ch] [rbp-1Ch]

result = *a1;
v3 = a1[1];
v5 = 9.3132257e-10 * **a1;
if ( a2 )
{
for ( i = 0LL; i != a2; ++i )
{
result = (float *)(unsigned int)(rand() - 0x3FFFFFFF);
v3[i] = (float)(int)result * v5;
}
}
return result;
}

original_code:
void
runNoiseSource(LADSPA_Handle Instance,
        unsigned long SampleCount) {
  NoiseSource * psNoiseSource;
  LADSPA_Data * pfOutput;
  LADSPA_Data fAmplitude;
  unsigned long lSampleIndex;
  psNoiseSource = (NoiseSource *)Instance;
  fAmplitude
    = *(psNoiseSource->m_pfAmplitudeValue) * (LADSPA_Data)(2.0 / 2147483647);
  pfOutput = psNoiseSource->m_pfOutputBuffer;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = (rand() - (2147483647 / 2)) * fAmplitude;
}

canonical_original_code:
void runNoiseSource(void *Instance, unsigned long SampleCount) {
  struct NoiseSource *psNoiseSource;
  float *pfOutput;
  float fAmplitude;
  unsigned long lSampleIndex;
  psNoiseSource = (struct NoiseSource *)Instance;
  fAmplitude
    = *(psNoiseSource->m_pfAmplitudeValue) * (LADSPA_Data)(2.0 / 2147483647);
  pfOutput = psNoiseSource->m_pfOutputBuffer;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) = (rand() - (2147483647 / 2)) * fAmplitude;
}

variable_types:
SampleCount
unsigned long

variable_types: struct NoiseSource { float *m_pfAmplitudeValue; float *m_pfOutputBuffer; float m_fRunAddingGain; } *

variable_types:
pfOutput
float *

variable_types: fAmplitude float

variable_types:
lSampleIndex
unsigned long


runAddingNoiseSource

decompiled_code:
float *__fastcall runAddingNoiseSource(__int64 a1, __int64 a2)
{
float *result; // rax
__int64 v3; // r12
__int64 i; // rbx
float v5; // [rsp+Ch] [rbp-1Ch]

result = *(float **)a1;
v3 = *(_QWORD *)(a1 + 8);
v5 = (float)(**(float **)a1 * *(float *)(a1 + 16)) * 9.3132257e-10;
if ( a2 )
{
for ( i = 0LL; i != a2; ++i )
{
result = (float *)(unsigned int)(rand() - 0x3FFFFFFF);
*(float *)(v3 + 4 * i) = (float)((float)(int)result * v5) + *(float *)(v3 + 4 * i);
}
}
return result;
}

canonical_decompiled_code:
float *__fastcall func4(__int64 a1, __int64 a2)
{
float *result; // rax
__int64 v3; // r12
__int64 i; // rbx
float v5; // [rsp+Ch] [rbp-1Ch]

result = *(float **)a1;
v3 = *(_QWORD *)(a1 + 8);
v5 = (float)(**(float **)a1 * *(float *)(a1 + 16)) * 9.3132257e-10;
if ( a2 )
{
for ( i = 0LL; i != a2; ++i )
{
result = (float *)(unsigned int)(rand() - 0x3FFFFFFF);
*(float *)(v3 + 4 * i) = (float)((float)(int)result * v5) + *(float *)(v3 + 4 * i);
}
}
return result;
}

original_code:
void
runAddingNoiseSource(LADSPA_Handle Instance,
       unsigned long SampleCount) {
  NoiseSource * psNoiseSource;
  LADSPA_Data * pfOutput;
  LADSPA_Data fAmplitude;
  unsigned long lSampleIndex;
  psNoiseSource = (NoiseSource *)Instance;
  fAmplitude
    = (*(psNoiseSource->m_pfAmplitudeValue)
       * psNoiseSource->m_fRunAddingGain
       * (LADSPA_Data)(2.0 / 2147483647));
  pfOutput = psNoiseSource->m_pfOutputBuffer;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) += (rand() - (2147483647 / 2)) * fAmplitude;
}

canonical_original_code:
void runAddingNoiseSource(void *Instance, unsigned long SampleCount) {
  struct NoiseSource *psNoiseSource;
  float *pfOutput;
  float fAmplitude;
  unsigned long lSampleIndex;
  psNoiseSource = (struct NoiseSource *)Instance;
  fAmplitude
    = (*(psNoiseSource->m_pfAmplitudeValue)
       * psNoiseSource->m_fRunAddingGain
       * (LADSPA_Data)(2.0 / 2147483647));
  pfOutput = psNoiseSource->m_pfOutputBuffer;
  for (lSampleIndex = 0; lSampleIndex < SampleCount; lSampleIndex++)
    *(pfOutput++) += (rand() - (2147483647 / 2)) * fAmplitude;
}


cleanupNoiseSource

decompiled_code:
// attributes: thunk
void cleanupNoiseSource(void *ptr)
{
free(ptr);
}

original_code:
void
cleanupNoiseSource(LADSPA_Handle Instance) {
  free(Instance);
}

canonical_original_code:
void cleanupNoiseSource(void *Instance) {
  free(Instance);
}


analysePlugin

decompiled_code:
__int64 __fastcall analysePlugin(const char *a1, const char *a2, int a3)
{
unsigned __int64 v3; // r13
size_t v4; // rbp
__int64 i; // rbx
double v6; // xmm0_8
double v7; // xmm0_8
__int64 v8; // rax
__int64 *v9; // r12
const char *v10; // r14
size_t v11; // rax
__int64 v12; // rdx
__int64 j; // r14
__int64 v14; // rax
__int64 v15; // rbx
size_t v16; // rbp
double v17; // xmm0_8
unsigned __int64 k; // rbp
unsigned __int64 v19; // rbp
__int64 v20; // rax
float v21; // xmm0_4
double v22; // xmm1_8
bool v23; // zf
int v24; // eax
int v25; // eax
__int64 v26; // r12
int v27; // er13
int v28; // eax
float v29; // xmm0_4
double v30; // xmm1_8
float v31; // xmm0_4
double v32; // xmm1_8
float v33; // xmm0_4
__int64 v34; // rax
float v35; // xmm0_4
__int64 v36; // r12
float v37; // xmm0_4
__int64 v38; // rdx
unsigned int v39; // er13
double v41; // xmm0_8
double v42; // xmm0_8
float v43; // xmm0_4
char *v44; // rcx
size_t v45; // [rsp+8h] [rbp-70h]
unsigned __int64 v46; // [rsp+10h] [rbp-68h]
__int64 (__fastcall *v47)(__int64); // [rsp+18h] [rbp-60h]
void *v49; // [rsp+30h] [rbp-48h]
double v50; // [rsp+38h] [rbp-40h]
double v51; // [rsp+38h] [rbp-40h]

v49 = (void *)loadLADSPAPluginLibrary();
dlerror();
v47 = (__int64 (__fastcall *)(__int64))dlsym(v49, "ladspa_descriptor");
if ( v47 )
{
if ( a3 )
{
v46 = 0LL;
v45 = 0LL;
}
else
{
v3 = 0LL;
v4 = 0LL;
for ( i = 0LL; ; ++i )
{
v8 = v47(i);
v9 = (__int64 *)v8;
if ( !v8 )
break;
v10 = *(const char **)(v8 + 8);
if ( !a2 || !strcmp(a2, v10) )
{
v11 = strlen(v10);
if ( v4 < v11 )
v4 = v11;
if ( *v9 >= 0 )
{
v6 = (double)(int)*v9;
}
else
{
v12 = *v9 & 1 | ((unsigned __int64)*v9 >> 1);
v6 = (double)(int)v12 + (double)(int)v12;
}
v7 = log10(v6);
if ( v3 < (unsigned __int64)(unsigned int)(int)v7 + 1 )
v3 = (unsigned int)(int)v7 + 1LL;
}
}
v45 = v4 + 2;
v46 = v3 + 2;
}
for ( j = 0LL; ; ++j )
{
v14 = v47(j);
v15 = v14;
if ( !v14 )
break;
if ( !a2 || !strcmp(a2, *(const char **)(v14 + 8)) )
{
if ( a3 )
{
putchar(10);
printf("Plugin Name: \"%s\"\n", *(const char **)(v15 + 24));
printf("Plugin Label: \"%s\"\n", *(const char **)(v15 + 8));
printf("Plugin Unique ID: %lu\n", *(_QWORD *)v15);
printf("Maker: \"%s\"\n", *(const char **)(v15 + 32));
printf("Copyright: \"%s\"\n", *(const char **)(v15 + 40));
printf("Must Run Real-Time: ");
if ( (*(_BYTE *)(v15 + 16) & 1) != 0 )
puts("Yes");
else
puts("No");
printf("Has activate() Function: ");
if ( *(_QWORD *)(v15 + 104) )
puts("Yes");
else
puts("No");
printf("Has deactivate() Function: ");
if ( *(_QWORD *)(v15 + 136) )
puts("Yes");
else
puts("No");
printf("Has run_adding() Function: ");
if ( *(_QWORD *)(v15 + 120) )
{
puts("Yes");
if ( *(_QWORD *)(v15 + 88) )
goto LABEL_37;
LABEL_135:
puts("ERROR: PLUGIN HAS NO INSTANTIATE FUNCTION.");
}
else
{
puts("No");
if ( !*(_QWORD *)(v15 + 88) )
goto LABEL_135;
}
LABEL_37:
if ( !*(_QWORD *)(v15 + 96) )
puts("ERROR: PLUGIN HAS NO CONNECT_PORT FUNCTION.");
if ( !*(_QWORD *)(v15 + 112) )
puts("ERROR: PLUGIN HAS NO RUN FUNCTION.");
if ( !*(_QWORD *)(v15 + 120)
|| !*(_QWORD *)(v15 + 128)
&& (puts("ERROR: PLUGIN HAS RUN_ADDING FUNCTION BUT NOT SET_RUN_ADDING_GAIN."), !*(_QWORD *)(v15 + 120)) )
{
if ( *(_QWORD *)(v15 + 128) )
puts("ERROR: PLUGIN HAS SET_RUN_ADDING_GAIN FUNCTION BUT NOT RUN_ADDING.");
}
if ( !*(_QWORD *)(v15 + 144) )
puts("ERROR: PLUGIN HAS NO CLEANUP FUNCTION.");
printf("Environment: ");
if ( (*(_BYTE *)(v15 + 16) & 4) != 0 )
{
puts("Normal or Hard Real-Time");
if ( (*(_BYTE *)(v15 + 16) & 2) == 0 )
{
LABEL_47:
printf("Ports:");
if ( !*(_QWORD *)(v15 + 48) )
{
puts("\tERROR: PLUGIN HAS NO PORTS.");
if ( !*(_QWORD *)(v15 + 48) )
continue;
}
v19 = 0LL;
LABEL_62:
printf("\t\"%s\" ", *(const char **)(*(_QWORD *)(v15 + 64) + 8 * v19));
v24 = *(_DWORD *)(*(_QWORD *)(v15 + 56) + 4 * v19);
if ( (v24 & 3) == 3 )
{
printf("ERROR: INPUT AND OUTPUT");
}
else if ( (v24 & 1) != 0 )
{
printf("input");
}
else if ( (v24 & 2) != 0 )
{
printf("output");
}
else
{
printf("ERROR: NEITHER INPUT NOR OUTPUT");
}
v25 = *(_DWORD *)(*(_QWORD *)(v15 + 56) + 4 * v19);
if ( (v25 & 0xC) == 12 )
{
printf(", ERROR: CONTROL AND AUDIO");
}
else if ( (v25 & 4) != 0 )
{
printf(", control");
}
else if ( (v25 & 8) != 0 )
{
printf(", audio");
}
else
{
printf(", ERROR: NEITHER CONTROL NOR AUDIO");
}
v26 = 12 * v19;
v27 = *(_DWORD *)(*(_QWORD *)(v15 + 72) + 12 * v19);
if ( (v27 & 3) != 0 )
{
printf(", ");
if ( (v27 & 1) != 0 )
{
v29 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 4);
v30 = v29;
if ( (v27 & 8) != 0 && v29 != 0.0 )
printf("%g*srate", v30);
else
printf("%g", v30);
}
else
{
printf("...");
}
printf(" to ");
if ( (v27 & 2) != 0 )
{
v31 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 8);
v32 = v31;
if ( (v27 & 8) != 0 && v31 != 0.0 )
printf("%g*srate", v32);
else
printf("%g", v32);
}
else
{
printf("...");
}
}
if ( (v27 & 4) != 0 )
{
if ( (v27 | 0x240) == 580 )
printf(", toggled");
else
printf(", ERROR: TOGGLED INCOMPATIBLE WITH OTHER HINT");
}
v28 = v27 & 0x3C0;
if ( v28 == 320 )
{
v33 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 8);
v22 = v33;
if ( (v27 & 8) == 0 )
goto LABEL_58;
v23 = v33 == 0.0;
}
else
{
if ( (v27 & 0x3C0u) > 0x140 )
{
if ( v28 == 640 )
{
printf(", default 100");
}
else if ( (v27 & 0x3C0u) <= 0x280 )
{
if ( v28 == 512 )
{
printf(", default 0");
}
else
{
if ( v28 != 576 )
goto LABEL_117;
printf(", default 1");
}
}
else
{
if ( v28 == 704 )
{
printf(", default 440");
if ( (v27 & 0x10) != 0 )
{
LABEL_80:
printf(", logarithmic");
if ( (v27 & 0x20) != 0 )
LABEL_81:
printf(", integer");
LABEL_61:
++v19;
putchar(10);
if ( *(_QWORD *)(v15 + 48) <= v19 )
continue;
goto LABEL_62;
}
LABEL_60:
if ( (v27 & 0x20) != 0 )
goto LABEL_81;
goto LABEL_61;
}
LABEL_117:
printf(", UNKNOWN DEFAULT CODE");
}
LABEL_59:
if ( (v27 & 0x10) != 0 )
goto LABEL_80;
goto LABEL_60;
}
if ( v28 == 128 )
{
v34 = v26 + *(_QWORD *)(v15 + 72);
if ( (v27 & 0x10) != 0 )
{
v51 = log(*(float *)(v34 + 4));
v42 = log(*(float *)(*(_QWORD *)(v15 + 72) + v26 + 8));
v35 = exp(v51 * 0.75 + v42 * 0.25);
}
else
{
v35 = *(float *)(v34 + 8) * 0.25 + *(float *)(v34 + 4) * 0.75;
}
v22 = v35;
if ( (v27 & 8) == 0 )
goto LABEL_58;
v23 = v35 == 0.0;
}
else
{
if ( (v27 & 0x3C0u) > 0x80 )
{
if ( v28 == 192 )
{
v36 = *(_QWORD *)(v15 + 72) + v26;
v37 = *(float *)(v36 + 8);
if ( (v27 & 0x10) != 0 )
{
v43 = v37 * *(float *)(v36 + 4);
if ( v43 < 0.0 )
v21 = sqrtf(v43);
else
v21 = fsqrt(v43);
}
else
{
v21 = (float)(v37 + *(float *)(v36 + 4)) * 0.5;
}
}
else
{
if ( v28 != 256 )
goto LABEL_117;
v20 = v26 + *(_QWORD *)(v15 + 72);
if ( (v27 & 0x10) != 0 )
{
v50 = log(*(float *)(v20 + 4));
v41 = log(*(float *)(*(_QWORD *)(v15 + 72) + v26 + 8));
v21 = exp(v50 * 0.25 + v41 * 0.75);
}
else
{
v21 = *(float *)(v20 + 8) * 0.75 + *(float *)(v20 + 4) * 0.25;
}
}
v22 = v21;
if ( (v27 & 8) != 0 )
goto LABEL_56;
LABEL_58:
printf(", default %g", v22);
goto LABEL_59;
}
if ( (v27 & 0x3C0) == 0 )
goto LABEL_59;
if ( v28 != 64 )
goto LABEL_117;
v21 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 4);
v22 = v21;
if ( (v27 & 8) == 0 )
goto LABEL_58;
LABEL_56:
v23 = v21 == 0.0;
}
}
if ( !v23 )
{
printf(", default %g*srate", v22);
goto LABEL_59;
}
goto LABEL_58;
}
}
else
{
puts("Normal");
if ( (*(_BYTE *)(v15 + 16) & 2) == 0 )
goto LABEL_47;
}
puts("This plugin cannot use in-place processing. It will not work with all hosts.");
goto LABEL_47;
}
printf("%s", *(const char **)(v15 + 8));
v16 = strlen(*(const char **)(v15 + 8));
if ( v45 > v16 )
{
do
{
++v16;
putchar(32);
}
while ( v45 != v16 );
}
printf("%lu", *(_QWORD *)v15);
if ( *(__int64 *)v15 < 0 )
{
v38 = *(_QWORD *)v15 & 1LL | (*(_QWORD *)v15 >> 1);
v17 = (double)(int)v38 + (double)(int)v38;
}
else
{
v17 = (double)(int)*(_QWORD *)v15;
}
for ( k = (unsigned int)(int)log10(v17) + 1LL; v46 > k; ++k )
putchar(32);
puts(*(const char **)(v15 + 24));
}
}
if ( a3 )
putchar(10);
v39 = 0;
unloadLADSPAPluginLibrary(v49);
}
else
{
v39 = 1;
v44 = dlerror();
if ( v44 )
fprintf(
stderr,
"Unable to find ladspa_descriptor() function in plugin file \"%s\": %s.\n"
"Are you sure this is a LADSPA plugin file?\n",
a1,
v44);
}
return v39;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, int a3)
{
unsigned __int64 v3; // r13
size_t v4; // rbp
__int64 i; // rbx
double v6; // xmm0_8
double v7; // xmm0_8
__int64 v8; // rax
__int64 *v9; // r12
const char *v10; // r14
size_t v11; // rax
__int64 v12; // rdx
__int64 j; // r14
__int64 v14; // rax
__int64 v15; // rbx
size_t v16; // rbp
double v17; // xmm0_8
unsigned __int64 k; // rbp
unsigned __int64 v19; // rbp
__int64 v20; // rax
float v21; // xmm0_4
double v22; // xmm1_8
bool v23; // zf
int v24; // eax
int v25; // eax
__int64 v26; // r12
int v27; // er13
int v28; // eax
float v29; // xmm0_4
double v30; // xmm1_8
float v31; // xmm0_4
double v32; // xmm1_8
float v33; // xmm0_4
__int64 v34; // rax
float v35; // xmm0_4
__int64 v36; // r12
float v37; // xmm0_4
__int64 v38; // rdx
unsigned int v39; // er13
double v41; // xmm0_8
double v42; // xmm0_8
float v43; // xmm0_4
char *v44; // rcx
size_t v45; // [rsp+8h] [rbp-70h]
unsigned __int64 v46; // [rsp+10h] [rbp-68h]
__int64 (__fastcall *v47)(__int64); // [rsp+18h] [rbp-60h]
void *v49; // [rsp+30h] [rbp-48h]
double v50; // [rsp+38h] [rbp-40h]
double v51; // [rsp+38h] [rbp-40h]

v49 = (void *)loadLADSPAPluginLibrary();
dlerror();
v47 = (__int64 (__fastcall *)(__int64))dlsym(v49, "ladspa_descriptor");
if ( v47 )
{
if ( a3 )
{
v46 = 0LL;
v45 = 0LL;
}
else
{
v3 = 0LL;
v4 = 0LL;
for ( i = 0LL; ; ++i )
{
v8 = v47(i);
v9 = (__int64 *)v8;
if ( !v8 )
break;
v10 = *(const char **)(v8 + 8);
if ( !a2 || !strcmp(a2, v10) )
{
v11 = strlen(v10);
if ( v4 < v11 )
v4 = v11;
if ( *v9 >= 0 )
{
v6 = (double)(int)*v9;
}
else
{
v12 = *v9 & 1 | ((unsigned __int64)*v9 >> 1);
v6 = (double)(int)v12 + (double)(int)v12;
}
v7 = log10(v6);
if ( v3 < (unsigned __int64)(unsigned int)(int)v7 + 1 )
v3 = (unsigned int)(int)v7 + 1LL;
}
}
v45 = v4 + 2;
v46 = v3 + 2;
}
for ( j = 0LL; ; ++j )
{
v14 = v47(j);
v15 = v14;
if ( !v14 )
break;
if ( !a2 || !strcmp(a2, *(const char **)(v14 + 8)) )
{
if ( a3 )
{
putchar(10);
printf("Plugin Name: \"%s\"\n", *(const char **)(v15 + 24));
printf("Plugin Label: \"%s\"\n", *(const char **)(v15 + 8));
printf("Plugin Unique ID: %lu\n", *(_QWORD *)v15);
printf("Maker: \"%s\"\n", *(const char **)(v15 + 32));
printf("Copyright: \"%s\"\n", *(const char **)(v15 + 40));
printf("Must Run Real-Time: ");
if ( (*(_BYTE *)(v15 + 16) & 1) != 0 )
puts("Yes");
else
puts("No");
printf("Has activate() Function: ");
if ( *(_QWORD *)(v15 + 104) )
puts("Yes");
else
puts("No");
printf("Has deactivate() Function: ");
if ( *(_QWORD *)(v15 + 136) )
puts("Yes");
else
puts("No");
printf("Has run_adding() Function: ");
if ( *(_QWORD *)(v15 + 120) )
{
puts("Yes");
if ( *(_QWORD *)(v15 + 88) )
goto LABEL_37;
LABEL_135:
puts("ERROR: PLUGIN HAS NO INSTANTIATE FUNCTION.");
}
else
{
puts("No");
if ( !*(_QWORD *)(v15 + 88) )
goto LABEL_135;
}
LABEL_37:
if ( !*(_QWORD *)(v15 + 96) )
puts("ERROR: PLUGIN HAS NO CONNECT_PORT FUNCTION.");
if ( !*(_QWORD *)(v15 + 112) )
puts("ERROR: PLUGIN HAS NO RUN FUNCTION.");
if ( !*(_QWORD *)(v15 + 120)
|| !*(_QWORD *)(v15 + 128)
&& (puts("ERROR: PLUGIN HAS RUN_ADDING FUNCTION BUT NOT SET_RUN_ADDING_GAIN."), !*(_QWORD *)(v15 + 120)) )
{
if ( *(_QWORD *)(v15 + 128) )
puts("ERROR: PLUGIN HAS SET_RUN_ADDING_GAIN FUNCTION BUT NOT RUN_ADDING.");
}
if ( !*(_QWORD *)(v15 + 144) )
puts("ERROR: PLUGIN HAS NO CLEANUP FUNCTION.");
printf("Environment: ");
if ( (*(_BYTE *)(v15 + 16) & 4) != 0 )
{
puts("Normal or Hard Real-Time");
if ( (*(_BYTE *)(v15 + 16) & 2) == 0 )
{
LABEL_47:
printf("Ports:");
if ( !*(_QWORD *)(v15 + 48) )
{
puts("\tERROR: PLUGIN HAS NO PORTS.");
if ( !*(_QWORD *)(v15 + 48) )
continue;
}
v19 = 0LL;
LABEL_62:
printf("\t\"%s\" ", *(const char **)(*(_QWORD *)(v15 + 64) + 8 * v19));
v24 = *(_DWORD *)(*(_QWORD *)(v15 + 56) + 4 * v19);
if ( (v24 & 3) == 3 )
{
printf("ERROR: INPUT AND OUTPUT");
}
else if ( (v24 & 1) != 0 )
{
printf("input");
}
else if ( (v24 & 2) != 0 )
{
printf("output");
}
else
{
printf("ERROR: NEITHER INPUT NOR OUTPUT");
}
v25 = *(_DWORD *)(*(_QWORD *)(v15 + 56) + 4 * v19);
if ( (v25 & 0xC) == 12 )
{
printf(", ERROR: CONTROL AND AUDIO");
}
else if ( (v25 & 4) != 0 )
{
printf(", control");
}
else if ( (v25 & 8) != 0 )
{
printf(", audio");
}
else
{
printf(", ERROR: NEITHER CONTROL NOR AUDIO");
}
v26 = 12 * v19;
v27 = *(_DWORD *)(*(_QWORD *)(v15 + 72) + 12 * v19);
if ( (v27 & 3) != 0 )
{
printf(", ");
if ( (v27 & 1) != 0 )
{
v29 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 4);
v30 = v29;
if ( (v27 & 8) != 0 && v29 != 0.0 )
printf("%g*srate", v30);
else
printf("%g", v30);
}
else
{
printf("...");
}
printf(" to ");
if ( (v27 & 2) != 0 )
{
v31 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 8);
v32 = v31;
if ( (v27 & 8) != 0 && v31 != 0.0 )
printf("%g*srate", v32);
else
printf("%g", v32);
}
else
{
printf("...");
}
}
if ( (v27 & 4) != 0 )
{
if ( (v27 | 0x240) == 580 )
printf(", toggled");
else
printf(", ERROR: TOGGLED INCOMPATIBLE WITH OTHER HINT");
}
v28 = v27 & 0x3C0;
if ( v28 == 320 )
{
v33 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 8);
v22 = v33;
if ( (v27 & 8) == 0 )
goto LABEL_58;
v23 = v33 == 0.0;
}
else
{
if ( (v27 & 0x3C0u) > 0x140 )
{
if ( v28 == 640 )
{
printf(", default 100");
}
else if ( (v27 & 0x3C0u) <= 0x280 )
{
if ( v28 == 512 )
{
printf(", default 0");
}
else
{
if ( v28 != 576 )
goto LABEL_117;
printf(", default 1");
}
}
else
{
if ( v28 == 704 )
{
printf(", default 440");
if ( (v27 & 0x10) != 0 )
{
LABEL_80:
printf(", logarithmic");
if ( (v27 & 0x20) != 0 )
LABEL_81:
printf(", integer");
LABEL_61:
++v19;
putchar(10);
if ( *(_QWORD *)(v15 + 48) <= v19 )
continue;
goto LABEL_62;
}
LABEL_60:
if ( (v27 & 0x20) != 0 )
goto LABEL_81;
goto LABEL_61;
}
LABEL_117:
printf(", UNKNOWN DEFAULT CODE");
}
LABEL_59:
if ( (v27 & 0x10) != 0 )
goto LABEL_80;
goto LABEL_60;
}
if ( v28 == 128 )
{
v34 = v26 + *(_QWORD *)(v15 + 72);
if ( (v27 & 0x10) != 0 )
{
v51 = log(*(float *)(v34 + 4));
v42 = log(*(float *)(*(_QWORD *)(v15 + 72) + v26 + 8));
v35 = exp(v51 * 0.75 + v42 * 0.25);
}
else
{
v35 = *(float *)(v34 + 8) * 0.25 + *(float *)(v34 + 4) * 0.75;
}
v22 = v35;
if ( (v27 & 8) == 0 )
goto LABEL_58;
v23 = v35 == 0.0;
}
else
{
if ( (v27 & 0x3C0u) > 0x80 )
{
if ( v28 == 192 )
{
v36 = *(_QWORD *)(v15 + 72) + v26;
v37 = *(float *)(v36 + 8);
if ( (v27 & 0x10) != 0 )
{
v43 = v37 * *(float *)(v36 + 4);
if ( v43 < 0.0 )
v21 = sqrtf(v43);
else
v21 = fsqrt(v43);
}
else
{
v21 = (float)(v37 + *(float *)(v36 + 4)) * 0.5;
}
}
else
{
if ( v28 != 256 )
goto LABEL_117;
v20 = v26 + *(_QWORD *)(v15 + 72);
if ( (v27 & 0x10) != 0 )
{
v50 = log(*(float *)(v20 + 4));
v41 = log(*(float *)(*(_QWORD *)(v15 + 72) + v26 + 8));
v21 = exp(v50 * 0.25 + v41 * 0.75);
}
else
{
v21 = *(float *)(v20 + 8) * 0.75 + *(float *)(v20 + 4) * 0.25;
}
}
v22 = v21;
if ( (v27 & 8) != 0 )
goto LABEL_56;
LABEL_58:
printf(", default %g", v22);
goto LABEL_59;
}
if ( (v27 & 0x3C0) == 0 )
goto LABEL_59;
if ( v28 != 64 )
goto LABEL_117;
v21 = *(float *)(*(_QWORD *)(v15 + 72) + v26 + 4);
v22 = v21;
if ( (v27 & 8) == 0 )
goto LABEL_58;
LABEL_56:
v23 = v21 == 0.0;
}
}
if ( !v23 )
{
printf(", default %g*srate", v22);
goto LABEL_59;
}
goto LABEL_58;
}
}
else
{
puts("Normal");
if ( (*(_BYTE *)(v15 + 16) & 2) == 0 )
goto LABEL_47;
}
puts("This plugin cannot use in-place processing. It will not work with all hosts.");
goto LABEL_47;
}
printf("%s", *(const char **)(v15 + 8));
v16 = strlen(*(const char **)(v15 + 8));
if ( v45 > v16 )
{
do
{
++v16;
putchar(32);
}
while ( v45 != v16 );
}
printf("%lu", *(_QWORD *)v15);
if ( *(__int64 *)v15 < 0 )
{
v38 = *(_QWORD *)v15 & 1LL | (*(_QWORD *)v15 >> 1);
v17 = (double)(int)v38 + (double)(int)v38;
}
else
{
v17 = (double)(int)*(_QWORD *)v15;
}
for ( k = (unsigned int)(int)log10(v17) + 1LL; v46 > k; ++k )
putchar(32);
puts(*(const char **)(v15 + 24));
}
}
if ( a3 )
putchar(10);
v39 = 0;
unloadLADSPAPluginLibrary(v49);
}
else
{
v39 = 1;
v44 = dlerror();
if ( v44 )
fprintf(
stderr,
"Unable to find ladspa_descriptor() function in plugin file \"%s\": %s.\n"
"Are you sure this is a LADSPA plugin file?\n",
a1,
v44);
}
return v39;
}

original_code:
static int
analysePlugin(const char * pcPluginFilename,
       const char * pcPluginLabel,
       const int bVerbose) {
  LADSPA_Descriptor_Function pfDescriptorFunction;
  const LADSPA_Descriptor * psDescriptor;
  unsigned long lPluginIndex;
  unsigned long lPortIndex;
  unsigned long lSpaceIndex;
  unsigned long lSpacePadding1;
  unsigned long lSpacePadding2;
  unsigned long lLength;
  void * pvPluginHandle;
  LADSPA_PortRangeHintDescriptor iHintDescriptor;
  LADSPA_Data fBound;
  LADSPA_Data fDefault;
  pvPluginHandle = loadLADSPAPluginLibrary(pcPluginFilename);
  dlerror();
  pfDescriptorFunction
    = (LADSPA_Descriptor_Function)dlsym(pvPluginHandle, "ladspa_descriptor");
  if (!pfDescriptorFunction) {
    const char * pcError = dlerror();
    if (pcError)
      fprintf(stderr,
       "Unable to find ladspa_descriptor() function in plugin file "
       "\"%s\": %s.\n"
       "Are you sure this is a LADSPA plugin file?\n",
       pcPluginFilename,
       pcError);
    return 1;
  }
  lSpacePadding1 = 0;
  lSpacePadding2 = 0;
  if (!bVerbose) {
    for (lPluginIndex = 0;; lPluginIndex++) {
      psDescriptor = pfDescriptorFunction(lPluginIndex);
      if (!psDescriptor)
 break;
      if (pcPluginLabel != ((void *)0))
 if (strcmp(pcPluginLabel, psDescriptor->Label) != 0)
   continue;
      lLength = strlen(psDescriptor->Label);
      if (lSpacePadding1 < lLength)
 lSpacePadding1 = lLength;
      lLength = (long)(log10(psDescriptor->UniqueID)) + 1;
      if (lSpacePadding2 < lLength)
 lSpacePadding2 = lLength;
    }
    lSpacePadding1 += 2;
    lSpacePadding2 += 2;
  }
  for (lPluginIndex = 0;; lPluginIndex++) {
    psDescriptor = pfDescriptorFunction(lPluginIndex);
    if (!psDescriptor)
      break;
    if (pcPluginLabel != ((void *)0))
      if (strcmp(pcPluginLabel, psDescriptor->Label) != 0)
 continue;
    if (!bVerbose) {
      printf("%s", psDescriptor->Label);
      for (lSpaceIndex = strlen(psDescriptor->Label);
    lSpaceIndex < lSpacePadding1;
    lSpaceIndex++)
 putchar(' ');
      printf("%lu", psDescriptor->UniqueID);
      for (lSpaceIndex = (long)(log10(psDescriptor->UniqueID)) + 1;
    lSpaceIndex < lSpacePadding2;
    lSpaceIndex++)
 putchar(' ');
      puts(psDescriptor->Name);
    }
    else {
      putchar('\n');
      printf("Plugin Name: \"%s\"\n", psDescriptor->Name);
      printf("Plugin Label: \"%s\"\n", psDescriptor->Label);
      printf("Plugin Unique ID: %lu\n", psDescriptor->UniqueID);
      printf("Maker: \"%s\"\n", psDescriptor->Maker);
      printf("Copyright: \"%s\"\n", psDescriptor->Copyright);
      printf("Must Run Real-Time: ");
      if (((psDescriptor->Properties) & 0x1))
 printf("Yes\n");
      else
 printf("No\n");
      printf("Has activate() Function: ");
      if (psDescriptor->activate != ((void *)0))
 printf("Yes\n");
      else
 printf("No\n");
      printf("Has deactivate() Function: ");
      if (psDescriptor->deactivate != ((void *)0))
 printf("Yes\n");
      else
 printf("No\n");
      printf("Has run_adding() Function: ");
      if (psDescriptor->run_adding != ((void *)0))
 printf("Yes\n");
      else
 printf("No\n");
      if (psDescriptor->instantiate == ((void *)0))
 printf("ERROR: PLUGIN HAS NO INSTANTIATE FUNCTION.\n");
      if (psDescriptor->connect_port == ((void *)0))
 printf("ERROR: PLUGIN HAS NO CONNECT_PORT FUNCTION.\n");
      if (psDescriptor->run == ((void *)0))
 printf("ERROR: PLUGIN HAS NO RUN FUNCTION.\n");
      if (psDescriptor->run_adding != ((void *)0)
   && psDescriptor->set_run_adding_gain == ((void *)0))
 printf("ERROR: PLUGIN HAS RUN_ADDING FUNCTION BUT "
        "NOT SET_RUN_ADDING_GAIN.\n");
      if (psDescriptor->run_adding == ((void *)0)
   && psDescriptor->set_run_adding_gain != ((void *)0))
 printf("ERROR: PLUGIN HAS SET_RUN_ADDING_GAIN FUNCTION BUT "
        "NOT RUN_ADDING.\n");
      if (psDescriptor->cleanup == ((void *)0))
 printf("ERROR: PLUGIN HAS NO CLEANUP FUNCTION.\n");
      printf("Environment: ");
      if (((psDescriptor->Properties) & 0x4))
 printf("Normal or Hard Real-Time\n");
      else
 printf("Normal\n");
      if (((psDescriptor->Properties) & 0x2))
 printf("This plugin cannot use in-place processing. "
        "It will not work with all hosts.\n");
      printf("Ports:");
      if (psDescriptor->PortCount == 0)
 printf("\tERROR: PLUGIN HAS NO PORTS.\n");
      for (lPortIndex = 0;
    lPortIndex < psDescriptor->PortCount;
    lPortIndex++) {
 printf("\t\"%s\" ", psDescriptor->PortNames[lPortIndex]);
 if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x1)
     && ((psDescriptor->PortDescriptors[lPortIndex]) & 0x2))
   printf("ERROR: INPUT AND OUTPUT");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x1))
   printf("input");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x2))
   printf("output");
 else
   printf("ERROR: NEITHER INPUT NOR OUTPUT");
 if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x4)
     && ((psDescriptor->PortDescriptors[lPortIndex]) & 0x8))
   printf(", ERROR: CONTROL AND AUDIO");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x4))
   printf(", control");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x8))
   printf(", audio");
 else
   printf(", ERROR: NEITHER CONTROL NOR AUDIO");
 iHintDescriptor
   = psDescriptor->PortRangeHints[lPortIndex].HintDescriptor;
 if (((iHintDescriptor) & 0x1)
     || ((iHintDescriptor) & 0x2)) {
   printf(", ");
   if (((iHintDescriptor) & 0x1)) {
     fBound = psDescriptor->PortRangeHints[lPortIndex].LowerBound;
     if (((iHintDescriptor) & 0x8) && fBound != 0)
       printf("%g*srate", fBound);
     else
       printf("%g", fBound);
   }
   else
     printf("...");
   printf(" to ");
   if (((iHintDescriptor) & 0x2)) {
     fBound = psDescriptor->PortRangeHints[lPortIndex].UpperBound;
     if (((iHintDescriptor) & 0x8) && fBound != 0)
       printf("%g*srate", fBound);
     else
       printf("%g", fBound);
   }
   else
     printf("...");
 }
 if (((iHintDescriptor) & 0x4)) {
   if ((iHintDescriptor
        | 0x200
        | 0x240)
        != (0x4
     | 0x200
     | 0x240))
     printf(", ERROR: TOGGLED INCOMPATIBLE WITH OTHER HINT");
   else
     printf(", toggled");
 }
 switch (iHintDescriptor & 0x3C0) {
 case 0x0:
   break;
 case 0x40:
   fDefault = psDescriptor->PortRangeHints[lPortIndex].LowerBound;
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x80:
   if (((iHintDescriptor) & 0x10)) {
     fDefault
       = exp(log(psDescriptor->PortRangeHints[lPortIndex].LowerBound)
      * 0.75
      + log(psDescriptor->PortRangeHints[lPortIndex].UpperBound)
      * 0.25);
   }
   else {
     fDefault
       = (psDescriptor->PortRangeHints[lPortIndex].LowerBound
   * 0.75
   + psDescriptor->PortRangeHints[lPortIndex].UpperBound
   * 0.25);
   }
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0xC0:
   if (((iHintDescriptor) & 0x10)) {
     fDefault
       = sqrt(psDescriptor->PortRangeHints[lPortIndex].LowerBound
       * psDescriptor->PortRangeHints[lPortIndex].UpperBound);
   }
   else {
     fDefault
       = 0.5 * (psDescriptor->PortRangeHints[lPortIndex].LowerBound
         + psDescriptor->PortRangeHints[lPortIndex].UpperBound);
   }
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x100:
   if (((iHintDescriptor) & 0x10)) {
     fDefault
       = exp(log(psDescriptor->PortRangeHints[lPortIndex].LowerBound)
      * 0.25
      + log(psDescriptor->PortRangeHints[lPortIndex].UpperBound)
      * 0.75);
   }
   else {
     fDefault
       = (psDescriptor->PortRangeHints[lPortIndex].LowerBound
   * 0.25
   + psDescriptor->PortRangeHints[lPortIndex].UpperBound
   * 0.75);
   }
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x140:
   fDefault = psDescriptor->PortRangeHints[lPortIndex].UpperBound;
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x200:
   printf(", default 0");
   break;
 case 0x240:
   printf(", default 1");
   break;
 case 0x280:
   printf(", default 100");
   break;
 case 0x2C0:
   printf(", default 440");
   break;
 default:
   printf(", UNKNOWN DEFAULT CODE");
   break;
 }
 if (((iHintDescriptor) & 0x10))
   printf(", logarithmic");
 if (((iHintDescriptor) & 0x20))
   printf(", integer");
 putchar('\n');
      }
    }
  }
  if (bVerbose)
    putchar('\n');
  unloadLADSPAPluginLibrary(pvPluginHandle);
  return(0);
}

canonical_original_code:
static int analysePlugin(char *pcPluginFilename, char *pcPluginLabel, int bVerbose) {
  struct _LADSPA_Descriptor *(*pfDescriptorFunction)(unsigned long Index);
  struct _LADSPA_Descriptor *psDescriptor;
  unsigned long lPluginIndex;
  unsigned long lPortIndex;
  unsigned long lSpaceIndex;
  unsigned long lSpacePadding1;
  unsigned long lSpacePadding2;
  unsigned long lLength;
  void *pvPluginHandle;
  int iHintDescriptor;
  float fBound;
  float fDefault;
  pvPluginHandle = loadLADSPAPluginLibrary(pcPluginFilename);
  dlerror();
  pfDescriptorFunction
    = (struct _LADSPA_Descriptor *(*)(unsigned long Index))dlsym(pvPluginHandle, "ladspa_descriptor");
  if (!pfDescriptorFunction) {
    char *pcError = dlerror();
    if (pcError)
      fprintf(stderr,
       "Unable to find ladspa_descriptor() function in plugin file "
       "\"%s\": %s.\n"
       "Are you sure this is a LADSPA plugin file?\n",
       pcPluginFilename,
       pcError);
    return 1;
  }
  lSpacePadding1 = 0;
  lSpacePadding2 = 0;
  if (!bVerbose) {
    for (lPluginIndex = 0;; lPluginIndex++) {
      psDescriptor = pfDescriptorFunction(lPluginIndex);
      if (!psDescriptor)
 break;
      if (pcPluginLabel != ((void *)0))
 if (strcmp(pcPluginLabel, psDescriptor->Label) != 0)
   continue;
      lLength = strlen(psDescriptor->Label);
      if (lSpacePadding1 < lLength)
 lSpacePadding1 = lLength;
      lLength = (long)(log10(psDescriptor->UniqueID)) + 1;
      if (lSpacePadding2 < lLength)
 lSpacePadding2 = lLength;
    }
    lSpacePadding1 += 2;
    lSpacePadding2 += 2;
  }
  for (lPluginIndex = 0;; lPluginIndex++) {
    psDescriptor = pfDescriptorFunction(lPluginIndex);
    if (!psDescriptor)
      break;
    if (pcPluginLabel != ((void *)0))
      if (strcmp(pcPluginLabel, psDescriptor->Label) != 0)
 continue;
    if (!bVerbose) {
      printf("%s", psDescriptor->Label);
      for (lSpaceIndex = strlen(psDescriptor->Label);
    lSpaceIndex < lSpacePadding1;
    lSpaceIndex++)
 putchar(' ');
      printf("%lu", psDescriptor->UniqueID);
      for (lSpaceIndex = (long)(log10(psDescriptor->UniqueID)) + 1;
    lSpaceIndex < lSpacePadding2;
    lSpaceIndex++)
 putchar(' ');
      puts(psDescriptor->Name);
    }
    else {
      putchar('\n');
      printf("Plugin Name: \"%s\"\n", psDescriptor->Name);
      printf("Plugin Label: \"%s\"\n", psDescriptor->Label);
      printf("Plugin Unique ID: %lu\n", psDescriptor->UniqueID);
      printf("Maker: \"%s\"\n", psDescriptor->Maker);
      printf("Copyright: \"%s\"\n", psDescriptor->Copyright);
      printf("Must Run Real-Time: ");
      if (((psDescriptor->Properties) & 0x1))
 printf("Yes\n");
      else
 printf("No\n");
      printf("Has activate() Function: ");
      if (psDescriptor->activate != ((void *)0))
 printf("Yes\n");
      else
 printf("No\n");
      printf("Has deactivate() Function: ");
      if (psDescriptor->deactivate != ((void *)0))
 printf("Yes\n");
      else
 printf("No\n");
      printf("Has run_adding() Function: ");
      if (psDescriptor->run_adding != ((void *)0))
 printf("Yes\n");
      else
 printf("No\n");
      if (psDescriptor->instantiate == ((void *)0))
 printf("ERROR: PLUGIN HAS NO INSTANTIATE FUNCTION.\n");
      if (psDescriptor->connect_port == ((void *)0))
 printf("ERROR: PLUGIN HAS NO CONNECT_PORT FUNCTION.\n");
      if (psDescriptor->run == ((void *)0))
 printf("ERROR: PLUGIN HAS NO RUN FUNCTION.\n");
      if (psDescriptor->run_adding != ((void *)0)
   && psDescriptor->set_run_adding_gain == ((void *)0))
 printf("ERROR: PLUGIN HAS RUN_ADDING FUNCTION BUT "
        "NOT SET_RUN_ADDING_GAIN.\n");
      if (psDescriptor->run_adding == ((void *)0)
   && psDescriptor->set_run_adding_gain != ((void *)0))
 printf("ERROR: PLUGIN HAS SET_RUN_ADDING_GAIN FUNCTION BUT "
        "NOT RUN_ADDING.\n");
      if (psDescriptor->cleanup == ((void *)0))
 printf("ERROR: PLUGIN HAS NO CLEANUP FUNCTION.\n");
      printf("Environment: ");
      if (((psDescriptor->Properties) & 0x4))
 printf("Normal or Hard Real-Time\n");
      else
 printf("Normal\n");
      if (((psDescriptor->Properties) & 0x2))
 printf("This plugin cannot use in-place processing. "
        "It will not work with all hosts.\n");
      printf("Ports:");
      if (psDescriptor->PortCount == 0)
 printf("\tERROR: PLUGIN HAS NO PORTS.\n");
      for (lPortIndex = 0;
    lPortIndex < psDescriptor->PortCount;
    lPortIndex++) {
 printf("\t\"%s\" ", psDescriptor->PortNames[lPortIndex]);
 if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x1)
     && ((psDescriptor->PortDescriptors[lPortIndex]) & 0x2))
   printf("ERROR: INPUT AND OUTPUT");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x1))
   printf("input");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x2))
   printf("output");
 else
   printf("ERROR: NEITHER INPUT NOR OUTPUT");
 if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x4)
     && ((psDescriptor->PortDescriptors[lPortIndex]) & 0x8))
   printf(", ERROR: CONTROL AND AUDIO");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x4))
   printf(", control");
 else if (((psDescriptor->PortDescriptors[lPortIndex]) & 0x8))
   printf(", audio");
 else
   printf(", ERROR: NEITHER CONTROL NOR AUDIO");
 iHintDescriptor
   = psDescriptor->PortRangeHints[lPortIndex].HintDescriptor;
 if (((iHintDescriptor) & 0x1)
     || ((iHintDescriptor) & 0x2)) {
   printf(", ");
   if (((iHintDescriptor) & 0x1)) {
     fBound = psDescriptor->PortRangeHints[lPortIndex].LowerBound;
     if (((iHintDescriptor) & 0x8) && fBound != 0)
       printf("%g*srate", fBound);
     else
       printf("%g", fBound);
   }
   else
     printf("...");
   printf(" to ");
   if (((iHintDescriptor) & 0x2)) {
     fBound = psDescriptor->PortRangeHints[lPortIndex].UpperBound;
     if (((iHintDescriptor) & 0x8) && fBound != 0)
       printf("%g*srate", fBound);
     else
       printf("%g", fBound);
   }
   else
     printf("...");
 }
 if (((iHintDescriptor) & 0x4)) {
   if ((iHintDescriptor
        | 0x200
        | 0x240)
        != (0x4
     | 0x200
     | 0x240))
     printf(", ERROR: TOGGLED INCOMPATIBLE WITH OTHER HINT");
   else
     printf(", toggled");
 }
 switch (iHintDescriptor & 0x3C0) {
 case 0x0:
   break;
 case 0x40:
   fDefault = psDescriptor->PortRangeHints[lPortIndex].LowerBound;
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x80:
   if (((iHintDescriptor) & 0x10)) {
     fDefault
       = exp(log(psDescriptor->PortRangeHints[lPortIndex].LowerBound)
      * 0.75
      + log(psDescriptor->PortRangeHints[lPortIndex].UpperBound)
      * 0.25);
   }
   else {
     fDefault
       = (psDescriptor->PortRangeHints[lPortIndex].LowerBound
   * 0.75
   + psDescriptor->PortRangeHints[lPortIndex].UpperBound
   * 0.25);
   }
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0xC0:
   if (((iHintDescriptor) & 0x10)) {
     fDefault
       = sqrt(psDescriptor->PortRangeHints[lPortIndex].LowerBound
       * psDescriptor->PortRangeHints[lPortIndex].UpperBound);
   }
   else {
     fDefault
       = 0.5 * (psDescriptor->PortRangeHints[lPortIndex].LowerBound
         + psDescriptor->PortRangeHints[lPortIndex].UpperBound);
   }
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x100:
   if (((iHintDescriptor) & 0x10)) {
     fDefault
       = exp(log(psDescriptor->PortRangeHints[lPortIndex].LowerBound)
      * 0.25
      + log(psDescriptor->PortRangeHints[lPortIndex].UpperBound)
      * 0.75);
   }
   else {
     fDefault
       = (psDescriptor->PortRangeHints[lPortIndex].LowerBound
   * 0.25
   + psDescriptor->PortRangeHints[lPortIndex].UpperBound
   * 0.75);
   }
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x140:
   fDefault = psDescriptor->PortRangeHints[lPortIndex].UpperBound;
   if (((iHintDescriptor) & 0x8) && fDefault != 0)
     printf(", default %g*srate", fDefault);
   else
     printf(", default %g", fDefault);
   break;
 case 0x200:
   printf(", default 0");
   break;
 case 0x240:
   printf(", default 1");
   break;
 case 0x280:
   printf(", default 100");
   break;
 case 0x2C0:
   printf(", default 440");
   break;
 default:
   printf(", UNKNOWN DEFAULT CODE");
   break;
 }
 if (((iHintDescriptor) & 0x10))
   printf(", logarithmic");
 if (((iHintDescriptor) & 0x20))
   printf(", integer");
 putchar('\n');
      }
    }
  }
  if (bVerbose)
    putchar('\n');
  unloadLADSPAPluginLibrary(pvPluginHandle);
  return(0);
}

variable_types:
pcPluginFilename
char *

variable_types:
pcPluginLabel
char *

variable_types: bVerbose int

variable_types: struct _LADSPA_Descriptor { unsigned long UniqueID; char *Label; int Properties; char *Name; char *Maker; char *Copyright; unsigned long PortCount; int *PortDescriptors; char **PortNames; struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; } *PortRangeHints; void *ImplementationData; void *(*instantiate)(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate); void (*connect_port)(void *Instance, unsigned long Port, float *DataLocation); void (*activate)(void *Instance); void (*run)(void *Instance, unsigned long SampleCount); void (*run_adding)(void *Instance, unsigned long SampleCount); void (*set_run_adding_gain)(void *Instance, float Gain); void (*deactivate)(void *Instance); void (*cleanup)(void *Instance); } *(*)(unsigned long Index)

variable_types:
lPluginIndex
unsigned long

variable_types:
lPortIndex
unsigned long

variable_types:
lSpaceIndex
unsigned long

variable_types:
lLength
unsigned long

variable_types:
pvPluginHandle
void *

variable_types: iHintDescriptor int

variable_types: fBound float

variable_types: fDefault float

variable_types:
pcError
char *

return_type: int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v5; // rbp
int v6; // eax
const char *v7; // rsi
const char *v8; // rax

if ( argc != 3 )
{
if ( argc != 4 )
{
if ( argc == 2 )
{
v5 = argv[1];
if ( strcmp(v5, "-h") )
{
v7 = 0LL;
return analysePlugin(v5, v7, 1);
}
}
LABEL_4:
fwrite(
"Usage:\tanalyseplugin [flags] <LADSPA plugin file name> [<plugin label>].\n"
"Flags:-l Produce a summary list rather than a verbose report.\n"
"Note that the LADSPA_PATH environment variable is used to help find plugins.\n",
1uLL,
0xD5uLL,
stderr);
return 1;
}
if ( strcmp(argv[1], "-l") )
goto LABEL_4;
v7 = argv[2];
v8 = argv[3];
LABEL_12:
if ( v7 )
return analysePlugin(v7, v8, 0);
goto LABEL_4;
}
v5 = argv[1];
v6 = strcmp(v5, "-l");
v7 = argv[2];
if ( !v6 )
{
v8 = 0LL;
goto LABEL_12;
}
return analysePlugin(v5, v7, 1);
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v5; // rbp
int v6; // eax
const char *v7; // rsi
const char *v8; // rax

if ( argc != 3 )
{
if ( argc != 4 )
{
if ( argc == 2 )
{
v5 = argv[1];
if ( strcmp(v5, "-h") )
{
v7 = 0LL;
return func0(v5, v7, 1);
}
}
LABEL_4:
fwrite(
"Usage:\tanalyseplugin [flags] <LADSPA plugin file name> [<plugin label>].\n"
"Flags:-l Produce a summary list rather than a verbose report.\n"
"Note that the LADSPA_PATH environment variable is used to help find plugins.\n",
1uLL,
0xD5uLL,
stderr);
return 1;
}
if ( strcmp(argv[1], "-l") )
goto LABEL_4;
v7 = argv[2];
v8 = argv[3];
LABEL_12:
if ( v7 )
return func0(v7, v8, 0);
goto LABEL_4;
}
v5 = argv[1];
v6 = strcmp(v5, "-l");
v7 = argv[2];
if ( !v6 )
{
v8 = 0LL;
goto LABEL_12;
}
return func0(v5, v7, 1);
}

original_code:
int
main(const int iArgc, const char ** ppcArgv) {
  const char * pcPluginName = ((void *)0);
  const char * pcPluginLabel = ((void *)0);
  int bVerbose = 1;
  switch (iArgc) {
  case 2:
    if (strcmp(ppcArgv[1], "-h") != 0) {
      pcPluginName = ppcArgv[1];
      pcPluginLabel = ((void *)0);
    }
    break;
  case 3:
    if (strcmp(ppcArgv[1], "-l") == 0) {
      pcPluginName = ppcArgv[2];
      pcPluginLabel = ((void *)0);
      bVerbose = 0;
    }
    else {
      pcPluginName = ppcArgv[1];
      pcPluginLabel = ppcArgv[2];
    }
    break;
  case 4:
    if (strcmp(ppcArgv[1], "-l") == 0) {
      pcPluginName = ppcArgv[2];
      pcPluginLabel = ppcArgv[3];
      bVerbose = 0;
    }
    break;
  }
  if (!pcPluginName) {
    fprintf(stderr,
     "Usage:\tanalyseplugin [flags] <LADSPA plugin file name> "
     "[<plugin label>].\n"
     "Flags:"
     "-l  Produce a summary list rather than a verbose report.\n"
            "Note that the LADSPA_PATH environment variable is used "
            "to help find plugins.\n");
    return(1);
  }
  return analysePlugin(pcPluginName, pcPluginLabel, bVerbose);
}

canonical_original_code:
int main(int iArgc, char **ppcArgv) {
  char *pcPluginName = ((void *)0);
  char *pcPluginLabel = ((void *)0);
  int bVerbose = 1;
  switch (iArgc) {
  case 2:
    if (strcmp(ppcArgv[1], "-h") != 0) {
      pcPluginName = ppcArgv[1];
      pcPluginLabel = ((void *)0);
    }
    break;
  case 3:
    if (strcmp(ppcArgv[1], "-l") == 0) {
      pcPluginName = ppcArgv[2];
      pcPluginLabel = ((void *)0);
      bVerbose = 0;
    }
    else {
      pcPluginName = ppcArgv[1];
      pcPluginLabel = ppcArgv[2];
    }
    break;
  case 4:
    if (strcmp(ppcArgv[1], "-l") == 0) {
      pcPluginName = ppcArgv[2];
      pcPluginLabel = ppcArgv[3];
      bVerbose = 0;
    }
    break;
  }
  if (!pcPluginName) {
    fprintf(stderr,
     "Usage:\tanalyseplugin [flags] <LADSPA plugin file name> "
     "[<plugin label>].\n"
     "Flags:"
     "-l  Produce a summary list rather than a verbose report.\n"
            "Note that the LADSPA_PATH environment variable is used "
            "to help find plugins.\n");
    return(1);
  }
  return analysePlugin(pcPluginName, pcPluginLabel, bVerbose);
}

variable_types: iArgc int

variable_types:
ppcArgv
char **

variable_types:
pcPluginName
char *


loadLADSPAPluginLibrary

decompiled_code:
void *__fastcall loadLADSPAPluginLibrary(const char *a1)
{
void *result; // rax
char *v2; // rax

result = dlopenLADSPA_constprop_0(a1);
if ( !result )
{
v2 = dlerror();
fprintf(stderr, "Failed to load plugin \"%s\": %s\n", a1, v2);
exit(1);
}
return result;
}

canonical_decompiled_code:
void *__fastcall func1(const char *a1)
{
void *result; // rax
char *v2; // rax

result = func0(a1);
if ( !result )
{
v2 = dlerror();
fprintf(stderr, "Failed to load plugin \"%s\": %s\n", a1, v2);
exit(1);
}
return result;
}

original_code:
void *
loadLADSPAPluginLibrary(const char * pcPluginFilename) {
  void * pvPluginHandle;
  pvPluginHandle = dlopenLADSPA(pcPluginFilename, 0x00002);
  if (!pvPluginHandle) {
    fprintf(stderr,
     "Failed to load plugin \"%s\": %s\n",
     pcPluginFilename,
     dlerror());
    exit(1);
  }
  return pvPluginHandle;
}

canonical_original_code:
void *loadLADSPAPluginLibrary(char *pcPluginFilename) {
  void *pvPluginHandle;
  pvPluginHandle = dlopenLADSPA(pcPluginFilename, 0x00002);
  if (!pvPluginHandle) {
    fprintf(stderr,
     "Failed to load plugin \"%s\": %s\n",
     pcPluginFilename,
     dlerror());
    exit(1);
  }
  return pvPluginHandle;
}


unloadLADSPAPluginLibrary

decompiled_code:
// attributes: thunk
int unloadLADSPAPluginLibrary(void *handle)
{
return dlclose(handle);
}

canonical_decompiled_code:
int func2(void *handle)
{
return dlclose(handle);
}

original_code:
void
unloadLADSPAPluginLibrary(void * pvLADSPAPluginLibrary) {
  dlclose(pvLADSPAPluginLibrary);
}

canonical_original_code:
void unloadLADSPAPluginLibrary(void *pvLADSPAPluginLibrary) {
  dlclose(pvLADSPAPluginLibrary);
}

variable_types:
pvLADSPAPluginLibrary
void *


findLADSPAPluginDescriptor

decompiled_code:
__int64 __fastcall findLADSPAPluginDescriptor(void *handle, __int64 a2, const char *a3)
{
__int64 (__fastcall *v4)(__int64); // rbp
__int64 i; // rbx
__int64 v6; // rax
__int64 v7; // r12
char *v9; // rax

dlerror();
v4 = (__int64 (__fastcall *)(__int64))dlsym(handle, "ladspa_descriptor");
if ( !v4 )
{
v9 = dlerror();
if ( v9 )
{
fprintf(
stderr,
"Unable to find ladspa_descriptor() function in plugin library file \"%s\": %s.\n"
"Are you sure this is a LADSPA plugin file?\n",
a2,
v9);
goto LABEL_10;
}
}
for ( i = 0LL; ; ++i )
{
v6 = v4(i);
v7 = v6;
if ( !v6 )
{
fprintf(stderr, "Unable to find label \"%s\" in plugin library file \"%s\".\n", a3, a2);
LABEL_10:
exit(1);
}
if ( !strcmp(*(const char **)(v6 + 8), a3) )
break;
}
return v7;
}

canonical_decompiled_code:
__int64 __fastcall func3(void *handle, __int64 a2, const char *a3)
{
__int64 (__fastcall *v4)(__int64); // rbp
__int64 i; // rbx
__int64 v6; // rax
__int64 v7; // r12
char *v9; // rax

dlerror();
v4 = (__int64 (__fastcall *)(__int64))dlsym(handle, "ladspa_descriptor");
if ( !v4 )
{
v9 = dlerror();
if ( v9 )
{
fprintf(
stderr,
"Unable to find ladspa_descriptor() function in plugin library file \"%s\": %s.\n"
"Are you sure this is a LADSPA plugin file?\n",
a2,
v9);
goto LABEL_10;
}
}
for ( i = 0LL; ; ++i )
{
v6 = v4(i);
v7 = v6;
if ( !v6 )
{
fprintf(stderr, "Unable to find label \"%s\" in plugin library file \"%s\".\n", a3, a2);
LABEL_10:
exit(1);
}
if ( !strcmp(*(const char **)(v6 + 8), a3) )
break;
}
return v7;
}

original_code:
const LADSPA_Descriptor *
findLADSPAPluginDescriptor(void * pvLADSPAPluginLibrary,
      const char * pcPluginLibraryFilename,
      const char * pcPluginLabel) {
  const LADSPA_Descriptor * psDescriptor;
  LADSPA_Descriptor_Function pfDescriptorFunction;
  unsigned long lPluginIndex;
  dlerror();
  pfDescriptorFunction
    = (LADSPA_Descriptor_Function)dlsym(pvLADSPAPluginLibrary,
     "ladspa_descriptor");
  if (!pfDescriptorFunction) {
    const char * pcError = dlerror();
    if (pcError) {
      fprintf(stderr,
       "Unable to find ladspa_descriptor() function in plugin "
       "library file \"%s\": %s.\n"
       "Are you sure this is a LADSPA plugin file?\n",
       pcPluginLibraryFilename,
       pcError);
      exit(1);
    }
  }
  for (lPluginIndex = 0;; lPluginIndex++) {
    psDescriptor = pfDescriptorFunction(lPluginIndex);
    if (psDescriptor == ((void *)0)) {
      fprintf(stderr,
       "Unable to find label \"%s\" in plugin library file \"%s\".\n",
       pcPluginLabel,
       pcPluginLibraryFilename);
      exit(1);
    }
    if (strcmp(psDescriptor->Label, pcPluginLabel) == 0)
      return psDescriptor;
  }
}

canonical_original_code:
struct _LADSPA_Descriptor *findLADSPAPluginDescriptor(void *pvLADSPAPluginLibrary, char *pcPluginLibraryFilename, char *pcPluginLabel) {
  struct _LADSPA_Descriptor *psDescriptor;
  struct _LADSPA_Descriptor *(*pfDescriptorFunction)(unsigned long Index);
  unsigned long lPluginIndex;
  dlerror();
  pfDescriptorFunction
    = (struct _LADSPA_Descriptor *(*)(unsigned long Index))dlsym(pvLADSPAPluginLibrary,
     "ladspa_descriptor");
  if (!pfDescriptorFunction) {
    char *pcError = dlerror();
    if (pcError) {
      fprintf(stderr,
       "Unable to find ladspa_descriptor() function in plugin "
       "library file \"%s\": %s.\n"
       "Are you sure this is a LADSPA plugin file?\n",
       pcPluginLibraryFilename,
       pcError);
      exit(1);
    }
  }
  for (lPluginIndex = 0;; lPluginIndex++) {
    psDescriptor = pfDescriptorFunction(lPluginIndex);
    if (psDescriptor == ((void *)0)) {
      fprintf(stderr,
       "Unable to find label \"%s\" in plugin library file \"%s\".\n",
       pcPluginLabel,
       pcPluginLibraryFilename);
      exit(1);
    }
    if (strcmp(psDescriptor->Label, pcPluginLabel) == 0)
      return psDescriptor;
  }
}

variable_types:
pcPluginLibraryFilename
char *

variable_types: struct _LADSPA_Descriptor { unsigned long UniqueID; char *Label; int Properties; char *Name; char *Maker; char *Copyright; unsigned long PortCount; int *PortDescriptors; char **PortNames; struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; } *PortRangeHints; void *ImplementationData; void *(*instantiate)(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate); void (*connect_port)(void *Instance, unsigned long Port, float *DataLocation); void (*activate)(void *Instance); void (*run)(void *Instance, unsigned long SampleCount); void (*run_adding)(void *Instance, unsigned long SampleCount); void (*set_run_adding_gain)(void *Instance, float Gain); void (*deactivate)(void *Instance); void (*cleanup)(void *Instance); } *


listPlugins

decompiled_code:
__int64 listPlugins()
{
LADSPAPluginSearch(&describePluginLibrary);
return 0LL;
}

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

original_code:
static int
listPlugins() {
  LADSPAPluginSearch(describePluginLibrary);
  return(0);
}


describePluginLibrary

decompiled_code:
int __fastcall describePluginLibrary(const char *a1, void *a2, __int64 (__fastcall *a3)(__int64))
{
__int64 v4; // rbx
__int64 v5; // rax

v4 = 0LL;
printf("%s:\n", a1);
while ( 1 )
{
v5 = a3(v4);
if ( !v5 )
break;
++v4;
printf("\t%s (%lu/%s)\n", *(const char **)(v5 + 24), *(_QWORD *)v5, *(const char **)(v5 + 8));
}
return dlclose(a2);
}

canonical_decompiled_code:
int __fastcall func1(const char *a1, void *a2, __int64 (__fastcall *a3)(__int64))
{
__int64 v4; // rbx
__int64 v5; // rax

v4 = 0LL;
printf("%s:\n", a1);
while ( 1 )
{
v5 = a3(v4);
if ( !v5 )
break;
++v4;
printf("\t%s (%lu/%s)\n", *(const char **)(v5 + 24), *(_QWORD *)v5, *(const char **)(v5 + 8));
}
return dlclose(a2);
}

original_code:
static void
describePluginLibrary(const char * pcFullFilename,
        void * pvPluginHandle,
        LADSPA_Descriptor_Function fDescriptorFunction) {
  const LADSPA_Descriptor * psDescriptor;
  long lIndex;
  printf("%s:\n", pcFullFilename);
  for (lIndex = 0;
       (psDescriptor = fDescriptorFunction(lIndex)) != ((void *)0);
       lIndex++)
    printf("\t%s (%lu/%s)\n",
    psDescriptor->Name,
    psDescriptor->UniqueID,
    psDescriptor->Label);
  dlclose(pvPluginHandle);
}

canonical_original_code:
static void describePluginLibrary(char *pcFullFilename, void *pvPluginHandle, struct _LADSPA_Descriptor *(*fDescriptorFunction)(unsigned long Index)) {
  struct _LADSPA_Descriptor *psDescriptor;
  long lIndex;
  printf("%s:\n", pcFullFilename);
  for (lIndex = 0;
       (psDescriptor = fDescriptorFunction(lIndex)) != ((void *)0);
       lIndex++)
    printf("\t%s (%lu/%s)\n",
    psDescriptor->Name,
    psDescriptor->UniqueID,
    psDescriptor->Label);
  dlclose(pvPluginHandle);
}

variable_types:
pcFullFilename
char *

variable_types: lIndex long


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
return listPlugins(argc, argv, envp);
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
return func0(argc, argv, envp);
}

original_code:
int
main(const int iArgc, const char ** ppcArgv) {
  return listPlugins();
}

canonical_original_code:
int main(int iArgc, char **ppcArgv) {
  return listPlugins();
}


LADSPAPluginSearch

decompiled_code:
size_t __fastcall LADSPAPluginSearch(void (__fastcall *a1)(char *, void *))
{
char *v1; // rax
const char *v2; // r12
size_t result; // rax
const char *v4; // rbx
const char *v5; // rdx
char v6; // al
const char *v7; // rbp
char *v8; // rax
char *v9; // r14
char *v10; // r15

v1 = getenv("LADSPA_PATH");
if ( !v1 )
return fwrite("Warning: You do not have a LADSPA_PATH environment variable set.\n", 1uLL, 0x41uLL, stderr);
v2 = v1;
result = (unsigned __int8)*v1;
while ( (_BYTE)result )
{
v4 = v2;
if ( (_BYTE)result == 58 )
{
v7 = v2 + 1;
v9 = (char *)malloc(1uLL);
v10 = v9;
}
else
{
do
{
v5 = v4;
v6 = *++v4;
}
while ( v6 != 58 && v6 );
v7 = v5 + 2;
v8 = (char *)malloc(v5 + 2 - v2);
v9 = v8;
if ( v4 > v2 )
strncpy(v8, v2, v4 - v2);
v10 = &v9[v4 - v2];
v2 = v4;
}
*v10 = 0;
LADSPADirectoryPluginSearch(v9, a1);
free(v9);
result = *(unsigned __int8 *)v2;
if ( (_BYTE)result == 58 )
{
result = *(unsigned __int8 *)v7;
v2 = v7;
}
}
return result;
}

canonical_decompiled_code:
size_t __fastcall func1(void (__fastcall *a1)(char *, void *))
{
char *v1; // rax
const char *v2; // r12
size_t result; // rax
const char *v4; // rbx
const char *v5; // rdx
char v6; // al
const char *v7; // rbp
char *v8; // rax
char *v9; // r14
char *v10; // r15

v1 = getenv("LADSPA_PATH");
if ( !v1 )
return fwrite("Warning: You do not have a LADSPA_PATH environment variable set.\n", 1uLL, 0x41uLL, stderr);
v2 = v1;
result = (unsigned __int8)*v1;
while ( (_BYTE)result )
{
v4 = v2;
if ( (_BYTE)result == 58 )
{
v7 = v2 + 1;
v9 = (char *)malloc(1uLL);
v10 = v9;
}
else
{
do
{
v5 = v4;
v6 = *++v4;
}
while ( v6 != 58 && v6 );
v7 = v5 + 2;
v8 = (char *)malloc(v5 + 2 - v2);
v9 = v8;
if ( v4 > v2 )
strncpy(v8, v2, v4 - v2);
v10 = &v9[v4 - v2];
v2 = v4;
}
*v10 = 0;
func0(v9, a1);
free(v9);
result = *(unsigned __int8 *)v2;
if ( (_BYTE)result == 58 )
{
result = *(unsigned __int8 *)v7;
v2 = v7;
}
}
return result;
}

original_code:
void
LADSPAPluginSearch(LADSPAPluginSearchCallbackFunction fCallbackFunction) {
  char * pcBuffer;
  const char * pcEnd;
  const char * pcLADSPAPath;
  const char * pcStart;
  pcLADSPAPath = getenv("LADSPA_PATH");
  if (!pcLADSPAPath) {
    fprintf(stderr,
     "Warning: You do not have a LADSPA_PATH "
     "environment variable set.\n");
    return;
  }
  pcStart = pcLADSPAPath;
  while (*pcStart != '\0') {
    pcEnd = pcStart;
    while (*pcEnd != ':' && *pcEnd != '\0')
      pcEnd++;
    pcBuffer = malloc(1 + pcEnd - pcStart);
    if (pcEnd > pcStart)
      strncpy(pcBuffer, pcStart, pcEnd - pcStart);
    pcBuffer[pcEnd - pcStart] = '\0';
    LADSPADirectoryPluginSearch(pcBuffer, fCallbackFunction);
    free(pcBuffer);
    pcStart = pcEnd;
    if (*pcStart == ':')
      pcStart++;
  }
}

canonical_original_code:
void LADSPAPluginSearch(void fCallbackFunction(char *pcFullFilename, void *pvPluginHandle, struct _LADSPA_Descriptor *(*fDescriptorFunction)(unsigned long Index))) {
  char *pcBuffer;
  char *pcEnd;
  char *pcLADSPAPath;
  char *pcStart;
  pcLADSPAPath = getenv("LADSPA_PATH");
  if (!pcLADSPAPath) {
    fprintf(stderr,
     "Warning: You do not have a LADSPA_PATH "
     "environment variable set.\n");
    return;
  }
  pcStart = pcLADSPAPath;
  while (*pcStart != '\0') {
    pcEnd = pcStart;
    while (*pcEnd != ':' && *pcEnd != '\0')
      pcEnd++;
    pcBuffer = malloc(1 + pcEnd - pcStart);
    if (pcEnd > pcStart)
      strncpy(pcBuffer, pcStart, pcEnd - pcStart);
    pcBuffer[pcEnd - pcStart] = '\0';
    LADSPADirectoryPluginSearch(pcBuffer, fCallbackFunction);
    free(pcBuffer);
    pcStart = pcEnd;
    if (*pcStart == ':')
      pcStart++;
  }
}

variable_types: void (char *pcFullFilename, void *pvPluginHandle, struct _LADSPA_Descriptor { unsigned long UniqueID; char *Label; int Properties; char *Name; char *Maker; char *Copyright; unsigned long PortCount; int *PortDescriptors; char **PortNames; struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; } *PortRangeHints; void *ImplementationData; void *(*instantiate)(struct _LADSPA_Descriptor *Descriptor, unsigned long SampleRate); void (*connect_port)(void *Instance, unsigned long Port, float *DataLocation); void (*activate)(void *Instance); void (*run)(void *Instance, unsigned long SampleCount); void (*run_adding)(void *Instance, unsigned long SampleCount); void (*set_run_adding_gain)(void *Instance, float Gain); void (*deactivate)(void *Instance); void (*cleanup)(void *Instance); } *(*fDescriptorFunction)(unsigned long Index))

variable_types:
pcBuffer
char *

variable_types:
pcEnd
char *

variable_types:
pcLADSPAPath
char *

variable_types:
pcStart
char *


getLADSPADefault

decompiled_code:
__int64 __fastcall getLADSPADefault(float *a1, __int64 a2, float *a3)
{
float v4; // edx
int v5; // eax
__int64 result; // rax
float v7; // xmm0_4
float v8; // xmm1_4

v4 = *a1;
v5 = *(_DWORD *)a1 & 0x3C0;
if ( v5 == 320 )
{
v8 = a1[2];
if ( (LOBYTE(v4) & 8) == 0 )
goto LABEL_24;
goto LABEL_26;
}
if ( (*(_DWORD *)a1 & 0x3C0u) <= 0x140 )
{
if ( v5 == 192 )
{
v7 = (float)(a1[1] + a1[2]) * 0.5;
if ( (LOBYTE(v4) & 8) == 0 )
goto LABEL_20;
goto LABEL_11;
}
if ( (*(_DWORD *)a1 & 0x3C0u) > 0xC0 )
{
if ( v5 == 256 )
{
v7 = a1[2] * 0.75 + a1[1] * 0.25;
if ( (LOBYTE(v4) & 8) != 0 )
goto LABEL_11;
LABEL_20:
*a3 = v7;
return 0LL;
}
return 0xFFFFFFFFLL;
}
if ( v5 != 64 )
{
if ( v5 != 128 )
return 0xFFFFFFFFLL;
v7 = a1[2] * 0.25 + a1[1] * 0.75;
if ( (LOBYTE(v4) & 8) == 0 )
goto LABEL_20;
LABEL_11:
if ( a2 < 0 )
v8 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v8 = (float)(int)a2;
LABEL_13:
result = 0LL;
*a3 = v7 * v8;
return result;
}
v8 = a1[1];
if ( (LOBYTE(v4) & 8) == 0 )
{
LABEL_24:
*a3 = v8;
return 0LL;
}
LABEL_26:
if ( a2 < 0 )
v7 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v7 = (float)(int)a2;
goto LABEL_13;
}
if ( v5 == 640 )
{
*a3 = 100.0;
result = 0LL;
}
else
{
if ( (*(_DWORD *)a1 & 0x3C0u) > 0x280 )
{
if ( v5 == 704 )
{
*a3 = 440.0;
return 0LL;
}
return 0xFFFFFFFFLL;
}
if ( v5 != 512 )
{
if ( v5 == 576 )
{
*a3 = 1.0;
return 0LL;
}
return 0xFFFFFFFFLL;
}
*a3 = 0.0;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(float *a1, __int64 a2, float *a3)
{
float v4; // edx
int v5; // eax
__int64 result; // rax
float v7; // xmm0_4
float v8; // xmm1_4

v4 = *a1;
v5 = *(_DWORD *)a1 & 0x3C0;
if ( v5 == 320 )
{
v8 = a1[2];
if ( (LOBYTE(v4) & 8) == 0 )
goto LABEL_24;
goto LABEL_26;
}
if ( (*(_DWORD *)a1 & 0x3C0u) <= 0x140 )
{
if ( v5 == 192 )
{
v7 = (float)(a1[1] + a1[2]) * 0.5;
if ( (LOBYTE(v4) & 8) == 0 )
goto LABEL_20;
goto LABEL_11;
}
if ( (*(_DWORD *)a1 & 0x3C0u) > 0xC0 )
{
if ( v5 == 256 )
{
v7 = a1[2] * 0.75 + a1[1] * 0.25;
if ( (LOBYTE(v4) & 8) != 0 )
goto LABEL_11;
LABEL_20:
*a3 = v7;
return 0LL;
}
return 0xFFFFFFFFLL;
}
if ( v5 != 64 )
{
if ( v5 != 128 )
return 0xFFFFFFFFLL;
v7 = a1[2] * 0.25 + a1[1] * 0.75;
if ( (LOBYTE(v4) & 8) == 0 )
goto LABEL_20;
LABEL_11:
if ( a2 < 0 )
v8 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v8 = (float)(int)a2;
LABEL_13:
result = 0LL;
*a3 = v7 * v8;
return result;
}
v8 = a1[1];
if ( (LOBYTE(v4) & 8) == 0 )
{
LABEL_24:
*a3 = v8;
return 0LL;
}
LABEL_26:
if ( a2 < 0 )
v7 = (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1))
+ (float)(a2 & 1 | (unsigned int)((unsigned __int64)a2 >> 1));
else
v7 = (float)(int)a2;
goto LABEL_13;
}
if ( v5 == 640 )
{
*a3 = 100.0;
result = 0LL;
}
else
{
if ( (*(_DWORD *)a1 & 0x3C0u) > 0x280 )
{
if ( v5 == 704 )
{
*a3 = 440.0;
return 0LL;
}
return 0xFFFFFFFFLL;
}
if ( v5 != 512 )
{
if ( v5 == 576 )
{
*a3 = 1.0;
return 0LL;
}
return 0xFFFFFFFFLL;
}
*a3 = 0.0;
result = 0LL;
}
return result;
}

original_code:
int
getLADSPADefault(const LADSPA_PortRangeHint * psPortRangeHint,
   const unsigned long lSampleRate,
   LADSPA_Data * pfResult) {
  int iHintDescriptor;
  iHintDescriptor = psPortRangeHint->HintDescriptor & 0x3C0;
  switch (iHintDescriptor & 0x3C0) {
  case 0x0:
    return -1;
  case 0x40:
    *pfResult = psPortRangeHint->LowerBound;
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x80:
    if (((iHintDescriptor) & 0x10)) {
      *pfResult = exp(log(psPortRangeHint->LowerBound) * 0.75
        + log(psPortRangeHint->UpperBound) * 0.25);
    }
    else {
      *pfResult = (psPortRangeHint->LowerBound * 0.75
     + psPortRangeHint->UpperBound * 0.25);
    }
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0xC0:
    if (((iHintDescriptor) & 0x10)) {
      *pfResult = sqrt(psPortRangeHint->LowerBound
         * psPortRangeHint->UpperBound);
    }
    else {
      *pfResult = 0.5 * (psPortRangeHint->LowerBound
    + psPortRangeHint->UpperBound);
    }
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x100:
    if (((iHintDescriptor) & 0x10)) {
      *pfResult = exp(log(psPortRangeHint->LowerBound) * 0.25
        + log(psPortRangeHint->UpperBound) * 0.75);
    }
    else {
      *pfResult = (psPortRangeHint->LowerBound * 0.25
     + psPortRangeHint->UpperBound * 0.75);
    }
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x140:
    *pfResult = psPortRangeHint->UpperBound;
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x200:
    *pfResult = 0;
    return 0;
  case 0x240:
    *pfResult = 1;
    return 0;
  case 0x280:
    *pfResult = 100;
    return 0;
  case 0x2C0:
    *pfResult = 440;
    return 0;
  }
  return -1;
}

canonical_original_code:
int getLADSPADefault(struct _LADSPA_PortRangeHint *psPortRangeHint, unsigned long lSampleRate, float *pfResult) {
  int iHintDescriptor;
  iHintDescriptor = psPortRangeHint->HintDescriptor & 0x3C0;
  switch (iHintDescriptor & 0x3C0) {
  case 0x0:
    return -1;
  case 0x40:
    *pfResult = psPortRangeHint->LowerBound;
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x80:
    if (((iHintDescriptor) & 0x10)) {
      *pfResult = exp(log(psPortRangeHint->LowerBound) * 0.75
        + log(psPortRangeHint->UpperBound) * 0.25);
    }
    else {
      *pfResult = (psPortRangeHint->LowerBound * 0.75
     + psPortRangeHint->UpperBound * 0.25);
    }
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0xC0:
    if (((iHintDescriptor) & 0x10)) {
      *pfResult = sqrt(psPortRangeHint->LowerBound
         * psPortRangeHint->UpperBound);
    }
    else {
      *pfResult = 0.5 * (psPortRangeHint->LowerBound
    + psPortRangeHint->UpperBound);
    }
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x100:
    if (((iHintDescriptor) & 0x10)) {
      *pfResult = exp(log(psPortRangeHint->LowerBound) * 0.25
        + log(psPortRangeHint->UpperBound) * 0.75);
    }
    else {
      *pfResult = (psPortRangeHint->LowerBound * 0.25
     + psPortRangeHint->UpperBound * 0.75);
    }
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x140:
    *pfResult = psPortRangeHint->UpperBound;
    if (((psPortRangeHint->HintDescriptor) & 0x8))
      *pfResult *= lSampleRate;
    return 0;
  case 0x200:
    *pfResult = 0;
    return 0;
  case 0x240:
    *pfResult = 1;
    return 0;
  case 0x280:
    *pfResult = 100;
    return 0;
  case 0x2C0:
    *pfResult = 440;
    return 0;
  }
  return -1;
}

variable_types: struct _LADSPA_PortRangeHint { int HintDescriptor; float LowerBound; float UpperBound; } *

variable_types:
lSampleRate
unsigned long

variable_types:
pfResult
float *

variable_types: iHintDescriptor int