
Assembly programmer writes in C for first time - seisvelas
https://gist.github.com/seisvelas/a09fb1650a6bffbd7dc8393edf9462f5
======
exikyut
This is GAS syntax x86. I am _very_ interested to learn what sort of context
you do assembly language programming mainly.

Heh. If this were 10 years ago, we'd be using _register int_ s.

As I'm sure you're aware you can get gcc to emit assembly, quite a few of the
answers here seem interesting:
[https://stackoverflow.com/questions/137038/how-do-you-get-
as...](https://stackoverflow.com/questions/137038/how-do-you-get-assembler-
output-from-c-c-source-in-gcc)

You don't need to parallel-install dozens of versions of different compilers
to play with them, too: [https://gcc.godbolt.org/](https://gcc.godbolt.org/)

~~~
seisvelas
I'm a hobbyist, but I'm applying to get into an awesome program called
hola<code/> here in CDMX.

~~~
exikyut
Oh, that sounds interesting. Definitely hope it works out for you!

I must admit my great curiosity about what path led you to assembly language
and _then_ C. In many circumstances it's the other way around.

------
crooked-v
Next would probably be a while loop using the same setup, then a for loop with
the counter reversed (incrementing rather than decrementing), and seeing how
the assembly differs in each case. If you were using C++ then next after that
would be using an iterator on a vector and mostly taking away direct control
of the counter in the process.

------
lioeters
The latest comment on the gist is gold! It's like watching a conversation in
code.

~~~
app4soft
TL;DR:

    
    
      L_.str:                                 ## @.str

------
Vendan

        int ebx = 0;
    

but

    
    
        movl $1, %ebx
    

.... FAIL.. :D

~~~
seisvelas
That's actually a copy/paste error, the original assembly goes like this:

    
    
        movl $10, %edi # number of fibnum we hunt
        movl $0, %ebx # 1st fibnum
        movl $1, %eax # 2nd fibnum
    

Updated the gist, thanks!

