% ------------------------------------------------------------------------------
% Copyright (c) 2019, 2026 Contributors to the Eclipse Foundation
%
% See the NOTICE file(s) distributed with this work for additional
% information regarding copyright ownership.
%
% This program and the accompanying materials are made available under the terms
% of the MIT License which is available at https://opensource.org/licenses/MIT
%
% SPDX-License-Identifier: MIT
% ------------------------------------------------------------------------------
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, arrows, automata, positioning, shapes, shapes.misc}
\usepackage[paperwidth=40in, paperheight=20in]{geometry}

\begin{document}
\pagestyle{empty}

\begin{tikzpicture}[
    auto,
    ->,
    node distance=5cm,
    every state/.style={ellipse, semithick, fill=black!5, minimum size=2cm, font=\Large},
    initial distance=1.2cm,
    every initial by arrow/.style={-{Stealth[scale=1.4]}},
    initial text=,
    transform shape,
    double distance=2pt,
    every loop/.style={min distance=10mm}
]

\node[label={[align=center]$\mathtt{yc} = 225$\\$\mathtt{sc} = 0$\\$\mathtt{ps} = 5$\\$\mathtt{given} = 0$\\$\mathtt{cha} = 0$}] (I) {};
\node[state, right=2cm of I] (A) {\emph{Paying}};
\node[state, right=5cm of A] (B) {\emph{Checking}};
\node[state, below of=B] (C) {\emph{Getting}};

\path[-{Stealth[scale=1.4]}]
    (I) edge[] node[align=center] {} (A)
    (A) edge[above,out=70,in=110] node[align=center] {\texttt{pfive}\\$\mathtt{yc} := \mathtt{yc} - 5$\\$\mathtt{sc} := \mathtt{sc} + 5$\\$\mathtt{given} := \mathtt{given} + 5$} (B)
    (A) edge[above,out=10,in=170] node[align=center] {\texttt{pten}\\$\mathtt{yc} := \mathtt{yc} - 10$\\$\mathtt{sc} := \mathtt{sc} + 10$\\$\mathtt{given} := \mathtt{given} + 10$} (B)
    (A) edge[above,out=-45,in=-135] node[align=center,xshift=4pt,yshift=8pt] {\texttt{ptwenty}\\$\mathtt{yc} := \mathtt{yc} - 20$\\$\mathtt{sc} := \mathtt{sc} + 20$\\$\mathtt{given} := \mathtt{given} + 20$} (B)
    (B) edge[above,out=-100,in=-80] node[align=center] {$\mathtt{given} < 45$\\\texttt{ask\_more}} (A)
    (B) edge[right] node[align=center] {$\mathtt{given} \geq 45$\\\texttt{get\_product}\\$\mathtt{ps} := \mathtt{ps} - 1$\\$\mathtt{cha} := \mathtt{given} - 45$} (C)
    (C) edge[below left,out=180,in=-90] node[align=center] {\texttt{deliver}\\$\mathtt{sc} := \mathtt{sc} - \mathtt{cha}$\\$\mathtt{yc} := \mathtt{yc} + \mathtt{cha}$\\$\mathtt{given} := 0$\\$\mathtt{cha} := 0$} (A)
;

\end{tikzpicture}
\end{document}
