title: Assembly check type in register
body: <p>I want to create a function in assembly that prints the value no matter what is in the %rsi register (The register the value is in)</p>
  <p>This is the code:</p>
  <pre><code>    .section __TEXT, __text
      .globl _print
  _print:
      pushq %rbp
      movq %rsp, %rbp
      leaq pr_String(%rip), %rdi
      movb $0, %al
      call _printf
      xorl %eax, %eax
      popq %rbp
      retq
  pr_String:
      .asciz &quot;%s&quot;
  pr_Int:
      .asciz &quot;%d&quot;
  str0:
      .asciz &quot;Hello, World!&quot;
  str1:
      .asciz &quot;\n&quot;
      .globl _main
  _main:
      pushq %rbp
      movq %rsp, %rbp
      leaq str0(%rip), %rax
      movq %rax, %rsi
      callq _print
      leaq str1(%rip), %rax
      movq %rax, %rsi #works
      #movq $3, %rsi should also work but it gives segmentation error
      callq _print
      xorl %eax, %eax
      popq %rbp
      retq
  .subsections_via_symbols
  </code></pre>
  <p>I have two strings called pr_String and pr_Int that I wan't to switch between however I don't know how.</p>
  <p>Help would be appreciated.</p>