Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8603043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:13:53+00:00 2026-06-12T02:13:53+00:00

I have this assembly code and what I think it does is print using

  • 0

I have this assembly code and what I think it does is print using the printf function. i am not really familiar with C, but I created a main function and I printed out printf("%d, %d", x, y) where x and y are both zero.

I converted the C code to assembly but I got something totally different. Can somebody help me understand what the assembly code below does?

            mov    %edx,0x8(%esp)
            mov    %eax,0x4(%esp)
            movl   $0x80486a0,(%esp)
            call   8048360 <printf@plt>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T02:13:55+00:00Added an answer on June 12, 2026 at 2:13 am

    As a very literal translation of your assembly,

    mov    %edx,0x8(%esp)
    

    move the value in edx onto the stack at offset 8 (esp + 8)

    mov    %eax,0x4(%esp)
    

    move the value in eax onto the stack at offset 4 (esp + 4)

    movl   $0x80486a0,(%esp)
    

    move [the 32bit value] 0x80486a0 onto the stack at offset 0

    This is a very basic way that arguments to a function will be placed on the stack–RTL or C order. The value at the lowest offset is the first argument (in this case, the address of your string literal in memory), and the value at the highest offset is the last argument.

    When you hit the call:

    call   8048360 <printf@plt>
    

    Your program will jump to the given address (which your disassembler has identified as the printf function), read the values from the stack, perform the print operation, and then return back to your code, resuming operation at the next instruction after your call.

    I’m going to guess that your source looked something like this:

    void main()
    {
        int x =0, y=0;
        printf("%d, %d", x, y);
    }
    

    Depending on your OS/compiler, you might be guaranteed that eax and edx will have the value 0 at startup. Or you could be missing the initialization code from your snippet.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to register dlls into my gac Assembly asm = Assembly.LoadFrom(argument);
I have c#.net code which calls a method from another external/referenced .net assembly. This
I have this error message could not load assembly 'system.data.entity, version 4.2.0.0, culture=neutral,publickeytoken=b77a5c561934e089' or
I think this is a really newb question, but I never found out the
I have an assembly that contains an embedded resource. However, when this assembly is
So I have this asp.net web application that I renamed. I changed the assembly
I have a method in an assembly that looks like this: namespace MyNameSpace {
I have an assembly containing a number of classes. This is a class library
Have this self-made slider: http://jsfiddle.net/wyc3P/4/ What it does: takes min and max values in
I have been given an end of term project to write an assembly code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.