I'm trying to print the number of command line arguments that are present in an Assembly program in x86-64.
It's from my understanding that argument information is stored on the stack.
I feel like I'm missing something fundamental on how to retrieve items stored from the stack but I don't know exactly what.
.file "args.s"
.globl main
.type main, @function
.section .data
format_string:
  .string "Argument: %s\n"
.section .text
main:
  pushq %rbp
  movq %rsp, %rbp
  popq %rsp                   ; get argc
  movq %rsp, %rdi             ; move argc to rdi, first parameter register
  movq $format_string, %rdi   ; pass in the string to be used and give the parameter
  call printf                 
  leave
  ret
.size main, .-main 

 
     
    