In: Computer Science
#include
using namespace std;
char ch;
int main() {
cin >> ch;
cout << "You inputted " << ch << endl;
ch++;
cout << "Next character is " << ch << endl;
if (ch <= ‘Z’)
cout << “Could be luppercase\n”;
return 0;
}
Given program :
#include <iostream>
using namespace std;
char ch;
int main()
{
cin >> ch;
cout << "You inputted " << ch << endl;
ch++;
cout << "Next character is " << ch << endl;
if (ch <= 'Z')
cout << "Could be luppercase\n";
return 0;
}
Save tis program as program.cpp
In Assembly language
.file "program.cpp"
.text
.section .rodata
.type _ZStL19piecewise_construct,
@object
.size _ZStL19piecewise_construct, 1
_ZStL19piecewise_construct:
.zero 1
.local _ZStL8__ioinit
.comm _ZStL8__ioinit,1,1
.globl ch
.bss
.type ch, @object
.size ch, 1
ch:
.zero 1
.section .rodata
.LC0:
.string "You inputted "
.LC1:
.string "Next character is "
.LC2:
.string "Could be luppercase\n"
.text
.globl main
.type main, @function
main:
.LFB1522:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
leaq ch(%rip), %rsi
leaq _ZSt3cin(%rip), %rdi
call
_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_@PLT
leaq .LC0(%rip), %rsi
leaq _ZSt4cout(%rip), %rdi
call
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdx
movzbl ch(%rip), %eax
movsbl %al, %eax
movl %eax, %esi
movq %rdx, %rdi
call
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
movq %rax, %rdx
movq
_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip),
%rax
movq %rax, %rsi
movq %rdx, %rdi
call _ZNSolsEPFRSoS_E@PLT
movzbl ch(%rip), %eax
addl $1, %eax
movb %al, ch(%rip)
leaq .LC1(%rip), %rsi
leaq _ZSt4cout(%rip), %rdi
call
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
movq %rax, %rdx
movzbl ch(%rip), %eax
movsbl %al, %eax
movl %eax, %esi
movq %rdx, %rdi
call
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c@PLT
movq %rax, %rdx
movq
_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_@GOTPCREL(%rip),
%rax
movq %rax, %rsi
movq %rdx, %rdi
call _ZNSolsEPFRSoS_E@PLT
movzbl ch(%rip), %eax
cmpb $90, %al
jg .L2
leaq .LC2(%rip), %rsi
leaq _ZSt4cout(%rip), %rdi
call
_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc@PLT
.L2:
movl $0, %eax
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE1522:
.size main, .-main
.type
_Z41__static_initialization_and_destruction_0ii, @function
_Z41__static_initialization_and_destruction_0ii:
.LFB2012:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
subq $16, %rsp
movl %edi, -4(%rbp)
movl %esi, -8(%rbp)
cmpl $1, -4(%rbp)
jne .L6
cmpl $65535, -8(%rbp)
jne .L6
leaq _ZStL8__ioinit(%rip), %rdi
call _ZNSt8ios_base4InitC1Ev@PLT
leaq __dso_handle(%rip), %rdx
leaq _ZStL8__ioinit(%rip), %rsi
movq
_ZNSt8ios_base4InitD1Ev@GOTPCREL(%rip), %rax
movq %rax, %rdi
call __cxa_atexit@PLT
.L6:
nop
leave
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE2012:
.size
_Z41__static_initialization_and_destruction_0ii,
.-_Z41__static_initialization_and_destruction_0ii
.type _GLOBAL__sub_I_ch, @function
_GLOBAL__sub_I_ch:
.LFB2013:
.cfi_startproc
endbr64
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
movl $65535, %esi
movl $1, %edi
call
_Z41__static_initialization_and_destruction_0ii
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE2013:
.size _GLOBAL__sub_I_ch,
.-_GLOBAL__sub_I_ch
.section .init_array,"aw"
.align 8
.quad _GLOBAL__sub_I_ch
.hidden __dso_handle
.ident "GCC: (Ubuntu
9.3.0-17ubuntu1~20.04) 9.3.0"
.section
.note.GNU-stack,"",@progbits
.section .note.gnu.property,"a"
.align 8
.long 1f - 0f
.long 4f - 1f
.long 5
0:
.string "GNU"
1:
.align 8
.long 0xc0000002
.long 3f - 2f
2:
.long 0x3
3:
.align 8
4:
Please give like and comment
THANKS !!!!!!!!!!!!!!