;Paths64
;fasm Paths64.asm
;gcc Paths64.o -o Paths64



format elf64


section '.data'

P1 db 'Hallo, soldier, what path would you like to take? That of a lost ancient Romantic? Or do you like a somewhat skilled monster, bent on revenge? Enter 1 for Romantic, 2 for Revenge.',10,0
A1 db 'A bird falls from a cloud down towards the swamp. Do you jump to protect the creature or call a winged scout to dive and catch it? Enter 1 for Jump, 2 for Call.',10,0
A2 db 'A bird falls closer and closer towards the bottom of the swamp. It has wronged you. Do you go elsewhere? Or do you grab it and hope it learns its lesson? Enter 1 for elsewhere, 2 for grab.',10,0
B11 db 'Oh no, why did you jump? Now the bird is alarmed and uses its remaining power to fly away, faster to the depths. What does this mean for you? I wish I was stronger. Or I never knew my dangerous potential? Enter 1 for strengthening, 2 for Potential.',10,0
B12 db 'Oh no, why did you call the scout? Now the bird is alarmed and uses its remaining power to fly away, faster to the depths. What does this mean for you? I wish I was stronger. Or I never knew my dangerous potential.',10,0
B21 db "Oh no, why did you walk away? Now the bird sneaks up behind you, because it was displaying fake injury and stings your neck. What does this mean for you? I wish I was stronger. Or, that bird is clever, I'm gonna have it teach me. Enter 1 for stronger, 2 for clever.",10,0
B22 db "Oh no, why did you try to teach it? The bird is too stubborn, fails to hear you, and stings you and flees. What does this mean for you? I wish I was stronger. Or, that bird is clever, I'm gonna have it teach me. Enter 1 for stronger, 2 for clever.",10,0
C111 db "You have the ability to grow. Do you like to improve? Yes. Or No. Enter 1 for Yes, 2 for No.",10,0
C211 db "You have the ability to grow. Do you like to improve? Yes. Or No. Enter 1 for Yes, 2 for No.",10,0
C212 db 'The bird is in the distance and you watch. Many lessons can be gained from observations. Do you like to improve? Yes. Or, No. Enter 1 for Yes, 2 for No.',10,0
C121 db 'You have the ability to grow. Do you like to improve? Yes. Or No. Enter 1 for Yes, 2 for No.',10,0
C122 db 'You have the ability to grow more benevolent. Do you want this? Yes. Or No. Enter 1 for Yes, 2 for No.',10,0
C221 db 'You have the ability to grow. Do you like to improve? Yes. Or No. Enter 1 for Yes, 2 for No.',10,0
C222 db 'The bird is in the distance and you watch. Many lessons can be gained from observations. Do you like to improve? Yes. Or, No. Enter 1 for Yes, 2 for No.',10,0
C112 db "This side of you doesn't have many benefits for you down the road, except for your focus. You can use it when you grow. Do you like to improve? Yes. Or, No. Enter 1 for Yes, 2 for No.",10,0
D1111 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your wisdom to? Or do you simply stay content from having improved and sharing your lessons? Enter 1 for Rest, 2 for Shared.',10,0
D1112 db 'Too bad, your dreams are out of reach. Do you figure out how to gain a new path? Or, do you try to see the truth?',10,0
D2111 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your power to? Or do you simply get your revenge? Enter 1 for Rest, 2 for Revenge.',10,0
D2112 db "Too bad, your agenda is then halted as you don't care about pushing on. Do you figure out how to gain a new path? Or, do you try to see the truth?",10,0
D2121 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your power to? Or do you simply get your revenge? Enter 1 for Rest, 2 for Revenge.',10,0
D2122 db "Too bad, your agenda is then halted as you don't care about pushing on. Do you figure out how to gain a new path? Or, do you try to see the truth?",10,0
D1211 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your wisdom to? Or do you simply stay content from having improved and sharing your lessons? Enter 1 for Rest, 2 for Shared.',10,0
D1212 db 'Too bad, your dreams are out of reach. Do you figure out how to gain a new path? Or, do you try to see the truth?',10,0
D1221 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your wisdom to? Or do you simply stay content from having improved and sharing your lessons? Enter 1 for Rest, 2 for Shared.',10,0
D1222 db 'Too bad, your dreams are out of reach. Do you figure out how to gain a new path? Or, do you try to see the truth?',10,0
D2211 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your power to? Or do you simply get your revenge? Enter 1 for Rest, 2 for Revenge.',10,0
D2212 db "Too bad, your agenda is then halted as you don't care about pushing on. Do you figure out how to gain a new path? Or, do you try to see the truth?",10,0
D2222 db "Too bad, your agenda is then halted as you don't care about pushing on. Do you figure out how to gain a new path? Or, do you try to see the truth? Enter 1 for Gain, 2 for See.",10,0
D1121 db 'Now, you are set to be rewarded. Do you rest in the company of those you spread your wisdom to? Or do you simply stay content from having improved and sharing your lessons? Enter 1 for Rest, 2 for Shared.',10,0
D1122 db 'Too bad, your dreams are out of reach. Do you figure out how to gain a new path? Or, do you try to see the truth?',10,0
D2221 db 'Too bad, your dreams are out of reach. Do you figure out how to gain a new path? Or, do you try to see the truth?',10,0
E db 'It is done.',10,0
ONE dd '1',0
TWO dd '2',0
AnswerFormat db '%d',0


section '.bss' writable

Answers rb 2


section '.text' executable

extrn stdin
extrn fgets
extrn printf
extrn scanf
public main
        
main:
;Init
        push rbp
        mov rbp, rsp
;Opus
mov rdx, [stdin]

SectionP1:		;PRINT INITIAL MSG
mov rdi, P1
xor eax, eax
call printf

mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf

SectionCMP1:
cmp byte[Answers], 1
je SectionA1
cmp byte[Answers], 2
je SectionA2

SectionA1:
mov rdi, A1
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP2

SectionA2:
mov rdi, A2
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP3

SectionCMP2:
cmp byte[Answers], 1
je SectionB11
cmp byte[Answers], 2
je SectionB12

SectionCMP3:
cmp byte[Answers], 1
je SectionB21
cmp byte[Answers], 2
je SectionB22

SectionB11:
mov rdi, B11
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP4

SectionB12:
mov rdi, B12
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP5

SectionB21:
mov rdi, B21
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP6

SectionB22:
mov rdi, B22
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP7

SectionCMP4:
cmp byte[Answers], 1
je SectionC111
cmp byte[Answers], 2
je SectionC112

SectionCMP5:
cmp byte[Answers], 1
je SectionC121
cmp byte[Answers], 2
je SectionC122

SectionCMP6:
cmp byte[Answers], 1
je SectionC211
cmp byte[Answers], 2
je SectionC212

SectionCMP7:
cmp byte[Answers], 1
je SectionC221
cmp byte[Answers], 2
je SectionC222

SectionC111:
mov rdi, C111
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP8

SectionC112:
mov rdi, C112
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP9

SectionC121:
mov rdi, C121
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP10

SectionC122:
mov rdi, C122
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP11

SectionC211:
mov rdi, C211
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP12

SectionC212:
mov rdi, C212
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP13

SectionC221:
mov rdi, C221
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP14

SectionC222:
mov rdi, C222
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionCMP15

SectionCMP8:
cmp byte[Answers], 1
je SectionD1111
cmp byte[Answers], 2
je SectionD1112

SectionCMP9:
cmp byte[Answers], 1
je SectionD1121
cmp byte[Answers], 2
je SectionD1122

SectionCMP10:
cmp byte[Answers], 1
je SectionD1211
cmp byte[Answers], 2
je SectionD1212

SectionCMP11:
cmp byte[Answers], 1
je SectionD1221
cmp byte[Answers], 2
je SectionD1222

SectionCMP12:
cmp byte[Answers], 1
je SectionD2111
cmp byte[Answers], 2
je SectionD2112

SectionCMP13:
cmp byte[Answers], 1
je SectionD2121
cmp byte[Answers], 2
je SectionD2122

SectionCMP14:
cmp byte[Answers], 1
je SectionD2211
cmp byte[Answers], 2
je SectionD2212

SectionCMP15:
cmp byte[Answers], 1
je SectionD2221
cmp byte[Answers], 2
je SectionD2222

SectionD1111:
mov rdi, D1111
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1112:
mov rdi, D1112
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1121:
mov rdi, D1121
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1122:
mov rdi, D1122
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1211:
mov rdi, D1211
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1212:
mov rdi, D1111
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1221:
mov rdi, D1221
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD1222:
mov rdi, D1222
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2111:
mov rdi, D2111
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2112:
mov rdi, D2112
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2121:
mov rdi, D2121
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2122:
mov rdi, D2122
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2211:
mov rdi, D2211
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2212:
mov rdi, D2212
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2221:
mov rdi, D2221
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionD2222:
mov rdi, D2222
xor eax, eax
call printf
mov rsi, Answers
mov rdi, AnswerFormat
xor eax, eax
call scanf
jmp SectionE

SectionE:
mov rdi, E
xor eax, eax
call printf

;End
        mov rsp, rbp
        pop rbp
        ret

