Farooq Karimi Zadeh

I am trying to calculate factorial of 30 using x86_64 assembly on Linux. Here's my code:

```
.global _start

.text
_start:
mov %RCX, 1 # counter
mov %RAX, 1 # factorial result
loop:
mul %RCX
inc %RCX
cmp %RCX, n
jle loop

.data
n: .byte 30

```

I am converting it using these two commands:

```
as file.s
ldd file.s -o a
```

However when running the executable `a`, segmention fault is raised. checking with gdb it seems that it is raised right at the first instruction after `_start`. Where am I wrong?

#asm #assembly #x86 #x86_64 #linux #debugging #programming #segfault #segmention_fault