Starter/main.c #include #include int** matMult(int **a, int num_rows_a, int num_cols_a, int** b, int num_rows_b, int num_cols_b); void displayMat(int** mat, int num_rows, int num_cols); void...

2 answer below »
I've attached the starter code and the instructions below.


Starter/main.c #include #include int** matMult(int **a, int num_rows_a, int num_cols_a, int** b, int num_rows_b, int num_cols_b); void displayMat(int** mat, int num_rows, int num_cols); void readMat(const char* file_name, int*** mat, int* num_rows, int* num_cols); void displayMat(int** mat, int num_rows, int num_cols){ //display the contents of the 2D matrix to the scren //@mat: the matrix to be displayed //@num_rows: the number of rows in the matrix //@num_cols: the number of columns in the matrix int i,j; for(i = 0; i < num_rows;="" i++){//for="" each="" row="" for(j="0;" j="">< num_cols;="" j++){="" for="" each="" column="" printf("%d="" ",="" mat[i][j]);="" display="" the="" value="" }="" printf("\n");="" }="" }//displaymat="" void="" readmat(const="" char*="" file_name,="" int***="" mat,="" int*="" num_rows,="" int*="" num_cols){="" read="" in="" a="" file="" that="" contains="" a="" matrix="" format="" of="" file="" is="" number="" of="" rows="" number="" of="" columns="" values="" separated="" by="" white="" space="" @file_name:="" the="" name="" of="" the="" file="" containing="" the="" matrix="" @mat:="" the="" matrix="" to="" be="" intialized="" from="" the="" file.="" space="" will="" be="" allocated="" for="" it="" inside="" the="" function="" @num_rows:="" the="" number="" of="" rows="" in="" the="" matrix.="" intialized="" by="" this="" function="" @num_cols:="" the="" number="" of="" columns="" in="" the="" matrix.="" intialized="" by="" this="" function="" int="" i,j;="" file="" *fptr;="" fptr="fopen(file_name," "r");="" open="" the="" file="" read="" in="" the="" dimensions="" fscanf(fptr,="" "%d",="" num_rows);="" fscanf(fptr,="" "%d",="" num_cols);="" make="" space="" for="" mat="" *mat="(int**)malloc(*num_rows" *="" sizeof(int*));="" for(i="0;" i="">< *num_rows;="" i++){="" (*mat)[i]="(int*)malloc(*num_cols" *="" sizeof(int));="" }="" initialize="" mat="" for(i="0;" i="">< *num_rows;="" i++){="" for(j="0;" j="">< *num_cols;="" j++){="" fscanf(fptr,="" "%d",="" &((*mat)[i][j]));="" }//for="" each="" row="" }//for="" each="" column="" fclose(fptr);//="" close="" the="" file="" }//readmat="" int="" main(int="" argc,="" char="" **argv){="" int**="" mat_a;="" int**="" mat_b;="" int**="" mat_c;="" int="" rows_mat_a,="" cols_mat_a,="" rows_mat_b,="" cols_mat_b;="" int="" i;="" if(argc="">< 3){="" printf("matmult.out="" matrix_a_file="" matrix_b_file\n");="" printf("not="" enough="" arguments="" given.n");="" return(1);="" }="" read="" in="" matrices="" readmat(argv[1],="" &mat_a,="" &rows_mat_a,="" &cols_mat_a);="" readmat(argv[2],="" &mat_b,="" &rows_mat_b,="" &cols_mat_b);="" do="" the="" multiplication="" mat_c="matMult(mat_a," rows_mat_a,="" cols_mat_a,="" mat_b,="" rows_mat_b,="" cols_mat_b);="" display="" solution="" displaymat(mat_c,="" rows_mat_a,="" cols_mat_b);="" free="" up="" malloced="" space="" for(i="0;" i="">< rows_mat_a;="" i++){="" free(mat_a[i]);="" }="" for(i="0;" i="">< rows_mat_b;="" i++){="" free(mat_b[i]);="" }="" for(i="0;" i="">< rows_mat_a; i++){ free(mat_c[i]); } free(mat_a); free(mat_b); free(mat_c); return 0; }//main starter/makefile matmult.out: main.o matmult.o gcc -g -m32 -wall -o matmult.out main.o matmult.o matmult.o: matmult.s gcc -g -m32 -wall -c -o matmult.o matmult.s #-wa,-alms main.o: main.c gcc -g -m32 -wall -c -o main.o main.c clean: rm -f main.o matmult.o matmult.out starter/matmult.s starter/tests/mata/0-test.txt 3 3 470 -192 -539 235 -814 -538 -503 -418 541 starter/tests/mata/1-test.txt 4 4 914 -387 723 -270 -96 -995 0 -245 -204 493 -158 650 560 978 -964 -994 starter/tests/mata/2-test.txt 5 2 267 -994 -426 -681 770 407 892 -915 337 726 starter/tests/mata/3-test.txt 10 10 -45 -188 344 -423 167 978 548 691 -563 891 618 715 -892 -979 810 593 -550 -762 -656 -830 14 -471 710 835 391 953 135 -29 337 -430 -102 -593 516 200 -83 714 -878 664 324 588 -894 954 993 624 -978 993 -240 998 86 -458 -85 -291 -926 379 -544 -239 808 122 747 503 617 -327 -848 638 -3 -742 -740 93 -947 929 381 -429 -903 205 -673 -992 483 -39 857 -782 -973 -572 -879 389 102 -146 854 870 -732 -508 -572 54 -128 -512 239 460 506 -336 -455 672 starter/tests/mata/4-test.txt 20 15 -906 518 587 -422 -630 277 164 977 805 361 7 151 255 503 523 454 487 -428 -154 685 -69 425 -927 -407 445 -164 545 826 363 -782 -86 508 -109 635 99 -702 962 83 -907 428 -831 810 546 404 427 873 919 -521 -979 65 -269 -126 560 -317 -481 381 -280 -641 751 -727 897 -962 -328 627 73 -584 -109 -876 -601 -924 -5 -881 -589 496 51 -31 -7 350 -171 796 -640 9 37 -891 -627 -114 972 -699 452 -644 862 -861 412 -255 774 251 585 614 470 432 670 -19 21 379 -836 929 -813 -226 496 683 -967 663 437 -738 -735 -71 714 284 874 -521 -991 69 597 581 426 -56 -237 -279 611 -439 177 -976 847 610 -246 225 941 601 655 261 -150 875 -757 -3 -259 472 -252 111 -119 -272 -756 910 388 163 -191 771 659 -846 586 -654 -101 120 -20 212 -57 913 323 955 122 875 -667 703 409 -103 129 65 -559 -761 -70 0 888 791 10 429 -41 -683 964 735 349 -63 -449 -217 -68 -606 -960 -180 -593 -708 -389 -519 364 -133 -955 -82 -171 40 596 92 -506 -162 -598 711 944 -499 378 49 -745 -485 -162 25 -278 370 658 138 -943 -22 -186 -101 -557 -809 599 -319 816 -252 -308 962 733 624 -496 -748 4 828 834 -489 142 315 148 -379 -492 799 489 -592 143 548 337 310 221 -47 797 42 234 -314 363 519 -864 38 401 -820 756 -725 100 -410 -209 970 -813 -929 637 725 68 -645 798 -938 -262 50 3 771 64 999 504 -967 965 726 452 -68 469 752 -906 151 -220 467 starter/tests/mata/5-test.txt 30 17 -219 -326 667 -971 -219 -416 -948 -1 297 -837 757 92 607 -788 927 395 -900 -602 -398 -371 -847 22 353 -150 842 176 -787 -914 370 -773 -810 623 147 43 -761 465 -229 665 800 -318 -220 -7 -809 -878 -395 -124 710 781 885 213 -862 -860 -630 -311 -707 223 -428 218 -645 -681 224 -57 188 447 958 -941 833 -762 204 695 -788 179 -419 -437 -858 -810 -557 -420 -671 -904 -240 -925 796 506 -748 487 -252 894 -30 845 -241 -985 -168 558 989 -181 -393 -757 -118 865 -52 -535 -52 -7 -632 -62 240 253 356 -768 908 380 -755 -2 -1 312 -787 365 -622 692 200 987 348 -87 -244 -39 -796 253 -380 637 -719 -357 -9 -593 -44 116 -371 -286 435 -279 -925 -578 170 -22 -487 669 253 -950 135 -668 -206 -642 -913 -934 76 -738 -100 768 -923 -535 95 418 -194 -375 -830 -445 850 866 940 -754 513 -662 -655 -72 718 -951 905 -205 527 -19 -268 -514 -776 -512 -405 -283 -452 -873 903 -775 -562 -547 -328 -206 852 270 -134 117 704 -148 517 698 -356 -513 -30 995 -494 -795 -231 -164 721 956 -690 -848 47 -304 541 -297 -508 800 -881 -464 -999 -381 889 -71 583 614 365 428 -742 520 112 -971 -251 -438 966 -576 779 -77 511 -167 195 665 826 -507 167 -510 -611 217 51 -559 -521 37 -775 228 -873 824 891 832 174 53 873 -750 857 -150 463 84 231 -430 714 -635 308 -17 -78 -270 721 620 -327 839 29 75 -294 940 -592 887 -830 -920 739 -671 -936 509 -50 -712 -933 159 851 268 -539 -840 -893 -183 -803 -185 173 508 -500 805 -571 240 -17 -220 -703 728 -186 -903 -828 -171 150 -396 21 571 995 -190 -476 403 800 101 198 -186 -182 632 235 712 548 762 765 -483 659 768 320 685 -462 -706 -601 -974 443 623 374 -426 174 566 958 -546 611 370 -289 96 -132 -708 -642 -464 893 625 -10 775 -307 -258 -927 -510 -381 -426 124 995 -381 -226 161 -184 972 984 770 256 407 675 -358 2 -828 -148 348 496 -518 -325 437 10 -466 178 -476 12 200 455 243 855 304 279 -788 -744 968 368 -608 99 609 872 -833 253 -339 -254 261 -97 -126 710 201 756 -342 -253 -831 -527 634 592 13 758 894 341 619 578 203 -778 214 685 50 -392 696 -90 314 -57 -381 563 -221 194 -167 26 -905 -138 -543 -452 543 265 923 358 849 565 -942 -351 -693 -846 -263 -427 896 351 -952 -353 871 -752 -276 -23 -609 722 -38 237 -131 832 -520 -360 729 -981 -788 -293 825 795 -720 101 432 633 567 -364 64 51 430 -529 -214 -44 695 513 634 934 -907 449 219 -833 901 400 starter/tests/mata/6-test.txt 5 19 52 61 598 -952 -302 -332 -27 -463 357 -614 90 -265 -70 -423 -548 699 337 617 632 -400 -950 -754 638 -360 -211 -738 42 -60 -739 412 139 119 -548 -637 -355 -740 799 1 -443 228 412 4 -326 -324 897 196 -912 -486 484 -904 -650 6 251 -766 -362 -29 905 647 123 338 403 -599 -454 -590 418 -643 -432 -769 -523 -369 539 923 711 781 641 751 396 535 -732 599 397 263 -623 -311 -416 -332 729 -416 -324 -398 672 -155 -709 880 -896 starter/tests/mata/7-test.txt 25 50 -816 -953 270 -208 953 -404 332 -825 401 -484 768 -487 -298 305 374 743 -498 860 -321 -402 -267 24 -897 62 657 952 -448 -387 484 -248 264 -729 516 616 -673 751 -272 450 -858 -308 -535 515 -355 822 337 -242 86 -92 848 -509 192 61 555 965 -70 -272 783 673 -617 -777 219 -910 -702 780 -303 297 102 772 -363 809 563 805 282 740 168 -770 -822 448 -555 681 -683 613 912 -497 -845 -197 -184 -86 874 -506 748 -622 855 -505 421 652 56 223 -965 -315 -565 449 893 -958 985 -86 716 -514 -599 655 -298 -822 -494 -621 -791 -353 662 397 544 569 204 531 -351 260 434 930 121 -643 -819 75 -245 267 453 -643 -112 192 135 -234 792 -728 -916 -793 933 -628 808 11 153 351 67 -519 -661 626 -32 -408 746 -235 -86 834 -787 -658 -597 -316 346 -166 182 611 252 662 677 125 -56 458 901 758 60 564 -942 -785 968 607 -562 345 -952 434 -775 -2 -322 903 47 284 -781 408 704 -292 317 -450 802 -499 359 -61 -59 488 -796 -543 401 616 616 -659 596 -797 -503 695 539 -825 708 39 -290 230 236 -850 255 -761 -512 571 -102 -957 557 46 -525 884 875 -901 -872 -495 351 694 -735 -801 -23 507 328 144 -853 -751 629 96 209 -634 -600 744 -375 -787 350 -869 -699 122 601 324 -254 483 -998 112 -892 -961 405 188 835 868 796 311 -125 -242 694 -808 -351 136 -897 -537 879 547 -318 -933 -419 -321 257 486 -314 -4 -9 -702 150 290 237 -112 770 971 -664 -957 452 -55 389 -78 632 -541 -702 491 -66 67 880 277 -185 371 367 814 847 29 843 597 -517 -647 -860 995 -800 318 -517 -912 913 51 92 127 492 938 344 661 -285 915 327 948 514 -558 -919 309 -377 65 -530 87 -819 -337 901 401 -583 -631 569 -155 437 -689 -573 -629 836 -305 306 rows_mat_a;="" i++){="" free(mat_c[i]);="" }="" free(mat_a);="" free(mat_b);="" free(mat_c);="" return="" 0;="" }//main="" starter/makefile="" matmult.out:="" main.o="" matmult.o="" gcc="" -g="" -m32="" -wall="" -o="" matmult.out="" main.o="" matmult.o="" matmult.o:="" matmult.s="" gcc="" -g="" -m32="" -wall="" -c="" -o="" matmult.o="" matmult.s="" #-wa,-alms="" main.o:="" main.c="" gcc="" -g="" -m32="" -wall="" -c="" -o="" main.o="" main.c="" clean:="" rm="" -f="" main.o="" matmult.o="" matmult.out="" starter/matmult.s="" starter/tests/mata/0-test.txt="" 3="" 3="" 470="" -192="" -539="" 235="" -814="" -538="" -503="" -418="" 541="" starter/tests/mata/1-test.txt="" 4="" 4="" 914="" -387="" 723="" -270="" -96="" -995="" 0="" -245="" -204="" 493="" -158="" 650="" 560="" 978="" -964="" -994="" starter/tests/mata/2-test.txt="" 5="" 2="" 267="" -994="" -426="" -681="" 770="" 407="" 892="" -915="" 337="" 726="" starter/tests/mata/3-test.txt="" 10="" 10="" -45="" -188="" 344="" -423="" 167="" 978="" 548="" 691="" -563="" 891="" 618="" 715="" -892="" -979="" 810="" 593="" -550="" -762="" -656="" -830="" 14="" -471="" 710="" 835="" 391="" 953="" 135="" -29="" 337="" -430="" -102="" -593="" 516="" 200="" -83="" 714="" -878="" 664="" 324="" 588="" -894="" 954="" 993="" 624="" -978="" 993="" -240="" 998="" 86="" -458="" -85="" -291="" -926="" 379="" -544="" -239="" 808="" 122="" 747="" 503="" 617="" -327="" -848="" 638="" -3="" -742="" -740="" 93="" -947="" 929="" 381="" -429="" -903="" 205="" -673="" -992="" 483="" -39="" 857="" -782="" -973="" -572="" -879="" 389="" 102="" -146="" 854="" 870="" -732="" -508="" -572="" 54="" -128="" -512="" 239="" 460="" 506="" -336="" -455="" 672="" starter/tests/mata/4-test.txt="" 20="" 15="" -906="" 518="" 587="" -422="" -630="" 277="" 164="" 977="" 805="" 361="" 7="" 151="" 255="" 503="" 523="" 454="" 487="" -428="" -154="" 685="" -69="" 425="" -927="" -407="" 445="" -164="" 545="" 826="" 363="" -782="" -86="" 508="" -109="" 635="" 99="" -702="" 962="" 83="" -907="" 428="" -831="" 810="" 546="" 404="" 427="" 873="" 919="" -521="" -979="" 65="" -269="" -126="" 560="" -317="" -481="" 381="" -280="" -641="" 751="" -727="" 897="" -962="" -328="" 627="" 73="" -584="" -109="" -876="" -601="" -924="" -5="" -881="" -589="" 496="" 51="" -31="" -7="" 350="" -171="" 796="" -640="" 9="" 37="" -891="" -627="" -114="" 972="" -699="" 452="" -644="" 862="" -861="" 412="" -255="" 774="" 251="" 585="" 614="" 470="" 432="" 670="" -19="" 21="" 379="" -836="" 929="" -813="" -226="" 496="" 683="" -967="" 663="" 437="" -738="" -735="" -71="" 714="" 284="" 874="" -521="" -991="" 69="" 597="" 581="" 426="" -56="" -237="" -279="" 611="" -439="" 177="" -976="" 847="" 610="" -246="" 225="" 941="" 601="" 655="" 261="" -150="" 875="" -757="" -3="" -259="" 472="" -252="" 111="" -119="" -272="" -756="" 910="" 388="" 163="" -191="" 771="" 659="" -846="" 586="" -654="" -101="" 120="" -20="" 212="" -57="" 913="" 323="" 955="" 122="" 875="" -667="" 703="" 409="" -103="" 129="" 65="" -559="" -761="" -70="" 0="" 888="" 791="" 10="" 429="" -41="" -683="" 964="" 735="" 349="" -63="" -449="" -217="" -68="" -606="" -960="" -180="" -593="" -708="" -389="" -519="" 364="" -133="" -955="" -82="" -171="" 40="" 596="" 92="" -506="" -162="" -598="" 711="" 944="" -499="" 378="" 49="" -745="" -485="" -162="" 25="" -278="" 370="" 658="" 138="" -943="" -22="" -186="" -101="" -557="" -809="" 599="" -319="" 816="" -252="" -308="" 962="" 733="" 624="" -496="" -748="" 4="" 828="" 834="" -489="" 142="" 315="" 148="" -379="" -492="" 799="" 489="" -592="" 143="" 548="" 337="" 310="" 221="" -47="" 797="" 42="" 234="" -314="" 363="" 519="" -864="" 38="" 401="" -820="" 756="" -725="" 100="" -410="" -209="" 970="" -813="" -929="" 637="" 725="" 68="" -645="" 798="" -938="" -262="" 50="" 3="" 771="" 64="" 999="" 504="" -967="" 965="" 726="" 452="" -68="" 469="" 752="" -906="" 151="" -220="" 467="" starter/tests/mata/5-test.txt="" 30="" 17="" -219="" -326="" 667="" -971="" -219="" -416="" -948="" -1="" 297="" -837="" 757="" 92="" 607="" -788="" 927="" 395="" -900="" -602="" -398="" -371="" -847="" 22="" 353="" -150="" 842="" 176="" -787="" -914="" 370="" -773="" -810="" 623="" 147="" 43="" -761="" 465="" -229="" 665="" 800="" -318="" -220="" -7="" -809="" -878="" -395="" -124="" 710="" 781="" 885="" 213="" -862="" -860="" -630="" -311="" -707="" 223="" -428="" 218="" -645="" -681="" 224="" -57="" 188="" 447="" 958="" -941="" 833="" -762="" 204="" 695="" -788="" 179="" -419="" -437="" -858="" -810="" -557="" -420="" -671="" -904="" -240="" -925="" 796="" 506="" -748="" 487="" -252="" 894="" -30="" 845="" -241="" -985="" -168="" 558="" 989="" -181="" -393="" -757="" -118="" 865="" -52="" -535="" -52="" -7="" -632="" -62="" 240="" 253="" 356="" -768="" 908="" 380="" -755="" -2="" -1="" 312="" -787="" 365="" -622="" 692="" 200="" 987="" 348="" -87="" -244="" -39="" -796="" 253="" -380="" 637="" -719="" -357="" -9="" -593="" -44="" 116="" -371="" -286="" 435="" -279="" -925="" -578="" 170="" -22="" -487="" 669="" 253="" -950="" 135="" -668="" -206="" -642="" -913="" -934="" 76="" -738="" -100="" 768="" -923="" -535="" 95="" 418="" -194="" -375="" -830="" -445="" 850="" 866="" 940="" -754="" 513="" -662="" -655="" -72="" 718="" -951="" 905="" -205="" 527="" -19="" -268="" -514="" -776="" -512="" -405="" -283="" -452="" -873="" 903="" -775="" -562="" -547="" -328="" -206="" 852="" 270="" -134="" 117="" 704="" -148="" 517="" 698="" -356="" -513="" -30="" 995="" -494="" -795="" -231="" -164="" 721="" 956="" -690="" -848="" 47="" -304="" 541="" -297="" -508="" 800="" -881="" -464="" -999="" -381="" 889="" -71="" 583="" 614="" 365="" 428="" -742="" 520="" 112="" -971="" -251="" -438="" 966="" -576="" 779="" -77="" 511="" -167="" 195="" 665="" 826="" -507="" 167="" -510="" -611="" 217="" 51="" -559="" -521="" 37="" -775="" 228="" -873="" 824="" 891="" 832="" 174="" 53="" 873="" -750="" 857="" -150="" 463="" 84="" 231="" -430="" 714="" -635="" 308="" -17="" -78="" -270="" 721="" 620="" -327="" 839="" 29="" 75="" -294="" 940="" -592="" 887="" -830="" -920="" 739="" -671="" -936="" 509="" -50="" -712="" -933="" 159="" 851="" 268="" -539="" -840="" -893="" -183="" -803="" -185="" 173="" 508="" -500="" 805="" -571="" 240="" -17="" -220="" -703="" 728="" -186="" -903="" -828="" -171="" 150="" -396="" 21="" 571="" 995="" -190="" -476="" 403="" 800="" 101="" 198="" -186="" -182="" 632="" 235="" 712="" 548="" 762="" 765="" -483="" 659="" 768="" 320="" 685="" -462="" -706="" -601="" -974="" 443="" 623="" 374="" -426="" 174="" 566="" 958="" -546="" 611="" 370="" -289="" 96="" -132="" -708="" -642="" -464="" 893="" 625="" -10="" 775="" -307="" -258="" -927="" -510="" -381="" -426="" 124="" 995="" -381="" -226="" 161="" -184="" 972="" 984="" 770="" 256="" 407="" 675="" -358="" 2="" -828="" -148="" 348="" 496="" -518="" -325="" 437="" 10="" -466="" 178="" -476="" 12="" 200="" 455="" 243="" 855="" 304="" 279="" -788="" -744="" 968="" 368="" -608="" 99="" 609="" 872="" -833="" 253="" -339="" -254="" 261="" -97="" -126="" 710="" 201="" 756="" -342="" -253="" -831="" -527="" 634="" 592="" 13="" 758="" 894="" 341="" 619="" 578="" 203="" -778="" 214="" 685="" 50="" -392="" 696="" -90="" 314="" -57="" -381="" 563="" -221="" 194="" -167="" 26="" -905="" -138="" -543="" -452="" 543="" 265="" 923="" 358="" 849="" 565="" -942="" -351="" -693="" -846="" -263="" -427="" 896="" 351="" -952="" -353="" 871="" -752="" -276="" -23="" -609="" 722="" -38="" 237="" -131="" 832="" -520="" -360="" 729="" -981="" -788="" -293="" 825="" 795="" -720="" 101="" 432="" 633="" 567="" -364="" 64="" 51="" 430="" -529="" -214="" -44="" 695="" 513="" 634="" 934="" -907="" 449="" 219="" -833="" 901="" 400="" starter/tests/mata/6-test.txt="" 5="" 19="" 52="" 61="" 598="" -952="" -302="" -332="" -27="" -463="" 357="" -614="" 90="" -265="" -70="" -423="" -548="" 699="" 337="" 617="" 632="" -400="" -950="" -754="" 638="" -360="" -211="" -738="" 42="" -60="" -739="" 412="" 139="" 119="" -548="" -637="" -355="" -740="" 799="" 1="" -443="" 228="" 412="" 4="" -326="" -324="" 897="" 196="" -912="" -486="" 484="" -904="" -650="" 6="" 251="" -766="" -362="" -29="" 905="" 647="" 123="" 338="" 403="" -599="" -454="" -590="" 418="" -643="" -432="" -769="" -523="" -369="" 539="" 923="" 711="" 781="" 641="" 751="" 396="" 535="" -732="" 599="" 397="" 263="" -623="" -311="" -416="" -332="" 729="" -416="" -324="" -398="" 672="" -155="" -709="" 880="" -896="" starter/tests/mata/7-test.txt="" 25="" 50="" -816="" -953="" 270="" -208="" 953="" -404="" 332="" -825="" 401="" -484="" 768="" -487="" -298="" 305="" 374="" 743="" -498="" 860="" -321="" -402="" -267="" 24="" -897="" 62="" 657="" 952="" -448="" -387="" 484="" -248="" 264="" -729="" 516="" 616="" -673="" 751="" -272="" 450="" -858="" -308="" -535="" 515="" -355="" 822="" 337="" -242="" 86="" -92="" 848="" -509="" 192="" 61="" 555="" 965="" -70="" -272="" 783="" 673="" -617="" -777="" 219="" -910="" -702="" 780="" -303="" 297="" 102="" 772="" -363="" 809="" 563="" 805="" 282="" 740="" 168="" -770="" -822="" 448="" -555="" 681="" -683="" 613="" 912="" -497="" -845="" -197="" -184="" -86="" 874="" -506="" 748="" -622="" 855="" -505="" 421="" 652="" 56="" 223="" -965="" -315="" -565="" 449="" 893="" -958="" 985="" -86="" 716="" -514="" -599="" 655="" -298="" -822="" -494="" -621="" -791="" -353="" 662="" 397="" 544="" 569="" 204="" 531="" -351="" 260="" 434="" 930="" 121="" -643="" -819="" 75="" -245="" 267="" 453="" -643="" -112="" 192="" 135="" -234="" 792="" -728="" -916="" -793="" 933="" -628="" 808="" 11="" 153="" 351="" 67="" -519="" -661="" 626="" -32="" -408="" 746="" -235="" -86="" 834="" -787="" -658="" -597="" -316="" 346="" -166="" 182="" 611="" 252="" 662="" 677="" 125="" -56="" 458="" 901="" 758="" 60="" 564="" -942="" -785="" 968="" 607="" -562="" 345="" -952="" 434="" -775="" -2="" -322="" 903="" 47="" 284="" -781="" 408="" 704="" -292="" 317="" -450="" 802="" -499="" 359="" -61="" -59="" 488="" -796="" -543="" 401="" 616="" 616="" -659="" 596="" -797="" -503="" 695="" 539="" -825="" 708="" 39="" -290="" 230="" 236="" -850="" 255="" -761="" -512="" 571="" -102="" -957="" 557="" 46="" -525="" 884="" 875="" -901="" -872="" -495="" 351="" 694="" -735="" -801="" -23="" 507="" 328="" 144="" -853="" -751="" 629="" 96="" 209="" -634="" -600="" 744="" -375="" -787="" 350="" -869="" -699="" 122="" 601="" 324="" -254="" 483="" -998="" 112="" -892="" -961="" 405="" 188="" 835="" 868="" 796="" 311="" -125="" -242="" 694="" -808="" -351="" 136="" -897="" -537="" 879="" 547="" -318="" -933="" -419="" -321="" 257="" 486="" -314="" -4="" -9="" -702="" 150="" 290="" 237="" -112="" 770="" 971="" -664="" -957="" 452="" -55="" 389="" -78="" 632="" -541="" -702="" 491="" -66="" 67="" 880="" 277="" -185="" 371="" 367="" 814="" 847="" 29="" 843="" 597="" -517="" -647="" -860="" 995="" -800="" 318="" -517="" -912="" 913="" 51="" 92="" 127="" 492="" 938="" 344="" 661="" -285="" 915="" 327="" 948="" 514="" -558="" -919="" 309="" -377="" 65="" -530="" 87="" -819="" -337="" 901="" 401="" -583="" -631="" 569="" -155="" 437="" -689="" -573="" -629="" 836="" -305="">
Answered 7 days AfterJul 12, 2021

Answer To: Starter/main.c #include #include int** matMult(int **a, int num_rows_a, int num_cols_a, int** b, int...

Gaurav answered on Jul 20 2021
153 Votes
.globl matMult
    .text
#int** matMult(int **a(8), int num_rows_a(12), int num_cols_a(16), int** b(2
0), int num_rows_b(24), int num_cols_b(28))
matMult:
    push %ebp
    mov %esp, %ebp
    push %ebx
    push %ecx
    push %edi
    push %esi                # save registers
    sub $20, %esp                # local variable ebp - 16 (register) - offset (subtract because stack decrements)
                        # 4 - i    -> outerloop counter
                        # 8 - j    -> innerLoop counter
                        # 12- sum-> stores sum of each multiplication before stored in mat_c matrix
                        # 16- address of each row mat_c for each iterations
                        # 20- address of mat_c
    xor %eax, %eax                
    mov 16(%ebp), %edx
    cmp %edx, 24(%ebp)            # if num_cols_a != num_rows_b then return 0, because matrix multiplication not possible
    jne exit
    mov 12(%ebp), %eax            
    shl ...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here