Buggy code:
protected void receiveBlockArg ( Variable v , Operand argsArray , int argIndex , boolean isSplat ) { } public void buildVersionSpecificBlockArgsAssignment ( Node node ) { } public void buildBlockArgsAssignment ( Node node , Operand argsArray , int argIndex , boolean isSplat ) { } public Operand buildAlias ( final AliasNode alias ) { } public Operand buildAnd ( final AndNode andNode ) { } public Operand buildArray ( Node node ) { } public Operand buildArgsCat ( final ArgsCatNode argsCatNode ) { } public Operand buildArgsPush ( final ArgsPushNode node ) { } private Operand buildAttrAssign ( final AttrAssignNode attrAssignNode ) { } public Operand buildAttrAssignAssignment ( Node node , Operand value ) { } public Operand buildBackref ( BackRefNode node ) { } public Operand buildBegin ( BeginNode beginNode ) { } public Operand buildBignum ( BignumNode node ) { } public Operand buildBlock ( BlockNode node ) { } public Operand buildBreak ( BreakNode breakNode ) { } private void handleNonlocalReturnInMethod ( ) { } private Operand receiveBreakException ( Operand block , IRBuilder . CodeBlock codeBlock ) { } private void receiveBreakException ( Operand block , final CallInstr callInstr ) { } public Operand buildCall ( CallNode callNode ) { } public Operand buildCase ( CaseNode caseNode ) { } public Operand buildClass ( ClassNode classNode ) { } public Operand buildSClass ( SClassNode sclassNode ) { } public Operand buildClassVar ( ClassVarNode node ) { } private Variable addResultInstr ( ResultInstr instr ) { } public Operand buildClassVarAsgn ( final ClassVarAsgnNode classVarAsgnNode ) { } public Operand buildClassVarDecl ( final ClassVarDeclNode classVarDeclNode ) { } public Operand classVarDeclarationContainer ( ) { } public Operand classVarDefinitionContainer ( ) { } public Operand classVarContainer ( boolean declContext ) { } public Operand buildConstDecl ( ConstDeclNode node ) { } private Operand findContainerModule ( ) { } private Operand startingSearchScope ( ) { } public Operand buildConstDeclAssignment ( ConstDeclNode constDeclNode , Operand val ) { } private void genInheritanceSearchInstrs ( Operand startingModule , Variable constVal , Label foundLabel , boolean noPrivateConstants , String name ) { } private Operand searchConstInInheritanceHierarchy ( Operand startingModule , String name ) { } private Operand searchConst ( String name ) { } public Operand buildColon2 ( final Colon2Node iVisited ) { } public Operand buildColon3 ( Colon3Node node ) { } public Operand buildComplex ( ComplexNode node ) { } interface CodeBlock { public Operand run ( ) { } } private Operand protectCodeWithRescue ( IRBuilder . CodeBlock protectedCode , IRBuilder . CodeBlock rescueBlock ) { } public Operand buildGetDefinition ( Node node ) { } protected Variable buildDefnCheckIfThenPaths ( Label undefLabel , Operand defVal ) { } protected Variable buildDefinitionCheck ( ResultInstr definedInstr , String definedReturnValue ) { } public Operand buildGetArgumentDefinition ( final Node node , String type ) { } public Operand buildDAsgn ( final DAsgnNode dasgnNode ) { } protected void defineMethodInner ( MethodDefNode defNode , IRScope parent ) { } private IRMethod defineNewMethod ( MethodDefNode defNode , boolean isInstanceMethod ) { } public Operand buildDefn ( MethodDefNode node ) { } public Operand buildDefs ( DefsNode node ) { } protected LocalVariable getArgVariable ( String name , int depth ) { } private void addArgReceiveInstr ( Variable v , int argIndex , boolean post , int numPreReqd , int numPostRead ) { } public void receiveRequiredArg ( Node node , int argIndex , boolean post , int numPreReqd , int numPostRead ) { } protected void receiveNonBlockArgs ( final ArgsNode argsNode ) { final int numPreReqd = argsNode . getPreCount ( ) ; final int numPostReqd = argsNode . getPostCount ( ) ; <START_BUG> final int required = argsNode . getRequiredArgsCount ( ) ; <END_BUG> int opt = argsNode . getOptionalArgsCount ( ) ; int rest = argsNode . getRestArg ( ) ; scope . getStaticScope ( ) . setArities ( required , opt , rest ) ; KeywordRestArgNode keyRest = argsNode . getKeyRest ( ) ; if ( ( scope ) instanceof IRMethod ) { addInstr ( new CheckArityInstr ( required , opt , rest , argsNode . hasKwargs ( ) , ( keyRest == null ? - 1 : keyRest . getIndex ( ) ) ) ) ; } else if ( ( ( scope ) instanceof IRClosure ) && ( argsNode . hasKwargs ( ) ) ) { addInstr ( new CheckArityInstr ( required , opt , rest , argsNode . hasKwargs ( ) , ( keyRest == null ? - 1 : keyRest . getIndex ( ) ) ) ) ; } int argIndex = 0 ; ListNode preArgs = argsNode . getPre ( ) ; for ( int i = 0 ; i < numPreReqd ; i ++ , argIndex ++ ) { receiveRequiredArg ( preArgs . get ( i ) , argIndex , false , ( - 1 ) , ( - 1 ) ) ; } opt = ( opt > 0 ) ? opt : 0 ; rest = ( rest > ( - 1 ) ) ? 1 : 0 ; if ( opt > 0 ) { ListNode optArgs = argsNode . getOptArgs ( ) ; for ( int j = 0 ; j < opt ; j ++ , argIndex ++ ) { Label l = getNewLabel ( ) ; OptArgNode n = ( ( OptArgNode ) ( optArgs . get ( j ) ) ) ; String argName = n . getName ( ) ; Variable av = getNewLocalVariable ( argName , 0 ) ; if ( ( scope ) instanceof IRMethod ) ( ( IRMethod ) ( scope ) ) . addArgDesc ( opt , argName ) ; addInstr ( new ReceiveOptArgInstr ( av , required , numPreReqd , j ) ) ; addInstr ( BNEInstr . create ( av , UNDEFINED , l ) ) ; build ( n . getValue ( ) ) ; addInstr ( new LabelInstr ( l ) ) ;

Fix:
final int required = ( argsNode . getRequiredArgsCount ( ) ) + ( argsNode . getRequiredKeywordCount ( ) ) ;