main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__m128i v3; // xmm0
int v4; // er14
int v5; // er12
const char **v6; // r15
__int64 v7; // rbx
bool v8; // cf
bool v9; // zf
int v10; // ebp
__int64 v11; // rax
__int64 v12; // rcx
const char *v13; // rdi
char v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
__int64 v19; // rax
float v20; // xmm2_4
unsigned int v21; // er15
char *v22; // rax
__int64 v23; // r12
__int64 v24; // rbx
__int64 v25; // rsi
char *v26; // rdi
__m128i v28; // xmm1
float v29; // [rsp+8h] [rbp-60h]
char v30[16]; // [rsp+10h] [rbp-58h] BYREF
char v31[72]; // [rsp+20h] [rbp-48h] BYREF

v4 = argc % 2;
if ( argc % 2 != 1 )
{
LABEL_24:
v4 = 1;
show_usage();
return v4;
}
v5 = argc - 1;
if ( argc - 1 > 1 )
{
v6 = argv;
v7 = 1LL;
v8 = 0;
v9 = 0;
v10 = -1;
v29 = *(float *)&LC15;
while ( 1 )
{
while ( 1 )
{
v12 = 9LL;
v13 = "--device";
argv = (const char **)v6[v7];
do
{
if ( !v12 )
break;
v8 = *(_BYTE *)argv < *v13;
v9 = *(_BYTE *)argv == *v13;
argv = (const char **)((char *)argv + 1);
++v13;
--v12;
}
while ( v9 );
v14 = (!v8 && !v9) - v8;
v15 = 0;
v16 = v14 == 0;
if ( v14 )
break;
v11 = (unsigned int)(v7 + 1);
v7 += 2LL;
v10 = atoi(v6[v11]);
v8 = v5 < (unsigned int)v7;
v9 = v5 == (_DWORD)v7;
if ( v5 <= (int)v7 )
goto LABEL_14;
}
v17 = "--vcore";
v18 = 8LL;
argv = (const char **)v6[v7];
do
{
if ( !v18 )
break;
v15 = *(_BYTE *)argv < *v17;
v16 = *(_BYTE *)argv == *v17;
argv = (const char **)((char *)argv + 1);
++v17;
--v18;
}
while ( v16 );
if ( (!v15 && !v16) != v15 )
goto LABEL_24;
v19 = (unsigned int)(v7 + 1);
v7 += 2LL;
*(double *)v3.m128i_i64 = atof(v6[v19]);
v20 = *(double *)v3.m128i_i64;
v29 = v20;
v8 = v5 < (unsigned int)v7;
v9 = v5 == (_DWORD)v7;
if ( v5 <= (int)v7 )
goto LABEL_14;
}
}
v10 = -1;
v29 = *(float *)&LC15;
LABEL_14:
cards = malloc(0x2200uLL);
v21 = enum_cards(8704LL, argv);
if ( v21 )
{
v22 = (char *)cards;
v23 = 272LL * v21;
v24 = 0LL;
while ( 1 )
{
while ( *(_DWORD *)&v22[v24 + 8] != v10 && v10 != -1 )
{
v24 += 272LL;
if ( v23 == v24 )
goto LABEL_23;
}
if ( (unsigned int)radeon_init((__int64 *)&v22[v24], (__int64)v30, (__int64)v31) )
break;
v25 = *(unsigned int *)((char *)cards + v24 + 8);
if ( ((_DWORD)v25 == v10 || v21 == 1) && v29 > 0.0 )
{
v28 = 0LL;
*(double *)v28.m128i_i64 = v29;
v3 = v28;
if ( v29 >= 2.0 )
{
fprintf(stderr, "Specified vddc (%.4f V) doesn't seem sane. Not setting..\n", *(double *)v28.m128i_i64);
}
else
{
printf(
"Setting vddc of device %d to %.4f V (%#02x)\n",
v25,
*(double *)v28.m128i_i64,
(unsigned __int8)(int)(float)((float)(v29 - 0.44999999) / 0.0125));
vt1165_set_voltage(v31, 2LL, (unsigned __int8)(int)(float)((float)(v29 - 0.44999999) / 0.0125));
}
}
putchar(10);
v26 = (char *)cards + v24;
v24 += 272LL;
show_info((__int64)v26, (__int64)v31, v3);
putchar(10);
radeon_release((__int64)v30);
v22 = (char *)cards;
if ( v23 == v24 )
goto LABEL_23;
}
free(cards);
}
else
{
LABEL_23:
v4 = 0;
free(cards);
}
return v4;
}

original_code:
int main(int argc, char *argv[])
{
 unsigned int num_cards;
 struct mem_ctx mem;
 struct rv8xx_i2c i2c;
 float vddc = -1;
 int device = -1;
 int i;
 if(argc % 2 != 1) {
  show_usage();
  return 1;
 }
 for(i = 1; i < (argc-1); i++) {
  if(!strcmp(argv[i], "--device")) {
   device = atoi(argv[++i]);
  } else if(!strcmp(argv[i], "--vcore")) {
   vddc = atof(argv[++i]);
  } else {
   show_usage();
   return 1;
  }
 }
 cards = malloc(sizeof(struct card) * 32);
 num_cards = enum_cards();
 for(i = 0; i < num_cards; i++) {
  if(device == cards[i].bus || device == -1) {
   if(radeon_init(&cards[i], &mem, &i2c)) {
    free(cards);
    return 1;
   }
   if(device == cards[i].bus || num_cards == 1) {
    if(vddc > 0) {
     if(vddc < 2.00f) {
      u8 value = (u8)((vddc - 0.450f) / 0.0125f);
      printf("Setting vddc of device %d to %.4f V (%#02x)\n", cards[i].bus, vddc, value);
      vt1165_set_voltage(&i2c, 2, value);
     } else {
      fprintf(stderr, "Specified vddc (%.4f V) doesn't seem sane. Not setting..\n", vddc);
     }
    }
   }
   printf("\n");
   show_info(&cards[i], &i2c);
   printf("\n");
   radeon_release(&mem);
  }
 }
 free(cards);
 return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
 unsigned int num_cards;
 struct mem_ctx mem;
 struct rv8xx_i2c i2c;
 float vddc = -1;
 int device = -1;
 int i;
 if(argc % 2 != 1) {
  show_usage();
  return 1;
 }
 for(i = 1; i < (argc-1); i++) {
  if(!strcmp(argv[i], "--device")) {
   device = atoi(argv[++i]);
  } else if(!strcmp(argv[i], "--vcore")) {
   vddc = atof(argv[++i]);
  } else {
   show_usage();
   return 1;
  }
 }
 cards = malloc(sizeof(struct card) * 32);
 num_cards = enum_cards();
 for(i = 0; i < num_cards; i++) {
  if(device == cards[i].bus || device == -1) {
   if(radeon_init(&cards[i], &mem, &i2c)) {
    free(cards);
    return 1;
   }
   if(device == cards[i].bus || num_cards == 1) {
    if(vddc > 0) {
     if(vddc < 2.00f) {
      unsigned char value = (u8)((vddc - 0.450f) / 0.0125f);
      printf("Setting vddc of device %d to %.4f V (%#02x)\n", cards[i].bus, vddc, value);
      vt1165_set_voltage(&i2c, 2, value);
     } else {
      fprintf(stderr, "Specified vddc (%.4f V) doesn't seem sane. Not setting..\n", vddc);
     }
    }
   }
   printf("\n");
   show_info(&cards[i], &i2c);
   printf("\n");
   radeon_release(&mem);
  }
 }
 free(cards);
 return 0;
}

variable_types:
mem
struct mem_ctx { int fd; void *base; }

variable_types: struct rv8xx_i2c { void *base; unsigned char address; }

variable_types: vddc float

variable_types: device int

variable_types: i int

variable_types:
value
unsigned char


repo: ius/radeonvolt

decompiled_code:
int __fastcall i2c_print_status(__int16 a1)
{
printf("i2c status: ");
switch ( a1 & 0xF )
{
case 0:
printf("idle");
if ( (a1 & 0x10) == 0 )
goto LABEL_4;
goto LABEL_10;
case 1:
printf("sending start");
break;
case 2:
printf("sending address");
break;
case 3:
printf("sending/receiving data");
break;
case 4:
printf("sending/receiving ack");
break;
case 5:
printf("sending stop");
break;
case 7:
printf("byte delay");
break;
case 8:
printf("waiting for GO");
break;
default:
printf("unknown");
break;
}
if ( (a1 & 0x10) != 0 )
{
LABEL_10:
printf(" (done)");
if ( (a1 & 0x20) == 0 )
{
LABEL_5:
if ( (a1 & 0x40) == 0 )
goto LABEL_6;
goto LABEL_12;
}
}
else
{
LABEL_4:
if ( (a1 & 0x20) == 0 )
goto LABEL_5;
}
printf(" (aborted)");
if ( (a1 & 0x40) == 0 )
{
LABEL_6:
if ( (a1 & 0x80u) == 0 )
goto LABEL_7;
LABEL_13:
printf(" (stopped on nack)");
if ( (a1 & 0x100) == 0 )
return putchar(10);
goto LABEL_14;
}
LABEL_12:
printf(" (timeout)");
if ( (a1 & 0x80u) != 0 )
goto LABEL_13;
LABEL_7:
if ( (a1 & 0x100) == 0 )
return putchar(10);
LABEL_14:
printf(" (nack)");
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func0(__int16 a1)
{
printf("i2c status: ");
switch ( a1 & 0xF )
{
case 0:
printf("idle");
if ( (a1 & 0x10) == 0 )
goto LABEL_4;
goto LABEL_10;
case 1:
printf("sending start");
break;
case 2:
printf("sending address");
break;
case 3:
printf("sending/receiving data");
break;
case 4:
printf("sending/receiving ack");
break;
case 5:
printf("sending stop");
break;
case 7:
printf("byte delay");
break;
case 8:
printf("waiting for GO");
break;
default:
printf("unknown");
break;
}
if ( (a1 & 0x10) != 0 )
{
LABEL_10:
printf(" (done)");
if ( (a1 & 0x20) == 0 )
{
LABEL_5:
if ( (a1 & 0x40) == 0 )
goto LABEL_6;
goto LABEL_12;
}
}
else
{
LABEL_4:
if ( (a1 & 0x20) == 0 )
goto LABEL_5;
}
printf(" (aborted)");
if ( (a1 & 0x40) == 0 )
{
LABEL_6:
if ( (a1 & 0x80u) == 0 )
goto LABEL_7;
LABEL_13:
printf(" (stopped on nack)");
if ( (a1 & 0x100) == 0 )
return putchar(10);
goto LABEL_14;
}
LABEL_12:
printf(" (timeout)");
if ( (a1 & 0x80u) != 0 )
goto LABEL_13;
LABEL_7:
if ( (a1 & 0x100) == 0 )
return putchar(10);
LABEL_14:
printf(" (nack)");
return putchar(10);
}

original_code:
void i2c_print_status(u32 status)
{
 printf("i2c status: ");
 switch(status & 0x0f) {
  case 0: printf("idle");
   break;
  case 1:
   printf("sending start");
   break;
  case 2:
   printf("sending address");
   break;
  case 3:
   printf("sending/receiving data");
   break;
  case 4:
   printf("sending/receiving ack");
   break;
  case 5:
   printf("sending stop");
   break;
  case 7:
   printf("byte delay");
   break;
  case 8:
   printf("waiting for GO");
   break;
  default:
   printf("unknown");
   break;
 }
 if(status & (1 << 4)) {
  printf(" (done)");
 }
 if(status & (1 << 5)) {
  printf(" (aborted)");
 }
 if(status & (1 << 6)) {
  printf(" (timeout)");
 }
 if(status & (1 << 7)) {
  printf(" (stopped on nack)");
 }
 if(status & (1 << 8)) {
  printf(" (nack)");
 }
 printf("\n");
}

canonical_original_code:
void i2c_print_status(unsigned int status)
{
 printf("i2c status: ");
 switch(status & 0x0f) {
  case 0: printf("idle");
   break;
  case 1:
   printf("sending start");
   break;
  case 2:
   printf("sending address");
   break;
  case 3:
   printf("sending/receiving data");
   break;
  case 4:
   printf("sending/receiving ack");
   break;
  case 5:
   printf("sending stop");
   break;
  case 7:
   printf("byte delay");
   break;
  case 8:
   printf("waiting for GO");
   break;
  default:
   printf("unknown");
   break;
 }
 if(status & (1 << 4)) {
  printf(" (done)");
 }
 if(status & (1 << 5)) {
  printf(" (aborted)");
 }
 if(status & (1 << 6)) {
  printf(" (timeout)");
 }
 if(status & (1 << 7)) {
  printf(" (stopped on nack)");
 }
 if(status & (1 << 8)) {
  printf(" (nack)");
 }
 printf("\n");
}

variable_types:
status
unsigned int

return_type: void


decompiled_code:
__int64 __fastcall mmio_read(__int64 a1, unsigned int a2)
{
return *(unsigned int *)(a1 + a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, unsigned int a2)
{
return *(unsigned int *)(a1 + a2);
}

original_code:
u32 mmio_read(void *base, u32 offset)
{
 u32 value;
 value = *(u32*)(base+offset);
 return value;
}

canonical_original_code:
unsigned int mmio_read(void *base, unsigned int offset)
{
 unsigned int value;
 value = *(unsigned int *)(base+offset);
 return value;
}

variable_types:
base
void *

variable_types:
offset
unsigned int

variable_types:
value
unsigned int

return_type: unsigned int


decompiled_code:
int __fastcall mmio_write(__int64 a1, unsigned int a2, int a3)
{
*(_DWORD *)(a1 + a2) = a3;
return usleep(1u);
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1, unsigned int a2, int a3)
{
*(_DWORD *)(a1 + a2) = a3;
return usleep(1u);
}

original_code:
void mmio_write(void *base, u32 offset, u32 value)
{
 *(u32*)(base+offset) = value;
 usleep(1);
}

canonical_original_code:
void mmio_write(void *base, unsigned int offset, unsigned int value)
{
 *(unsigned int *)(base+offset) = value;
 usleep(1);
}


decompiled_code:
int __fastcall i2c_show_status(__int64 a1)
{
__int16 v1; // ax

v1 = mmio_read(a1, 0x60D8u);
return i2c_print_status(v1);
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1)
{
__int16 v1; // ax

v1 = func1(a1, 0x60D8u);
return func0(v1);
}

original_code:
void i2c_show_status(void *base)
{
 i2c_print_status(mmio_read(base, 0x60d8));
}


decompiled_code:
int __fastcall i2c_do_tx(__int64 a1)
{
mmio_write(a1, 0x60D0u, 1);
return usleep(0x3E8u);
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1)
{
func2(a1, 0x60D0u, 1);
return usleep(0x3E8u);
}

original_code:
void i2c_do_tx(void *base)
{
 mmio_write(base, 0x60d0, 1);
 usleep(1000);
}


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

v1 = mmio_read(a1, 0x60D4u);
mmio_write(a1, 0x60D4u, v1 | 4);
mmio_write(a1, 0x60DCu, 35389442);
return mmio_write(a1, 0x60E0u, 671154183);
}

original_code:
void i2c_setup(void *base)
{
 u32 reg;
 reg = mmio_read(base, 0x60d4);
 mmio_write(base, 0x60d4, reg | (0x01 << 2));
 mmio_write(base, 0x60dc, ((0x021c << 16) | 0x02));
 reg = mmio_read(base, 0x60e0);
 mmio_write(base, 0x60e0, 0x28010007);
}

canonical_original_code:
void i2c_setup(void *base)
{
 unsigned int reg;
 reg = mmio_read(base, 0x60d4);
 mmio_write(base, 0x60d4, reg | (0x01 << 2));
 mmio_write(base, 0x60dc, ((0x021c << 16) | 0x02));
 reg = mmio_read(base, 0x60e0);
 mmio_write(base, 0x60e0, 0x28010007);
}

variable_types:
reg
unsigned int


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

v1 = mmio_read(a1, 0x6430u);
mmio_write(a1, 0x6430u, v1 & 0xFF000000);
return mmio_write(a1, 0x60ECu, 10281);
}

original_code:
void i2c_select_bus(void *base, unsigned int bus)
{
 u32 reg;
 reg = mmio_read(base, 0x6430);
 mmio_write(base, 0x6430, reg & 0xff000000);
 mmio_write(base, 0x60ec, (0x28 << 8) | 0x29);
}

canonical_original_code:
void i2c_select_bus(void *base, unsigned int bus)
{
 unsigned int reg;
 reg = mmio_read(base, 0x6430);
 mmio_write(base, 0x6430, reg & 0xff000000);
 mmio_write(base, 0x60ec, (0x28 << 8) | 0x29);
}

variable_types:
bus
unsigned int


decompiled_code:
int __fastcall i2c_write(__int64 a1, unsigned __int8 a2, unsigned __int8 *a3, unsigned __int8 a4)
{
int v4; // er14
int v7; // edx
__int64 v8; // r12
int v9; // edx
int result; // eax

if ( a4 <= 0xCu )
{
v4 = a4;
v7 = a4 << 16;
BYTE1(v7) = 48;
mmio_write(a1, 0x60E4u, v7);
mmio_write(a1, 0x60E8u, (a2 << 9) | 0x80000000);
if ( a4 )
{
v8 = (__int64)&a3[v4 - 1 + 1];
do
{
v9 = *a3++;
mmio_write(a1, 0x60E8u, v9 << 8);
}
while ( a3 != (unsigned __int8 *)v8 );
}
result = i2c_do_tx(a1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1, unsigned __int8 a2, unsigned __int8 *a3, unsigned __int8 a4)
{
int v4; // er14
int v7; // edx
__int64 v8; // r12
int v9; // edx
int result; // eax

if ( a4 <= 0xCu )
{
v4 = a4;
v7 = a4 << 16;
BYTE1(v7) = 48;
func2(a1, 0x60E4u, v7);
func2(a1, 0x60E8u, (a2 << 9) | 0x80000000);
if ( a4 )
{
v8 = (__int64)&a3[v4 - 1 + 1];
do
{
v9 = *a3++;
func2(a1, 0x60E8u, v9 << 8);
}
while ( a3 != (unsigned __int8 *)v8 );
}
result = func4(a1);
}
return result;
}

original_code:
void i2c_write(void *base, u8 address, u8 *data, u8 length)
{
 int i;
 if(length > 12)
  return;
 mmio_write(base, 0x60e4, (length << 16) | (1 << 12) | (1 << 13));
 mmio_write(base, 0x60e8, (1 << 31) | ((address << 1) << 8));
 for(i = 0; i < length; i++) {
  mmio_write(base, 0x60e8, (data[i] << 8));
 }
 i2c_do_tx(base);
}

canonical_original_code:
void i2c_write(void *base, unsigned char address, unsigned char *data, unsigned char length)
{
 int i;
 if(length > 12)
  return;
 mmio_write(base, 0x60e4, (length << 16) | (1 << 12) | (1 << 13));
 mmio_write(base, 0x60e8, (1 << 31) | ((address << 1) << 8));
 for(i = 0; i < length; i++) {
  mmio_write(base, 0x60e8, (data[i] << 8));
 }
 i2c_do_tx(base);
}

variable_types:
address
unsigned char

variable_types:
data
unsigned char *

variable_types:
length
unsigned char


decompiled_code:
int __fastcall i2c_write_byte(__int64 a1, unsigned __int8 a2, unsigned __int8 a3, unsigned __int8 a4)
{
unsigned __int8 v5[10]; // [rsp+Eh] [rbp-Ah] BYREF

v5[0] = a3;
v5[1] = a4;
return i2c_write(a1, a2, v5, 2u);
}

canonical_decompiled_code:
int __fastcall func8(__int64 a1, unsigned __int8 a2, unsigned __int8 a3, unsigned __int8 a4)
{
unsigned __int8 v5[10]; // [rsp+Eh] [rbp-Ah] BYREF

v5[0] = a3;
v5[1] = a4;
return func7(a1, a2, v5, 2u);
}

original_code:
void i2c_write_byte(void *base, u8 address, u8 offset, u8 value)
{
 u8 buf[2];
 buf[0] = offset;
 buf[1] = value;
 i2c_write(base, address, buf, sizeof(buf));
}

canonical_original_code:
void i2c_write_byte(void *base, unsigned char address, unsigned char offset, unsigned char value)
{
 unsigned char buf[2];
 buf[0] = offset;
 buf[1] = value;
 i2c_write(base, address, buf, sizeof(buf));
}

variable_types:
offset
unsigned char

variable_types:
buf
unsigned char [2]


decompiled_code:
__int64 __fastcall i2c_read_byte(__int64 a1, unsigned __int8 a2, unsigned __int8 a3)
{
int v4; // ebx

v4 = a2 << 9;
mmio_write(a1, 0x60E4u, 69632);
mmio_write(a1, 0x60E8u, v4 | 0x80000000);
mmio_write(a1, 0x60E8u, a3 << 8);
i2c_do_tx(a1);
mmio_write(a1, 0x60E4u, 77825);
mmio_write(a1, 0x60E8u, v4 | 0x80000100);
i2c_do_tx(a1);
mmio_write(a1, 0x60E8u, -2147418111);
return (unsigned int)mmio_read(a1, 0x60E8u) >> 8;
}

canonical_original_code:
unsigned char i2c_read_byte(void *base, unsigned char address, unsigned char offset)
{
 unsigned int reg;
 mmio_write(base, 0x60e4, (1 << 16) | (1 << 12));
 mmio_write(base, 0x60e8, (1 << 31) | ((address << 1) << 8));
 mmio_write(base, 0x60e8, (offset << 8));
 i2c_do_tx(base);
 mmio_write(base, 0x60e4, (1 << 16) | (1 << 12) | (1 << 13) | 1);
 mmio_write(base, 0x60e8, (1 << 31) | (((address << 1) | 0x01 ) << 8));
 i2c_do_tx(base);
 mmio_write(base, 0x60e8, (1 << 31) | (0x01 << 16) | 1);
 reg = mmio_read(base, 0x60e8);
 return (reg >> 8);
}

return_type: unsigned char


decompiled_code:
__int64 __fastcall vt1165_device_id(__int64 a1)
{
return i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), 26LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
return i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), 26LL);
}

original_code:
u8 vt1165_device_id(struct rv8xx_i2c *i2c)
{
 return i2c_read_byte(i2c->base, i2c->address, 0x1a);
}

canonical_original_code:
unsigned char vt1165_device_id(struct rv8xx_i2c *i2c)
{
 return i2c_read_byte(i2c->base, i2c->address, 0x1a);
}

variable_types: struct rv8xx_i2c { void *base; unsigned char address; } *


decompiled_code:
__int64 __fastcall vt1165_radc(_QWORD *a1, int a2)
{
unsigned int v2; // ebp
__int64 result; // rax
unsigned int v4; // ebp
unsigned int v5; // ebp
unsigned int v6; // ebp

switch ( a2 )
{
case 0:
result = i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 2LL) & 0x1F;
break;
case 1:
v4 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 2LL);
result = ((unsigned __int8)(v4 >> 5) | (unsigned __int8)(8 * i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 3LL))) & 0x1F;
break;
case 2:
result = ((unsigned int)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 3LL) >> 2) & 0x1F;
break;
case 3:
v5 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 3LL);
result = ((unsigned __int8)(v5 >> 7) | (unsigned __int8)(2 * i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 4LL))) & 0x1F;
break;
case 4:
v6 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 4LL);
result = ((unsigned __int8)(v6 >> 4) | (unsigned __int8)(16 * i2c_read_byte(
*a1,
*((unsigned __int8 *)a1 + 8),
5LL))) & 0x1F;
break;
case 5:
result = ((unsigned int)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 5LL) >> 1) & 0x1F;
break;
case 6:
v2 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 5LL);
result = ((unsigned __int8)(v2 >> 6) | (unsigned __int8)(4 * i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 6LL))) & 0x1F;
break;
case 7:
result = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 6LL) >> 3;
break;
default:
JUMPOUT(0x387LL);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_QWORD *a1, int a2)
{
unsigned int v2; // ebp
__int64 result; // rax
unsigned int v4; // ebp
unsigned int v5; // ebp
unsigned int v6; // ebp

switch ( a2 )
{
case 0:
result = i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 2LL) & 0x1F;
break;
case 1:
v4 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 2LL);
result = ((unsigned __int8)(v4 >> 5) | (unsigned __int8)(8 * i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 3LL))) & 0x1F;
break;
case 2:
result = ((unsigned int)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 3LL) >> 2) & 0x1F;
break;
case 3:
v5 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 3LL);
result = ((unsigned __int8)(v5 >> 7) | (unsigned __int8)(2 * i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 4LL))) & 0x1F;
break;
case 4:
v6 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 4LL);
result = ((unsigned __int8)(v6 >> 4) | (unsigned __int8)(16 * i2c_read_byte(
*a1,
*((unsigned __int8 *)a1 + 8),
5LL))) & 0x1F;
break;
case 5:
result = ((unsigned int)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 5LL) >> 1) & 0x1F;
break;
case 6:
v2 = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 5LL);
result = ((unsigned __int8)(v2 >> 6) | (unsigned __int8)(4 * i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 6LL))) & 0x1F;
break;
case 7:
result = (unsigned __int8)i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 6LL) >> 3;
break;
default:
JUMPOUT(0x387LL);
}
return result;
}

original_code:
u8 vt1165_radc(struct rv8xx_i2c *i2c, unsigned int index)
{
 unsigned int reg, value = 0;
 switch(index) {
  case 0:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x02);
   value = reg & 0x1f;
   break;
  case 1:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x02);
   value = (reg >> 5);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x03);
   value = ((reg << 3) | value) & 0x1f;
   break;
  case 2:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x03);
   value = (reg >> 2) & 0x1f;
   break;
  case 3:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x03);
   value = (reg >> 7);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x04);
   value = ((reg << 1) | value) & 0x1f;
   break;
  case 4:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x04);
   value = (reg >> 4);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x05);
   value = ((reg << 4) | value) & 0x1f;
   break;
  case 5:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x05);
   value = (reg >> 1) & 0x1f;
   break;
  case 6:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x05);
   value = (reg >> 6);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x06);
   value = ((reg << 2) | value) & 0x1f;
   break;
  case 7:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x06);
   value = (reg >> 3) & 0x1f;
   break;
 }
 return value;
}

canonical_original_code:
unsigned char vt1165_radc(struct rv8xx_i2c *i2c, unsigned int index)
{
 unsigned int reg; unsigned int value = 0;
 switch(index) {
  case 0:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x02);
   value = reg & 0x1f;
   break;
  case 1:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x02);
   value = (reg >> 5);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x03);
   value = ((reg << 3) | value) & 0x1f;
   break;
  case 2:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x03);
   value = (reg >> 2) & 0x1f;
   break;
  case 3:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x03);
   value = (reg >> 7);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x04);
   value = ((reg << 1) | value) & 0x1f;
   break;
  case 4:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x04);
   value = (reg >> 4);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x05);
   value = ((reg << 4) | value) & 0x1f;
   break;
  case 5:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x05);
   value = (reg >> 1) & 0x1f;
   break;
  case 6:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x05);
   value = (reg >> 6);
   reg = i2c_read_byte(i2c->base, i2c->address, 0x06);
   value = ((reg << 2) | value) & 0x1f;
   break;
  case 7:
   reg = i2c_read_byte(i2c->base, i2c->address, 0x06);
   value = (reg >> 3) & 0x1f;
   break;
 }
 return value;
}

variable_types:
index
unsigned int

user_defined_types: struct rv8xx_i2c { void *base; unsigned char address; }


decompiled_code:
char __fastcall vt1165_vid_mode(_QWORD *a1)
{
return (unsigned __int8)vt1165_radc(a1, 3) >> 2;
}

canonical_decompiled_code:
char __fastcall func2(_QWORD *a1)
{
return (unsigned __int8)func1(a1, 3) >> 2;
}

original_code:
u8 vt1165_vid_mode(struct rv8xx_i2c *i2c)
{
 u8 data = vt1165_radc(i2c, 3);
 return (data >> 2);
}

canonical_original_code:
unsigned char vt1165_vid_mode(struct rv8xx_i2c *i2c)
{
 unsigned char data = vt1165_radc(i2c, 3);
 return (data >> 2);
}

variable_types:
data
unsigned char


decompiled_code:
__int64 __fastcall vt1165_active_slaves(__int64 a1)
{
return i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), 14LL);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1)
{
return i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), 14LL);
}

original_code:
u8 vt1165_active_slaves(struct rv8xx_i2c *i2c)
{
 return i2c_read_byte(i2c->base, i2c->address, 0x0e);
}

canonical_original_code:
unsigned char vt1165_active_slaves(struct rv8xx_i2c *i2c)
{
 return i2c_read_byte(i2c->base, i2c->address, 0x0e);
}


decompiled_code:
__int64 __fastcall vt1165_temp(_QWORD *a1, char a2)
{
i2c_write_byte(*a1, *((unsigned __int8 *)a1 + 8), 8LL, 0LL);
i2c_write_byte(*a1, *((unsigned __int8 *)a1 + 8), 7LL, 167LL);
i2c_write_byte(*a1, *((unsigned __int8 *)a1 + 8), 8LL, (unsigned __int8)(a2 + 1) | 0x80u);
return i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 10LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(_QWORD *a1, char a2)
{
i2c_write_byte(*a1, *((unsigned __int8 *)a1 + 8), 8LL, 0LL);
i2c_write_byte(*a1, *((unsigned __int8 *)a1 + 8), 7LL, 167LL);
i2c_write_byte(*a1, *((unsigned __int8 *)a1 + 8), 8LL, (unsigned __int8)(a2 + 1) | 0x80u);
return i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 10LL);
}

original_code:
u8 vt1165_temp(struct rv8xx_i2c *i2c, u8 slave)
{
 i2c_write_byte(i2c->base, i2c->address, 0x08, 0x00);
 i2c_write_byte(i2c->base, i2c->address, 0x07, 0xA7);
 i2c_write_byte(i2c->base, i2c->address, 0x08, (0x80 | (slave + 1)));
 return i2c_read_byte(i2c->base, i2c->address, 0x0a);
}

canonical_original_code:
unsigned char vt1165_temp(struct rv8xx_i2c *i2c, unsigned char slave)
{
 i2c_write_byte(i2c->base, i2c->address, 0x08, 0x00);
 i2c_write_byte(i2c->base, i2c->address, 0x07, 0xA7);
 i2c_write_byte(i2c->base, i2c->address, 0x08, (0x80 | (slave + 1)));
 return i2c_read_byte(i2c->base, i2c->address, 0x0a);
}

variable_types:
slave
unsigned char


decompiled_code:
__int64 __fastcall vt1165_max_current(_QWORD *a1)
{
int v1; // ebx

v1 = (unsigned __int8)MAX_SLAVE_CURRENT[((unsigned __int8)vt1165_radc(a1, 4) >> 2) & 7];
return v1 * (unsigned int)(unsigned __int8)vt1165_active_slaves((__int64)a1);
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1)
{
int v1; // ebx

v1 = (unsigned __int8)MAX_SLAVE_CURRENT[((unsigned __int8)func1(a1, 4) >> 2) & 7];
return v1 * (unsigned int)(unsigned __int8)func3((__int64)a1);
}

original_code:
unsigned int vt1165_max_current(struct rv8xx_i2c *i2c)
{
 u8 data;
 data = vt1165_radc(i2c, 4);
 return MAX_SLAVE_CURRENT[(data >> 2) & 0x07] * vt1165_active_slaves(i2c);
}

canonical_original_code:
unsigned int vt1165_max_current(struct rv8xx_i2c *i2c)
{
 unsigned char data;
 data = vt1165_radc(i2c, 4);
 return MAX_SLAVE_CURRENT[(data >> 2) & 0x07] * vt1165_active_slaves(i2c);
}


decompiled_code:
float __fastcall vt1165_avg_current(_QWORD *a1)
{
char v1; // bl

v1 = i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 30LL);
return (double)(v1 & 0x7F) / 124.0 * (double)(int)vt1165_max_current(a1);
}

canonical_decompiled_code:
float __fastcall func6(_QWORD *a1)
{
char v1; // bl

v1 = i2c_read_byte(*a1, *((unsigned __int8 *)a1 + 8), 30LL);
return (double)(v1 & 0x7F) / 124.0 * (double)(int)func5(a1);
}

original_code:
float vt1165_avg_current(struct rv8xx_i2c *i2c)
{
 u8 data;
 data = i2c_read_byte(i2c->base, i2c->address, 0x1e);
 return ((data & 0x7f) / 124.0) * vt1165_max_current(i2c);
}

canonical_original_code:
float vt1165_avg_current(struct rv8xx_i2c *i2c)
{
 unsigned char data;
 data = i2c_read_byte(i2c->base, i2c->address, 0x1e);
 return ((data & 0x7f) / 124.0) * vt1165_max_current(i2c);
}

return_type: float


decompiled_code:
__int64 __fastcall vt1165_current_preset(__int64 a1)
{
return ((unsigned __int8)i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), 28LL) >> 4) & 3;
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
return ((unsigned __int8)i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), 28LL) >> 4) & 3;
}

original_code:
u8 vt1165_current_preset(struct rv8xx_i2c *i2c)
{
 u8 data;
 data = i2c_read_byte(i2c->base, i2c->address, 0x1c);
 data = ((data >> 4) & 0x03);
 return data;
}

canonical_original_code:
unsigned char vt1165_current_preset(struct rv8xx_i2c *i2c)
{
 unsigned char data;
 data = i2c_read_byte(i2c->base, i2c->address, 0x1c);
 data = ((data >> 4) & 0x03);
 return data;
}


decompiled_code:
float __fastcall vt1165_get_voltage(__int64 a1, char a2)
{
return (float)((float)(i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), (unsigned __int8)(a2 + 21)) & 0x7F)
* 0.0125)
+ 0.44999999;
}

canonical_decompiled_code:
float __fastcall func8(__int64 a1, char a2)
{
return (float)((float)(i2c_read_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), (unsigned __int8)(a2 + 21)) & 0x7F)
* 0.0125)
+ 0.44999999;
}

original_code:
float vt1165_get_voltage(struct rv8xx_i2c *i2c, u8 index)
{
 u8 data;
 data = i2c_read_byte(i2c->base, i2c->address, 0x15 + index);
 return (0.450f + 0.0125f * (data & 0x7f));
}

canonical_original_code:
float vt1165_get_voltage(struct rv8xx_i2c *i2c, unsigned char index)
{
 unsigned char data;
 data = i2c_read_byte(i2c->base, i2c->address, 0x15 + index);
 return (0.450f + 0.0125f * (data & 0x7f));
}

variable_types:
index
unsigned char


decompiled_code:
__int64 __fastcall vt1165_set_voltage(__int64 a1, char a2, unsigned __int8 a3)
{
return i2c_write_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), (a2 & 3u) + 21, a3);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, char a2, unsigned __int8 a3)
{
return i2c_write_byte(*(_QWORD *)a1, *(unsigned __int8 *)(a1 + 8), (a2 & 3u) + 21, a3);
}

original_code:
void vt1165_set_voltage(struct rv8xx_i2c *i2c, u8 index, u8 value)
{
 i2c_write_byte(i2c->base, i2c->address, 0x15 + (index & 0x03), value);
}

canonical_original_code:
void vt1165_set_voltage(struct rv8xx_i2c *i2c, unsigned char index, unsigned char value)
{
 i2c_write_byte(i2c->base, i2c->address, 0x15 + (index & 0x03), value);
}

variable_types:
value
unsigned char


decompiled_code:
int __fastcall log_error(const char *a1)
{
char v2[1016]; // [rsp+0h] [rbp-3F8h] BYREF

sprintf(v2, "[%s error] %s\n", my_path, a1);
v2[999] = 0;
return write_to_file("/root/mazeerrs", "a", v2);
}

canonical_decompiled_code:
int __fastcall func9(const char *a1)
{
char v2[1016]; // [rsp+0h] [rbp-3F8h] BYREF

sprintf(v2, "[%s error] %s\n", my_path, a1);
v2[999] = 0;
return func8("/root/mazeerrs", "a", v2);
}

original_code:
void log_error(char msg[]){
    char err[1000];
    sprintf(err,"[%s error] %s\n",my_path,msg);
    err[sizeof(err)-1]='\0';
    write_to_file("/root/mazeerrs","a",err);
}

variable_types:
msg
char []

variable_types:
err
char [1000]


decompiled_code:
__int64 __fastcall char_to_bitstring(int a1, const char *a2)
{
__int64 result; // rax

LODWORD(result) = 128;
*a2 = 0;
j = 128;
do
{
*(_WORD *)&a2[strlen(a2)] = (((unsigned int)result & a1) == (_DWORD)result) + 48;
result = (unsigned int)(j >> 1);
j = result;
}
while ( (int)result > 0 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, const char *a2)
{
__int64 result; // rax

LODWORD(result) = 128;
*a2 = 0;
j = 128;
do
{
*(_WORD *)&a2[strlen(a2)] = (((unsigned int)result & a1) == (_DWORD)result) + 48;
result = (unsigned int)(j >> 1);
j = result;
}
while ( (int)result > 0 );
return result;
}

variable_types: x int

variable_types:
b
char *


decompiled_code:
__int64 generate_magic_char()
{
unsigned int v0; // eax
int v1; // ebx
int v2; // eax
int v3; // edi
int v4; // eax
__int64 result; // rax

v0 = time(0LL);
srand(v0);
v1 = rand();
v2 = v1 / (atoi(my_position) + 1) % 126;
v3 = v2;
if ( v2 <= 32 )
{
v4 = v2 + 93;
v3 += 186;
if ( v4 >= 33 )
v3 = v4;
}
result = char_to_bitstring(v3, my_rand_char);
byte_404CD8 = 0;
return result;
}

canonical_decompiled_code:
__int64 func11()
{
unsigned int v0; // eax
int v1; // ebx
int v2; // eax
int v3; // edi
int v4; // eax
__int64 result; // rax

v0 = time(0LL);
srand(v0);
v1 = rand();
v2 = v1 / (atoi(my_position) + 1) % 126;
v3 = v2;
if ( v2 <= 32 )
{
v4 = v2 + 93;
v3 += 186;
if ( v4 >= 33 )
v3 = v4;
}
result = func10(v3, my_rand_char);
byte_404CD8 = 0;
return result;
}

original_code:
void generate_magic_char(){
    srand(time(((void *)0)));
    int pos=(rand()/(atoi(my_position)+1))%126;
    while(pos<33){
        pos+=126 -33;
    }
    char_to_bitstring(pos,my_rand_char);
    my_rand_char[8]='\0';
}

canonical_original_code:
void generate_magic_char(){
    srand(time(((void *)0)));
    int pos = (rand()/(atoi(my_position)+1))%126;
    while(pos<33){
        pos+=126 -33;
    }
    char_to_bitstring(pos,my_rand_char);
    my_rand_char[8]='\0';
}

variable_types: pos int


decompiled_code:
ssize_t __fastcall send_back(char *src)
{
__int16 v1; // ax
int v2; // edx
int v3; // eax
int v4; // ebp
ssize_t result; // rax
struct sockaddr v6; // [rsp+0h] [rbp-48h] BYREF
char dest[16]; // [rsp+10h] [rbp-38h] BYREF
int v8; // [rsp+20h] [rbp-28h]

v6.sa_family = 2;
*(_DWORD *)&v6.sa_data[2] = inet_addr("127.0.0.1");
v1 = atoi(srv_port);
*(_WORD *)v6.sa_data = _bswap_16(v1);
v3 = socket(2, 1, v2);
if ( v3 < 0 )
{
log_error("socket");
exit(1);
}
v4 = v3;
if ( connect(v3, &v6, 0x10u) < 0 )
{
log_error("connect");
exit(1);
}
v8 = 0;
*(_OWORD *)dest = 0LL;
strcpy(dest, src);
result = write(v4, dest, 0x14uLL);
if ( result != 20 )
{
log_error("kid send msg");
exit(1);
}
return result;
}

canonical_decompiled_code:
ssize_t __fastcall func12(char *src)
{
__int16 v1; // ax
int v2; // edx
int v3; // eax
int v4; // ebp
ssize_t result; // rax
struct sockaddr v6; // [rsp+0h] [rbp-48h] BYREF
char dest[16]; // [rsp+10h] [rbp-38h] BYREF
int v8; // [rsp+20h] [rbp-28h]

v6.sa_family = 2;
*(_DWORD *)&v6.sa_data[2] = inet_addr("127.0.0.1");
v1 = atoi(srv_port);
*(_WORD *)v6.sa_data = func7(v1);
v3 = socket(2, 1, v2);
if ( v3 < 0 )
{
func9("socket");
exit(1);
}
v4 = v3;
if ( connect(v3, &v6, 0x10u) < 0 )
{
func9("connect");
exit(1);
}
v8 = 0;
*(_OWORD *)dest = 0LL;
strcpy(dest, src);
result = write(v4, dest, 0x14uLL);
if ( result != 20 )
{
func9("kid send msg");
exit(1);
}
return result;
}

original_code:
void send_back(char *msg){
    char fixed_msg[20];
 int sd;
 struct sockaddr_in srv;
    bzero(&srv,sizeof(&srv));
    srv.sin_family=2;
    srv.sin_addr.s_addr=inet_addr("127.0.0.1");
    srv.sin_port=htons(atoi(srv_port));
    if((sd=socket(2,SOCK_STREAM,0))<0){
        log_error("socket");
        exit(1);
    }
    if(connect(sd,(struct sockaddr*)&srv,sizeof(struct sockaddr))<0){
        log_error("connect");
        exit(1);
    }
    bzero(fixed_msg,20);
    strcpy(fixed_msg,msg);
    if(write(sd,&fixed_msg,20)!=20){
        log_error("kid send msg");
        exit(1);
    }
}

canonical_original_code:
void send_back(char *msg){
    char fixed_msg[20];
 int sd;
 struct sockaddr_in srv;
    bzero(&srv,sizeof(&srv));
    srv.sin_family=2;
    srv.sin_addr.s_addr=inet_addr("127.0.0.1");
    srv.sin_port=htons(atoi(srv_port));
    if((sd=socket(2,SOCK_STREAM,0))<0){
        log_error("socket");
        exit(1);
    }
    if(connect(sd,(struct sockaddr *)&srv,sizeof(struct sockaddr))<0){
        log_error("connect");
        exit(1);
    }
    bzero(fixed_msg,20);
    strcpy(fixed_msg,msg);
    if(write(sd,&fixed_msg,20)!=20){
        log_error("kid send msg");
        exit(1);
    }
}

variable_types:
msg
char *

variable_types: sd int

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


decompiled_code:
_BOOL8 __fastcall validate_directory(char *a1)
{
int v1; // er8
_BOOL8 result; // rax
struct stat v3; // [rsp+0h] [rbp-98h] BYREF

v1 = stat(a1, &v3);
result = 1LL;
if ( v1 >= 0 )
result = (v3.st_mode & 0xF000) != 0x4000;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func13(char *a1)
{
int v1; // er8
_BOOL8 result; // rax
struct stat v3; // [rsp+0h] [rbp-98h] BYREF

v1 = func17(a1, &v3);
result = 1LL;
if ( v1 >= 0 )
result = (v3.st_mode & 0xF000) != 0x4000;
return result;
}

original_code:
int validate_directory(char *path){
    struct stat s;
    if(stat(path, &s)<0){
        return 1;
    }
    if(!((((s.st_mode)) & 0170000) == (0040000))){
        return 1;
    }
    return 0;
}

variable_types:
path
char *

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }

return_type: int

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }


decompiled_code:
__int64 __fastcall validate_args(__int64 a1)
{
unsigned int v1; // er12
unsigned int v2; // eax
char *endptr[4]; // [rsp+8h] [rbp-20h] BYREF

v1 = 0;
strtol(*(const char **)(a1 + 8), endptr, 10);
if ( *endptr[0] )
{
v1 = 1;
log_error("invalid arg 1 srv port");
if ( !validate_directory(*(char **)(a1 + 16)) )
goto LABEL_3;
LABEL_8:
v1 = 1;
log_error("invalid arg 2 mypath");
goto LABEL_3;
}
if ( validate_directory(*(char **)(a1 + 16)) )
goto LABEL_8;
LABEL_3:
v2 = strtol(*(const char **)(a1 + 24), endptr, 10);
if ( *endptr[0] || v2 > 6 )
{
v1 = 1;
log_error("invalid arg 3 myposition");
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
unsigned int v1; // er12
unsigned int v2; // eax
char *endptr[4]; // [rsp+8h] [rbp-20h] BYREF

v1 = 0;
strtol(*(const char **)(a1 + 8), endptr, 10);
if ( *endptr[0] )
{
v1 = 1;
func9("invalid arg 1 srv port");
if ( !func13(*(char **)(a1 + 16)) )
goto LABEL_3;
LABEL_8:
v1 = 1;
func9("invalid arg 2 mypath");
goto LABEL_3;
}
if ( func13(*(char **)(a1 + 16)) )
goto LABEL_8;
LABEL_3:
v2 = strtol(*(const char **)(a1 + 24), endptr, 10);
if ( *endptr[0] || v2 > 6 )
{
v1 = 1;
func9("invalid arg 3 myposition");
}
return v1;
}

original_code:
int validate_args(char* argv[]){
    int ret=0;
    char* endptr;
    strtol(argv[1],&endptr,10);
    if(strlen(endptr)!=0){
        log_error("invalid arg 1 srv port");
        ret=1;
    }
    if(validate_directory(argv[2])){
        log_error("invalid arg 2 mypath");
        ret=1;
    }
    int n=strtol(argv[3],&endptr,10);
    if(strlen(endptr)!=0 || n<0 || n>6){
        log_error("invalid arg 3 myposition");
        ret=1;
    }
    return ret;
}

canonical_original_code:
int validate_args(char *argv[]){
    int ret = 0;
    char *endptr;
    strtol(argv[1],&endptr,10);
    if(strlen(endptr)!=0){
        log_error("invalid arg 1 srv port");
        ret=1;
    }
    if(validate_directory(argv[2])){
        log_error("invalid arg 2 mypath");
        ret=1;
    }
    int n = strtol(argv[3],&endptr,10);
    if(strlen(endptr)!=0 || n<0 || n>6){
        log_error("invalid arg 3 myposition");
        ret=1;
    }
    return ret;
}

variable_types:
argv
char *[]

variable_types: ret int

variable_types:
endptr
char *

variable_types: n int


repo: ivanjimenez/ipaap

decompiled_code:
__int64 __fastcall cblas_drotm(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-14h] BYREF
int v7; // [rsp+8h] [rbp-10h] BYREF
int v8[3]; // [rsp+Ch] [rbp-Ch] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
return drotm_(v8, a2, &v7, a4, &v6);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-14h] BYREF
int v7; // [rsp+8h] [rbp-10h] BYREF
int v8[3]; // [rsp+Ch] [rbp-Ch] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
return drotm_(v8, a2, &v7, a4, &v6);
}

original_code:
void cblas_drotm( const int N, double *X, const int incX, double *Y,
                       const int incY, const double *P)
{
   drotm_( &N, X, &incX, Y, &incY, P);
}

canonical_original_code:
void cblas_drotm(int N, double *X, int incX, double *Y, int incY, double *P)
{
   drotm_( &N, X, &incX, Y, &incY, P);
}

variable_types: N int

variable_types:
X
double *

variable_types: incX int

variable_types:
Y
double *

variable_types: incY int

variable_types:
P
double *


decompiled_code:
__int64 __fastcall cblas_zsyr2k(unsigned int a1, unsigned int a2, unsigned int a3, int a4, int a5, __int64 a6, __int64 a7, char a8, __int64 a9, char a10, __int64 a11, __int64 a12, char a13)
{
__int64 result; // rax
int v14; // [rsp+8h] [rbp-20h] BYREF
int v15[4]; // [rsp+Ch] [rbp-1Ch] BYREF
char v16; // [rsp+1Eh] [rbp-Ah] BYREF
char v17[9]; // [rsp+1Fh] [rbp-9h] BYREF

RowMajorStrg = 0;
v14 = a5;
v15[0] = a4;
CBLAS_CallFromC = 1;
if ( a1 == 102 )
{
if ( a2 == 121 )
{
v16 = 85;
}
else
{
if ( a2 != 122 )
{
result = cblas_xerbla(2LL, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", a2);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
v16 = 76;
}
if ( a3 == 112 )
goto LABEL_8;
if ( a3 == 113 )
{
v17[0] = 67;
goto LABEL_18;
}
if ( a3 != 111 )
goto LABEL_24;
goto LABEL_17;
}
if ( a1 != 101 )
{
result = cblas_xerbla(1LL, "cblas_zsyr2k", "Illegal Order setting, %d\n", a1);
LABEL_10:
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
RowMajorStrg = 1;
if ( a2 == 121 )
{
v16 = 76;
LABEL_6:
if ( a3 - 112 > 1 )
{
if ( a3 == 111 )
{
LABEL_8:
v17[0] = 84;
LABEL_18:
result = zsyr2k_(&v16, v17, v15, &v14, a6, a7, &a8, a9, &a10, a11, a12, &a13);
goto LABEL_10;
}
LABEL_24:
result = cblas_xerbla(3LL, "cblas_zsyr2k", "Illegal Trans setting, %d\n", a3);
goto LABEL_21;
}
LABEL_17:
v17[0] = 78;
goto LABEL_18;
}
if ( a2 == 122 )
{
v16 = 85;
goto LABEL_6;
}
result = cblas_xerbla(3LL, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", a2);
LABEL_21:
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, unsigned int a2, unsigned int a3, int a4, int a5, __int64 a6, __int64 a7, char a8, __int64 a9, char a10, __int64 a11, __int64 a12, char a13)
{
__int64 result; // rax
int v14; // [rsp+8h] [rbp-20h] BYREF
int v15[4]; // [rsp+Ch] [rbp-1Ch] BYREF
char v16; // [rsp+1Eh] [rbp-Ah] BYREF
char v17[9]; // [rsp+1Fh] [rbp-9h] BYREF

RowMajorStrg = 0;
v14 = a5;
v15[0] = a4;
CBLAS_CallFromC = 1;
if ( a1 == 102 )
{
if ( a2 == 121 )
{
v16 = 85;
}
else
{
if ( a2 != 122 )
{
result = cblas_xerbla(2LL, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", a2);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
v16 = 76;
}
if ( a3 == 112 )
goto LABEL_8;
if ( a3 == 113 )
{
v17[0] = 67;
goto LABEL_18;
}
if ( a3 != 111 )
goto LABEL_24;
goto LABEL_17;
}
if ( a1 != 101 )
{
result = cblas_xerbla(1LL, "cblas_zsyr2k", "Illegal Order setting, %d\n", a1);
LABEL_10:
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
RowMajorStrg = 1;
if ( a2 == 121 )
{
v16 = 76;
LABEL_6:
if ( a3 - 112 > 1 )
{
if ( a3 == 111 )
{
LABEL_8:
v17[0] = 84;
LABEL_18:
result = zsyr2k_(&v16, v17, v15, &v14, a6, a7, &a8, a9, &a10, a11, a12, &a13);
goto LABEL_10;
}
LABEL_24:
result = cblas_xerbla(3LL, "cblas_zsyr2k", "Illegal Trans setting, %d\n", a3);
goto LABEL_21;
}
LABEL_17:
v17[0] = 78;
goto LABEL_18;
}
if ( a2 == 122 )
{
v16 = 85;
goto LABEL_6;
}
result = cblas_xerbla(3LL, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", a2);
LABEL_21:
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}

original_code:
void cblas_zsyr2k(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo,
                  const enum CBLAS_TRANSPOSE Trans, const int N, const int K,
                  const void *alpha, const void *A, const int lda,
                  const void *B, const int ldb, const void *beta,
                  void *C, const int ldc)
{
   char UL, TR;
   extern int CBLAS_CallFromC;
   extern int RowMajorStrg;
   RowMajorStrg = 0;
   CBLAS_CallFromC = 1;
   if( Order == CblasColMajor )
   {
      if( Uplo == CblasUpper) UL='U';
      else if ( Uplo == CblasLower ) UL='L';
      else
      {
         cblas_xerbla(2, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if( Trans == CblasTrans) TR ='T';
      else if ( Trans == CblasConjTrans ) TR='C';
      else if ( Trans == CblasNoTrans ) TR='N';
      else
      {
         cblas_xerbla(3, "cblas_zsyr2k", "Illegal Trans setting, %d\n", Trans);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      zsyr2k_(&UL, &TR, &N, &K, alpha, A, &lda,
                      B, &ldb, beta, C, &ldc);
   } else if (Order == CblasRowMajor)
   {
      RowMajorStrg = 1;
      if( Uplo == CblasUpper) UL='L';
      else if ( Uplo == CblasLower ) UL='U';
      else
      {
         cblas_xerbla(3, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if( Trans == CblasTrans) TR ='N';
      else if ( Trans == CblasConjTrans ) TR='N';
      else if ( Trans == CblasNoTrans ) TR='T';
      else
      {
         cblas_xerbla(3, "cblas_zsyr2k", "Illegal Trans setting, %d\n", Trans);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      zsyr2k_(&UL, &TR, &N, &K, alpha, A, &lda, B, &ldb, beta, C, &ldc);
   }
   else cblas_xerbla(1, "cblas_zsyr2k", "Illegal Order setting, %d\n", Order);
   CBLAS_CallFromC = 0;
   RowMajorStrg = 0;
   return;
}

canonical_original_code:
void cblas_zsyr2k(enum CBLAS_ORDER Order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE Trans, int N, int K, void *alpha, void *A, int lda, void *B, int ldb, void *beta, void *C, int ldc)
{
   char UL; char TR;
   extern int CBLAS_CallFromC;
   extern int RowMajorStrg;
   RowMajorStrg = 0;
   CBLAS_CallFromC = 1;
   if( Order == CblasColMajor )
   {
      if( Uplo == CblasUpper) UL='U';
      else if ( Uplo == CblasLower ) UL='L';
      else
      {
         cblas_xerbla(2, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if( Trans == CblasTrans) TR ='T';
      else if ( Trans == CblasConjTrans ) TR='C';
      else if ( Trans == CblasNoTrans ) TR='N';
      else
      {
         cblas_xerbla(3, "cblas_zsyr2k", "Illegal Trans setting, %d\n", Trans);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      zsyr2k_(&UL, &TR, &N, &K, alpha, A, &lda,
                      B, &ldb, beta, C, &ldc);
   } else if (Order == CblasRowMajor)
   {
      RowMajorStrg = 1;
      if( Uplo == CblasUpper) UL='L';
      else if ( Uplo == CblasLower ) UL='U';
      else
      {
         cblas_xerbla(3, "cblas_zsyr2k", "Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if( Trans == CblasTrans) TR ='N';
      else if ( Trans == CblasConjTrans ) TR='N';
      else if ( Trans == CblasNoTrans ) TR='T';
      else
      {
         cblas_xerbla(3, "cblas_zsyr2k", "Illegal Trans setting, %d\n", Trans);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      zsyr2k_(&UL, &TR, &N, &K, alpha, A, &lda, B, &ldb, beta, C, &ldc);
   }
   else cblas_xerbla(1, "cblas_zsyr2k", "Illegal Order setting, %d\n", Order);
   CBLAS_CallFromC = 0;
   RowMajorStrg = 0;
   return;
}

variable_types: enum CBLAS_ORDER { CblasRowMajor=101, CblasColMajor=102 }

variable_types: enum CBLAS_UPLO { CblasUpper=121, CblasLower=122 }

variable_types: enum CBLAS_TRANSPOSE { CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113 }

variable_types: K int

variable_types:
alpha
void *

variable_types:
A
void *

variable_types: lda int

variable_types:
B
void *

variable_types: ldb int

variable_types:
beta
void *

variable_types:
C
void *

variable_types: ldc int

variable_types: UL char

variable_types: TR char

variable_types: RowMajorStrg int


decompiled_code:
__int64 __fastcall cblas_ztrmv(unsigned int a1, unsigned int a2, unsigned int a3, __int64 a4, int a5, __int64 a6, char a7, _QWORD *a8, int a9)
{
signed int v10; // ebp
_QWORD *v11; // rax
__int64 v12; // rsi
_QWORD *v13; // r13
_QWORD *v14; // rbx
__int64 result; // rax
__int64 v16; // rbp
int v17[4]; // [rsp+Ch] [rbp-3Ch] BYREF
char v18; // [rsp+1Dh] [rbp-2Bh] BYREF
char v19; // [rsp+1Eh] [rbp-2Ah] BYREF
char v20[41]; // [rsp+1Fh] [rbp-29h] BYREF

RowMajorStrg = 0;
v17[0] = a5;
CBLAS_CallFromC = 1;
if ( a1 == 102 )
{
if ( a2 == 121 )
{
v19 = 85;
}
else
{
if ( a2 != 122 )
goto LABEL_26;
v19 = 76;
}
switch ( a3 )
{
case 'o':
v18 = 78;
break;
case 'p':
v18 = 84;
break;
case 'q':
v18 = 67;
break;
default:
goto LABEL_42;
}
if ( (_DWORD)a4 == 132 )
{
v20[0] = 85;
}
else
{
if ( (_DWORD)a4 != 131 )
{
LABEL_29:
result = cblas_xerbla(4LL, "cblas_ztrmv", "Illegal Diag setting, %d\n", a4);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
v20[0] = 78;
}
result = ztrmv_(&v19, &v18, v20, v17, a6, &a7, a8, &a9);
LABEL_14:
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
if ( a1 != 101 )
{
result = cblas_xerbla(1LL, "cblas_ztrmv", "Illegal Order setting, %d\n", a1);
goto LABEL_14;
}
RowMajorStrg = 1;
if ( a2 != 121 )
{
if ( a2 == 122 )
{
v19 = 85;
goto LABEL_6;
}
LABEL_26:
result = cblas_xerbla(2LL, "cblas_ztrmv", "Illegal Uplo setting, %d\n", a2);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
v19 = 76;
LABEL_6:
switch ( a3 )
{
case 'o':
v18 = 84;
v14 = a8;
v13 = 0LL;
v10 = 0;
LABEL_32:
if ( (_DWORD)a4 == 132 )
{
v20[0] = 85;
goto LABEL_35;
}
if ( (_DWORD)a4 == 131 )
{
v20[0] = 78;
LABEL_35:
result = ztrmv_(&v19, &v18, v20, v17, a6, &a7, a8, &a9);
if ( a3 == 113 )
{
result = (unsigned int)v17[0];
if ( v17[0] > 0 )
{
v16 = 8LL * v10;
do
{
*v14 ^= LC4;
v14 = (_QWORD *)((char *)v14 + v16);
}
while ( v13 != v14 );
}
}
goto LABEL_14;
}
goto LABEL_29;
case 'p':
v18 = 78;
v14 = a8;
v13 = 0LL;
v10 = 0;
goto LABEL_32;
case 'q':
v18 = 78;
if ( v17[0] <= 0 )
{
v14 = a8;
v13 = 0LL;
v10 = 0;
}
else
{
v10 = 2 * abs32(a9);
v11 = a8 + 1;
v12 = 8LL * v10 * v17[0];
v13 = &a8[(unsigned __int64)v12 / 8 + 1];
do
{
*v11 ^= LC4;
v11 += v10;
}
while ( v13 != v11 );
v14 = &v13[v12 / 0xFFFFFFFFFFFFFFF8LL];
}
goto LABEL_32;
}
LABEL_42:
result = cblas_xerbla(3LL, "cblas_ztrmv", "Illegal TransA setting, %d\n", a3);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, unsigned int a2, unsigned int a3, __int64 a4, int a5, __int64 a6, char a7, _QWORD *a8, int a9)
{
signed int v10; // ebp
_QWORD *v11; // rax
__int64 v12; // rsi
_QWORD *v13; // r13
_QWORD *v14; // rbx
__int64 result; // rax
__int64 v16; // rbp
int v17[4]; // [rsp+Ch] [rbp-3Ch] BYREF
char v18; // [rsp+1Dh] [rbp-2Bh] BYREF
char v19; // [rsp+1Eh] [rbp-2Ah] BYREF
char v20[41]; // [rsp+1Fh] [rbp-29h] BYREF

RowMajorStrg = 0;
v17[0] = a5;
CBLAS_CallFromC = 1;
if ( a1 == 102 )
{
if ( a2 == 121 )
{
v19 = 85;
}
else
{
if ( a2 != 122 )
goto LABEL_26;
v19 = 76;
}
switch ( a3 )
{
case 'o':
v18 = 78;
break;
case 'p':
v18 = 84;
break;
case 'q':
v18 = 67;
break;
default:
goto LABEL_42;
}
if ( (_DWORD)a4 == 132 )
{
v20[0] = 85;
}
else
{
if ( (_DWORD)a4 != 131 )
{
LABEL_29:
result = cblas_xerbla(4LL, "cblas_ztrmv", "Illegal Diag setting, %d\n", a4);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
v20[0] = 78;
}
result = ztrmv_(&v19, &v18, v20, v17, a6, &a7, a8, &a9);
LABEL_14:
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
if ( a1 != 101 )
{
result = cblas_xerbla(1LL, "cblas_ztrmv", "Illegal Order setting, %d\n", a1);
goto LABEL_14;
}
RowMajorStrg = 1;
if ( a2 != 121 )
{
if ( a2 == 122 )
{
v19 = 85;
goto LABEL_6;
}
LABEL_26:
result = cblas_xerbla(2LL, "cblas_ztrmv", "Illegal Uplo setting, %d\n", a2);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}
v19 = 76;
LABEL_6:
switch ( a3 )
{
case 'o':
v18 = 84;
v14 = a8;
v13 = 0LL;
v10 = 0;
LABEL_32:
if ( (_DWORD)a4 == 132 )
{
v20[0] = 85;
goto LABEL_35;
}
if ( (_DWORD)a4 == 131 )
{
v20[0] = 78;
LABEL_35:
result = ztrmv_(&v19, &v18, v20, v17, a6, &a7, a8, &a9);
if ( a3 == 113 )
{
result = (unsigned int)v17[0];
if ( v17[0] > 0 )
{
v16 = 8LL * v10;
do
{
*v14 ^= LC4;
v14 = (_QWORD *)((char *)v14 + v16);
}
while ( v13 != v14 );
}
}
goto LABEL_14;
}
goto LABEL_29;
case 'p':
v18 = 78;
v14 = a8;
v13 = 0LL;
v10 = 0;
goto LABEL_32;
case 'q':
v18 = 78;
if ( v17[0] <= 0 )
{
v14 = a8;
v13 = 0LL;
v10 = 0;
}
else
{
v10 = 2 * abs32(a9);
v11 = a8 + 1;
v12 = 8LL * v10 * v17[0];
v13 = &a8[(unsigned __int64)v12 / 8 + 1];
do
{
*v11 ^= LC4;
v11 += v10;
}
while ( v13 != v11 );
v14 = &v13[v12 / 0xFFFFFFFFFFFFFFF8LL];
}
goto LABEL_32;
}
LABEL_42:
result = cblas_xerbla(3LL, "cblas_ztrmv", "Illegal TransA setting, %d\n", a3);
CBLAS_CallFromC = 0;
RowMajorStrg = 0;
return result;
}

original_code:
void cblas_ztrmv(const enum CBLAS_ORDER order, const enum CBLAS_UPLO Uplo,
                 const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_DIAG Diag,
                 const int N, const void *A, const int lda,
                 void *X, const int incX)
{
   char TA;
   char UL;
   char DI;
   int n, i=0, tincX;
   double *st=0,*x=(double *)X;
   extern int CBLAS_CallFromC;
   extern int RowMajorStrg;
   RowMajorStrg = 0;
   CBLAS_CallFromC = 1;
   if (order == CblasColMajor)
   {
      if (Uplo == CblasUpper) UL = 'U';
      else if (Uplo == CblasLower) UL = 'L';
      else
      {
         cblas_xerbla(2, "cblas_ztrmv","Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (TransA == CblasNoTrans) TA = 'N';
      else if (TransA == CblasTrans) TA = 'T';
      else if (TransA == CblasConjTrans) TA = 'C';
      else
      {
         cblas_xerbla(3, "cblas_ztrmv","Illegal TransA setting, %d\n", TransA);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (Diag == CblasUnit) DI = 'U';
      else if (Diag == CblasNonUnit) DI = 'N';
      else
      {
         cblas_xerbla(4, "cblas_ztrmv","Illegal Diag setting, %d\n", Diag);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      ztrmv_( &UL, &TA, &DI, &N, A, &lda, X,
                      &incX);
   }
   else if (order == CblasRowMajor)
   {
      RowMajorStrg = 1;
      if (Uplo == CblasUpper) UL = 'L';
      else if (Uplo == CblasLower) UL = 'U';
      else
      {
         cblas_xerbla(2, "cblas_ztrmv","Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (TransA == CblasNoTrans) TA = 'T';
      else if (TransA == CblasTrans) TA = 'N';
      else if (TransA == CblasConjTrans)
      {
         TA = 'N';
         if ( N > 0)
         {
            if(incX > 0)
               tincX = incX;
            else
               tincX = -incX;
            i = tincX << 1;
            n = i * N;
            x++;
            st = x + n;
            do
            {
               *x = -(*x);
               x += i;
            }
            while (x != st);
            x -= n;
         }
      }
      else
      {
         cblas_xerbla(3, "cblas_ztrmv","Illegal TransA setting, %d\n", TransA);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (Diag == CblasUnit) DI = 'U';
      else if (Diag == CblasNonUnit) DI = 'N';
      else
      {
         cblas_xerbla(4, "cblas_ztrmv","Illegal Diag setting, %d\n", Diag);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
         ztrmv_( &UL, &TA, &DI, &N, A, &lda, X,
                      &incX);
      if (TransA == CblasConjTrans)
      {
         if (N > 0)
         {
            do
            {
               *x = -(*x);
               x += i;
            }
            while (x != st);
         }
      }
   }
   else cblas_xerbla(1, "cblas_ztrmv", "Illegal Order setting, %d\n", order);
   CBLAS_CallFromC = 0;
   RowMajorStrg = 0;
   return;
}

canonical_original_code:
void cblas_ztrmv(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, enum CBLAS_TRANSPOSE TransA, enum CBLAS_DIAG Diag, int N, void *A, int lda, void *X, int incX)
{
   char TA;
   char UL;
   char DI;
   int n; int i = 0; int tincX;
   double *st = 0; double *x = (double *)X;
   extern int CBLAS_CallFromC;
   extern int RowMajorStrg;
   RowMajorStrg = 0;
   CBLAS_CallFromC = 1;
   if (order == CblasColMajor)
   {
      if (Uplo == CblasUpper) UL = 'U';
      else if (Uplo == CblasLower) UL = 'L';
      else
      {
         cblas_xerbla(2, "cblas_ztrmv","Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (TransA == CblasNoTrans) TA = 'N';
      else if (TransA == CblasTrans) TA = 'T';
      else if (TransA == CblasConjTrans) TA = 'C';
      else
      {
         cblas_xerbla(3, "cblas_ztrmv","Illegal TransA setting, %d\n", TransA);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (Diag == CblasUnit) DI = 'U';
      else if (Diag == CblasNonUnit) DI = 'N';
      else
      {
         cblas_xerbla(4, "cblas_ztrmv","Illegal Diag setting, %d\n", Diag);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      ztrmv_( &UL, &TA, &DI, &N, A, &lda, X,
                      &incX);
   }
   else if (order == CblasRowMajor)
   {
      RowMajorStrg = 1;
      if (Uplo == CblasUpper) UL = 'L';
      else if (Uplo == CblasLower) UL = 'U';
      else
      {
         cblas_xerbla(2, "cblas_ztrmv","Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (TransA == CblasNoTrans) TA = 'T';
      else if (TransA == CblasTrans) TA = 'N';
      else if (TransA == CblasConjTrans)
      {
         TA = 'N';
         if ( N > 0)
         {
            if(incX > 0)
               tincX = incX;
            else
               tincX = -incX;
            i = tincX << 1;
            n = i * N;
            x++;
            st = x + n;
            do
            {
               *x = -(*x);
               x += i;
            }
            while (x != st);
            x -= n;
         }
      }
      else
      {
         cblas_xerbla(3, "cblas_ztrmv","Illegal TransA setting, %d\n", TransA);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      if (Diag == CblasUnit) DI = 'U';
      else if (Diag == CblasNonUnit) DI = 'N';
      else
      {
         cblas_xerbla(4, "cblas_ztrmv","Illegal Diag setting, %d\n", Diag);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
         ztrmv_( &UL, &TA, &DI, &N, A, &lda, X,
                      &incX);
      if (TransA == CblasConjTrans)
      {
         if (N > 0)
         {
            do
            {
               *x = -(*x);
               x += i;
            }
            while (x != st);
         }
      }
   }
   else cblas_xerbla(1, "cblas_ztrmv", "Illegal Order setting, %d\n", order);
   CBLAS_CallFromC = 0;
   RowMajorStrg = 0;
   return;
}

variable_types: enum CBLAS_DIAG { CblasNonUnit=131, CblasUnit=132 }

variable_types: N int

variable_types:
X
void *

variable_types: incX int

variable_types: TA char

variable_types: DI char

variable_types: n int

variable_types: i int

variable_types: tincX int

variable_types:
st
double *

variable_types:
x
double *

user_defined_types: enum CBLAS_ORDER { CblasRowMajor=101, CblasColMajor=102 }

user_defined_types: enum CBLAS_UPLO { CblasUpper=121, CblasLower=122 }

user_defined_types: enum CBLAS_TRANSPOSE { CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113 }


decompiled_code:
__int64 __fastcall sasumtest_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_sasum(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_sasum(*a1, a2, *a3);
}

original_code:
float sasumtest_(const int *N, float *X, const int *incX)
{
   return cblas_sasum(*N, X, *incX);
}

canonical_original_code:
float sasumtest_(int *N, float *X, int *incX)
{
   return cblas_sasum(*N, X, *incX);
}

variable_types:
N
int *

variable_types:
X
float *

variable_types:
incX
int *


decompiled_code:
__int64 __fastcall saxpytest_(unsigned int *a1, float *a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_saxpy(*a1, a3, *a4, a5, *a6, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int *a1, float *a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_saxpy(*a1, a3, *a4, a5, *a6, *a2);
}

original_code:
void saxpytest_(const int *N, const float *alpha, const float *X,
                    const int *incX, float *Y, const int *incY)
{
   cblas_saxpy(*N, *alpha, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void saxpytest_(int *N, float *alpha, float *X, int *incX, float *Y, int *incY)
{
   cblas_saxpy(*N, *alpha, X, *incX, Y, *incY);
   return;
}

variable_types:
alpha
float *

variable_types:
Y
float *

variable_types:
incY
int *


decompiled_code:
__int64 __fastcall scasumtest_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scasum(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scasum(*a1, a2, *a3);
}

original_code:
float scasumtest_(const int *N, void *X, const int *incX)
{
   return cblas_scasum(*N, X, *incX);
}

canonical_original_code:
float scasumtest_(int *N, void *X, int *incX)
{
   return cblas_scasum(*N, X, *incX);
}


decompiled_code:
__int64 __fastcall scnrm2test_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scnrm2(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scnrm2(*a1, a2, *a3);
}

original_code:
float scnrm2test_(const int *N, const void *X, const int *incX)
{
   return cblas_scnrm2(*N, X, *incX);
}

canonical_original_code:
float scnrm2test_(int *N, void *X, int *incX)
{
   return cblas_scnrm2(*N, X, *incX);
}


decompiled_code:
__int64 __fastcall scopytest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_scopy(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_scopy(*a1, a2, *a3, a4, *a5);
}

original_code:
void scopytest_(const int *N, const float *X, const int *incX,
                    float *Y, const int *incY)
{
   cblas_scopy(*N, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void scopytest_(int *N, float *X, int *incX, float *Y, int *incY)
{
   cblas_scopy(*N, X, *incX, Y, *incY);
   return;
}


decompiled_code:
__int64 __fastcall sdottest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_sdot(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_sdot(*a1, a2, *a3, a4, *a5);
}

original_code:
float sdottest_(const int *N, const float *X, const int *incX,
                        const float *Y, const int *incY)
{
   return cblas_sdot(*N, X, *incX, Y, *incY);
}

canonical_original_code:
float sdottest_(int *N, float *X, int *incX, float *Y, int *incY)
{
   return cblas_sdot(*N, X, *incX, Y, *incY);
}


decompiled_code:
__int64 __fastcall snrm2test_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_snrm2(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_snrm2(*a1, a2, *a3);
}

original_code:
float snrm2test_(const int *N, const float *X, const int *incX)
{
   return cblas_snrm2(*N, X, *incX);
}

canonical_original_code:
float snrm2test_(int *N, float *X, int *incX)
{
   return cblas_snrm2(*N, X, *incX);
}


decompiled_code:
// attributes: thunk
__int64 srotgtest_()
{
return cblas_srotg();
}

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

original_code:
void srotgtest_( float *a, float *b, float *c, float *s)
{
   cblas_srotg(a,b,c,s);
   return;
}

canonical_original_code:
void srotgtest_(float *a, float *b, float *c, float *s)
{
   cblas_srotg(a,b,c,s);
   return;
}

variable_types:
a
float *

variable_types:
b
float *

variable_types:
c
float *

variable_types:
s
float *


decompiled_code:
__int64 __fastcall srottest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5, float *a6, float *a7)
{
return cblas_srot(*a1, a2, *a3, a4, *a5, *a6, *a7);
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5, float *a6, float *a7)
{
return cblas_srot(*a1, a2, *a3, a4, *a5, *a6, *a7);
}

original_code:
void srottest_( const int *N, float *X, const int *incX, float *Y,
              const int *incY, const float *c, const float *s)
{
   cblas_srot(*N,X,*incX,Y,*incY,*c,*s);
   return;
}

canonical_original_code:
void srottest_(int *N, float *X, int *incX, float *Y, int *incY, float *c, float *s)
{
   cblas_srot(*N,X,*incX,Y,*incY,*c,*s);
   return;
}


decompiled_code:
__int64 __fastcall sscaltest_(unsigned int *a1, float *a2, __int64 a3, unsigned int *a4)
{
return cblas_sscal(*a1, a3, *a4, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned int *a1, float *a2, __int64 a3, unsigned int *a4)
{
return cblas_sscal(*a1, a3, *a4, *a2);
}

original_code:
void sscaltest_(const int *N, const float *alpha, float *X,
                         const int *incX)
{
   cblas_sscal(*N, *alpha, X, *incX);
   return;
}

canonical_original_code:
void sscaltest_(int *N, float *alpha, float *X, int *incX)
{
   cblas_sscal(*N, *alpha, X, *incX);
   return;
}


decompiled_code:
__int64 __fastcall sswaptest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_sswap(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func10(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_sswap(*a1, a2, *a3, a4, *a5);
}

original_code:
void sswaptest_( const int *N, float *X, const int *incX,
                          float *Y, const int *incY)
{
   cblas_sswap(*N,X,*incX,Y,*incY);
   return;
}

canonical_original_code:
void sswaptest_(int *N, float *X, int *incX, float *Y, int *incY)
{
   cblas_sswap(*N,X,*incX,Y,*incY);
   return;
}


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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_isamax() + 1;
return result;
}

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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_isamax() + 1;
return result;
}

original_code:
int isamaxtest_(const int *N, const float *X, const int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return (cblas_isamax(*N, X, *incX)+1);
}

canonical_original_code:
int isamaxtest_(int *N, float *X, int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return (cblas_isamax(*N, X, *incX)+1);
}


decompiled_code:
// attributes: thunk
__int64 cblas_srotg()
{
return srotg_();
}

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

original_code:
void cblas_srotg( float *a, float *b, float *c, float *s)
{
   srotg_(a,b,c,s);
}

canonical_original_code:
void cblas_srotg(float *a, float *b, float *c, float *s)
{
   srotg_(a,b,c,s);
}


decompiled_code:
__int64 __fastcall zaxpytest_(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_zaxpy(*a1, a2, a3, *a4, a5, *a6);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_zaxpy(*a1, a2, a3, *a4, a5, *a6);
}

original_code:
void zaxpytest_(const int *N, const void *alpha, void *X,
                    const int *incX, void *Y, const int *incY)
{
   cblas_zaxpy(*N, alpha, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void zaxpytest_(int *N, void *alpha, void *X, int *incX, void *Y, int *incY)
{
   cblas_zaxpy(*N, alpha, X, *incX, Y, *incY);
   return;
}

variable_types:
alpha
void *

variable_types:
X
void *

variable_types:
Y
void *


decompiled_code:
__int64 __fastcall zcopytest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zcopy(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zcopy(*a1, a2, *a3, a4, *a5);
}

original_code:
void zcopytest_(const int *N, void *X, const int *incX,
                    void *Y, const int *incY)
{
   cblas_zcopy(*N, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void zcopytest_(int *N, void *X, int *incX, void *Y, int *incY)
{
   cblas_zcopy(*N, X, *incX, Y, *incY);
   return;
}


decompiled_code:
__int64 __fastcall zdotctest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zdotc_sub(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zdotc_sub(*a1, a2, *a3, a4, *a5);
}

original_code:
void zdotctest_(const int *N, const void *X, const int *incX,
                     const void *Y, const int *incY,void *dotc)
{
   cblas_zdotc_sub(*N, X, *incX, Y, *incY, dotc);
   return;
}

canonical_original_code:
void zdotctest_(int *N, void *X, int *incX, void *Y, int *incY, void *dotc)
{
   cblas_zdotc_sub(*N, X, *incX, Y, *incY, dotc);
   return;
}

variable_types:
dotc
void *


decompiled_code:
__int64 __fastcall zdotutest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zdotu_sub(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zdotu_sub(*a1, a2, *a3, a4, *a5);
}

original_code:
void zdotutest_(const int *N, void *X, const int *incX,
                        void *Y, const int *incY,void *dotu)
{
   cblas_zdotu_sub(*N, X, *incX, Y, *incY, dotu);
   return;
}

canonical_original_code:
void zdotutest_(int *N, void *X, int *incX, void *Y, int *incY, void *dotu)
{
   cblas_zdotu_sub(*N, X, *incX, Y, *incY, dotu);
   return;
}

variable_types:
dotu
void *


decompiled_code:
__int64 __fastcall zdscaltest_(unsigned int *a1, double *a2, __int64 a3, unsigned int *a4)
{
return cblas_zdscal(*a1, a3, *a4, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int *a1, double *a2, __int64 a3, unsigned int *a4)
{
return cblas_zdscal(*a1, a3, *a4, *a2);
}

original_code:
void zdscaltest_(const int *N, const double *alpha, void *X,
                         const int *incX)
{
   cblas_zdscal(*N, *alpha, X, *incX);
   return;
}

canonical_original_code:
void zdscaltest_(int *N, double *alpha, void *X, int *incX)
{
   cblas_zdscal(*N, *alpha, X, *incX);
   return;
}

variable_types:
alpha
double *


decompiled_code:
__int64 __fastcall zscaltest_(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4)
{
return cblas_zscal(*a1, a2, a3, *a4);
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4)
{
return cblas_zscal(*a1, a2, a3, *a4);
}

original_code:
void zscaltest_(const int *N, const void * *alpha, void *X,
                         const int *incX)
{
   cblas_zscal(*N, alpha, X, *incX);
   return;
}

canonical_original_code:
void zscaltest_(int *N, void **alpha, void *X, int *incX)
{
   cblas_zscal(*N, alpha, X, *incX);
   return;
}

variable_types:
alpha
void **


decompiled_code:
__int64 __fastcall zswaptest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zswap(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_zswap(*a1, a2, *a3, a4, *a5);
}

original_code:
void zswaptest_( const int *N, void *X, const int *incX,
                          void *Y, const int *incY)
{
   cblas_zswap(*N,X,*incX,Y,*incY);
   return;
}

canonical_original_code:
void zswaptest_(int *N, void *X, int *incX, void *Y, int *incY)
{
   cblas_zswap(*N,X,*incX,Y,*incY);
   return;
}

variable_types:
N
int *


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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_izamax() + 1;
return result;
}

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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_izamax() + 1;
return result;
}

original_code:
int izamaxtest_(const int *N, const void *X, const int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return(cblas_izamax(*N, X, *incX)+1);
}

canonical_original_code:
int izamaxtest_(int *N, void *X, int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return(cblas_izamax(*N, X, *incX)+1);
}


decompiled_code:
__int64 __fastcall dznrm2test_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dznrm2(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dznrm2(*a1, a2, *a3);
}

original_code:
double dznrm2test_(const int *N, const void *X, const int *incX)
{
   return cblas_dznrm2(*N, X, *incX);
}

canonical_original_code:
double dznrm2test_(int *N, void *X, int *incX)
{
   return cblas_dznrm2(*N, X, *incX);
}

return_type: double


decompiled_code:
__int64 __fastcall dzasumtest_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dzasum(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dzasum(*a1, a2, *a3);
}

original_code:
double dzasumtest_(const int *N, void *X, const int *incX)
{
   return cblas_dzasum(*N, X, *incX);
}

canonical_original_code:
double dzasumtest_(int *N, void *X, int *incX)
{
   return cblas_dzasum(*N, X, *incX);
}


decompiled_code:
double __fastcall cblas_dsdot(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-24h] BYREF
int v7; // [rsp+8h] [rbp-20h] BYREF
int v8[3]; // [rsp+Ch] [rbp-1Ch] BYREF
double v9[2]; // [rsp+18h] [rbp-10h] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
dsdotsub_(v8, a2, &v7, a4, &v6, v9);
return v9[0];
}

canonical_decompiled_code:
double __fastcall func0(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-24h] BYREF
int v7; // [rsp+8h] [rbp-20h] BYREF
int v8[3]; // [rsp+Ch] [rbp-1Ch] BYREF
double v9[2]; // [rsp+18h] [rbp-10h] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
dsdotsub_(v8, a2, &v7, a4, &v6, v9);
return v9[0];
}

original_code:
double cblas_dsdot( const int N, const float *X,
                      const int incX, const float *Y, const int incY)
{
   double dot;
   dsdotsub_( &N, X, &incX, Y, &incY, &dot);
   return dot;
}

canonical_original_code:
double cblas_dsdot(int N, float *X, int incX, float *Y, int incY)
{
   double dot;
   dsdotsub_( &N, X, &incX, Y, &incY, &dot);
   return dot;
}

variable_types: N int

variable_types:
X
float *

variable_types: incX int

variable_types: incY int

variable_types: dot double


decompiled_code:
__int64 __fastcall caxpytest_(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_caxpy(*a1, a2, a3, *a4, a5, *a6);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_caxpy(*a1, a2, a3, *a4, a5, *a6);
}

original_code:
void caxpytest_(const int *N, const void *alpha, void *X,
                    const int *incX, void *Y, const int *incY)
{
   cblas_caxpy(*N, alpha, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void caxpytest_(int *N, void *alpha, void *X, int *incX, void *Y, int *incY)
{
   cblas_caxpy(*N, alpha, X, *incX, Y, *incY);
   return;
}

variable_types:
incX
int *

variable_types:
incY
int *


decompiled_code:
__int64 __fastcall ccopytest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_ccopy(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_ccopy(*a1, a2, *a3, a4, *a5);
}

original_code:
void ccopytest_(const int *N, void *X, const int *incX,
                    void *Y, const int *incY)
{
   cblas_ccopy(*N, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void ccopytest_(int *N, void *X, int *incX, void *Y, int *incY)
{
   cblas_ccopy(*N, X, *incX, Y, *incY);
   return;
}


decompiled_code:
__int64 __fastcall cdotctest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_cdotc_sub(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_cdotc_sub(*a1, a2, *a3, a4, *a5);
}

original_code:
void cdotctest_(const int *N, void *X, const int *incX,
                        void *Y, const int *incY, void *dotc)
{
   cblas_cdotc_sub(*N, X, *incX, Y, *incY, dotc);
   return;
}

canonical_original_code:
void cdotctest_(int *N, void *X, int *incX, void *Y, int *incY, void *dotc)
{
   cblas_cdotc_sub(*N, X, *incX, Y, *incY, dotc);
   return;
}


decompiled_code:
__int64 __fastcall cdotutest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_cdotu_sub(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_cdotu_sub(*a1, a2, *a3, a4, *a5);
}

original_code:
void cdotutest_(const int *N, void *X, const int *incX,
                        void *Y, const int *incY,void *dotu)
{
   cblas_cdotu_sub(*N, X, *incX, Y, *incY, dotu);
   return;
}

canonical_original_code:
void cdotutest_(int *N, void *X, int *incX, void *Y, int *incY, void *dotu)
{
   cblas_cdotu_sub(*N, X, *incX, Y, *incY, dotu);
   return;
}


decompiled_code:
__int64 __fastcall cscaltest_(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4)
{
return cblas_cscal(*a1, a2, a3, *a4);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int *a1, __int64 a2, __int64 a3, unsigned int *a4)
{
return cblas_cscal(*a1, a2, a3, *a4);
}

original_code:
void cscaltest_(const int *N, const void * *alpha, void *X,
                         const int *incX)
{
   cblas_cscal(*N, alpha, X, *incX);
   return;
}

canonical_original_code:
void cscaltest_(int *N, void **alpha, void *X, int *incX)
{
   cblas_cscal(*N, alpha, X, *incX);
   return;
}


decompiled_code:
__int64 __fastcall csscaltest_(unsigned int *a1, float *a2, __int64 a3, unsigned int *a4)
{
return cblas_csscal(*a1, a3, *a4, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int *a1, float *a2, __int64 a3, unsigned int *a4)
{
return cblas_csscal(*a1, a3, *a4, *a2);
}

original_code:
void csscaltest_(const int *N, const float *alpha, void *X,
                         const int *incX)
{
   cblas_csscal(*N, *alpha, X, *incX);
   return;
}

canonical_original_code:
void csscaltest_(int *N, float *alpha, void *X, int *incX)
{
   cblas_csscal(*N, *alpha, X, *incX);
   return;
}

variable_types:
alpha
float *


decompiled_code:
__int64 __fastcall cswaptest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_cswap(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_cswap(*a1, a2, *a3, a4, *a5);
}

original_code:
void cswaptest_( const int *N, void *X, const int *incX,
                          void *Y, const int *incY)
{
   cblas_cswap(*N,X,*incX,Y,*incY);
   return;
}

canonical_original_code:
void cswaptest_(int *N, void *X, int *incX, void *Y, int *incY)
{
   cblas_cswap(*N,X,*incX,Y,*incY);
   return;
}


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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_icamax() + 1;
return result;
}

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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_icamax() + 1;
return result;
}

original_code:
int icamaxtest_(const int *N, const void *X, const int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return (cblas_icamax(*N, X, *incX)+1);
}

canonical_original_code:
int icamaxtest_(int *N, void *X, int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return (cblas_icamax(*N, X, *incX)+1);
}


decompiled_code:
__int64 __fastcall scnrm2test_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scnrm2(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scnrm2(*a1, a2, *a3);
}

original_code:
float scnrm2test_(const int *N, const void *X, const int *incX)
{
   return cblas_scnrm2(*N, X, *incX);
}

canonical_original_code:
float scnrm2test_(int *N, void *X, int *incX)
{
   return cblas_scnrm2(*N, X, *incX);
}


decompiled_code:
__int64 __fastcall scasumtest_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scasum(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_scasum(*a1, a2, *a3);
}

original_code:
float scasumtest_(const int *N, void *X, const int *incX)
{
   return cblas_scasum(*N, X, *incX);
}

canonical_original_code:
float scasumtest_(int *N, void *X, int *incX)
{
   return cblas_scasum(*N, X, *incX);
}


decompiled_code:
__int64 __fastcall dasumtest_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dasum(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dasum(*a1, a2, *a3);
}

original_code:
double dasumtest_(const int *N, double *X, const int *incX)
{
   return cblas_dasum(*N, X, *incX);
}

canonical_original_code:
double dasumtest_(int *N, double *X, int *incX)
{
   return cblas_dasum(*N, X, *incX);
}

variable_types:
X
double *


decompiled_code:
__int64 __fastcall daxpytest_(unsigned int *a1, double *a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_daxpy(*a1, a3, *a4, a5, *a6, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int *a1, double *a2, __int64 a3, unsigned int *a4, __int64 a5, unsigned int *a6)
{
return cblas_daxpy(*a1, a3, *a4, a5, *a6, *a2);
}

original_code:
void daxpytest_(const int *N, const double *alpha, const double *X,
                    const int *incX, double *Y, const int *incY)
{
   cblas_daxpy(*N, *alpha, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void daxpytest_(int *N, double *alpha, double *X, int *incX, double *Y, int *incY)
{
   cblas_daxpy(*N, *alpha, X, *incX, Y, *incY);
   return;
}

variable_types:
Y
double *


decompiled_code:
__int64 __fastcall dcopytest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_dcopy(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_dcopy(*a1, a2, *a3, a4, *a5);
}

original_code:
void dcopytest_(const int *N, double *X, const int *incX,
                    double *Y, const int *incY)
{
   cblas_dcopy(*N, X, *incX, Y, *incY);
   return;
}

canonical_original_code:
void dcopytest_(int *N, double *X, int *incX, double *Y, int *incY)
{
   cblas_dcopy(*N, X, *incX, Y, *incY);
   return;
}


decompiled_code:
__int64 __fastcall ddottest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_ddot(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_ddot(*a1, a2, *a3, a4, *a5);
}

original_code:
double ddottest_(const int *N, const double *X, const int *incX,
                const double *Y, const int *incY)
{
   return cblas_ddot(*N, X, *incX, Y, *incY);
}

canonical_original_code:
double ddottest_(int *N, double *X, int *incX, double *Y, int *incY)
{
   return cblas_ddot(*N, X, *incX, Y, *incY);
}


decompiled_code:
__int64 __fastcall dnrm2test_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dnrm2(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dnrm2(*a1, a2, *a3);
}

original_code:
double dnrm2test_(const int *N, const double *X, const int *incX)
{
   return cblas_dnrm2(*N, X, *incX);
}

canonical_original_code:
double dnrm2test_(int *N, double *X, int *incX)
{
   return cblas_dnrm2(*N, X, *incX);
}


decompiled_code:
// attributes: thunk
__int64 drotgtest_()
{
return cblas_drotg();
}

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

original_code:
void drotgtest_( double *a, double *b, double *c, double *s)
{
   cblas_drotg(a,b,c,s);
   return;
}

canonical_original_code:
void drotgtest_(double *a, double *b, double *c, double *s)
{
   cblas_drotg(a,b,c,s);
   return;
}

variable_types:
a
double *

variable_types:
b
double *

variable_types:
c
double *

variable_types:
s
double *


decompiled_code:
__int64 __fastcall drottest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5, double *a6, double *a7)
{
return cblas_drot(*a1, a2, *a3, a4, *a5, *a6, *a7);
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5, double *a6, double *a7)
{
return cblas_drot(*a1, a2, *a3, a4, *a5, *a6, *a7);
}

original_code:
void drottest_( const int *N, double *X, const int *incX, double *Y,
       const int *incY, const double *c, const double *s)
{
   cblas_drot(*N,X,*incX,Y,*incY,*c,*s);
   return;
}

canonical_original_code:
void drottest_(int *N, double *X, int *incX, double *Y, int *incY, double *c, double *s)
{
   cblas_drot(*N,X,*incX,Y,*incY,*c,*s);
   return;
}


decompiled_code:
__int64 __fastcall dscaltest_(unsigned int *a1, double *a2, __int64 a3, unsigned int *a4)
{
return cblas_dscal(*a1, a3, *a4, *a2);
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int *a1, double *a2, __int64 a3, unsigned int *a4)
{
return cblas_dscal(*a1, a3, *a4, *a2);
}

original_code:
void dscaltest_(const int *N, const double *alpha, double *X,
                         const int *incX)
{
   cblas_dscal(*N, *alpha, X, *incX);
   return;
}

canonical_original_code:
void dscaltest_(int *N, double *alpha, double *X, int *incX)
{
   cblas_dscal(*N, *alpha, X, *incX);
   return;
}

variable_types:
alpha
double *


decompiled_code:
__int64 __fastcall dswaptest_(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_dswap(*a1, a2, *a3, a4, *a5);
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int *a1, __int64 a2, unsigned int *a3, __int64 a4, unsigned int *a5)
{
return cblas_dswap(*a1, a2, *a3, a4, *a5);
}

original_code:
void dswaptest_( const int *N, double *X, const int *incX,
                          double *Y, const int *incY)
{
   cblas_dswap(*N,X,*incX,Y,*incY);
   return;
}

canonical_original_code:
void dswaptest_(int *N, double *X, int *incX, double *Y, int *incY)
{
   cblas_dswap(*N,X,*incX,Y,*incY);
   return;
}


decompiled_code:
__int64 __fastcall dzasumtest_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dzasum(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func9(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dzasum(*a1, a2, *a3);
}

original_code:
double dzasumtest_(const int *N, void *X, const int *incX)
{
   return cblas_dzasum(*N, X, *incX);
}

canonical_original_code:
double dzasumtest_(int *N, void *X, int *incX)
{
   return cblas_dzasum(*N, X, *incX);
}

variable_types:
X
void *


decompiled_code:
__int64 __fastcall dznrm2test_(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dznrm2(*a1, a2, *a3);
}

canonical_decompiled_code:
__int64 __fastcall func10(unsigned int *a1, __int64 a2, unsigned int *a3)
{
return cblas_dznrm2(*a1, a2, *a3);
}

original_code:
double dznrm2test_(const int *N, const void *X, const int *incX)
{
   return cblas_dznrm2(*N, X, *incX);
}

canonical_original_code:
double dznrm2test_(int *N, void *X, int *incX)
{
   return cblas_dznrm2(*N, X, *incX);
}

variable_types:
N
int *


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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_idamax() + 1;
return result;
}

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

result = 0LL;
if ( *a1 > 0 && *a3 > 0 )
result = (unsigned int)cblas_idamax() + 1;
return result;
}

original_code:
int idamaxtest_(const int *N, const double *X, const int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return (cblas_idamax(*N, X, *incX)+1);
}

canonical_original_code:
int idamaxtest_(int *N, double *X, int *incX)
{
   if (*N < 1 || *incX < 1) return(0);
   return (cblas_idamax(*N, X, *incX)+1);
}


decompiled_code:
__int64 __fastcall cblas_sswap(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-14h] BYREF
int v7; // [rsp+8h] [rbp-10h] BYREF
int v8[3]; // [rsp+Ch] [rbp-Ch] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
return sswap_(v8, a2, &v7, a4, &v6);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-14h] BYREF
int v7; // [rsp+8h] [rbp-10h] BYREF
int v8[3]; // [rsp+Ch] [rbp-Ch] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
return sswap_(v8, a2, &v7, a4, &v6);
}

original_code:
void cblas_sswap( const int N, float *X, const int incX, float *Y,
                       const int incY)
{
   sswap_( &N, X, &incX, Y, &incY);
}

canonical_original_code:
void cblas_sswap(int N, float *X, int incX, float *Y, int incY)
{
   sswap_( &N, X, &incX, Y, &incY);
}

variable_types: N int

variable_types:
Y
float *


decompiled_code:
double __fastcall cblas_dasum(int a1, __int64 a2, int a3)
{
int v4; // [rsp+8h] [rbp-20h] BYREF
int v5[3]; // [rsp+Ch] [rbp-1Ch] BYREF
double v6[2]; // [rsp+18h] [rbp-10h] BYREF

v5[0] = a1;
v4 = a3;
dasumsub_(v5, a2, &v4, v6);
return v6[0];
}

canonical_decompiled_code:
double __fastcall func0(int a1, __int64 a2, int a3)
{
int v4; // [rsp+8h] [rbp-20h] BYREF
int v5[3]; // [rsp+Ch] [rbp-1Ch] BYREF
double v6[2]; // [rsp+18h] [rbp-10h] BYREF

v5[0] = a1;
v4 = a3;
dasumsub_(v5, a2, &v4, v6);
return v6[0];
}

original_code:
double cblas_dasum( const int N, const double *X, const int incX)
{
   double asum;
   dasumsub_( &N, X, &incX, &asum);
   return asum;
}

canonical_original_code:
double cblas_dasum(int N, double *X, int incX)
{
   double asum;
   dasumsub_( &N, X, &incX, &asum);
   return asum;
}

variable_types: incX int

variable_types: asum double


decompiled_code:
float __fastcall cblas_sdot(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-24h] BYREF
int v7; // [rsp+8h] [rbp-20h] BYREF
int v8[4]; // [rsp+Ch] [rbp-1Ch] BYREF
float v9[3]; // [rsp+1Ch] [rbp-Ch] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
sdotsub_(v8, a2, &v7, a4, &v6, v9);
return v9[0];
}

canonical_decompiled_code:
float __fastcall func0(int a1, __int64 a2, int a3, __int64 a4, int a5)
{
int v6; // [rsp+4h] [rbp-24h] BYREF
int v7; // [rsp+8h] [rbp-20h] BYREF
int v8[4]; // [rsp+Ch] [rbp-1Ch] BYREF
float v9[3]; // [rsp+1Ch] [rbp-Ch] BYREF

v8[0] = a1;
v7 = a3;
v6 = a5;
sdotsub_(v8, a2, &v7, a4, &v6, v9);
return v9[0];
}

original_code:
float cblas_sdot( const int N, const float *X,
                      const int incX, const float *Y, const int incY)
{
   float dot;
   sdotsub_( &N, X, &incX, Y, &incY, &dot);
   return dot;
}

canonical_original_code:
float cblas_sdot(int N, float *X, int incX, float *Y, int incY)
{
   float dot;
   sdotsub_( &N, X, &incX, Y, &incY, &dot);
   return dot;
}

variable_types:
X
float *

variable_types: incY int

variable_types: dot float


original_code:
void cblas_chbmv(const enum CBLAS_ORDER order,
                 const enum CBLAS_UPLO Uplo,const int N,const int K,
                 const void *alpha, const void *A, const int lda,
                 const void *X, const int incX, const void *beta,
                 void *Y, const int incY)
{
   char UL;
   int n, i=0, incx=incX;
   const float *xx= (float *)X, *alp= (float *)alpha, *bet = (float *)beta;
   float ALPHA[2],BETA[2];
   int tincY, tincx;
   float *x=(float *)X, *y=(float *)Y, *st=0, *tx;
   extern int CBLAS_CallFromC;
   extern int RowMajorStrg;
   RowMajorStrg = 0;
   CBLAS_CallFromC = 1;
   if (order == CblasColMajor)
   {
      if (Uplo == CblasLower) UL = 'L';
      else if (Uplo == CblasUpper) UL = 'U';
      else
      {
         cblas_xerbla(2, "cblas_chbmv","Illegal Uplo setting, %d\n",Uplo );
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      chbmv_(&UL, &N, &K, alpha, A, &lda, X,
                     &incx, beta, Y, &incY);
   }
   else if (order == CblasRowMajor)
   {
      RowMajorStrg = 1;
      ALPHA[0]= *alp;
      ALPHA[1]= -alp[1];
      BETA[0]= *bet;
      BETA[1]= -bet[1];
      if (N > 0)
      {
         n = N << 1;
         x = malloc(n*sizeof(float));
         tx = x;
         if( incX > 0 ) {
           i = incX << 1 ;
           tincx = 2;
           st= x+n;
         } else {
           i = incX *(-2);
           tincx = -2;
           st = x-2;
           x +=(n-2);
         }
         do
         {
           *x = *xx;
           x[1] = -xx[1];
           x += tincx ;
           xx += i;
         }
         while (x != st);
         x=tx;
            incx = 1;
         if(incY > 0)
           tincY = incY;
         else
           tincY = -incY;
         y++;
         i = tincY << 1;
         n = i * N ;
         st = y + n;
         do {
            *y = -(*y);
            y += i;
         } while(y != st);
         y -= n;
      } else
         x = (float *) X;
      if (Uplo == CblasUpper) UL = 'L';
      else if (Uplo == CblasLower) UL = 'U';
      else
      {
         cblas_xerbla(2, "cblas_chbmv","Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      chbmv_(&UL, &N, &K, ALPHA,
                     A ,&lda, x,&incx, BETA, Y, &incY);
   }
   else
   {
      cblas_xerbla(1, "cblas_chbmv","Illegal Order setting, %d\n", order);
      CBLAS_CallFromC = 0;
      RowMajorStrg = 0;
      return;
   }
   if ( order == CblasRowMajor )
   {
      RowMajorStrg = 1;
      if(X!=x)
         free(x);
      if (N > 0)
      {
         do
         {
            *y = -(*y);
            y += i;
         }
         while (y != st);
      }
   }
   CBLAS_CallFromC = 0;
   RowMajorStrg = 0;
   return;
}

canonical_original_code:
void cblas_chbmv(enum CBLAS_ORDER order, enum CBLAS_UPLO Uplo, int N, int K, void *alpha, void *A, int lda, void *X, int incX, void *beta, void *Y, int incY)
{
   char UL;
   int n; int i = 0; int incx = incX;
   float *xx = (float *)X; float *alp = (float *)alpha; float *bet = (float *)beta;
   float ALPHA[2]; float BETA[2];
   int tincY; int tincx;
   float *x = (float *)X; float *y = (float *)Y; float *st = 0; float *tx;
   extern int CBLAS_CallFromC;
   extern int RowMajorStrg;
   RowMajorStrg = 0;
   CBLAS_CallFromC = 1;
   if (order == CblasColMajor)
   {
      if (Uplo == CblasLower) UL = 'L';
      else if (Uplo == CblasUpper) UL = 'U';
      else
      {
         cblas_xerbla(2, "cblas_chbmv","Illegal Uplo setting, %d\n",Uplo );
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      chbmv_(&UL, &N, &K, alpha, A, &lda, X,
                     &incx, beta, Y, &incY);
   }
   else if (order == CblasRowMajor)
   {
      RowMajorStrg = 1;
      ALPHA[0]= *alp;
      ALPHA[1]= -alp[1];
      BETA[0]= *bet;
      BETA[1]= -bet[1];
      if (N > 0)
      {
         n = N << 1;
         x = malloc(n*sizeof(float));
         tx = x;
         if( incX > 0 ) {
           i = incX << 1 ;
           tincx = 2;
           st= x+n;
         } else {
           i = incX *(-2);
           tincx = -2;
           st = x-2;
           x +=(n-2);
         }
         do
         {
           *x = *xx;
           x[1] = -xx[1];
           x += tincx ;
           xx += i;
         }
         while (x != st);
         x=tx;
            incx = 1;
         if(incY > 0)
           tincY = incY;
         else
           tincY = -incY;
         y++;
         i = tincY << 1;
         n = i * N ;
         st = y + n;
         do {
            *y = -(*y);
            y += i;
         } while(y != st);
         y -= n;
      } else
         x = (float *) X;
      if (Uplo == CblasUpper) UL = 'L';
      else if (Uplo == CblasLower) UL = 'U';
      else
      {
         cblas_xerbla(2, "cblas_chbmv","Illegal Uplo setting, %d\n", Uplo);
         CBLAS_CallFromC = 0;
         RowMajorStrg = 0;
         return;
      }
      chbmv_(&UL, &N, &K, ALPHA,
                     A ,&lda, x,&incx, BETA, Y, &incY);
   }
   else
   {
      cblas_xerbla(1, "cblas_chbmv","Illegal Order setting, %d\n", order);
      CBLAS_CallFromC = 0;
      RowMajorStrg = 0;
      return;
   }
   if ( order == CblasRowMajor )
   {
      RowMajorStrg = 1;
      if(X!=x)
         free(x);
      if (N > 0)
      {
         do
         {
            *y = -(*y);
            y += i;
         }
         while (y != st);
      }
   }
   CBLAS_CallFromC = 0;
   RowMajorStrg = 0;
   return;
}

variable_types: enum CBLAS_ORDER { CblasRowMajor=101, CblasColMajor=102 }

variable_types: enum CBLAS_UPLO { CblasUpper=121, CblasLower=122 }

variable_types: K int

variable_types:
alpha
void *

variable_types:
A
void *

variable_types: lda int

variable_types:
beta
void *

variable_types:
Y
void *

variable_types: UL char

variable_types: n int

variable_types: i int

variable_types: incx int

variable_types:
xx
float *

variable_types:
alp
float *

variable_types:
bet
float *

variable_types:
ALPHA
float [2]

variable_types:
BETA
float [2]

variable_types: tincY int

variable_types: tincx int

variable_types:
x
float *

variable_types:
y
float *

variable_types:
st
float *

variable_types:
tx
float *

variable_types: RowMajorStrg int