def ensure_stack_restore_count(function_name, expected_count):
    code = generated[generated.find(function_name):]
    code = code[:(code.find('\n}') + 2)]
    actual_count = code.count('STACKTOP = sp')
    assert (actual_count == expected_count), ((('Expected %d stack restorations, got %d' % (expected_count, actual_count)) + ': ') + code)
def ensure_stack_restore_count(function_name, expected_count):
    code = generated[generated.find(function_name):]
    code = code[:(code.find('\n}') + 2)]
    actual_count = code.count('STACKTOP = sp')
    assert (actual_count == expected_count), ((('Expected %d stack restorations, got %d' % (expected_count, actual_count)) + ': ') + code)