Want to see the code used to run this program .ORIG x3000 LEA R1, HELLO AGAIN LD
ID: 3692194 • Letter: W
Question
Want to see the code used to run this program
.ORIG x3000
LEA R1, HELLO
AGAIN LDR R2, R1, #0
BRz NEXT
ADD R1, R1, #1
BR AGAIN
NEXT LEA R0, PROMPT
TRAP x22 ; PUTS
LD R3, NEGENTER
AGAIN2 TRAP x20 ; GETC
TRAP x21 ; OUT
ADD R2, R0, R3
BRz CONT
STR R0, R1, #0
ADD R1, R1, #1
BR AGAIN2
CONT ADD R2, R2, #0
STR R2, R2, #0
LEA R0, HELLO
TRAP x22 ; PUTS
TRAP x25 ; HALT
NEGENTER .FILL xFFF6 ; -x0A
PROMPT .STRINGZ “Please enter your name: “
HELLO.STRINGZ “Hello, “
.BLKW #25
.END
Want to see the code used for this program
1.) “Hello, World” Write, compile and execute an assembler program that take a store String that contains “Hello, World” and prints it to the screen.
Explanation / Answer
Answer:
.Ltext0:
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.globl main
main:
.LFB1021:
.cfi_startproc
0000 55 pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
0001 4889E5 movq %rsp, %rbp
.cfi_def_cfa_register 6
0004 4881ECE0 subq $224, %rsp
000b 64488B04 movq %fs:40, %rax
0014 488945F8 movq %rax, -8(%rbp)
0018 31C0 xorl %eax, %eax
001a 48B84865 movabsq $478560413000, %rax
0024 48898520 movq %rax, -224(%rbp)
002b 488D9528 leaq -216(%rbp), %rdx
0032 B8000000 movl $0, %eax
0037 B90B0000 movl $11, %ecx
003c 4889D7 movq %rdx, %rdi
003f F348AB rep stosq
0042 4889FA movq %rdi, %rdx
0045 8902 movl %eax, (%rdx)
0047 4883C204 addq $4, %rdx
004b 48B8576F movabsq $431316168535, %rax
0055 48894590 movq %rax, -112(%rbp)
0059 488D5598 leaq -104(%rbp), %rdx
005d B8000000 movl $0, %eax
0062 B90B0000 movl $11, %ecx
0067 4889D7 movq %rdx, %rdi
006a F348AB rep stosq
006d 4889FA movq %rdi, %rdx
0070 8902 movl %eax, (%rdx)
0072 4883C204 addq $4, %rdx
0076 488D8520 leaq -224(%rbp), %rax
007d 4889C6 movq %rax, %rsi
0080 BF000000 movl $_ZSt4cout, %edi
0085 E8000000 call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
008a 4889C2 movq %rax, %rdx
008d 488D4590 leaq -112(%rbp), %rax
0091 4889C6 movq %rax, %rsi
0094 4889D7 movq %rdx, %rdi
0097 E8000000 call _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc
009c B8000000 movl $0, %eax
00a1 488B75F8 movq -8(%rbp), %rsi
00a5 64483334 xorq %fs:40, %rsi
00ae 7405 je .L3
00b0 E8000000 call __stack_chk_fail
.L3:
00b5 C9 leave
.cfi_def_cfa 7, 8
00b6 C3 ret
.cfi_endproc
.LFE1021:
_Z41__static_initialization_and_destruction_0ii:
.LFB1025:
00d4 BF000000 movl $_ZStL8__ioinit, %edi
00d9 E8000000 call _ZNSt8ios_base4InitC1Ev
00de BA000000 movl $__dso_handle, %edx
00e3 BE000000 movl $_ZStL8__ioinit, %esi
00e8 BF000000 movl $_ZNSt8ios_base4InitD1Ev, %edi
00ed E8000000 call __cxa_atexit
.cfi_startproc
00b7 55 pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
00b8 4889E5 movq %rsp, %rbp
.cfi_def_cfa_register 6
00bb 4883EC10 subq $16, %rsp
00bf 897DFC movl %edi, -4(%rbp)
00c2 8975F8 movl %esi, -8(%rbp)
00c5 837DFC01 cmpl $1, -4(%rbp)
00c9 7527 jne .L6
00cb 817DF8FF cmpl $65535, -8(%rbp)
00d2 751E jne .L6
.L6:
00f2 90 nop
00f3 C9 leave
.cfi_def_cfa 7, 8
00f4 C3 ret
.cfi_endproc
.LFE1025:
_GLOBAL__sub_I_main:
.LFB1026:
.cfi_startproc
00f5 55 pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
00f6 4889E5 movq %rsp, %rbp
.cfi_def_cfa_register 6
00f9 BEFFFF00 movl $65535, %esi
00fe BF010000 movl $1, %edi
0103 E8AFFFFF call _Z41__static_initialization_and_destruction_0ii
0108 5D popq %rbp
.cfi_def_cfa 7, 8
0109 C3 ret
.cfi_endproc
.LFE1026:
.section .init_array,"aw"
.align 8
0000 00000000 .quad _GLOBAL__sub_I_main
.text
.Letext0:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.