title: Impossible to debug assembler code due to segmentation faullt
body: <p>Here below I have a peace of code for two programs that cannot be debugged. Written in assembly language. Main point is that I need to debug it using DDD debugger. However, it displays "Segmentation Fault" in each case. I also tried to debug it in a simple way and with online debugger, but returns error meassage. Can someone help me with that?</p>
  
  <p>Code A)</p>
  
  <pre><code> #Program asmddd.s for debugging with ddd
  .global _start
  .text
  _start: movq $0x01289AB76EF34567, %rax
  movb $-1, %al
  movw $-1, %ax
  movl $-1, %eax
  movq $-1, %rax
  movq $0x01289AB76EF34567, %rbx
  movb $0xBB, %dl
  movb %dl, %bl
  movsbq %dl, %rbx
  movzbq %dl, %rbx
  movq $65535, %rbx
  addq %rbx, %rax
  subq %rax, %rbx
  negq %rbx
  subq %rbx, %rax
  movq $60000, %rsi
  movq $65535, %rdx
  movq %rsi, %rax
  imulq %rdx
  cqto
  idivq %rsi
  testq %rsi,%rdi
  jnz down1
  up1: cmpq %rsi,%rdi
  setl %al
  movzbq %al, %rax
  jmp down2
  down1: pushq %rax
  pushq %rbx
  popq %rax
  popq %rbx
  movq %rdi, %rax
  subq %rsi, %rax
  movq %rsi, %rdx
  subq %rdi, %rdx
  cmpq %rsi, %rdi
  cmovle %rdx, %rax
  cmp %rdx, %rax
  jz up1
  down2: xorq %rax, %rbx
  xorq %rbx, %rax
  xorq %rax, %rbx
  andq %rsi, %rax
  orq %rsi, %rax
  xorq %rax, %rax
  notq %rax
  negq %rax
  incq %rax
  decq %rax
  addq $99,%rax
  leaq (%rax, %rax, 8), %rax
  leaq (%rax, %rax,4), %rax
  salq $3, %rax
  negq %rax
  sarq %rax
  ret
  </code></pre>
  
  <p>Code B)</p>
  
  <pre><code>.global _start
  .data
  n: .quad 0x0000000000000008
  nfact: .quad 0x0000000000000000
  .text
  _start:
  movq n, %rbx
  movq %rbx,%rax
  call ffact
  movq $nfact, %rdi
  movq %rax, (%rdi)
  movq $60, %rax # system call 60 for exit
  xorq %rdi, %rdi # return code 0 syscall
  syscall
  ffact: cmpq $1, %rbx
  je L1
  decq %rbx
  pushq %rbx
  call ffact
  popq %rbx
  mulq %rbx
  L1: ret
  </code></pre>