static int merge ( int arr [ ] , int temp [ ] , int left , int mid , int right ) {
  int inv_count = 0 ;
  int i = left ;
  int j = mid ;
  int k = left ;
  while ( ( i <= mid - 1 ) && ( j <= right ) ) {
    if ( arr [ i ] <= arr [ j ] ) temp [ k ++ ] = arr [ i ++ ] ;
    else {
      temp [ k ++ ] = arr [ j ++ ] ;
      inv_count = inv_count + ( mid - i ) ;
    }
  }
  while ( i <= mid - 1 ) temp [ k ++ ] = arr [ i ++ ] ;
  while ( j <= right ) temp [ k ++ ] = arr [ j ++ ] ;
  for ( i = left ;
  i <= right ;
  i ++ ) arr [ i ] = temp [ i ] ;
  return inv_count ;
}

static int merge ( int arr [ ] , int temp [ ] , int left , int mid , int right ) { int inv_count = 0 ; int i = left ; int j = mid ; int k = left ; while ( ( i <= mid - 1 ) && ( j <= right ) ) { if ( arr [ i ] <= arr [ j ] ) temp [ k ++ ] = arr [ i ++ ] ; else { temp [ k ++ ] = arr [ j ++ ] ; inv_count = inv_count + ( mid - i ) ; } } while ( i <= mid - 1 ) temp [ k ++ ] = arr [ i ++ ] ; while ( j <= right ) temp [ k ++ ] = arr [ j ++ ] ; for ( i = left ; i <= right ; i ++ ) arr [ i ] = temp [ i ] ; return inv_count ; }
(method_declaration (modifiers) type: (integral_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier) dimensions: (dimensions)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (while_statement condition: (parenthesized_expression (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))))) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier))))) alternative: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier)))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (update_expression (identifier))) right: (array_access array: (identifier) index: (update_expression (identifier)))))) (for_statement init: (assignment_expression left: (identifier) right: (identifier)) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) (return_statement (identifier))))