首页
社区
课程
招聘
[旧帖] [求助]请教一段简单的代码,将它的流程用高级语言方式写出来 0.00雪花
2008-6-5 00:54 3596

[旧帖] [求助]请教一段简单的代码,将它的流程用高级语言方式写出来 0.00雪花

2008-6-5 00:54
3596
这是一段简单的代码,请大家帮忙看一看,能不能实现:
1.把它的流程用高级语言的方式写出来.
2.不使用goto.
3.代码块不重复使用.

如果不能实现,那么能不能从逻辑理论上证明呢?

condX  表示条件转移
codeX  表示代码块

.text:0048D4C2 call    CFile_Open  ; CFile::Open(const char* file,int flag,CFileException* exception);
.text:0048D4C7 test    eax, eax
.text:0048D4C9 jz      short loc_48D533      ; ----------------------------cond0
.text:0048D4CB lea     eax, [esp+148h+dataBlockCount] ; ----------------------------code0
.text:0048D4CF push    4 
.text:0048D4D1 push    eax
.text:0048D4D2 lea     ecx, [esp+150h+fileObject]
.text:0048D4D6 mov     [esp+150h+dataBlockCount], edi
.text:0048D4DA call    CFile_Read            ; CFile::Read(void* buffer,int readCount)
.text:0048D4DF cmp     [esp+148h+dataBlockCount], edi
.text:0048D4E3 jbe     short loc_48D528      ; ----------------------------cond1
.text:0048D4E5
.text:0048D4E5 loc_48D4E5:
.text:0048D4E5 lea     ecx, [esp+148h+dataBlockbuffer] ; ----------------------------code2
.text:0048D4E9 push    108h
.text:0048D4EE push    ecx
.text:0048D4EF lea     ecx, [esp+150h+fileObject]
.text:0048D4F3 call    CFile_Read            ; CFile::Read(void* buffer,int readCount)
.text:0048D4F8 cmp     eax, 108h
.text:0048D4FD jb      short loc_48D526      ; ----------------------------cond2
.text:0048D4FF mov     eax, [esi+0Ch]        ; ----------------------------code4
.text:0048D502 lea     ecx, [esi+4]
.text:0048D505 lea     edx, [esp+148h+dataBlockbuffer]
.text:0048D509 push    edx
.text:0048D50A push    1
.text:0048D50C push    eax
.text:0048D50D call    sub_405C45
.text:0048D512 mov     eax, [esp+148h+dataBlockCount]
.text:0048D516 inc     edi
.text:0048D517 cmp     edi, eax
.text:0048D519 jb      short loc_48D4E5      ; ----------------------------cond3
.text:0048D51B lea     ecx, [esp+148h+fileObject] ; ----------------------------code6
.text:0048D51F call    CFile_Close
.text:0048D524 jmp     short loc_48D535      ; ----------------------------code7
.text:0048D526 ; ---------------------------------------------------------------------------
.text:0048D526
.text:0048D526 loc_48D526:
.text:0048D526 mov     bl, 1                 ; ----------------------------code5
.text:0048D528
.text:0048D528 loc_48D528: 
.text:0048D528 lea     ecx, [esp+148h+fileObject] ; ----------------------------code3
.text:0048D52C call    CFile_Close
.text:0048D531 jmp     short loc_48D535      ; ----------------------------code7
.text:0048D533 ; ---------------------------------------------------------------------------
.text:0048D533
.text:0048D533 loc_48D533: 
.text:0048D533 mov     bl, 1                 ; ----------------------------code1
.text:0048D535
.text:0048D535 loc_48D535: 
.text:0048D535                               ; TableFileInfo_readImpl+101j
.text:0048D535 test    bl, bl                ; ----------------------------code7
.text:0048D537 setz    bl
.text:0048D53A mov     [esp+148h+exceptionObject], offset off_51A5CC
.text:0048D542 lea     ecx, [esp+148h+var_128]
.text:0048D546 mov     byte ptr [esp+148h+var_4], 4
.text:0048D54E call    CException_Dtor
.text:0048D553 lea     ecx, [esp+148h+fileObject]
.text:0048D557 mov     [esp+148h+var_4], 0FFFFFFFFh
.text:0048D562 call    CFile_Dtor
.text:0048D567 mov     ecx, [esp+148h+var_C]
.text:0048D56E pop     edi
.text:0048D56F mov     al, bl
.text:0048D571 pop     esi
.text:0048D572 pop     ebx
.text:0048D573 mov     large fs:0, ecx
.text:0048D57A add     esp, 13Ch
.text:0048D580 retn

阿里云助力开发者!2核2G 3M带宽不限流量!6.18限时价,开 发者可享99元/年,续费同价!

收藏
点赞0
打赏
分享
最新回复 (4)
雪    币: 200
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
incrediman 2008-6-5 08:59
2
0
this looks like mfc apps...
雪    币: 215
活跃值: (11)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
caocunt 2008-6-5 09:25
3
0
既然简单,那就请楼主自便吧.
雪    币: 208
活跃值: (10)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
bood 1 2008-6-5 09:29
4
0
早就有人证明理论上可以不用goto了
雪    币: 260
活跃值: (224)
能力值: ( LV9,RANK:170 )
在线值:
发帖
回帖
粉丝
andy00 4 2008-6-5 11:18
5
0
这儿还有一个条件,代码块不能重复使用。
加上这个就不好弄了。
游客
登录 | 注册 方可回帖
返回