title: Linux X86-64 assembly and printf
body: <p>I am reading some linux assembly manuals and found idea about using  printf() function. I need it to output register values for debugging reasons in binary form to terminal, but now I am tried simply to test that function with text.</p>
  
  <p>I am stuck, because of segfault when I am using pushq instead of pushl. How can I change this program to output strings and binary form of registers?</p>
  
  <pre><code>.data
  input_prompt:
      .string "Hello, world!"
  
  printf_format:
      .string "%5d "
  
  printf_newline:
      .string "\n"
  
  size:
      .long 0
  
  .text
  .globl main
  main:
      pushq $input_prompt
      call  printf
  
      movl  $0, %eax
      ret
  </code></pre>
  
  <p>It was compiled by GCC as:</p>
  
  <pre><code>gcc tmp.S -o tmp
  </code></pre>