代码拉取完成,页面将自动刷新
同步操作将从 西边/asm_fragment 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/* 删除文件中的记录 195.c */
.text
.data
.globl emp
.comm emp,280,32
.section .rodata
.LC0:
.string "please input filename:\n"
.LC1:
.string "%s"
.LC2:
.string "please input the number of emploees:\n"
.LC3:
.string "%d"
.LC4:
.string "input name and salary:\n"
.LC5:
.string "NO%d:\n"
.LC6:
.string "%s%d"
.LC7:
.string "ab"
.LC8:
.string "Can not open the file."
.LC9:
.string "error\n"
.LC10:
.string "rb"
.LC11:
.string "Can not open file."
.LC12:
.string "\n original data:"
.LC13:
.string "\n %8s%7d"
.LC14:
.string "\n Input name which do you want to delete:"
.LC15:
.string "\nNot found"
.LC16:
.string "\nNow,the content of file:\n"
.LC17:
.string "wb"
.LC18:
.string "rb"
.LC19:
.string "\n%8s%7d"
.text
.globl main
main:
pushq %rbp
movq %rsp,%rbp
subq $0x1000,%rsp
movq $0,-0x1000(%rbp) /* fp1 */
movq $0,-0xff8(%rbp) /* fp2 */
movl $0,-0xff0(%rbp) /* i */
movl $0,-0xfec(%rbp) /* j */
movl $0,-0xfe8(%rbp) /* n */
movl $0,-0xfe4(%rbp) /* flag */
movl $0,-0xfe0(%rbp) /* salary */
movl $0,-0xfd0(%rbp) /* name */
movl $0,-0xfc0(%rbp) /* filename */
leaq .LC0(%rip),%rdi
movl $0,%eax
call printf
leaq -0xfc0(%rbp),%rsi /* filename */
leaq .LC1(%rip),%rdi
movl $0,%eax
call scanf
leaq .LC2(%rip),%rdi
movl $0,%eax
call printf
leaq -0xfe8(%rbp),%rsi /* n */
leaq .LC3(%rip),%rdi
movl $0,%eax
call scanf
leaq .LC4(%rip),%rdi
movl $0,%eax
call printf
movl $0,-0xff0(%rbp) /* i */
jmp .Lmain_400
.Lmain_500:
movl -0xff0(%rbp),%eax /* i */
addl $1,%eax
movl %eax,%esi
leaq .LC5(%rip),%rdi
movl $0,%eax
call printf
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
leaq 10(%rdi),%rdx /* emp[i].salary */
leaq 0(%rdi),%rsi /* emp[i].name */
leaq .LC6(%rip),%rdi
movl $0,%eax
call scanf
addl $1,-0xff0(%rbp) /* i */
.Lmain_400:
movl -0xff0(%rbp),%eax /* i */
cmpl -0xfe8(%rbp),%eax /* n */
jl .Lmain_500
leaq .LC7(%rip),%rsi
leaq -0xfc0(%rbp),%rdi /* filename */
movl $0,%eax
call fopen
movq %rax,-0x1000(%rbp) /* fp1 */
cmpq $0,-0x1000(%rbp) /* fp1 */
jne .Lmain_398
leaq .LC8(%rip),%rdi
movl $0,%eax
call printf
movl $0,%edi
movl $0,%eax
call exit
.Lmain_398:
movl $0,-0xff0(%rbp) /* i */
jmp .Lmain_390
.Lmain_397:
movq -0x1000(%rbp),%rcx /* fp1 */
movl $1,%edx
movl $14,%esi
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
movl $0,%eax
call fwrite
cmpl $1,%eax
je .Lmain_392
leaq .LC9(%rip),%rdi
movl $0,%eax
call printf
.Lmain_392:
addl $1,-0xff0(%rbp) /* i */
.Lmain_390:
movl -0xff0(%rbp),%eax /* i */
cmpl -0xfe8(%rbp),%eax /* n */
jl .Lmain_397
movq -0x1000(%rbp),%rdi /* fp1 */
movl $0,%eax
call fclose
leaq .LC10(%rip),%rsi /* rb */
leaq -0xfc0(%rbp),%rdi /* filename */
movl $0,%eax
call fopen
movq %rax,-0xff8(%rbp) /* fp2 */
cmpq $0,-0xff8(%rbp) /* fp2 */
jne .Lmain_380
leaq .LC11(%rip),%rdi
movl $0,%eax
call printf
movl $0,%edi
movl $0,%eax
call exit
.Lmain_380:
leaq .LC12(%rip),%rdi
movl $0,%eax
call printf
movl $0,-0xff0(%rbp) /* i */
jmp .Lmain_360
.Lmain_379:
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
movl 10(%rdi),%edx /* emp[i].salary */
leaq 0(%rdi),%rsi /* emp[i].name */
leaq .LC13(%rip),%rdi
movl $0,%eax
call printf
addl $1,-0xff0(%rbp) /* i */
.Lmain_360:
movq -0xff8(%rbp),%rcx /* fp2 */
movl $1,%edx
movl $14,%esi
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
movl $0,%eax
call fread
cmpl $0,%eax
jne .Lmain_379
movl -0xff0(%rbp),%eax /* i */
movl %eax,-0xfe8(%rbp) /* n */
movq -0xff8(%rbp),%rdi /* fp2 */
movl $0,%eax
call fclose
leaq .LC14(%rip),%rdi
movl $0,%eax
call printf
leaq -0xfd0(%rbp),%rsi /* name */
leaq .LC1(%rip),%rdi
movl $0,%eax
call scanf
movl $1,-0xfe4(%rbp) /* flag */
movl $0,-0xff0(%rbp) /* i */
jmp .Lmain_330
.Lmain_359:
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
leaq 0(%rdi),%rsi /* emp[i].name */
leaq -0xfd0(%rbp),%rdi /* name */
movl $0,%eax
call strcmp
cmpl $0,%eax
jne .Lmain_332
movl -0xff0(%rbp),%eax /* i */
movl %eax,-0xfec(%rbp) /* j */
jmp .Lmain_345
.Lmain_358:
movl -0xfec(%rbp),%eax /* j */
addl $1,%eax
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[j+1] */
leaq 0(%rdi),%rsi
movl -0xfec(%rbp),%eax /* j */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
leaq 0(%rdi),%rdi /* emp[i].name */
movl $0,%eax
call strcpy
movl -0xfec(%rbp),%eax /* j */
addl $1,%eax
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[j+1] */
movl 10(%rdi),%ecx /* emp[j+1].salary */
movl -0xfec(%rbp),%eax /* j */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[j] */
movl %ecx,10(%rdi) /* emp[j].salary */
addl $1,-0xfec(%rbp) /* j */
.Lmain_345:
movl -0xfe8(%rbp),%eax /* n */
subl $1,%eax
cmpl -0xfec(%rbp),%eax /* j */
jg .Lmain_358
movl $0,-0xfe4(%rbp) /* flag */
.Lmain_332:
addl $1,-0xff0(%rbp) /* i */
.Lmain_330:
movl -0xfe4(%rbp),%eax /* flag */
testl %eax,%eax
je .Lmain_329
movl -0xff0(%rbp),%eax /* i */
cmpl -0xfe8(%rbp),%eax /* n */
jge .Lmain_329
jmp .Lmain_359
.Lmain_329:
movl -0xfe4(%rbp),%eax /* flag */
testl %eax,%eax
jne .Lmain_310
movl -0xfe8(%rbp),%eax /* n */
subl $1,%eax
movl %eax,-0xfe8(%rbp) /* n */
jmp .Lmain_309
.Lmain_310:
leaq .LC15(%rip),%rdi
movl $0,%eax
call printf
.Lmain_309:
leaq .LC16(%rip),%rdi
movl $0,%eax
call printf
leaq .LC17(%rip),%rsi
leaq -0xfc0(%rbp),%rdi /* filename */
movl $0,%eax
call fopen
movq %rax,-0xff8(%rbp) /* fp2 */
movl $0,-0xff0(%rbp) /* i */
jmp .Lmain_250
.Lmain_300:
movq -0xff8(%rbp),%rcx /* fp2 */
movl $1,%edx
movl $14,%esi
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
movl $0,%eax
call fwrite
addl $1,-0xff0(%rbp) /* i */
.Lmain_250:
movl -0xff0(%rbp),%eax /* i */
cmpl -0xfe8(%rbp),%eax /* n */
jl .Lmain_300
movq -0xff8(%rbp),%rdi /* fp2 */
movl $0,%eax
call fclose
leaq .LC18(%rip),%rsi /* */
leaq -0xfc0(%rbp),%rdi /* filename */
movl $0,%eax
call fopen
movq %rax,-0xff8(%rbp) /* fp2 */
movl $0,-0xff0(%rbp) /* i */
jmp .Lmain_200
.Lmain_240:
movl -0xff0(%rbp),%eax /* i */
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
movl 10(%rdi),%edx /* emp[i].salary */
leaq 0(%rdi),%rsi /* emp[i].name */
leaq .LC19(%rip),%rdi
movl $0,%eax
call printf
addl $1,-0xff0(%rbp) /* i */
.Lmain_200:
movq -0xff8(%rbp),%rcx /* fp2 */
movl $1,%edx
movl $14,%esi
movl -0xff0(%rbp),%eax
imull $14,%eax
movslq %eax,%rax
leaq emp(%rip),%rdi
leaq 0(%rdi,%rax,1),%rdi /* emp[i] */
movl $0,%eax
call fread
cmpl $0,%eax
jne .Lmain_240
movq -0xff8(%rbp),%rdi /* fp2 */
movl $0,%eax
call fclose
movl $0,%eax
leave
ret
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。