There are three sub contracts in a contract of guarantee.
For quick reference:
Mr Giver is Creditor, Mr. Taker is Principal Debtor, and Mr. Safe is Surety.
Here, Mr Giver has given a loan to Mr. Taker and Mr. Safe stands as guarantee for the transaction.
There are the three contracts involved.
Contract 1: (between Creditor and the principal Debtor)
Mr. Giver gives a loan to Mr. Taker.
Contract 2: (between Surety and principal debtor)
Mr. Safe agrees to stand guarantee to the transaction.
Contract 3: (between Surety and Creditor)
Mr. Safe agrees to pay the loan to Mr. Giver if Mr. Taker fails to repay the loan.