#include <stdio.h>
#include <math.h>

float myLog(float x) {
  float result;
  __asm {
    fldln2  ;// load log_e(2) in ST0
    fld x   ;// load ST0=x; ST1=log_e(2)
    fyl2x   ;// ST1=log_e(2)*log_2(x) = log_e(x); pop;
    fstp result; // store ST0 in result; pop;
  }
  return result;
}

int main() {
  float x = 25.0;
  float result = myLog(x);
  printf("ln(%f) = %f \n", x, result); // output result of myLog
  printf("ln(%f) = %f \n", x, log(x)); // check results with C log function
  return 0;
}