x86 Disassembly/Disassembly Examples

Example: Hello World Listing edit

Write a simple "Hello World" program using C or C++ and your favorite compiler. Generate a listing file from the compiler. Does the code look the way you expect it to? Do you understand what the assembly code means?

Here are examples of C and C++ "Hello World!" programs.

#include <stdio.h>

int main()
{
  printf("Hello World!\n");
  return 0;
}
#include <iostream>

int main()
{
  std::cout << "Hello World!\n";
  return 0;
}

Example: Basic Disassembly edit

Write a basic "Hello World!" program (see the example above). Compile the program into an executable with your favorite compiler, then disassemble it. How big is the disassembled code file? How does it compare to the code from the listing file you generated? Can you explain why the file is this size?