I would start out by looking at this previous topic Good reference for Assembler here on stack overflow. From the sound of it you probably don't have much assembler experience and that's ok. Assembler is just a way of getting the cpu to understand what you want it to do.
before things can be explained you have to understand the convention of the use of the registers and what they all mean. for example the base pointer of the stack is saved at entry of a function (push rbp) so it can be restored when the function ends. in your c code you have
the start of the function defines a new stack frame with no parameters and a return result. we'll be returning a variable and it by convention will be returned in the A register (usually RAX).
Once RBP has been preserved the current stack pointer (RSP) is set to the base pointer RBP and things get manipulated from there. Think of the stack as just a structure of memory that has been pre-allocated for special computational use.
the instructions will bounce back and forth relative to the RBP to reference variables, (local, global, etc) as the function progresses and as needed.
Depending on the OS and chip, FS might be referring to a thread local storage block, or it might be referring to a memory segment on the cpu. Its dependent on your OS and architecture. the :40 is an offset into the segment or block.
typically, and it depends on your OS, when you see something like rbp-8 or whatever it means to take the current value of RBP and subtract 8 from it. however on some implementations and depending on where the scalar is placed it can mean take that many byte segments (words) as an offset from RBP and use that effective address.
that's all I have for now. I'd start with the other topic and go from there.
Or just run it in a debugger and look at the values of the registers as it moves through each step.