Examples of flattening code to create an R1CS
This sort of programming logic for the ZK SNARK systems can be developed into Arithmetic Circuits using Zokrates, a toolbox for zkSNARKs on Ethereum. It helps you use verifiable computation in your Decentralised Applications, from the specification of your program in a high-level language to generating proofs of computation to verifying those proofs in Solidity, the Smart Contract Langauge for Ethereum Blockchain. Please find a sample programming logic written for Zokrates below. 

Once you compile the code, you can proceed to the circuit setup. It creates a prover key and verification key. These keys are derived from a source of randomness, commonly referred to as “toxic waste”. Once it is generated, you can proceed to generate a Solidity contract which contains the generated verification key and a public function to verify a solution to the compiled program. Then you can compute a witness for the compiled program. A witness is a valid assignment of the variables, which include the results of the computation.

def main(field a, field b, field c) -&gt; (field):
    field result = 0
    result = if a + b &gt; c  then a + b else 1 fi
    result = if a + b &lt; c  then c else 1 fi
  return result