static int thing ( int r , int c , int n , int basegood , int corn , int edg ) {
  if ( n <= basegood ) return 0 ;
  n -= basegood ;
  if ( n <= corn ) return 2 * n ;
  int result = 2 * corn ;
  n -= corn ;
  if ( n <= edg ) return result + 3 * n ;
  result += 3 * edg ;
  n -= edg ;
  return result + 4 * n ;
}

static int thing ( int r , int c , int n , int basegood , int corn , int edg ) { if ( n <= basegood ) return 0 ; n -= basegood ; if ( n <= corn ) return 2 * n ; int result = 2 * corn ; n -= corn ; if ( n <= edg ) return result + 3 * n ; result += 3 * edg ; n -= edg ; return result + 4 * n ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (decimal_integer_literal))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (binary_expression left: (decimal_integer_literal) right: (identifier)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (return_statement (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier)))) (expression_statement (assignment_expression left: (identifier) right: (identifier))) (return_statement (binary_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (identifier))))))