Compile thus:
gcc a.c -O3 -Wall q.s; ./a.outClang OK.
To print decimal value of x, each iteration of the outer loop prints the integral part of 1013x as a decimal numeral and replaces x by (1013x) mod 1. There is nothing magic about 13 except that 0<13<20.
See this about addq, divq and mulq. In 1957 IBM 704 machine code, to compute e in binary, without decimal printout or accuracy estimate, fit on one punched card of 22 instructions.