// chapter1.4.4.cpp : 定义控制台应用程序的入口点。
//

#include "stdafx.h"
#include <iostream>

int _tmain(int argc, _TCHAR* argv[])
{
 int sum = 0, value;
 while(std::cin>>value)
 {
  sum+=value;
 }
 std::cout<<"Sum is "
  <<sum<<std::endl;
 return 0;
}

debug

od

004114C0    55              push    ebp
004114C1    8BEC            mov     ebp, esp
004114C3    81EC E4000000   sub     esp, 0E4
004114C9    53              push    ebx
004114CA    56              push    esi
004114CB    57              push    edi
004114CC    8DBD 1CFFFFFF   lea     edi, dword ptr [ebp-E4]
004114D2    B9 39000000     mov     ecx, 39
004114D7    B8 CCCCCCCC     mov     eax, CCCCCCCC
004114DC    F3:AB           rep     stos dword ptr es:[edi]
004114DE    C745 F8 0000000>mov     dword ptr [ebp-8], 0
004114E5    8BF4            mov     esi, esp
004114E7    8D45 EC         lea     eax, dword ptr [ebp-14]
004114EA    50              push    eax
004114EB    8B0D 24A34100   mov     ecx, dword ptr [<&MSVCP90D.std::>; MSVCP90D.std::cin
004114F1    FF15 20A34100   call    dword ptr [<&MSVCP90D.std::basic>; MSVCP90D.std::basic_istream<char,std::char_traits<char> >::operator>>
004114F7    3BF4            cmp     esi, esp
004114F9    E8 BAFCFFFF     call    004111B8
004114FE    8985 20FFFFFF   mov     dword ptr [ebp-E0], eax
00411504    8B8D 20FFFFFF   mov     ecx, dword ptr [ebp-E0]
0041150A    8B11            mov     edx, dword ptr [ecx]
0041150C    8B8D 20FFFFFF   mov     ecx, dword ptr [ebp-E0]
00411512    034A 04         add     ecx, dword ptr [edx+4]
00411515    8BF4            mov     esi, esp
00411517    FF15 1CA34100   call    dword ptr [<&MSVCP90D.std::ios_b>; MSVCP90D.std::ios_base::operator void *
0041151D    3BF4            cmp     esi, esp
0041151F    E8 94FCFFFF     call    004111B8
00411524    85C0            test    eax, eax                         ; 输入是否结束
00411526    74 0B           je      short 00411533
00411528    8B45 F8         mov     eax, dword ptr [ebp-8]           ; sum
0041152B    0345 EC         add     eax, dword ptr [ebp-14]          ; sum+=value
0041152E    8945 F8         mov     dword ptr [ebp-8], eax
00411531  ^ EB B2           jmp     short 004114E5
00411533    8BF4            mov     esi, esp
00411535    A1 18A34100     mov     eax, dword ptr [<&MSVCP90D.std::>
0041153A    50              push    eax
0041153B    8BFC            mov     edi, esp
0041153D    8B4D F8         mov     ecx, dword ptr [ebp-8]
00411540    51              push    ecx
00411541    68 00784100     push    00417800                         ; ASCII "Sum is "
00411546    8B15 14A34100   mov     edx, dword ptr [<&MSVCP90D.std::>; MSVCP90D.std::cout
0041154C    52              push    edx
0041154D    E8 11FCFFFF     call    00411163
00411552    83C4 08         add     esp, 8
00411555    8BC8            mov     ecx, eax
00411557    FF15 10A34100   call    dword ptr [<&MSVCP90D.std::basic>; MSVCP90D.std::basic_ostream<char,std::char_traits<char> >::operator<<
0041155D    3BFC            cmp     edi, esp
0041155F    E8 54FCFFFF     call    004111B8
00411564    8BC8            mov     ecx, eax
00411566    FF15 0CA34100   call    dword ptr [<&MSVCP90D.std::basic>; MSVCP90D.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >::operator<<
0041156C    3BF4            cmp     esi, esp
0041156E    E8 45FCFFFF     call    004111B8
00411573    33C0            xor     eax, eax
00411575    52              push    edx
00411576    8BCD            mov     ecx, ebp
00411578    50              push    eax
00411579    8D15 9C154100   lea     edx, dword ptr [41159C]
0041157F    E8 2BFBFFFF     call    004110AF
00411584    58              pop     eax
00411585    5A              pop     edx
00411586    5F              pop     edi
00411587    5E              pop     esi
00411588    5B              pop     ebx
00411589    81C4 E4000000   add     esp, 0E4
0041158F    3BEC            cmp     ebp, esp
00411591    E8 22FCFFFF     call    004111B8
00411596    8BE5            mov     esp, ebp
00411598    5D              pop     ebp
00411599    C3              retn

ida

.text:004114C0
.text:004114C0 ; =============== S U B R O U T I N E =======================================
.text:004114C0
.text:004114C0 ; Attributes: bp-based frame
.text:004114C0
.text:004114C0 _wmain          proc near               ; CODE XREF: j__wmainj
.text:004114C0
.text:004114C0 var_E4          = byte ptr -0E4h
.text:004114C0 cin             = dword ptr -0E0h
.text:004114C0 value           = dword ptr -14h
.text:004114C0 sum             = dword ptr -8
.text:004114C0
.text:004114C0                 push    ebp
.text:004114C1                 mov     ebp, esp
.text:004114C3                 sub     esp, 0E4h
.text:004114C9                 push    ebx
.text:004114CA                 push    esi
.text:004114CB                 push    edi
.text:004114CC                 lea     edi, [ebp+var_E4]
.text:004114D2                 mov     ecx, 39h
.text:004114D7                 mov     eax, 0CCCCCCCCh
.text:004114DC                 rep stosd
.text:004114DE                 mov     [ebp+sum], 0
.text:004114E5
.text:004114E5 loc_4114E5:                             ; CODE XREF: _wmain+71j
.text:004114E5                 mov     esi, esp
.text:004114E7                 lea     eax, [ebp+value]
.text:004114EA                 push    eax
.text:004114EB                 mov     ecx, ds:__imp_?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A ; std::basic_istream<char,std::char_traits<char>> std::cin
.text:004114F1                 call    ds:__imp_??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z ; std::basic_istream<char,std::char_traits<char>>::operator>>(int &)
.text:004114F7                 cmp     esi, esp
.text:004114F9                 call    j___RTC_CheckEsp
.text:004114FE                 mov     [ebp+cin], eax
.text:00411504                 mov     ecx, [ebp+cin]
.text:0041150A                 mov     edx, [ecx]
.text:0041150C                 mov     ecx, [ebp+cin]
.text:00411512                 add     ecx, [edx+4]
.text:00411515                 mov     esi, esp
.text:00411517                 call    ds:__imp_??Bios_base@std@@QBEPAXXZ ; std::ios_base::operator void *(void)
.text:0041151D                 cmp     esi, esp
.text:0041151F                 call    j___RTC_CheckEsp
.text:00411524                 test    eax, eax
.text:00411526                 jz      short loc_411533
.text:00411528                 mov     eax, [ebp+sum]
.text:0041152B                 add     eax, [ebp+value]
.text:0041152E                 mov     [ebp+sum], eax
.text:00411531                 jmp     short loc_4114E5
.text:00411533 ; ---------------------------------------------------------------------------
.text:00411533
.text:00411533 loc_411533:                             ; CODE XREF: _wmain+66j
.text:00411533                 mov     esi, esp
.text:00411535                 mov     eax, ds:__imp_?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z ; std::endl(std::basic_ostream<char,std::char_traits<char>> &)
.text:0041153A                 push    eax
.text:0041153B                 mov     edi, esp
.text:0041153D                 mov     ecx, [ebp+sum]
.text:00411540                 push    ecx
.text:00411541                 push    offset aSumIs   ; "Sum is "
.text:00411546                 mov     edx, ds:__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A ; std::basic_ostream<char,std::char_traits<char>> std::cout
.text:0041154C                 push    edx
.text:0041154D                 call    j_??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z ; std::operator<<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,char const *)
.text:00411552                 add     esp, 8
.text:00411555                 mov     ecx, eax
.text:00411557                 call    ds:__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z ; std::basic_ostream<char,std::char_traits<char>>::operator<<(int)
.text:0041155D                 cmp     edi, esp
.text:0041155F                 call    j___RTC_CheckEsp
.text:00411564                 mov     ecx, eax
.text:00411566                 call    ds:__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z ; std::basic_ostream<char,std::char_traits<char>>::operator<<(std::basic_ostream<char,std::char_traits<char>> & (*)(std::basic_ostream<char,std::char_traits<char>> &))
.text:0041156C                 cmp     esi, esp
.text:0041156E                 call    j___RTC_CheckEsp
.text:00411573                 xor     eax, eax
.text:00411575                 push    edx
.text:00411576                 mov     ecx, ebp
.text:00411578                 push    eax
.text:00411579                 lea     edx, dword_41159C
.text:0041157F                 call    j_@_RTC_CheckStackVars@8 ; _RTC_CheckStackVars(x,x)
.text:00411584                 pop     eax
.text:00411585                 pop     edx
.text:00411586                 pop     edi
.text:00411587                 pop     esi
.text:00411588                 pop     ebx
.text:00411589                 add     esp, 0E4h
.text:0041158F                 cmp     ebp, esp
.text:00411591                 call    j___RTC_CheckEsp
.text:00411596                 mov     esp, ebp
.text:00411598                 pop     ebp
.text:00411599                 retn
.text:00411599 _wmain          endp
.text:00411599
.text:00411599 ; ---------------------------------------------------------------------------

release

od

00401000  /$  51            push    ecx
00401001  |.  8B0D 40204000 mov     ecx, dword ptr [<&MSVCP90.std::c>;  MSVCP90.std::cin
00401007  |.  56            push    esi
00401008  |.  8D4424 04     lea     eax, dword ptr [esp+4]
0040100C  |.  50            push    eax
0040100D  |.  33F6          xor     esi, esi
0040100F  |.  FF15 5C204000 call    dword ptr [<&MSVCP90.std::basic_>;  MSVCP90.std::basic_istream<char,std::char_traits<char> >::operator>>
00401015  |.  8B08          mov     ecx, dword ptr [eax]
00401017  |.  8B49 04       mov     ecx, dword ptr [ecx+4]
0040101A  |.  8B5401 08     mov     edx, dword ptr [ecx+eax+8]
0040101E  |.  03C8          add     ecx, eax
00401020  |.  80E2 06       and     dl, 6
00401023  |.  0FBEC2        movsx   eax, dl
00401026  |.  F7D8          neg     eax
00401028  |.  1BC0          sbb     eax, eax
0040102A  |.  F7D0          not     eax
0040102C  |.  85C1          test    ecx, eax
0040102E  |.  74 2E         je      short 0040105E
00401030  |>  037424 04     /add     esi, dword ptr [esp+4]          ;  sum+=value
00401034  |.  8D4C24 04     |lea     ecx, dword ptr [esp+4]
00401038  |.  51            |push    ecx                             ;  value
00401039  |.  8B0D 40204000 |mov     ecx, dword ptr [<&MSVCP90.std::>;  MSVCP90.std::cin
0040103F  |.  FF15 5C204000 |call    dword ptr [<&MSVCP90.std::basic>;  MSVCP90.std::basic_istream<char,std::char_traits<char> >::operator>>
00401045  |.  8B10          |mov     edx, dword ptr [eax]
00401047  |.  8B4A 04       |mov     ecx, dword ptr [edx+4]
0040104A  |.  03C8          |add     ecx, eax
0040104C  |.  8B41 08       |mov     eax, dword ptr [ecx+8]
0040104F  |.  24 06         |and     al, 6
00401051  |.  0FBED0        |movsx   edx, al
00401054  |.  F7DA          |neg     edx
00401056  |.  1BD2          |sbb     edx, edx
00401058  |.  F7D2          |not     edx
0040105A  |.  85D1          |test    ecx, edx                        ;  是否是结束
0040105C  |.^ 75 D2         \jnz     short 00401030
0040105E  |>  A1 38204000   mov     eax, dword ptr [<&MSVCP90.std::e>
00401063  |.  8B0D 44204000 mov     ecx, dword ptr [<&MSVCP90.std::c>;  MSVCP90.std::cout
00401069  |.  50            push    eax
0040106A  |.  56            push    esi                              ;  sum
0040106B  |.  51            push    ecx
0040106C  |.  E8 4F010000   call    004011C0
00401071  |.  83C4 04       add     esp, 4
00401074  |.  8BC8          mov     ecx, eax
00401076  |.  FF15 64204000 call    dword ptr [<&MSVCP90.std::basic_>;  MSVCP90.std::basic_ostream<char,std::char_traits<char> >::operator<<
0040107C  |.  8BC8          mov     ecx, eax
0040107E  |.  FF15 68204000 call    dword ptr [<&MSVCP90.std::basic_>;  MSVCP90.std::basic_ostream<wchar_t,std::char_traits<wchar_t> >::operator<<
00401084  |.  33C0          xor     eax, eax
00401086  |.  5E            pop     esi
00401087  |.  59            pop     ecx
00401088  \.  C3            retn

ida

.text:00401000
.text:00401000 ; =============== S U B R O U T I N E =======================================
.text:00401000
.text:00401000
.text:00401000 ; int __cdecl main(int temvalue, const char **argv, const char *envp)
.text:00401000 _main           proc near               ; CODE XREF: ___tmainCRTStartup+10Ap
.text:00401000
.text:00401000 value           = byte ptr -4
.text:00401000 temvalue        = dword ptr  4
.text:00401000 argv            = dword ptr  8
.text:00401000 envp            = dword ptr  0Ch
.text:00401000
.text:00401000                 push    ecx
.text:00401001                 mov     ecx, ds:__imp_?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A ; std::basic_istream<char,std::char_traits<char>> std::cin
.text:00401007                 push    esi
.text:00401008                 lea     eax, [esp+8+value]
.text:0040100C                 push    eax
.text:0040100D                 xor     esi, esi
.text:0040100F                 call    ds:__imp_??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z ; std::basic_istream<char,std::char_traits<char>>::operator>>(int &)
.text:00401015                 mov     ecx, [eax]
.text:00401017                 mov     ecx, [ecx+4]
.text:0040101A                 mov     edx, [ecx+eax+8]
.text:0040101E                 add     ecx, eax
.text:00401020                 and     dl, 6
.text:00401023                 movsx   eax, dl
.text:00401026                 neg     eax
.text:00401028                 sbb     eax, eax
.text:0040102A                 not     eax
.text:0040102C                 test    eax, ecx        ; 是否是结束
.text:0040102E                 jz      short printresult
.text:00401030
.text:00401030 whilecin:                               ; CODE XREF: _main+5Cj
.text:00401030                 add     esi, [esp+temvalue] ; esi为sum
.text:00401034                 lea     ecx, [esp+temvalue] ; temvalue
.text:00401038                 push    ecx
.text:00401039                 mov     ecx, ds:__imp_?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A ; std::basic_istream<char,std::char_traits<char>> std::cin
.text:0040103F                 call    ds:__imp_??5?$basic_istream@DU?$char_traits@D@std@@@std@@QAEAAV01@AAH@Z ; std::basic_istream<char,std::char_traits<char>>::operator>>(int &)
.text:00401045                 mov     edx, [eax]
.text:00401047                 mov     ecx, [edx+4]
.text:0040104A                 add     ecx, eax
.text:0040104C                 mov     eax, [ecx+8]
.text:0040104F                 and     al, 6
.text:00401051                 movsx   edx, al
.text:00401054                 neg     edx
.text:00401056                 sbb     edx, edx
.text:00401058                 not     edx
.text:0040105A                 test    edx, ecx        ; 是否结束
.text:0040105C                 jnz     short whilecin  ; esi为sum
.text:0040105E
.text:0040105E printresult:                            ; CODE XREF: _main+2Ej
.text:0040105E                 mov     eax, ds:__imp_?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z ; std::endl(std::basic_ostream<char,std::char_traits<char>> &)
.text:00401063                 mov     ecx, ds:__imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A ; std::basic_ostream<char,std::char_traits<char>> std::cout
.text:00401069                 push    eax
.text:0040106A                 push    esi             ; sum
.text:0040106B                 push    ecx
.text:0040106C                 call    ??$?6U?$char_traits@D@std@@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@PBD@Z ; std::operator<<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,char const *)
.text:00401071                 add     esp, 4
.text:00401074                 mov     ecx, eax
.text:00401076                 call    ds:__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@H@Z ; std::basic_ostream<char,std::char_traits<char>>::operator<<(int)
.text:0040107C                 mov     ecx, eax
.text:0040107E                 call    ds:__imp_??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z ; std::basic_ostream<char,std::char_traits<char>>::operator<<(std::basic_ostream<char,std::char_traits<char>> & (*)(std::basic_ostream<char,std::char_traits<char>> &))
.text:00401084                 xor     eax, eax
.text:00401086                 pop     esi
.text:00401087                 pop     ecx
.text:00401088                 retn
.text:00401088 _main           endp
.text:00401088
.text:00401088 ; ---------------------------------------------------------------------------

chapter1.4.4相关推荐

  1. 统计学习方法chapter1

    统计学习方法chapter1 统计学习概述 对象 object 统计学习的对象为数据,从数据出发,提取数据的特征(特征工程),抽象出数据的模型(建立模型),发现数据中的知识,又回到对数据的分析与预测中 ...

  2. 大数据应用导论 Chapter1 | 大数据技术与应用概述

      大家好,我是不温卜火,是一名计算机学院大数据专业大二的学生,昵称来源于成语-不温不火,本意是希望自己性情温和.作为一名互联网行业的小白,博主写博客一方面是为了记录自己的学习过程,另一方面是总结自己 ...

  3. 嵌入式操作系统风云录:历史演进与物联网未来Chapter1 第1章

    Chapter1 第1章 认识嵌入式操作系统 操作系统和物联网是今天大众熟悉的二个专业技术词汇.人们拿起智能手机就想到绿色小机器人-谷歌的Android操作系统:使用电脑的时候就想到了Windows操 ...

  4. Latex排版 Chapter1基本使用(文档结构插入表格、图片)

    Chapter1基本使用 设置文章种类 载入包 开始正文 摘要 章节目录 列表使用 插入表格 基本表格 跨列表格 位置浮动的表格 插入图片 图文并排的小图片 图文分开的大图片 参考文献 设置文章种类 ...

  5. 【MIRACL】 用户手册研究学习 chapter1

    miracl文件包里有一个miracl_manual,尝试学一部分,能翻译多少就翻译多少 Chapter1  introduction 第一章主要内容是, 引子:用传统方法来进行大数运算,会出现错误提 ...

  6. 谱图理论(Spectral and Algebraic Graph Theory)| Chapter1: Introduction

    一.图 图G=(V,E)是由其顶点集V和边集E定义的.在无向图中,边集是一组无序的顶点对. 图(也称为"网络")通常用于建模事物之间的连接或关系,其中"事物"是 ...

  7. 先进半导体材料与器件Chapter1

    Chapter1 先进半导体材料及器件基础 作者: Saint 掘金:https://juejin.im/user/5aa1f89b6fb9a028bb18966a 微博:https://weibo. ...

  8. #读书笔记# 《人类简史》Chapter1

    <人类简史> BY 尤瓦尔·赫拉利(Yuval Noah Harari) Part1 认知革命 Chapter1 人类:一种也没什么特别的动物 2018-12-20 人类早在有历史记录之前 ...

  9. 机器学习_周志华(西瓜书) 课后习题答案 第一章 Chapter1

    机器学习_周志华 课后习题答案 第一章 Chapter1 习题1.1 Q:表1.1中若只包含编号为1和4的两个样例,试给出相应的版本空间. 由所给出的数据集(训练集)可知,属性3个:色泽.根蒂.敲声, ...

最新文章

  1. Java中判断List中是否有重复元素
  2. JSON字符串转换object错误:MorphDynaBean cannot be cast to com.softright.bean.TestBean,类中有集合类型的属性...
  3. ASP.NET web.config
  4. 在ElementUI中改变el-table中的el-table-column样式
  5. 数学建模7 多元线性回归分析
  6. RSA 数字签名 免密码登录
  7. Python手动安装Jieba库(Win11)
  8. 计算机无法识别打印机usb,Windows7打印机usb无法识别如何解决
  9. LVDS 扫盲基础知识
  10. ASP.NET2.0 ReportingServices,报表灵魂的收割者(一)【月儿原创】
  11. Clion 报错 Cannot save file ... [Failed to reload]
  12. 根据一个下拉框改变另外一个下拉框内容
  13. 自建低成本代码托管与文档管理平台经验分享
  14. 自学单片机难吗?单片机编程教学怎么选?
  15. 四十九、HBase介绍
  16. Deepin v20 Beta 手动更新深度应用中安装的火狐浏览器中国版
  17. 汇编语言零基础入门学习教程
  18. 大隐隐于市,你身边的那些安全隐患你都知道么?
  19. Grafana+prometheus实现主机监控
  20. Retrofit+Rxjava+mvp购物车

热门文章

  1. mysql 做回归模型_技术分享 | 我对 MySQL 隔离级别的剖析
  2. 软件工程小组第六次会议记录
  3. windows server 2008安装wampserver后几种小问题个人总结
  4. 阿里巴巴2010校园招聘笔试题
  5. Ubuntu上安装rvm
  6. Ogre:ManualObject
  7. fileTOFILE
  8. java功能性需求分析_Java-CS-Record/3、结构化需求分析.md at main · yzx66-net/Java-CS-Record · GitHub...
  9. window10保存文件时提示联系管理员_东芝2000AC扫描文件到远程域共享服务器
  10. 搜索文献_搜索参考文献?6个搜索小技巧,搞科研需知!