hapter 8 Irvine book, When I compiled this code I get the following errors ;Greatest Common Divisor Comment ! Write a recursive implementation of Euclid’s algorithm for finding  the greatest common divisor (GCD) of two integers. Descriptions of  this algorithm are available in algebra books and on the Web. Write  a test program that calls your GCD procedure five times, using the  following pairs of integers: (5,20), (24,18), (11,7), (432,226),  (26,13). After each procedure call, display the GCD. ! INCLUDE Irvine32.inc CalcGcd PROTO,int1:DWORD, int2:DWORD .data array SDWORD 5,20,24,18,11,7,438,226,26,13 str1 BYTE "Greatest common divisor is: ",0 .code main PROC     mov  ecx,LENGTHOF array / 2     mov  esi,OFFSET array L1:    INVOKE CalcGcd,[esi],[esi+4]     mov  edx,OFFSET str1     call WriteString     call WriteDec     call Crlf     add  esi,TYPE array * 2     loop L1     exit main ENDP ;--------------------------------------------- CalcGcd PROC,     int1:DWORD, int2:DWORD ; ; Calculate the greatest common divisor, of two ; nonnegative integers, using Euclid's algrithm. ; Implemented using recursion. ; Receives: int1, int2 ; Returns:  EAX = Greatest common divisor ;--------------------------------------------- ;Write your code here ;.GCD: ;following is the function for GCD .data pair1 QWORD 53 pair2 QWORD 17 .code ;main proc  ; (5,20) mov RDX,0 mov RAX,5 mov RBX,20      push RAX      push RBX call Gcd_Two_Numbers   ; (24,18) mov RDX,0 mov RAX,24 mov RBX,18      push RAX      push RBX call Gcd_Two_Numbers   ; (11,7)   mov RDX,0 mov RAX,11 mov RBX,7      push RAX      push RBX call Gcd_Two_Numbers   ; (432,226)   mov RDX,0 mov RAX,432 mov RBX,226      push RAX      push RBX call Gcd_Two_Numbers   ; (26,13)   mov RDX,0 mov RAX,26 mov RBX,13      push RAX      push RBX call Gcd_Two_Numbers CALL ExitProcess ;main endp     ;***** This function Find the GCD of Two No... ***** Gcd_Two_Numbers proc  enter 0,0 mov RDX,0   mov RAX,[rbp+24]   mov RBX,[rbp+16]   DIV RBX   cmp RDX,0   jz Lable      push RBX      push RDX      call Gcd_Two_Numbers      Lable:   leave   ret 8 ;Gcd_Two_Numbers endp end CalcGcd ENDP END main   I get the following errors 1>------ Build started: Project: Project7, Configuration: Debug Win32 ------ 1>Assembling AddPacked.asm... 1>AddPacked.asm(92): error A2144: cannot nest procedures 1>AddPacked.asm(111): fatal error A1010: unmatched block nesting : Gcd_Two_Numbers 1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\masm.targets(70,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\AddPacked.obj" /I "c:\Irvine" /W3 /errorReport:prompt  /TaAddPacked.asm" exited with code 1. 1>Done building project "Project7.vcxproj" -- FAILED. ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Chapter 8 Irvine book, When I compiled this code I get the following errors

;Greatest Common Divisor

Comment !
Write a recursive implementation of Euclid’s algorithm for finding 
the greatest common divisor (GCD) of two integers. Descriptions of 
this algorithm are available in algebra books and on the Web. Write 
a test program that calls your GCD procedure five times, using the 
following pairs of integers: (5,20), (24,18), (11,7), (432,226), 
(26,13). After each procedure call, display the GCD.
!

INCLUDE Irvine32.inc
CalcGcd PROTO,int1:DWORD, int2:DWORD

.data
array SDWORD 5,20,24,18,11,7,438,226,26,13
str1 BYTE "Greatest common divisor is: ",0

.code
main PROC
    mov  ecx,LENGTHOF array / 2
    mov  esi,OFFSET array

L1:    INVOKE CalcGcd,[esi],[esi+4]
    mov  edx,OFFSET str1
    call WriteString
    call WriteDec
    call Crlf
    add  esi,TYPE array * 2
    loop L1

    exit
main ENDP

;---------------------------------------------
CalcGcd PROC,
    int1:DWORD, int2:DWORD
;
; Calculate the greatest common divisor, of two
; nonnegative integers, using Euclid's algrithm.
; Implemented using recursion.
; Receives: int1, int2
; Returns:  EAX = Greatest common divisor
;---------------------------------------------
;Write your code here
;.GCD: ;following is the function for GCD
.data
pair1 QWORD 53
pair2 QWORD 17
.code
;main proc
 ; (5,20)
mov RDX,0
mov RAX,5
mov RBX,20
     push RAX
     push RBX
call Gcd_Two_Numbers
  ; (24,18)
mov RDX,0
mov RAX,24
mov RBX,18
     push RAX
     push RBX
call Gcd_Two_Numbers
  ; (11,7)
  mov RDX,0
mov RAX,11
mov RBX,7
     push RAX
     push RBX
call Gcd_Two_Numbers
  ; (432,226)
  mov RDX,0
mov RAX,432
mov RBX,226
     push RAX
     push RBX
call Gcd_Two_Numbers
  ; (26,13)
  mov RDX,0
mov RAX,26
mov RBX,13
     push RAX
     push RBX
call Gcd_Two_Numbers
CALL ExitProcess
;main endp
    ;***** This function Find the GCD of Two No... *****


Gcd_Two_Numbers proc 
enter 0,0
mov RDX,0
  mov RAX,[rbp+24]
  mov RBX,[rbp+16]
  DIV RBX
  cmp RDX,0
  jz Lable
     push RBX
     push RDX
     call Gcd_Two_Numbers   
  Lable:
  leave
  ret 8
;Gcd_Two_Numbers endp
end

CalcGcd ENDP

END main

 

I get the following errors
1>------ Build started: Project: Project7, Configuration: Debug Win32 ------
1>Assembling AddPacked.asm...
1>AddPacked.asm(92): error A2144: cannot nest procedures
1>AddPacked.asm(111): fatal error A1010: unmatched block nesting : Gcd_Two_Numbers
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\BuildCustomizations\masm.targets(70,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"Debug\AddPacked.obj" /I "c:\Irvine" /W3 /errorReport:prompt  /TaAddPacked.asm" exited with code 1.
1>Done building project "Project7.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education