[...]
Except "long long int" is not IntPtr, the corresponding c type would be intptr_t from stdint.h and printf does not replace WriteLn, which can be seen quite good here because your format string is broken (%d prints an int, to print long long int you need to use lld or lli. when you would be using intptr_t you would need to distinguish between 32 and 64 bit and use ld and lld respectively), which is not possible with WriteLn because there the compiler takes care of such things.
Not all Pascal programs have a perfect C representation, as pretty well seen by your example. The other direction is much better (i.e. C to pascal) because nearly all C constructs have a representation in pascal and you can use the libc in pascal (while you can't use the RTL in C).
That said, these are two different languages and not everything has a 1-1 translation and some problems are simply to be expected when trying to convert from one language to the other. But your chances are better when trying to convert C to Pascal than the other way around