Fwd: Code mau 64

6 views
Skip to first unread message

Phuc Le Sanh

unread,
Jun 14, 2013, 2:25:24 AM6/14/13
to aep04-uit


---------- Forwarded message ----------
From: Nguyễn Văn, Toàn <toa...@uit.edu.vn>
Date: 2013/6/14
Subject: Code mau 64
To: Phuc Le Sanh <phuc...@gmail.com>


        .file   "Hello.c"
        .text
        .globl  Sum
        .def    Sum;    .scl    2;      .type   32;     .endef
        .seh_proc       Sum
Sum:
        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        .seh_setframe   %rbp, 0
        .seh_endprologue
        movl    %ecx, 16(%rbp)
        movl    %edx, 24(%rbp)
        movl    16(%rbp), %eax
        cmpl    24(%rbp), %eax
        jle     .L2
        movl    16(%rbp), %eax
        jmp     .L3
.L2:
        movl    24(%rbp), %eax
.L3:
        popq    %rbp
        ret
        .seh_endproc
        .def    __main; .scl    2;      .type   32;     .endef
        .section .rdata,"dr"
.LC0:
        .ascii "%d\0"
        .text
        .globl  main
        .def    main;   .scl    2;      .type   32;     .endef
        .seh_proc       main
main:
        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        subq    $32, %rsp
        .seh_stackalloc 32
        .seh_setframe   %rbp, 32
        .seh_endprologue
        call    __main
        movl    $4, %edx
        movl    $3, %ecx
        call    Sum
        movl    %eax, %edx
        leaq    .LC0(%rip), %rcx
        call    printf
        addq    $32, %rsp
        popq    %rbp
        ret
        .seh_endproc
        .def    printf; .scl    2;      .type   32;     .endef

-

        .file   "Hello.c"
        .text
        .globl  Sum
        .def    Sum;    .scl    2;      .type   32;     .endef
        .seh_proc       Sum
Sum:
        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        subq    $16, %rsp
        .seh_stackalloc 16
        .seh_setframe   %rbp, 16
        .seh_endprologue
        movl    %ecx, 16(%rbp)
        movl    %edx, 24(%rbp)
        movl    24(%rbp), %eax
        movl    16(%rbp), %edx
        addl    %edx, %eax
        movl    %eax, -4(%rbp)
        movl    -4(%rbp), %eax
        addq    $16, %rsp
        popq    %rbp
        ret
        .seh_endproc
        .def    __main; .scl    2;      .type   32;     .endef
        .section .rdata,"dr"
.LC0:
        .ascii "%d\0"
        .text
        .globl  main
        .def    main;   .scl    2;      .type   32;     .endef
        .seh_proc       main
main:
        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        subq    $32, %rsp
        .seh_stackalloc 32
        .seh_setframe   %rbp, 32
        .seh_endprologue
        call    __main
        movl    $4, %edx
        movl    $3, %ecx
        call    Sum
        movl    %eax, %edx
        leaq    .LC0(%rip), %rcx
        call    printf
        addq    $32, %rsp
        popq    %rbp
        ret
        .seh_endproc
        .def    printf; .scl    2;      .type   32;     .endef



--
Nguyễn Văn Toàn
Phòng Công tác Sinh viên - Trường Đại học Công nghệ thông tin - ĐHQG-HCM
SĐT: 0903761559 - Email: toa...@uit.edu.vn



--
University of Information Technology
Student at Advanced Education Program in Information System
Phone: 0933111875

Phuc Le Sanh

unread,
Jun 14, 2013, 2:44:46 AM6/14/13
to aep04-uit
---------- Forwarded message ----------
From: Nguyễn Văn, Toàn <toa...@uit.edu.vn>
Date: 2013/6/14
Subject: Re: Code mau 64
To: Phuc Le Sanh <phuc...@gmail.com>


        .file   "max.c"
        .text
        .globl  Max
        .def    Max;    .scl    2;      .type   32;     .endef
        .seh_proc       Max
Max:

        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        .seh_setframe   %rbp, 0
        .seh_endprologue
        movl    %ecx, 16(%rbp)
        movl    %edx, 24(%rbp)
        movl    16(%rbp), %eax
        cmpl    24(%rbp), %eax
        jle     .L2
        movl    16(%rbp), %eax
        jmp     .L3
.L2:
        movl    24(%rbp), %eax
.L3:
        popq    %rbp
        ret
        .seh_endproc
        .def    __main; .scl    2;      .type   32;     .endef
        .section .rdata,"dr"
.LC0:
        .ascii "Nhap a,b : \0"
.LC1:
        .ascii "%d %d\0"
.LC2:
        .ascii "So lon nhat la %d\0"

        .text
        .globl  main
        .def    main;   .scl    2;      .type   32;     .endef
        .seh_proc       main
main:
        pushq   %rbp
        .seh_pushreg    %rbp
        movq    %rsp, %rbp
        subq    $48, %rsp
        .seh_stackalloc 48
        .seh_setframe   %rbp, 48
        .seh_endprologue
        call    __main

        leaq    .LC0(%rip), %rcx
        call    printf
        leaq    -8(%rbp), %rdx
        leaq    -4(%rbp), %rax
        movq    %rdx, %r8
        movq    %rax, %rdx
        leaq    .LC1(%rip), %rcx
        call    scanf
        movl    -8(%rbp), %edx
        movl    -4(%rbp), %eax
        movl    %eax, %ecx
        call    Max
        movl    %eax, %edx
        leaq    .LC2(%rip), %rcx
        call    printf
        addq    $48, %rsp

        popq    %rbp
        ret
        .seh_endproc
        .def    printf; .scl    2;      .type   32;     .endef
        .def    scanf;  .scl    2;      .type   32;     .endef


On Fri, Jun 14, 2013 at 1:41 PM, Nguyễn Văn, Toàn <toa...@uit.edu.vn> wrote:
>         .file   "max.c"
>         .text
>         .globl  Max
>         .def    Max;    .scl    2;      .type   32;     .endef
>         .seh_proc       Max
> Max:

>         pushq   %rbp
>         .seh_pushreg    %rbp
>         movq    %rsp, %rbp
>         .seh_setframe   %rbp, 0
>         .seh_endprologue
>         movl    %ecx, 16(%rbp)
>         movl    %edx, 24(%rbp)
>         movl    16(%rbp), %eax
>         cmpl    24(%rbp), %eax
>         jle     .L2
>         movl    16(%rbp), %eax
>         jmp     .L3
> .L2:
>         movl    24(%rbp), %eax
> .L3:
>         popq    %rbp
>         ret
>         .seh_endproc
>         .def    __main; .scl    2;      .type   32;     .endef
>         .section .rdata,"dr"
> .LC0:
>         .ascii "Nhap a,b : \0"
> .LC1:
>         .ascii "%d %d\0"
> .LC2:
>         .ascii "So lon nhat la %d\0"

>         .text
>         .globl  main
>         .def    main;   .scl    2;      .type   32;     .endef
>         .seh_proc       main
> main:
>         pushq   %rbp
>         .seh_pushreg    %rbp
>         movq    %rsp, %rbp
>         subq    $48, %rsp
>         .seh_stackalloc 48
>         .seh_setframe   %rbp, 48
>         .seh_endprologue
>         call    __main

>         leaq    .LC0(%rip), %rcx
>         call    printf
>         leaq    -8(%rbp), %rdx
>         leaq    -4(%rbp), %rax
>         movq    %rdx, %r8
>         movq    %rax, %rdx
>         leaq    .LC1(%rip), %rcx
>         call    scanf
>         movl    -8(%rbp), %edx
>         movl    -4(%rbp), %eax
>         movl    %eax, %ecx
>         call    Max
>         movl    %eax, %edx
>         leaq    .LC2(%rip), %rcx
>         call    printf
>         addq    $48, %rsp

>         popq    %rbp
>         ret
>         .seh_endproc
>         .def    printf; .scl    2;      .type   32;     .endef
>         .def    scanf;  .scl    2;      .type   32;     .endef
>
>
> 2013/6/14 Nguyễn Văn, Toàn <toa...@uit.edu.vn>:
Reply all
Reply to author
Forward
0 new messages