Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an ASSEMBLY CODE that prompts the user to enter a string of up to 100 char

ID: 3687623 • Letter: W

Question

Write an ASSEMBLY CODE that prompts the user to enter a string of up to 100 characters (your program should ensure the input is sane and re-prompt if necessary). As the characters are received, store them in an array of BYTES (single characters). Once the input array has been populated, write a loop that iterates through the array and only writes back the vowels from the input string in their respective order. See the following examples for clarity:

INPUT: abcdef

OUTPUT: ae

INPUT: Here are some words.

OUTPUT: eeaeoeo

INPUT: This one has digits and stuff 49504. Some more text.

OUTPUT: ioeaiiauoeoee

INPUT: Lose symbols too #($*%(#. Like that...

OUTPUT: oeoooiea

INPUT: Big Letters Are Always Big

OUTPUT: ieeAeAai

In addition to displaying the mutated string on the screen, re-store the mutated series of vowels into a completely different array of BYTES.

Code should be written to work when put into Visual Studio.

Explanation / Answer

.Ltext0: .section .rodata.str1.1,"aMS",@progbits,1 .LC0: 0000 456E7465 .string "Enter ur string: " 72207572 20737472 696E673A 0A00 .LC1: 0012 54727920 .string "Try again! Enter ur string: " 61676169 6E212045 6E746572 20757220 .LC2: 002f 257300 .string "%s" .LC3: 0032 256300 .string "%c" .section .text.unlikely,"ax",@progbits .LCOLDB4: .section .text.startup,"ax",@progbits .LHOTB4: .p2align 4,,15 .section .text.unlikely .Ltext_cold0: .section .text.startup .globl main main: .LFB13: .cfi_startproc 0000 4154 pushq %r12 .cfi_def_cfa_offset 16 .cfi_offset 12, -16 0002 55 pushq %rbp .cfi_def_cfa_offset 24 .cfi_offset 6, -24 .LBB11: .LBB12: 0003 BE000000 movl $.LC0, %esi 00 .LBE12: .LBE11: 0008 53 pushq %rbx .cfi_def_cfa_offset 32 .cfi_offset 3, -32 .LBB15: .LBB13: 0009 BF010000 movl $1, %edi 00 .LBE13: .LBE15: 000e 4881ECD0 subq $208, %rsp 000000 .cfi_def_cfa_offset 240 0015 64488B04 movq %fs:40, %rax 25280000 00 001e 48898424 movq %rax, 200(%rsp) C8000000 0026 31C0 xorl %eax, %eax .LVL0: .LBB16: .LBB17: 0028 4989E4 movq %rsp, %r12 .LBE17: .LBE16: .LBB19: .LBB14: 002b E8000000 call __printf_chk 00 .LVL1: .LBE14: .LBE19: .LBB20: .LBB18: 0030 BEC80000 movl $200, %esi 00 0035 4889E7 movq %rsp, %rdi 0038 E8000000 call __gets_chk 00 .LVL2: .LBE18: .LBE20: .LBB21: 003d 4889E1 movq %rsp, %rcx .L2: 0040 8B11 movl (%rcx), %edx 0042 4883C104 addq $4, %rcx 0046 8D82FFFE leal -16843009(%rdx), %eax FEFE 004c F7D2 notl %edx 004e 21D0 andl %edx, %eax 0050 25808080 andl $-2139062144, %eax 80 0055 74E9 je .L2 0057 89C2 movl %eax, %edx 0059 C1EA10 shrl $16, %edx 005c A9808000 testl $32896, %eax 00 0061 0F44C2 cmove %edx, %eax 0064 488D5102 leaq 2(%rcx), %rdx 0068 89C3 movl %eax, %ebx 006a 480F44CA cmove %rdx, %rcx 006e 00C3 addb %al, %bl 0070 4883D903 sbbq $3, %rcx 0074 4C29E1 subq %r12, %rcx 0077 4883F964 cmpq $100, %rcx 007b 0F878000 ja .L4 0000 0081 803C2400 cmpb $0, (%rsp) 0085 747A je .L4 0087 31ED xorl %ebp, %ebp 0089 48BB1141 movabsq $4575140898685201, %rbx 10001141 1000 0093 EB65 jmp .L5 .LVL3: .p2align 4,,10 0095 0F1F00 .p2align 3 .L10: 0098 410FBE14 movsbl (%r12,%rbp), %edx 2C 009d 8D42BF leal -65(%rdx), %eax 00a0 3C34 cmpb $52, %al 00a2 7752 ja .L7 00a4 480FA3C3 btq %rax, %rbx 00a8 734C jnc .L7 .LVL4: .LBB22: .LBB23: 00aa BE000000 movl $.LC3, %esi 00 00af BF010000 movl $1, %edi 00 00b4 31C0 xorl %eax, %eax 00b6 E8000000 call __printf_chk 00 .LVL5: 00bb 4C89E1 movq %r12, %rcx .L8: 00be 8B11 movl (%rcx), %edx 00c0 4883C104 addq $4, %rcx 00c4 8D82FFFE leal -16843009(%rdx), %eax FEFE 00ca F7D2 notl %edx 00cc 21D0 andl %edx, %eax 00ce 25808080 andl $-2139062144, %eax 80 00d3 74E9 je .L8 00d5 89C2 movl %eax, %edx 00d7 C1EA10 shrl $16, %edx 00da A9808000 testl $32896, %eax 00 00df 0F44C2 cmove %edx, %eax 00e2 488D5102 leaq 2(%rcx), %rdx 00e6 89C6 movl %eax, %esi 00e8 480F44CA cmove %rdx, %rcx 00ec 4000C6 addb %al, %sil 00ef 4883D903 sbbq $3, %rcx 00f3 4C29E1 subq %r12, %rcx .LVL6: .L7: 00f6 4883C501 addq $1, %rbp .LVL7: .L5: .LBE23: .LBE22: 00fa 4839E9 cmpq %rbp, %rcx 00fd 7799 ja .L10 00ff EB20 jmp .L6 .LVL8: .L4: .LBB24: .LBB25: 0101 BE000000 movl $.LC1, %esi 00 0106 BF010000 movl $1, %edi 00 010b 31C0 xorl %eax, %eax 010d E8000000 call __printf_chk 00 .LVL9: .LBE25: .LBE24: 0112 4C89E6 movq %r12, %rsi 0115 BF000000 movl $.LC2, %edi 00 011a 31C0 xorl %eax, %eax 011c E8000000 call __isoc99_scanf 00 .LVL10: .L6: .LBE21: 0121 31C0 xorl %eax, %eax 0123 488BBC24 movq 200(%rsp), %rdi C8000000 012b 6448333C xorq %fs:40, %rdi 25280000 00 0134 750C jne .L18 0136 4881C4D0 addq $208, %rsp 000000 .cfi_remember_state .cfi_def_cfa_offset 32 013d 5B popq %rbx .cfi_def_cfa_offset 24 013e 5D popq %rbp .cfi_def_cfa_offset 16 013f 415C popq %r12 .cfi_def_cfa_offset 8 0141 C3 ret .L18: .cfi_restore_state 0142 E8000000 call __stack_chk_fail 00 .LVL11: .cfi_endproc .LFE13: .section .text.unlikely .LCOLDE4: .section .text.startup .LHOTE4: .text .Letext0: .section .text.unlikely .Letext_cold0:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote