from __future__ import annotations

import gc
import os
import time

import pytest
from inference.core.workflows.core_steps.sinks.s3.v1 import deduct_csv_header


def codeflash_wrap(codeflash_wrapped, codeflash_test_module_name, codeflash_test_class_name, codeflash_test_name, codeflash_function_name, codeflash_line_id, codeflash_loop_index, *args, **kwargs):
    test_id = f'{codeflash_test_module_name}:{codeflash_test_class_name}:{codeflash_test_name}:{codeflash_line_id}:{codeflash_loop_index}'
    if not hasattr(codeflash_wrap, 'index'):
        codeflash_wrap.index = {}
    if test_id in codeflash_wrap.index:
        codeflash_wrap.index[test_id] += 1
    else:
        codeflash_wrap.index[test_id] = 0
    codeflash_test_index = codeflash_wrap.index[test_id]
    invocation_id = f'{codeflash_line_id}_{codeflash_test_index}'
    test_stdout_tag = f"{codeflash_test_module_name}:{(codeflash_test_class_name + '.' if codeflash_test_class_name else '')}{codeflash_test_name}:{codeflash_function_name}:{codeflash_loop_index}:{invocation_id}"
    print(f'!$######{test_stdout_tag}######$!')
    exception = None
    gc.disable()
    try:
        counter = time.perf_counter_ns()
        return_value = codeflash_wrapped(*args, **kwargs)
        codeflash_duration = time.perf_counter_ns() - counter
    except Exception as e:
        codeflash_duration = time.perf_counter_ns() - counter
        exception = e
    gc.enable()
    print(f'!######{test_stdout_tag}:{codeflash_duration}######!')
    if exception:
        raise exception
    return return_value

def test_basic_two_line_csv():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test basic CSV with header and one data row.'
    content = 'name,age\nJohn,30'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_basic_two_line_csv', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_basic_three_line_csv():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test basic CSV with header and two data rows.'
    content = 'id,name,value\n1,Alice,100\n2,Bob,200'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_basic_three_line_csv', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_multiple_rows_with_various_data():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with multiple rows containing different data types.'
    content = 'col1,col2,col3\nval1,val2,val3\nval4,val5,val6\nval7,val8,val9'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_multiple_rows_with_various_data', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_single_column_csv():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with only a single column.'
    content = 'header\ndata1\ndata2'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_single_column_csv', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_csv_with_numeric_header():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV where header contains numbers.'
    content = '1,2,3\n10,20,30\n40,50,60'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_csv_with_numeric_header', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_csv_with_spaces_in_data():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with spaces in data values.'
    content = 'first name,last name\nJohn Doe,Jane Smith\nBob Johnson,Alice Williams'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_csv_with_spaces_in_data', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_csv_with_special_characters():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV containing special characters in data.'
    content = 'name,email\nJohn,john@example.com\nAlice,alice@test.org'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_csv_with_special_characters', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_empty_string():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with completely empty string input.'
    content = ''
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_empty_string', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_single_line_only():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with only header line, no data rows.'
    content = 'header'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_single_line_only', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_header_with_trailing_newline():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with trailing newline after header.'
    content = 'header\n'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_header_with_trailing_newline', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_single_data_row_with_trailing_newline():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with one data row and trailing newline.'
    content = 'header\ndata\n'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_single_data_row_with_trailing_newline', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_multiple_trailing_newlines():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with multiple trailing newlines.'
    content = 'header\ndata1\ndata2\n\n'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_multiple_trailing_newlines', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_header_with_commas_only():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test header that is only commas.'
    content = ',,,\ndata1,data2,data3'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_header_with_commas_only', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_empty_data_cells():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with empty cells in data rows.'
    content = 'col1,col2,col3\n,,\nval1,,val3'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_empty_data_cells', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_data_row_with_only_commas():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test data row that contains only commas.'
    content = 'header1,header2,header3\n,,,,'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_data_row_with_only_commas', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_unicode_characters_in_data():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with unicode characters.'
    content = 'name,city\nJosé,São Paulo\nMüller,München'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_unicode_characters_in_data', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_tabs_as_delimiters():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with tab-delimited data (tabs are preserved).'
    content = 'col1\tcol2\tcol3\nval1\tval2\tval3'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_tabs_as_delimiters', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_quoted_values_with_newlines():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with quoted values (function treats as regular commas).'
    content = 'name,description\nItem,"A simple item"'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_quoted_values_with_newlines', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_carriage_return_characters():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test content with carriage returns (treated as part of content).'
    content = 'header\r\ndata1\r\ndata2'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_carriage_return_characters', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_very_long_header_row():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with extremely long header row.'
    long_header = ','.join([f'col{i}' for i in range(100)])
    content = long_header + '\ndata_value'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_very_long_header_row', 'deduct_csv_header', '3', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_very_long_data_row():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with extremely long data row.'
    long_data = ','.join([f'val{i}' for i in range(100)])
    content = 'header\n' + long_data
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_very_long_data_row', 'deduct_csv_header', '3', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_numeric_data_with_decimals():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with numeric decimal data.'
    content = 'value1,value2\n1.5,2.7\n3.14,2.71'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_numeric_data_with_decimals', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_negative_numbers():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with negative numbers.'
    content = 'num1,num2\n-10,-20\n-5.5,-3.3'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_negative_numbers', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_boolean_like_values():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with boolean-like string values.'
    content = 'active,enabled\nTrue,False\nFalse,True'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_boolean_like_values', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_null_like_strings():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with null-like string representations.'
    content = 'value1,value2\nNULL,None\n,N/A'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_null_like_strings', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_whitespace_only_data():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with whitespace-only data cells.'
    content = 'col1,col2\n   ,\t\t'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_whitespace_only_data', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_header_only_newline():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with header followed immediately by newline, nothing else.'
    content = 'header\n'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_header_only_newline', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_multiple_consecutive_newlines_in_middle():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with multiple consecutive newlines creating empty lines.'
    content = 'header\ndata1\n\ndata2'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_multiple_consecutive_newlines_in_middle', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_row_with_only_spaces():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test data row that contains only spaces.'
    content = 'header\n   '
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_row_with_only_spaces', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_mixed_line_endings_simulation():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test that function only splits on newline character.'
    content = 'header;data1\ndata2;data3'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_mixed_line_endings_simulation', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_large_number_of_rows():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with 1000+ data rows.'
    rows = ['header']
    for i in range(1000):
        rows.append(f'row{i},value{i}')
    content = '\n'.join(rows)
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_large_number_of_rows', 'deduct_csv_header', '4', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_large_number_of_columns():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with 500+ columns.'
    header = ','.join([f'col{i}' for i in range(500)])
    data_row1 = ','.join([f'val{i}' for i in range(500)])
    data_row2 = ','.join([f'data{i}' for i in range(500)])
    content = header + '\n' + data_row1 + '\n' + data_row2
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_large_number_of_columns', 'deduct_csv_header', '5', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_large_csv_both_dimensions():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV with 500 rows and 100 columns.'
    header = ','.join([f'col{i}' for i in range(100)])
    rows = [header]
    for row_num in range(500):
        row = ','.join([f'r{row_num}c{col}' for col in range(100)])
        rows.append(row)
    content = '\n'.join(rows)
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_large_csv_both_dimensions', 'deduct_csv_header', '5', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_very_long_single_row():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with one extremely long data row.'
    header = 'data'
    long_value = 'x' * 10000
    content = header + '\n' + long_value
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_very_long_single_row', 'deduct_csv_header', '4', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_many_empty_rows():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test with many consecutive empty rows (just newlines).'
    rows = ['header'] + [''] * 100 + ['data']
    content = '\n'.join(rows)
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_many_empty_rows', 'deduct_csv_header', '3', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_large_csv_with_special_chars():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test large CSV where each cell contains special characters.'
    header = 'id,text'
    rows = [header]
    for i in range(100):
        row = f"{i},text@#$%^&*()_+-=[]{{}}|;:',<>?/{i}"
        rows.append(row)
    content = '\n'.join(rows)
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_large_csv_with_special_chars', 'deduct_csv_header', '5', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_large_csv_with_unicode():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test large CSV with unicode characters.'
    header = 'index,name,city'
    rows = [header]
    cities = ['São Paulo', 'München', 'Beijing', 'Москва', '東京', 'Αθήνα']
    for i in range(100):
        city = cities[i % len(cities)]
        rows.append(f'{i},Name{i},{city}')
    content = '\n'.join(rows)
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_large_csv_with_unicode', 'deduct_csv_header', '6', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_performance_with_many_splits():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test that function efficiently handles content requiring many split operations.'
    rows = []
    header = ','.join([f'h{i}' for i in range(50)])
    rows.append(header)
    for row_idx in range(1000):
        row = ','.join([f'r{row_idx}c{col}' for col in range(50)])
        rows.append(row)
    content = '\n'.join(rows)
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_performance_with_many_splits', 'deduct_csv_header', '6', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_return_type_is_string():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Verify that the function always returns a string type.'
    content = 'header\ndata'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_return_type_is_string', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output

def test_function_preserves_order():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Verify that row order is preserved.'
    content = 'header\nfirst\nsecond\nthird\nfourth'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_function_preserves_order', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output
    lines = result.split('\n')

def test_single_character_rows():
    codeflash_loop_index = int(os.environ['CODEFLASH_LOOP_INDEX'])
    'Test CSV where each row is just a single character.'
    content = 'H\na\nb\nc'
    codeflash_return_value = codeflash_wrap(deduct_csv_header, 'tests.inference.unit_tests.test_deduct_csv_header__unit_test_1', None, 'test_single_character_rows', 'deduct_csv_header', '2', codeflash_loop_index, content)
    codeflash_output = codeflash_return_value
    result = codeflash_output