Anda di halaman 1dari 28

Percobaan I

Compiler Bahasa C dan Bahasa Assembly


Intel ® X86
Zepanya Sahron Banjarnahor (14S16033)
Tanggal Percobaan : 27/09/2018
[ELS2203] Elektronika 1]
[Laboratorium Sistem Digital] – Teknik Elektro
Institut Teknologi Del

Abstrak 2. Praktikan mampu melakukan kompilasi program


This week's practice is titled C Language Compiler and Intel Bahasa C menggunakan compiler GCC beserta
x86 Assembly Language. In this lab, 9 assignments will be penggunaan makefile dan batch file.
given for analysis. Practicum tools used are: Laptop with 3. Praktikan memahami Bahasa Assembly dan mampu
Windows operating system, GCC compiler in Codebloks melakukan analisis terhadap Bahasa assembly Intel
program package, and the last is Notepad ++ as text editor and x86 yang dihasilkan compiler GCC.
HexEdit as hexadecimal editor. The results expected by the 4. Praktikan dapat memahami penggunaan stack memory
practitioner to understand the compilation phase of the program pada setiap procedure call.
in C Language, are able to compile using the GCC compiler,
understand Assembly language, and understand the use of stack II. LANDASAN TEORI
memory in each procedure call.
A. Kompilasi menggunakan GCC
Keywords: Assembly, Compiler, GCC.

I. PENDAHULUAN Proses menerjemahkan baris kode program dalam bahasa C


menjadi file executable dilakukan dalam empat langkah yaitu
Dalam Prose pembuatan program, bahasa tingkat tinggi lebih preprocessor, compiler, assembler, dan linker yang seluruhnya
banyak digunakan karena bahasa tersebut lebih mudah disebut sistem kompilasi.
dimengerti dan dipahami oleh manusia contohnya bahasa C.
Akan tetapi, bahasa tersebut sulit untuk dimengerti oleh mesin
(mikroprosessor) sehingga tidak dieksekusi. Oleh karena itu,
diperlukan suatu bahasa yang menjembatani antara kedua
bahasa tersebut dari bahasa tingkat tinggi ke tingkat rendah.
Solusi dari masalah tersebut adalah dibuatnya Bahasa
Assembly yang menjadi penerjemah pemrograman tingkat B. Preprocessor
tinggi menjadi bahasa tingkat rendah yang berisi urutan
instruksi yang dimengerti oleh mesin. Selanjutnya instruksi Semua perintah Preprocessor yang ditulis dalam bahasa tingkat
tersebut dikemas kedalam suatu bentuk executable object tinggi akan diproses terlebih dahulu oleh preprocessor sebelum
program yang disimpan dalam bentuk file biner. Proses compiler melaksanakan tugasnya. Beberapa tugas dari
penerjemahan dari Bahasa tingkat tinggi menjadi bahasa preprocessor ini adalah sebagai berikut :
Assembly disebut dengan compilation. Dari sisi instruction set
(kumpulan instruksi dalam Bahasa mesin), terdapat dua  Semua komentar dalam file program, diganti dengan
penggolongan mesin (mikroprosessor) yaitu Complex spasi satu buah.
Instruction Set Computer (CISC), contoh mikroprossesor Intel  Semua \n yang menandakan baris baru akan dihapus
dan Reduce Instruction Set Computer (RISC), contohnya tidak peduli dimanapun dia berada. Fitur ini
MIPS32. memungkinkan kita untuk membagi baris program
yang panjang ke dalam beberapa baris tanpa
Pada praktikum ini tujuannya adalah : mengubah arti.
1. Praktikan memahami tahap-tahap kompilasi program  Macro yang telah didefinisikan diganti dengan
dalam Bahasa C sebagai tingkat tinggi hingga definisinya.
diperoleh Bahasa tingkat rendah yang dapat
dieksekusi oleh mesin. Contohnya, pada perintah #define MAX_ROWS 10,
preprocessor akan mengganti semua kata MAX_ROWS
dengan 10. Kemudian pada perintah #include <stdio.h>,
preprocessor akan mengganti baris tersebut dengan isi file dengan ukuran tidak terlalu besar dan lebih sedikit
stdio.h menggunakan RAM

 -O3: optimalisasi penuh, memanfaatkan


C. MOSFET Sebagai Switch
multithreading, waktu kompilasi yang cepat,
Compiler akan menerjemahkan bahasa tingkat tinggi C ke kode binari berukuran kecil dan menggunakan RAM
assembly. Kode tersebut berisi intruksi-instruksi yang sesuai seminum mungkin binarinya nanti, namun potensi
dengan indtruction set yang dimiliki oleh mesin. File yang crash amat besar jika sistem tidak mendukung atau
dihasilkan pada tahap ini masih berupa file teks (.s). source code tidak mendukung opsi ini.

D. Assembler  -Os : optimasi dilakukan dengan


mengoptimalkan pada ukuran yang kecil pada binari
Assembler akan menerjamahkan bahasa assembly menjadi file
saja,
objek. File objek ini merupakan file biner (.o).
 -Ofast : mengaktifkan semua optimasi pada – O3
E. Linker dan pilihan – ffast-math dan fortrand specific
Linker menggabungkan file biner yang diperoleh pada tahap
sebelumnya dengan file biner lain yang merupakan dependency H. Makefile dan Batch file
dari program yang dibuat, contohnya library untuk Pada GCC terdapat fitur makefile yang berfungsi untuk menulis
menjalankan fungsi printf. Hasil dari linker berupa file biner daftar nama file kode didalam suatu project. Kita hanya
executable (dalam file memiliki akhiran .exe). memberikanGCC nama makefile lalu GCC akan melakukan
Untuk melakukan proses kompilasi menggunakan GCC, dapat proses kompilasi untuk semua file tersebut yang kemudian akan
digunakan Command Prompt pada Microsoft Windows. digabungkan pada file executable. Makefile dapat bersifat
sederhana hingga kompleks, bergantung pada sejauh mana
makefile digunakan untuk mengorganisasikan project.
F. Disassembly menggunakan GCC
Contohnya adalah sebagai berikut :

Selain dapat melakukan kompilasi, paket compiler GCC juga all: main_text.exe
menyertakan sebuah disassembler yang mampu melakukan
disassembly file biner (.o atau .exe) menjadi file assembly main_text.exe: main_text.o text.o
(.s) bernama Object Dump. gcc main_text.o text.o -o main_text.exe

main_text.o: main_text.c
gcc -c main_text.c
G. Optimasi Program melalui Proses Kompilasi
text.o: text.c
GCC mendukung beberapa tingkat optimasi program yang gcc -c text.c
dapat dilakukan saat proses kompilasi dilakukan.
Terdapat beberapa tingkat optimasi program yang dapat dipilih
dengan menambahkan flag optimasi saat melakukan Lalu untuk melakukan kompilasi makefile kita gunakan
kompilasi program. Umumnya optimasi program merupakan perintah sesuai dengan yang ada di modul yaitu :
trade-off antara executablespeed, program size, compilation
time, dan kemudahan dalam melakukan debugging. Mingw32-make –f makefile
Beberapa flag optimasi yang dikenali oleh GCC adalah – O0, -
O1, -O2, -O3, -Os, dan – Ofast. Perbedaan masing-masing level Perintah tersebut akan melakukan kompilasi terhadap makefile
optimasi diberikan sebagai berikut : yang diberikan menjadi sebuah program bernama contoh.exe.
Program ini dihasilkan oleh hasil linker terhadap dua file objek
 -O0 : tidak melakukan optimalisasi sama sekali namun bernama contoh.o dan text.o. Untuk memperoleh main.o, GCC
mengorbankan waktu kompilasi yang lama, dan harus melakukan kompilasi source code main.c menjadi file
menggunakan RAM yang amat besar baik objek. Begitu pula untuk memperoleh text.o, GCC harus
selama proses kompialasi atau binari nantinya, melakukan kompilasi source code text.c.
namun baiknya binari akan sangat stabil.
Pada platform Microsoft® Windows™, ada sebuah file sheel
 -O1 : opstimasi yang dilakukan sedikit dan script Windows™ Batch file. Kita dapat menuliskan perintah
menghasilkan waktu kompilasi yang lama, yang biasa kita tuliskan secara terpisah pada commad prompt
binary berukuran besar, dan memakan banyak RAM. dalam suatu file yang disimpan dengan ekstensi .bat. Untuk
eksekusi perintah-perintah tersebut, kita cukup menjalankan
 -O2 : optimalisasi lebih ditingkatkan (dari – O1), file .bat tersebut sehingga command prompt terbuka dan
waktu kompilasi lebih cepat, menghasilkan binari perintah yang kita tuliskan dapat dieksekusi secara otomatis.
Contoh Windows™ Batch File adalah sebagai berikut :
%~d0 Tapi, apabila dibuka dengan HexEdit, maka akan muncul
cd "%~dp0" tampilan pola tertentu dalam bentuk biner.
gcc -O0 -c code_O0.c Proses terakhir yaitu Linker. Proses ini berperan untuk
gcc -O1 -c code_O1.c
gcc -O2 -c code_O2.c
mengubah code.o (file objek) jadi code.exe. file executable ini
gcc -O3 -c code_O3.c juga bertipe file biner, jadi kalau dibuka dengan text editor akan
gcc -Os -c code_Os.c menampilakan karakter yang tidak dipahami, ditujukkan seperti
gcc -Ofast -c code_Ofast.c gambar dibawah ini :
objdump -d code_O0.o > code_O0.s
objdump -d code_O1.o > code_O1.s
objdump -d code_O2.o > code_O2.s
objdump -d code_O3.o > code_O3.s
objdump -d code_Os.o > code_Os.s
objdump -d code_Ofast.o > code_Ofast.s
pause

Windows™ Batch File tersebut berisi perintah sebagai berikut.


Perintah %~d0 memerintahkan command Prompt untuk
berpindah driver letter yang sesuai dengan lokasi Windows™ Gambar 2. Tampilan filetext code.exe
Batch File berada. Selanjutnya, perintah cd “%`dp0”
memerintahkan Command prompt untuk berpindah folder ke Tapi jika dibuka dengan HexEdit akan menampilakan pola
lokasi Windows™ Batch File berada. Setelah itu command bilangan biner.
prompt mengeksekusi perintah yang memanggil GCC secara Perbedaannya dengan file objek adalah pada executable file
berurutan hingga berhenti akibat adanya perintah pause. Untuk ini ukurannya lebih besar dan isinya lebih banyak dikarenakan
melanjutkan eksekusi, kita cukup menekan sembarang tombol file merupakan gabungan dari semua file yang terkait,
pada keyboard sehingga cmd mengeksekusi perintah contohnya library.
selanjutnya yaitu object Dump.
B. Tugas 2 : Proses Kompilasi Bahasa C Menggunakan GCC
degan Bantuan Batch File
III. HASIL DAN ANALISIS
Pada tugas ini dilakukan kompilasi program code.c
A. Tugas 1 : Proses Kompilasi Bahasa C Menggunakan yang sama ditugas 1. Bedanya proses kompilasi tidak dilakukan
GCC dengan memberikan perintah satu persatu pada GCC melainkan
Pada tugas pertama ini dilakukan kompilasi program, dengan membuat suatu batch file. Batch file yang kita gunakan
secara bertahap menggunakan GCC. Prosesnya dimulai dengan sesuai dengan instruksi pada modul yaitu seperti ditujukkan
membuat membuat code program dalam Bahasa C. Kode dibawah ini :
tersebut berextensi file”.c”.
%~d0
Proses kompilasi diawali dengan preprocessing yang
cd "%~dp0"
berperan untuk mengubah file code.c ke code.i. kedua file ini gcc -E code.c > code.i
typenya filetext, sehingga bias dibuka dari notepad++ seperti gcc -S code.c
gambar berikut. Perbedaannya adalah pada code.i (masih gcc -c code.c
berbentuk bahasa C) tapi spasi hanya 1 karakter, komentarnya gcc -o code.exe code.c
hilang, dan definisi mikro sudah finati kedalam program code.exe
pause
(N_LOOP diganti dengan nilai definisi 500).
Proses kompilasi kedua adalah compiling. Proses ini
Gambar 3. File batch.bat
dilakukan penerjemahan code.i jadi kode.s (Bahasa assembly).
Kedua file ini masih berbentuk filetxt dan dapat dibuka dari
File ini hanya dapat dijalankan pada platform DOS and
notepad++. Code.s yang sudah dalam bahasa assembly ini
Windows. File ini berisi perintah yang mampu diterjemahkan
berisi instruksi-instruk yang dimengerti mesin.
oleh command interpreter. Jadi file ini cara kerjanya sama
Proses berikutnya adalah Assembler, dimana proses
dengan command prompt hanya bedanya di cara eksekusinya.
ini berperan untuk menerjemahkan code.s (bahasa assembly)
Proses kompilasi yang dibantu dengan file batch ini
menjadi code.o (file objek). Pada bagian ini file code.o bertipe
membutuhkan waktu yang singkat dikarenakan kompilasi tidak
biner (bukan filetxt) sehingga sehingga jika dibuka dengan text
dilakukan tahap demi tahap, tetapi hanya perlu melakukan
editor menghasilkan karakter yang kurang dimengerti,
double klik pada file batch.bat. hasilnya diperoleh yaitu berupa
ditunjukkan seperti dibawah ini :
file code.i, code.s, ceode.o, dan code.exe yang identic sama
dengan file pada percobaan 1 sebelumnya.

Gambar 1. Tampilan code.o


yang menyatakan bahwa optimasi –O1 lebih optimal untuk
mengecilkan file.
Pada optimasi dengan – O2, -O3, -Os, dan – Ofast
memiliki jumlah baris yang sama yaitu 16 baris. Pada masing-
masing optimasi (– O2, -O3, -Os, dan –Ofast) telah
dilakukan pengaktifan flag yang berbeda-beda, namun
dikarenakan hasil optimasi yang diperoleh sama maka dapat
dikatakan bahwa optimasi dengan –O2 saja sudah cukup
optimal untuk optimasi pajang file sehingga flag-flag tambahan
tidak terlalu berpengaruh.
Selain dituinjau dari ukuran file, proses optimasi juga
dapat diamati dari segi runtime program. Pada optimasi –O2, -
O3, dan –Ofast kemungkinan terdapat perbedaan runtime
namun karena tidak dilakukannya pengujian pada praktikum
ini, maka tidak dapat dikertahui perbedaan antar optimasi dari
segi runtime program. Runtime program sendiri dapat
dilakukan dengan mencatat timestamp dari tiap proses yang
dilakukan dengan bantuan library tambahan sehingga dapat
Dari gambar diatas bahwa batch file melakukan operasi yang mengakses informasi waktu dati system operasi.
sama dengan cmd. Tapi lebih praktis karena user hanya perlu
melakukan eksekusi file.bat tanpa perlu mengetikan perintah E. Tugas 5 : Kompilasi Beberapa File Kode dengan GCC
pada cmd setiap kali akan melakukan kompilasi.
Pada tugas kelima ini dilakukan proses kompilasi
terlebih dahulu pada file main_text.c dan text.c sampai
didapatkan executable file-nya (main_text.exe). perintah
C. Tugas 3 : Disassembly File Objek eksekusi pada command prompt ditujukkan pada gambar
Pada modul 3 dilakukan disassembly file objeck dengan dibawah ini :
menggunakan objdump. Pertama dilakukan disassembly file
code.c sehingga menghasilkan file disassembly_code_o.asm.
Kemudian dilakukan pula disassembly file code.exe dan
diperoleh file disassembly_code_exe.asm

Gambar 6. Perintah eksekusi pada command prompt

Untuk melakukan kompilasi kedua file, dibutuhkan file header


yang berfungsi untuk menghubungkan file main_text.c dan
text.c file header ini memuat deklarasi fungsi test pada text.c
yang selanjutnya akan diterjemahkan dan digunakan pada file
main_text.c hasil eksekusi file diatas menunjukkan bahwa GCC
Gambar 5. Perbandingan hasil disassembly file code.o dan juga dapat digunakan untuk melakukan kompilasi beberapa file
code.exe secara bersamaan dan juga menjadi penghubung antar file
Proses disassembly yang sudah dilakukan pada kedua file menjadi satu program yang utuh secara keseluruhan.
membuktikan bahwa file binary dapat diubah kembali menjadi
bentuk disassembly. Tapi perbedaannya adalah pada file F. Tugas 6 : Penggunaan Makefile pada GCC
assembly code.o hanya terdapat bagian main dari program,
sedangkan pada file assembly code.exe bukan hanya main Pada tugas ini menggunakan make_file.c dan text.c
program, tetapi juga disertai file-file pendukung program Seperti di tugas 5 sebelumnya, dilakukan kompilasi kedua file
lainnya. Hal tersebut menyebabkan disassembly_code_exe.asm tersebut dengan menggunakan makefile. Perintah untuk
memiliki ukuran file yang jauh lebih besar dibandingkan makefile ditujukkan gambar dibawah ini :
disassembly_code_o.asm.
all: main_text.exe

D. Tugas 4 : Optimisasi Kompilasi Program pada GCC main_text.exe: main_text.o text.o


gcc main_text.o text.o -o main_text.exe
Pada bagian ini dilakukan 4 jenis optimasi dari file code.c
(diantaranya optimasi –O1, -O2, -O3, -Os, dan –Ofast) yang main_text.o: main_text.c
kemudia akan dibandingkan hasil file assembly-nya. gcc -c main_text.c
Pada optimasi –O1, terlihat bahwa jumlah baris yang
text.o: text.c
dihasilkan menjadi lebih sedikit daripada file code tanpa gcc -c text.c
optimasi (code_O0.s). hal tersebut sudah sesuai dengan refrensi
Setelah ditest atau di eksekusi dengan cmd, hasil menujukkan
kompilasi yang identic sama seperti hasil kompilasi tugas 5.
Jadi dapat kita simpulkan bahwa makefile cara lain untuk
melakukan kompilasi praktis selain menggunakan batch file.
6. Return temp1+temp2
call stack : function : squaresum (y=5,z=9)
G. Tugas 7 : Header File
Pada tugas kali ini dilakukan penggunaan header file
dan extern pada header. Pertama-tama dibuat file add.c, file
main.c, file add.h dan juga makefile. Program main.c berfungsi
untuk memanggil fungsi yang telah didefinisikan pada add.c.
Untuk itu diperlukan header file yang akan di-include pada 7. Akhir program
main.c sehingga dapat memanggil fungsi pada add.c. Proses Call stack : mingw CRTStartup()
pemanggilan ini dapat mengalami masalah apabila variable
accum (pada add.c) tidak di-extern terlebih dulu sehingga
variable tidak terdefinisi pada main.c. Fungsi extern pada
header yaitu agar suatu variable dalam sebuah file dapat
digunakan pada file “.c” lainnya. Berdasarkan data tersebut, dapat diamati bahwa terdapat 3 buah
stack yang digunakan selama pelaksanaan program, yaitu
function main {esp 0x28ff00 ebp 0x28ff28}, function
H. Tugas 8 : Pemanggilan Prosedur dan Stack Memory squaresum {esp 0x28fee4 ebp 0x28fe28}, dan terakhir function
Ditugas 8 ini dilakukan percobaan untuk memahami square {esp 0x28fedc ebp 0x28fedc}. Stack pada ketiga fungsi
pemanggilan prosedur dan stack pada memory. Pada proses tersebut berperan dalam melakukan penyimpanan local variable
pemanggilan prosedur, memory dapat dimodelkan sebagai dan return address dari setiap fungsi. Apabila stack telah selesai
stack. Hal tersebut karena proses pemanggilan berbasis digunakan, maka nilainya akan direset kembali..
stacking data. Proses kompilasi Bahasa C dilakukan secara Call stack pada program digunakan untuk menyatakan
terurut yang mengakibatkan prose penyimpanan dan posisi stack terhadap fungsi yang saat itu digunakan. Misalnya
pengeluaran datanya pun dilakukan secara terurut. Memory pada return squaresum, stack berada pada fungsi main. %sp
sifatnya dinamis, dimana dapat membesar atau mengecil sesuai atau stack pointer berfungsi untuk menandai letak suatu stack.
kebutuhan. Hal ini dipengaruhi oleh banyaknya data dan Nilai %ebp selalu berada diatas nilai %esp dikarenakan base
optimasi yang dilakukan. pointer (ebp) menunjukan alamat tertinggi pada frame. Proses
pembaharuan nilai pointer dapat dinyatakan sebagai berikut :
1. Return squaresum (a,b) Proses 1 : stack %ebp dan %esp berselisih 28 bit
Call stack : function :main() (0x28). Fungsi main akan pertama-tama akan memanggil
fungsi squaresum. Setelah proses pemanggilan, main (sebagai
caller ) akan menyimpan return address ke dalam stack.
Selanjutnya, squaresum (sebagai callee) akan memperbaharui
nilai %ebp dan %esp.
2. Int temp1 = square (y) Proses 2 : Squaresum yang berikutnya bertindak
Call stack : function : squaresum(y=5,z=9) sebagai caller akan melakukan push nilai y kedalam stack yang
menyebabkan nilai %ebp berubah. Kemudian square (sebagai
callee) melakukan pembaharuian nilai %ebp dan %esp.
Proses 3 : Hasil dari return value (x*x) selanjutnya akan
dimasukan kedalam register %eax. Untuk nilai %ebp dan %esp
3. Return x*x akan tetap sama seperti sebelumnya karena stack
Call stack : function : square (x=5) belum berpindah.
Proses 4 dan 5 : Karena dilakukan perintah return,
maka callee akan membersihkan framenya dengan mengganti
%ebp dan %esp pada proses 2 sebagai return address untuk
melanjutkan proses eksekusi pada caller . Kemudian proses 2
4. Int temp2 = square(z) dilakukan kembali untuk mempush nilai variable z.
Call stack : function : squaresumly (y=5,z=9) Proses 6 : Di akhir fungsi squaresum, dilakukan
perhitungan temp1 + temp dan selanjutnya nilai hasil
perhitungan tersebut akan di return dan disimpan pada %eax.
Karena masih berada pada fungsi squaresum, maka nilai
pointer (%ebp dan %eax) akan tetap sama seperti pada proses 2
5. Return x*x dan 4. Kemudian stack akan kembali ke main setelah dilakukan
Call stack : function : square (x=9) return value.
Proses 7 : Main akan melakukan return value pada
register %eax. Lalu pointer akan kembali ke return address
yang telah disimpan dan dieksekusi. Hal tersbut dapat dilihat sedikit langkah pengerjaan. Sedangkan metode
pada call stack yang menunjuk _mingw_CRTStartup(). %esp kompilasi dengan makefile membuat perintah
dan %ebp adalah stack frame dari fungsi eksekusi file menjadi lebih mudah.
_mingw_CRTStartup(). 2. Compiler GCC dapat melakukan disassembly file
objek dan file executable yaitu dengan mengubah
file.o dan file.exe manjadi bertype file assembly
I. Tugas 9 : Program Fibonacci
3. Kompilasi pada GCC dapat dilakukan dengan
Pada bagian ke 9 ini kompilasi program fibo_main.exe beberapa jenis optimasi (disesuaikan dengan
yang merupakan executable file yang berasal dari gabungan file kebutuhan), seperti –O0, -O1,-O2, -O3, -Os, dan –
fibo_main.c, inputn.c dan fibo.c. Ketiga file dibuhungkan Ofast. Trade off yang dipertimbangkan yaitu ukuran
dengan membuat dua buah header file yaitu fibo.h dan inputn.h source code, runtime program, kecepatan kompilasi,
Inputn.h : serta kemudahan dalam debugging.
\#ifndef accum 4. Pemanggilan prosedur dapat direpresentasikan
extern int input;
sebagai stack memory yang bersifat dinamis (ukuran
#endif
dapat membesar dan mengecil sesuai kebutuhan
program yang dijalankan)
.Fibo.h 5. Header file berfungsi sebagai penghubung antara dua
#ifndef accum file atau lebih sehingga fungsi atau prosedur pada
extern int fibo (int n);
#endif suatu fungsi juga dapat digunakan pada fungsi lain
(yang dihubungkan). Extern berfungsi untuk
Fibo.c adalahh file yang berisi code untuk mendeklarasikan sebuah variable global agar dapat
menampilkan deret bilangan Fibonacci sebanyak n input yang
dipakai pada semua file yang telah diubungkan dengan
dimasukan oleh user. Input diperoleh dari fungsi inputn.c .
Sedangkan file fibo_main.c adalah main program yang akan header.
memanggil kedua fungsi tersebut (fibo.c serta inputn.c). Header
6. Kompilasi pada GCC terdiri dari 4 tahap
fibo.h berisi deklarasi untuk fungsi fibo sedangkan header
yaitu preprocessing, compiling, assembling, dan
inputn.h berisi deklarasi untuk fungsi inputn.h . Kedua header
linking. File hasil preprocessing yaitu berekstensi “ .i
ini akan di-include pada fibo_main.c kedua fungsi (fibo.c serta
“. File hasil compiling berekstensi file “ .s”. File hasil
inputn.c) dapat digunakan pada main program.
ssembling berekstensi file“ .o”serta file hasil proses
Eksekusi program berhasil sebagai berikut :
linking berekstensi “ .exe”. File .o dan .exe bertype
file biner sedangkan ketiga ekstensi file lainnya
IV. KESIMPULAN bertype file text.
Dari percobaan yang telah dilakukan, maka kita dapat menarik
kesimpulan sebagai berikut : V. REFERENSI
[1] Bryant, Randal E. Dan David R. O;Hallaron. Computer
System : A Programmer’s Perspective. Prentice Hall.
1. Proses kompilasi pada GCC dapat dilakukan
dengan beberapa metode, yaitu menuliskan perintah USA.2011
tahap pertahap pada command prompt, batch file, dan
[3] Data didapat dari praktikum jumat 27 September 2018 di
juga makefile. Metode batch file pada dasarnya sama
seperti melakukan compiling satu per satu, namun Lab Dasar Teknik Elektro IT Del.
ditulis dalam satu file sehingga hanya memerlukan
Lampiran

1. Source code tugas 1


a. Code.c
// Praktikum NWS3103 Arsitektur Sistem Komputer
// Modul : 1
// Percobaan : NA
// Tanggal : 27 September 2018
// Kelompok : NA
// Rombongan : NA
// Nama (NIM) 1 : Zepanya Sahron B (14S16033)
// Nama File : Code.c
//Deskripsi : Demonstrasi proses kompilasi
// menjumlahkan deret bilangan sebanyak N_LOOP

#define N_LOOP 500


int main(void)
{
int indeks;
int accumulator;
indeks = 0;
accumulator = 0;
while (indeks<N_LOOP)
{
accumulator = accumulator + indeks;
indeks = indeks + 1;
}
return accumulator;
}

b. File code.i

# 1 "code.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "code.c"
# 15 "code.c"
int main(void)
{
int indeks;
int accumulator;
indeks = 0;
accumulator = 0;
while (indeks<500)
{
accumulator = accumulator + indeks;
indeks = indeks + 1;
}
return accumulator;
}
C. File code.s
.file "code.c"
.def ___main; .scl 2; .type 32; .endef
.text
.globl _main
.def _main; .scl 2; .type 32; .endef
_main:
pushl %ebp
movl %esp, %ebp
subl $24, %esp
andl $-16, %esp
movl $0, %eax
movl %eax, -12(%ebp)
movl -12(%ebp), %eax
call __alloca
call ___main
movl $0, -4(%ebp)
movl $0, -8(%ebp)
L2:
cmpl $499, -4(%ebp)
jle L4
jmp L3
L4:
movl -4(%ebp), %eax
leal -8(%ebp), %edx
addl %eax, (%edx)
leal -4(%ebp), %eax
incl (%eax)
jmp L2
L3:
movl -8(%ebp), %eax
leave
ret

D. File code.o
E. File Code.exe

Tugas 3

code.o: file format pe-i386

Disassembly of section .text:

00000000 <_main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: 83 e4 f0 and $0xfffffff0,%esp
9: b8 00 00 00 00 mov $0x0,%eax
e: 89 45 f4 mov %eax,0xfffffff4(%ebp)
11: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
14: e8 00 00 00 00 call 19 <_main+0x19>
19: e8 00 00 00 00 call 1e <_main+0x1e>
1e: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)
25: c7 45 f8 00 00 00 00 movl $0x0,0xfffffff8(%ebp)
2c: 81 7d fc f3 01 00 00 cmpl $0x1f3,0xfffffffc(%ebp)
33: 7e 02 jle 37 <_main+0x37>
35: eb 0f jmp 46 <_main+0x46>
37: 8b 45 fc mov 0xfffffffc(%ebp),%eax
3a: 8d 55 f8 lea 0xfffffff8(%ebp),%edx
3d: 01 02 add %eax,(%edx)
3f: 8d 45 fc lea 0xfffffffc(%ebp),%eax
42: ff 00 incl (%eax)
44: eb e6 jmp 2c <_main+0x2c>
46: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
49: c9 leave
4a: c3 ret
4b: 90 nop
4c: 90 nop
4d: 90 nop
4e: 90 nop
4f: 90 nop

1.Hasil code disassembly code.asm

code.exe: file format pei-i386

Disassembly of section .text:

00401000 <__RUNTIME_PSEUDO_RELOC_LIST_END__>:
401000: 55 push %ebp
401001: 89 e5 mov %esp,%ebp
401003: 83 ec 28 sub $0x28,%esp
401006: c7 44 24 04 04 20 40 movl
$0x402004,0x4(%esp,1)
40100d: 00
40100e: 8d 45 fc lea 0xfffffffc(%ebp),%eax
401011: 89 44 24 10 mov
%eax,0x10(%esp,1)
401015: a1 10 20 40 00 mov 0x402010,%eax
40101a: c7 45 fc 00 00 00 00 movl
$0x0,0xfffffffc(%ebp)
401021: c7 04 24 00 20 40 00 movl
$0x402000,(%esp,1)
401028: 89 44 24 0c mov %eax,0xc(%esp,1)
40102c: 8d 45 f8 lea 0xfffffff8(%ebp),%eax
40102f: 89 44 24 08 mov %eax,0x8(%esp,1)
401033: e8 b8 07 00 00 call 4017f0
<___getmainargs>
401038: 89 ec mov %ebp,%esp
40103a: 5d pop %ebp
40103b: c3 ret
40103c: 8d 74 26 00 lea 0x0(%esi,1),%esi

00401040 <__mingw32_init_fmode>:
401040: 55 push %ebp
401041: 89 e5 mov %esp,%ebp
401043: 83 ec 08 sub $0x8,%esp
401046: a1 20 20 40 00 mov 0x402020,%eax
40104b: 85 c0 test %eax,%eax
40104d: 74 57 je 4010a6
<__mingw32_init_fmode+0x66>
40104f: a3 30 20 40 00 mov %eax,0x402030
401054: a1 d0 40 40 00 mov 0x4040d0,%eax
401059: 85 c0 test %eax,%eax
40105b: 75 5a jne 4010b7
<__mingw32_init_fmode+0x77>
40105d: 83 f8 e0 cmp $0xffffffe0,%eax
401060: 74 22 je 401084
<__mingw32_init_fmode+0x44>
401062: 83 c0 20 add $0x20,%eax
401065: 89 04 24 mov %eax,(%esp,1)
401068: e8 63 07 00 00 call 4017d0 <__fileno>
40106d: 8b 15 20 20 40 00 mov 0x402020,%edx
401073: 89 04 24 mov %eax,(%esp,1)
401076: 89 54 24 04 mov %edx,0x4(%esp,1)
40107a: e8 61 07 00 00 call 4017e0
<__setmode>
40107f: a1 d0 40 40 00 mov 0x4040d0,%eax
401084: 83 f8 c0 cmp $0xffffffc0,%eax
401087: 74 1d je 4010a6
<__mingw32_init_fmode+0x66>
401089: 83 c0 40 add $0x40,%eax
40108c: 89 04 24 mov %eax,(%esp,1)
40108f: e8 3c 07 00 00 call 4017d0 <__fileno>
401094: 8b 15 20 20 40 00 mov 0x402020,%edx
40109a: 89 04 24 mov %eax,(%esp,1)
40109d: 89 54 24 04 mov %edx,0x4(%esp,1)
4010a1: e8 3a 07 00 00 call 4017e0
<__setmode>
4010a6: e8 15 07 00 00 call 4017c0
<___p__fmode>
4010ab: 8b 15 30 20 40 00 mov 0x402030,%edx
4010b1: 89 10 mov %edx,(%eax)
4010b3: 89 ec mov %ebp,%esp
4010b5: 5d pop %ebp
4010b6: c3 ret
4010b7: 89 04 24 mov %eax,(%esp,1)
4010ba: e8 11 07 00 00 call 4017d0 <__fileno>
4010bf: 8b 15 20 20 40 00 mov 0x402020,%edx
4010c5: 89 04 24 mov %eax,(%esp,1)
4010c8: 89 54 24 04 mov %edx,0x4(%esp,1)
4010cc: e8 0f 07 00 00 call 4017e0 <__setmode>
4010d1: a1 d0 40 40 00 mov 0x4040d0,%eax
4010d6: eb 85 jmp 40105d
<__mingw32_init_fmode+0x1d>
4010d8: 90 nop
4010d9: 8d b4 26 00 00 00 00 lea 0x0(%esi,1),%esi

004010e0 <__gnu_exception_handler@4>:
4010e0: 55 push %ebp
4010e1: 89 e5 mov %esp,%ebp
4010e3: 83 ec 18 sub $0x18,%esp
4010e6: 89 5d f8 mov
%ebx,0xfffffff8(%ebp)
4010e9: 8b 45 08 mov 0x8(%ebp),%eax
4010ec: 31 db xor %ebx,%ebx
4010ee: 89 75 fc mov %esi,0xfffffffc(%ebp)
4010f1: 31 f6 xor %esi,%esi
4010f3: 8b 00 mov (%eax),%eax
4010f5: 8b 00 mov (%eax),%eax
4010f7: 3d 91 00 00 c0 cmp $0xc0000091,%eax
4010fc: 0f 87 be 00 00 00 ja 4011c0
<__gnu_exception_handler@4+0xe0>
401102: 3d 8d 00 00 c0 cmp $0xc000008d,%eax
401107: 73 67 jae 401170
<__gnu_exception_handler@4+0x90>
401109: 3d 05 00 00 c0 cmp $0xc0000005,%eax
40110e: 74 0e je 40111e
<__gnu_exception_handler@4+0x3e>
401110: 89 d8 mov %ebx,%eax
401112: 8b 75 fc mov 0xfffffffc(%ebp),%esi
401115: 8b 5d f8 mov
0xfffffff8(%ebp),%ebx
401118: 89 ec mov %ebp,%esp
40111a: 5d pop %ebp
40111b: c2 04 00 ret $0x4
40111e: c7 44 24 04 00 00 00 movl
$0x0,0x4(%esp,1)
401125: 00
401126: c7 04 24 0b 00 00 00 movl $0xb,(%esp,1)
40112d: e8 7e 06 00 00 call 4017b0 <_signal>
401132: 83 f8 01 cmp $0x1,%eax
401135: 74 22 je 401159
<__gnu_exception_handler@4+0x79>
401137: 85 c0 test %eax,%eax
401139: 74 d5 je 401110
<__gnu_exception_handler@4+0x30>
40113b: c7 04 24 0b 00 00 00 movl $0xb,(%esp,1)
401142: 8d b4 26 00 00 00 00 lea 0x0(%esi,1),%esi
401149: 8d bc 27 00 00 00 00 lea
0x0(%edi,1),%edi
401150: ff d0 call *%eax
401152: bb ff ff ff ff mov $0xffffffff,%ebx
401157: eb b7 jmp 401110
<__gnu_exception_handler@4+0x30>
401159: c7 44 24 04 01 00 00 movl
$0x1,0x4(%esp,1)
401160: 00
401161: c7 04 24 0b 00 00 00 movl $0xb,(%esp,1)
401168: e8 43 06 00 00 call 4017b0 <_signal>
40116d: eb e3 jmp 401152
<__gnu_exception_handler@4+0x72>
40116f: 90 nop
401170: be 01 00 00 00 mov $0x1,%esi
401175: c7 44 24 04 00 00 00 movl
$0x0,0x4(%esp,1)
40117c: 00
40117d: c7 04 24 08 00 00 00 movl $0x8,(%esp,1)
401184: e8 27 06 00 00 call 4017b0 <_signal>
401189: 83 f8 01 cmp $0x1,%eax
40118c: 74 11 je 40119f
<__gnu_exception_handler@4+0xbf>
40118e: 85 c0 test %eax,%eax
401190: 0f 84 7a ff ff ff je 401110
<__gnu_exception_handler@4+0x30>
401196: c7 04 24 08 00 00 00 movl $0x8,(%esp,1)
40119d: eb b1 jmp 401150
<__gnu_exception_handler@4+0x70>
40119f: c7 44 24 04 01 00 00 movl
$0x1,0x4(%esp,1)
4011a6: 00
4011a7: c7 04 24 08 00 00 00 movl $0x8,(%esp,1)
4011ae: e8 fd 05 00 00 call 4017b0 <_signal>
4011b3: 85 f6 test %esi,%esi
4011b5: 74 9b je 401152
<__gnu_exception_handler@4+0x72>
4011b7: e8 d4 01 00 00 call 401390 <__fpreset>
4011bc: eb 94 jmp 401152
<__gnu_exception_handler@4+0x72>
4011be: 89 f6 mov %esi,%esi
4011c0: 3d 93 00 00 c0 cmp $0xc0000093,%eax
4011c5: 74 a9 je 401170
<__gnu_exception_handler@4+0x90>
4011c7: 3d 94 00 00 c0 cmp $0xc0000094,%eax
4011cc: 74 a7 je 401175
<__gnu_exception_handler@4+0x95>
4011ce: e9 3d ff ff ff jmp 401110
<__gnu_exception_handler@4+0x30>
4011d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
4011d9: 8d bc 27 00 00 00 00 lea
0x0(%edi,1),%edi

004011e0 <___mingw_CRTStartup>:
4011e0: 55 push %ebp
4011e1: 89 e5 mov %esp,%ebp
4011e3: 83 ec 18 sub $0x18,%esp
4011e6: c7 04 24 e0 10 40 00 movl
$0x4010e0,(%esp,1)
4011ed: 89 5d fc mov %ebx,0xfffffffc(%ebp)
4011f0: e8 3b 06 00 00 call 401830
<_SetUnhandledExceptionFilter@4>
4011f5: 83 ec 04 sub $0x4,%esp
4011f8: e8 93 01 00 00 call 401390 <__fpreset>
4011fd: e8 fe fd ff ff call 401000
<__RUNTIME_PSEUDO_RELOC_LIST_END__>
401202: e8 39 fe ff ff call 401040
<__mingw32_init_fmode>
401207: e8 54 01 00 00 call 401360
<__pei386_runtime_relocator>
40120c: e8 8f 05 00 00 call 4017a0
<___p__environ>
401211: 8b 00 mov (%eax),%eax
401213: 89 44 24 08 mov %eax,0x8(%esp,1)
401217: a1 04 20 40 00 mov 0x402004,%eax
40121c: 89 44 24 04 mov %eax,0x4(%esp,1)
401220: a1 00 20 40 00 mov 0x402000,%eax
401225: 89 04 24 mov %eax,(%esp,1)
401228: e8 a3 00 00 00 call 4012d0 <_main>
40122d: 89 c3 mov %eax,%ebx
40122f: e8 5c 05 00 00 call 401790 <__cexit>
401234: 89 1c 24 mov %ebx,(%esp,1)
401237: e8 04 06 00 00 call 401840
<_ExitProcess@4>
40123c: 8d 74 26 00 lea 0x0(%esi,1),%esi

00401240 <_mainCRTStartup>:
401240: 55 push %ebp
401241: 89 e5 mov %esp,%ebp
401243: 83 ec 08 sub $0x8,%esp
401246: c7 04 24 01 00 00 00 movl $0x1,(%esp,1)
40124d: ff 15 c4 40 40 00 call *0x4040c4
401253: e8 88 ff ff ff call 4011e0
<___mingw_CRTStartup>
401258: 89 ec mov %ebp,%esp
40125a: 31 c0 xor %eax,%eax
40125c: 5d pop %ebp
40125d: c3 ret
40125e: 89 f6 mov %esi,%esi

00401260 <_WinMainCRTStartup>:
401260: 55 push %ebp
401261: 89 e5 mov %esp,%ebp
401263: 83 ec 08 sub $0x8,%esp
401266: c7 04 24 02 00 00 00 movl $0x2,(%esp,1)
40126d: ff 15 c4 40 40 00 call *0x4040c4
401273: e8 68 ff ff ff call 4011e0
<___mingw_CRTStartup>
401278: 89 ec mov %ebp,%esp
40127a: 31 c0 xor %eax,%eax
40127c: 5d pop %ebp
40127d: c3 ret
40127e: 89 f6 mov %esi,%esi

00401280 <_atexit>:
401280: 55 push %ebp
401281: 89 e5 mov %esp,%ebp
401283: 83 ec 08 sub $0x8,%esp
401286: 8b 45 08 mov 0x8(%ebp),%eax
401289: 89 04 24 mov %eax,(%esp,1)
40128c: ff 15 e0 40 40 00 call *0x4040e0
401292: 89 ec mov %ebp,%esp
401294: 5d pop %ebp
401295: c3 ret
401296: 8d 76 00 lea 0x0(%esi),%esi
401299: 8d bc 27 00 00 00 00 lea
0x0(%edi,1),%edi

004012a0 <__onexit>:
4012a0: 55 push %ebp
4012a1: 89 e5 mov %esp,%ebp
4012a3: 83 ec 08 sub $0x8,%esp
4012a6: 8b 45 08 mov 0x8(%ebp),%eax
4012a9: 89 04 24 mov %eax,(%esp,1)
4012ac: ff 15 d4 40 40 00 call *0x4040d4
4012b2: 89 ec mov %ebp,%esp
4012b4: 5d pop %ebp
4012b5: c3 ret
4012b6: 90 nop
4012b7: 90 nop
4012b8: 90 nop
4012b9: 90 nop
4012ba: 90 nop
4012bb: 90 nop
4012bc: 90 nop
4012bd: 90 nop
4012be: 90 nop
4012bf: 90 nop

004012c0 <___do_sjlj_init>:
4012c0: 55 push %ebp
4012c1: 89 e5 mov %esp,%ebp
4012c3: 5d pop %ebp
4012c4: e9 47 02 00 00 jmp 401510
<___w32_sharedptr_initialize>
4012c9: 90 nop
4012ca: 90 nop
4012cb: 90 nop
4012cc: 90 nop
4012cd: 90 nop
4012ce: 90 nop
4012cf: 90 nop

004012d0 <_main>:
4012d0: 55 push %ebp
4012d1: 89 e5 mov %esp,%ebp
4012d3: 83 ec 18 sub $0x18,%esp
4012d6: 83 e4 f0 and $0xfffffff0,%esp
4012d9: b8 00 00 00 00 mov $0x0,%eax
4012de: 89 45 f4 mov
%eax,0xfffffff4(%ebp)
4012e1: 8b 45 f4 mov
0xfffffff4(%ebp),%eax
4012e4: e8 67 04 00 00 call 401750 <___chkstk>
4012e9: e8 42 01 00 00 call 401430 <___main>
4012ee: c7 45 fc 00 00 00 00 movl
$0x0,0xfffffffc(%ebp)
4012f5: c7 45 f8 00 00 00 00 movl
$0x0,0xfffffff8(%ebp)
4012fc: 81 7d fc f3 01 00 00 cmpl
$0x1f3,0xfffffffc(%ebp)
401303: 7e 02 jle 401307 <_main+0x37>
401305: eb 0f jmp 401316 <_main+0x46>
401307: 8b 45 fc mov
0xfffffffc(%ebp),%eax
40130a: 8d 55 f8 lea 0xfffffff8(%ebp),%edx
40130d: 01 02 add %eax,(%edx)
40130f: 8d 45 fc lea 0xfffffffc(%ebp),%eax
401312: ff 00 incl (%eax)
401314: eb e6 jmp 4012fc <_main+0x2c>
401316: 8b 45 f8 mov
0xfffffff8(%ebp),%eax
401319: c9 leave
40131a: c3 ret
40131b: 90 nop
40131c: 90 nop
40131d: 90 nop
40131e: 90 nop
40131f: 90 nop

00401320 <_do_pseudo_reloc>:
401320: 55 push %ebp
401321: 89 e5 mov %esp,%ebp
401323: 56 push %esi
401324: 8b 4d 08 mov 0x8(%ebp),%ecx
401327: 53 push %ebx
401328: 8b 5d 0c mov 0xc(%ebp),%ebx
40132b: 8b 75 10 mov 0x10(%ebp),%esi
40132e: 39 d9 cmp %ebx,%ecx
401330: 73 20 jae 401352
<_do_pseudo_reloc+0x32>
401332: 8d b4 26 00 00 00 00 lea 0x0(%esi,1),%esi
401339: 8d bc 27 00 00 00 00 lea
0x0(%edi,1),%edi
401340: 8b 41 04 mov 0x4(%ecx),%eax
401343: 89 f2 mov %esi,%edx
401345: 01 c2 add %eax,%edx
401347: 8b 01 mov (%ecx),%eax
401349: 83 c1 08 add $0x8,%ecx
40134c: 01 02 add %eax,(%edx)
40134e: 39 d9 cmp %ebx,%ecx
401350: 72 ee jb 401340
<_do_pseudo_reloc+0x20>
401352: 5b pop %ebx
401353: 5e pop %esi
401354: 5d pop %ebp
401355: c3 ret
401356: 8d 76 00 lea 0x0(%esi),%esi
401359: 8d bc 27 00 00 00 00 lea
0x0(%edi,1),%edi

00401360 <__pei386_runtime_relocator>:
401360: 55 push %ebp
401361: 89 e5 mov %esp,%ebp
401363: 83 ec 18 sub $0x18,%esp
401366: c7 44 24 08 00 00 40 movl
$0x400000,0x8(%esp,1)
40136d: 00
40136e: c7 44 24 04 00 30 40 movl
$0x403000,0x4(%esp,1)
401375: 00
401376: c7 04 24 00 30 40 00 movl
$0x403000,(%esp,1)
40137d: e8 9e ff ff ff call 401320
<_do_pseudo_reloc>
401382: 89 ec mov %ebp,%esp
401384: 5d pop %ebp
401385: c3 ret
401386: 90 nop
401387: 90 nop
401388: 90 nop
401389: 90 nop
40138a: 90 nop
40138b: 90 nop
40138c: 90 nop
40138d: 90 nop
40138e: 90 nop
40138f: 90 nop

00401390 <__fpreset>:
401390: 55 push %ebp
401391: 89 e5 mov %esp,%ebp
401393: db e3 fninit
401395: 5d pop %ebp
401396: c3 ret
401397: 90 nop
401398: 90 nop
401399: 90 nop
40139a: 90 nop
40139b: 90 nop
40139c: 90 nop
40139d: 90 nop
40139e: 90 nop
40139f: 90 nop

004013a0 <___do_global_dtors>:
4013a0: 55 push %ebp
4013a1: 89 e5 mov %esp,%ebp
4013a3: 83 ec 08 sub $0x8,%esp
4013a6: a1 40 20 40 00 mov 0x402040,%eax
4013ab: 8b 08 mov (%eax),%ecx
4013ad: 85 c9 test %ecx,%ecx
4013af: 75 04 jne 4013b5
<___do_global_dtors+0x15>
4013b1: 89 ec mov %ebp,%esp
4013b3: 5d pop %ebp
4013b4: c3 ret
4013b5: ff 10 call *(%eax)
4013b7: 8b 15 40 20 40 00 mov 0x402040,%edx
4013bd: 8d 42 04 lea 0x4(%edx),%eax
4013c0: 8b 52 04 mov 0x4(%edx),%edx
4013c3: a3 40 20 40 00 mov %eax,0x402040
4013c8: 85 d2 test %edx,%edx
4013ca: 75 e9 jne 4013b5
<___do_global_dtors+0x15>
4013cc: eb e3 jmp 4013b1
<___do_global_dtors+0x11>
4013ce: 89 f6 mov %esi,%esi

004013d0 <___do_global_ctors>:
4013d0: 55 push %ebp
4013d1: 89 e5 mov %esp,%ebp
4013d3: 83 ec 08 sub $0x8,%esp
4013d6: 89 5d fc mov %ebx,0xfffffffc(%ebp)
4013d9: a1 90 18 40 00 mov 0x401890,%eax
4013de: 83 f8 ff cmp $0xffffffff,%eax
4013e1: 74 29 je 40140c
<___do_global_ctors+0x3c>
4013e3: 85 c0 test %eax,%eax
4013e5: 89 c3 mov %eax,%ebx
4013e7: 75 17 jne 401400
<___do_global_ctors+0x30>
4013e9: c7 04 24 a0 13 40 00 movl
$0x4013a0,(%esp,1)
4013f0: e8 8b fe ff ff call 401280 <_atexit>
4013f5: 8b 5d fc mov
0xfffffffc(%ebp),%ebx
4013f8: 89 ec mov %ebp,%esp
4013fa: 5d pop %ebp
4013fb: c3 ret
4013fc: 8d 74 26 00 lea 0x0(%esi,1),%esi
401400: ff 14 9d 90 18 40 00 call
*0x401890(,%ebx,4)
401407: 4b dec %ebx
401408: 75 f6 jne 401400
<___do_global_ctors+0x30>
40140a: eb dd jmp 4013e9
<___do_global_ctors+0x19>
40140c: 8b 15 94 18 40 00 mov 0x401894,%edx
401412: 31 c0 xor %eax,%eax
401414: 85 d2 test %edx,%edx
401416: 74 cb je 4013e3
<___do_global_ctors+0x13>
401418: ba 90 18 40 00 mov $0x401890,%edx
40141d: 8d 76 00 lea 0x0(%esi),%esi
401420: 40 inc %eax
401421: 8b 5c 82 04 mov
0x4(%edx,%eax,4),%ebx
401425: 85 db test %ebx,%ebx
401427: 75 f7 jne 401420
<___do_global_ctors+0x50>
401429: eb b8 jmp 4013e3
<___do_global_ctors+0x13>
40142b: 90 nop
40142c: 8d 74 26 00 lea 0x0(%esi,1),%esi

00401430 <___main>:
401430: 55 push %ebp
401431: a1 44 20 40 00 mov 0x402044,%eax
401436: 89 e5 mov %esp,%ebp
401438: 85 c0 test %eax,%eax
40143a: 74 04 je 401440
<___main+0x10>
40143c: 5d pop %ebp
40143d: c3 ret
40143e: 89 f6 mov %esi,%esi
401440: 5d pop %ebp
401441: b9 01 00 00 00 mov $0x1,%ecx
401446: 89 0d 44 20 40 00 mov %ecx,0x402044
40144c: eb 82 jmp 4013d0
<___do_global_ctors>
40144e: 90 nop
40144f: 90 nop

00401450 <_w32_atom_suffix>:
401450: 2d 4c 49 42 47 sub $0x4742494c,%eax
401455: 43 inc %ebx
401456: 43 inc %ebx
401457: 57 push %edi
401458: 33 32 xor (%edx),%esi
40145a: 2d 45 48 2d 53 sub $0x532d4845,%eax
40145f: 4a dec %edx
401460: 4c dec %esp
401461: 4a dec %edx
401462: 2d 47 54 48 52 sub $0x52485447,%eax
401467: 2d 4d 49 4e 47 sub $0x474e494d,%eax
40146c: 57 push %edi
40146d: 33 32 xor (%edx),%esi
...

00401470 <___w32_sharedptr_default_unexpected>:
401470: 55 push %ebp
401471: 89 e5 mov %esp,%ebp
401473: 50 push %eax
401474: 50 push %eax
401475: a1 30 30 40 00 mov 0x403030,%eax
40147a: ff 50 04 call *0x4(%eax)
40147d: 89 ec mov %ebp,%esp
40147f: 5d pop %ebp
401480: c3 ret
401481: eb 0d jmp 401490
<___w32_eh_shared_initialize>
401483: 90 nop
401484: 90 nop
401485: 90 nop
401486: 90 nop
401487: 90 nop
401488: 90 nop
401489: 90 nop
40148a: 90 nop
40148b: 90 nop
40148c: 90 nop
40148d: 90 nop
40148e: 90 nop
40148f: 90 nop

00401490 <___w32_eh_shared_initialize>:
401490: 55 push %ebp
401491: 31 c0 xor %eax,%eax
401493: 89 e5 mov %esp,%ebp
401495: b9 0e 00 00 00 mov $0xe,%ecx
40149a: fc cld
40149b: 57 push %edi
40149c: 8b 7d 08 mov 0x8(%ebp),%edi
40149f: f3 ab repz stos %eax,%es:(%edi)
4014a1: 8b 45 08 mov 0x8(%ebp),%eax
4014a4: 8b 55 08 mov 0x8(%ebp),%edx
4014a7: 8b 4d 08 mov 0x8(%ebp),%ecx
4014aa: c7 00 38 00 00 00 movl $0x38,(%eax)
4014b0: c7 40 04 20 18 40 00 movl
$0x401820,0x4(%eax)
4014b7: c7 40 08 70 14 40 00 movl
$0x401470,0x8(%eax)
4014be: a1 00 30 40 00 mov 0x403000,%eax
4014c3: 89 42 14 mov %eax,0x14(%edx)
4014c6: 8b 15 64 20 40 00 mov 0x402064,%edx
4014cc: a1 60 20 40 00 mov 0x402060,%eax
4014d1: 89 51 1c mov %edx,0x1c(%ecx)
4014d4: 89 41 18 mov %eax,0x18(%ecx)
4014d7: a1 10 30 40 00 mov 0x403010,%eax
4014dc: 89 41 28 mov %eax,0x28(%ecx)
4014df: c7 41 2c ff ff ff ff movl $0xffffffff,0x2c(%ecx)
4014e6: a1 68 20 40 00 mov 0x402068,%eax
4014eb: 8b 15 6c 20 40 00 mov 0x40206c,%edx
4014f1: c7 41 24 00 00 00 00 movl $0x0,0x24(%ecx)
4014f8: 89 41 30 mov %eax,0x30(%ecx)
4014fb: 89 51 34 mov %edx,0x34(%ecx)
4014fe: 5f pop %edi
4014ff: 5d pop %ebp
401500: c3 ret
401501: eb 0d jmp 401510
<___w32_sharedptr_initialize>
401503: 90 nop
401504: 90 nop
401505: 90 nop
401506: 90 nop
401507: 90 nop
401508: 90 nop
401509: 90 nop
40150a: 90 nop
40150b: 90 nop
40150c: 90 nop
40150d: 90 nop
40150e: 90 nop
40150f: 90 nop

00401510 <___w32_sharedptr_initialize>:
401510: 55 push %ebp
401511: 89 e5 mov %esp,%ebp
401513: 56 push %esi
401514: 53 push %ebx
401515: 83 ec 40 sub $0x40,%esp
401518: 8b 15 30 30 40 00 mov 0x403030,%edx
40151e: 85 d2 test %edx,%edx
401520: 74 0e je 401530
<___w32_sharedptr_initialize+0x20>
401522: 8d 65 f8 lea 0xfffffff8(%ebp),%esp
401525: 5b pop %ebx
401526: 5e pop %esi
401527: 5d pop %ebp
401528: c3 ret
401529: 8d b4 26 00 00 00 00 lea 0x0(%esi,1),%esi
401530: a1 50 14 40 00 mov 0x401450,%eax
401535: 83 ec 0c sub $0xc,%esp
401538: 89 45 d8 mov
%eax,0xffffffd8(%ebp)
40153b: 8d 75 b8 lea 0xffffffb8(%ebp),%esi
40153e: a1 54 14 40 00 mov 0x401454,%eax
401543: 56 push %esi
401544: 89 45 dc mov
%eax,0xffffffdc(%ebp)
401547: a1 58 14 40 00 mov 0x401458,%eax
40154c: 89 45 e0 mov
%eax,0xffffffe0(%ebp)
40154f: a1 5c 14 40 00 mov 0x40145c,%eax
401554: 89 45 e4 mov
%eax,0xffffffe4(%ebp)
401557: a1 60 14 40 00 mov 0x401460,%eax
40155c: 89 45 e8 mov
%eax,0xffffffe8(%ebp)
40155f: a1 64 14 40 00 mov 0x401464,%eax
401564: 89 45 ec mov
%eax,0xffffffec(%ebp)
401567: a1 68 14 40 00 mov 0x401468,%eax
40156c: 89 45 f0 mov %eax,0xfffffff0(%ebp)
40156f: a1 6c 14 40 00 mov 0x40146c,%eax
401574: c7 45 b8 41 41 41 41 movl
$0x41414141,0xffffffb8(%ebp)
40157b: c7 45 bc 41 41 41 41 movl
$0x41414141,0xffffffbc(%ebp)
401582: c7 45 c0 41 41 41 41 movl
$0x41414141,0xffffffc0(%ebp)
401589: c7 45 c4 41 41 41 41 movl
$0x41414141,0xffffffc4(%ebp)
401590: c7 45 c8 41 41 41 41 movl
$0x41414141,0xffffffc8(%ebp)
401597: c7 45 cc 41 41 41 41 movl
$0x41414141,0xffffffcc(%ebp)
40159e: c7 45 d0 41 41 41 41 movl
$0x41414141,0xffffffd0(%ebp)
4015a5: c7 45 d4 41 41 41 41 movl
$0x41414141,0xffffffd4(%ebp)
4015ac: 89 45 f4 mov %eax,0xfffffff4(%ebp)
4015af: e8 9c 02 00 00 call 401850
<_FindAtomA@4>
4015b4: 83 c4 0c add $0xc,%esp
4015b7: 66 85 c0 test %ax,%ax
4015ba: 74 34 je 4015f0
<___w32_sharedptr_initialize+0xe0>
4015bc: 83 ec 0c sub $0xc,%esp
4015bf: 25 ff ff 00 00 and $0xffff,%eax
4015c4: 50 push %eax
4015c5: e8 26 01 00 00 call 4016f0
<___w32_sharedptr_get>
4015ca: 83 c4 10 add $0x10,%esp
4015cd: 89 c3 mov %eax,%ebx
4015cf: 8d 43 04 lea 0x4(%ebx),%eax
4015d2: 89 1d 30 30 40 00 mov %ebx,0x403030
4015d8: a3 20 30 40 00 mov %eax,0x403020
4015dd: 8d 43 08 lea 0x8(%ebx),%eax
4015e0: a3 40 30 40 00 mov %eax,0x403040
4015e5: e9 38 ff ff ff jmp 401522
<___w32_sharedptr_initialize+0x12>
4015ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
4015f0: 83 ec 0c sub $0xc,%esp
4015f3: 6a 38 push $0x38
4015f5: e8 16 02 00 00 call 401810 <_malloc>
4015fa: 83 c4 10 add $0x10,%esp
4015fd: 89 c3 mov %eax,%ebx
4015ff: 85 c0 test %eax,%eax
401601: 74 2c je 40162f
<___w32_sharedptr_initialize+0x11f>
401603: 83 ec 0c sub $0xc,%esp
401606: 50 push %eax
401607: e8 84 fe ff ff call 401490
<___w32_eh_shared_initialize>
40160c: 89 1c 24 mov %ebx,(%esp,1)
40160f: e8 2c 00 00 00 call 401640
<___w32_sharedptr_set>
401614: 83 c4 10 add $0x10,%esp
401617: 66 85 c0 test %ax,%ax
40161a: 75 b3 jne 4015cf
<___w32_sharedptr_initialize+0xbf>
40161c: 83 ec 0c sub $0xc,%esp
40161f: 53 push %ebx
401620: e8 db 01 00 00 call 401800 <_free>
401625: 89 34 24 mov %esi,(%esp,1)
401628: e8 23 02 00 00 call 401850
<_FindAtomA@4>
40162d: eb 90 jmp 4015bf
<___w32_sharedptr_initialize+0xaf>
40162f: e8 ec 01 00 00 call 401820 <_abort>
401634: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
40163a: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
00401640 <___w32_sharedptr_set>:
401640: 55 push %ebp
401641: b8 1f 00 00 00 mov $0x1f,%eax
401646: 89 e5 mov %esp,%ebp
401648: ba 01 00 00 00 mov $0x1,%edx
40164d: 56 push %esi
40164e: 53 push %ebx
40164f: 83 ec 40 sub $0x40,%esp
401652: 8b 75 08 mov 0x8(%ebp),%esi
401655: b1 41 mov $0x41,%cl
401657: 85 f2 test %esi,%edx
401659: 75 02 jne 40165d
<___w32_sharedptr_set+0x1d>
40165b: b1 61 mov $0x61,%cl
40165d: 88 4c 05 b8 mov
%cl,0xffffffb8(%ebp,%eax,1)
401661: 01 d2 add %edx,%edx
401663: 48 dec %eax
401664: 79 ef jns 401655
<___w32_sharedptr_set+0x15>
401666: a1 50 14 40 00 mov 0x401450,%eax
40166b: 83 ec 0c sub $0xc,%esp
40166e: 89 45 d8 mov
%eax,0xffffffd8(%ebp)
401671: a1 54 14 40 00 mov 0x401454,%eax
401676: 89 45 dc mov
%eax,0xffffffdc(%ebp)
401679: a1 58 14 40 00 mov 0x401458,%eax
40167e: 89 45 e0 mov
%eax,0xffffffe0(%ebp)
401681: a1 5c 14 40 00 mov 0x40145c,%eax
401686: 89 45 e4 mov
%eax,0xffffffe4(%ebp)
401689: a1 60 14 40 00 mov 0x401460,%eax
40168e: 89 45 e8 mov
%eax,0xffffffe8(%ebp)
401691: a1 64 14 40 00 mov 0x401464,%eax
401696: 89 45 ec mov
%eax,0xffffffec(%ebp)
401699: a1 68 14 40 00 mov 0x401468,%eax
40169e: 89 45 f0 mov
%eax,0xfffffff0(%ebp)
4016a1: a1 6c 14 40 00 mov 0x40146c,%eax
4016a6: 89 45 f4 mov
%eax,0xfffffff4(%ebp)
4016a9: 8d 45 b8 lea
0xffffffb8(%ebp),%eax
4016ac: 50 push %eax
4016ad: e8 ae 01 00 00 call 401860
<_AddAtomA@4>
4016b2: 83 c4 0c add $0xc,%esp
4016b5: 66 85 c0 test %ax,%ax
4016b8: 75 0b jne 4016c5
<___w32_sharedptr_set+0x85>
4016ba: 31 d2 xor %edx,%edx
4016bc: 8d 65 f8 lea 0xfffffff8(%ebp),%esp
4016bf: 89 d0 mov %edx,%eax
4016c1: 5b pop %ebx
4016c2: 5e pop %esi
4016c3: 5d pop %ebp
4016c4: c3 ret
4016c5: 83 ec 0c sub $0xc,%esp
4016c8: 89 c3 mov %eax,%ebx
4016ca: 81 e3 ff ff 00 00 and $0xffff,%ebx
4016d0: 53 push %ebx
4016d1: e8 1a 00 00 00 call 4016f0
<___w32_sharedptr_get>
4016d6: 89 da mov %ebx,%edx
4016d8: 83 c4 10 add $0x10,%esp
4016db: 39 f0 cmp %esi,%eax
4016dd: 75 db jne 4016ba
<___w32_sharedptr_set+0x7a>
4016df: eb db jmp 4016bc
<___w32_sharedptr_set+0x7c>
4016e1: eb 0d jmp 4016f0
<___w32_sharedptr_get>
4016e3: 90 nop
4016e4: 90 nop
4016e5: 90 nop
4016e6: 90 nop
4016e7: 90 nop
4016e8: 90 nop
4016e9: 90 nop
4016ea: 90 nop
4016eb: 90 nop
4016ec: 90 nop
4016ed: 90 nop
4016ee: 90 nop
4016ef: 90 nop

004016f0 <___w32_sharedptr_get>:
4016f0: 55 push %ebp
4016f1: 89 e5 mov %esp,%ebp
4016f3: 53 push %ebx
4016f4: 83 ec 48 sub $0x48,%esp
4016f7: 31 db xor %ebx,%ebx
4016f9: 8d 45 b8 lea
0xffffffb8(%ebp),%eax
4016fc: 6a 40 push $0x40
4016fe: 50 push %eax
4016ff: 8b 45 08 mov 0x8(%ebp),%eax
401702: 25 ff ff 00 00 and $0xffff,%eax
401707: 50 push %eax
401708: e8 63 01 00 00 call 401870
<_GetAtomNameA@12>
40170d: ba 1f 00 00 00 mov $0x1f,%edx
401712: 59 pop %ecx
401713: 85 c0 test %eax,%eax
401715: b9 01 00 00 00 mov $0x1,%ecx
40171a: 74 20 je 40173c
<___w32_sharedptr_get+0x4c>
40171c: 8d 74 26 00 lea 0x0(%esi,1),%esi
401720: 80 7c 15 b8 41 cmpb
$0x41,0xffffffb8(%ebp,%edx,1)
401725: 74 11 je 401738
<___w32_sharedptr_get+0x48>
401727: 01 c9 add %ecx,%ecx
401729: 4a dec %edx
40172a: 79 f4 jns 401720
<___w32_sharedptr_get+0x30>
40172c: 83 3b 38 cmpl $0x38,(%ebx)
40172f: 75 0b jne 40173c
<___w32_sharedptr_get+0x4c>
401731: 89 d8 mov %ebx,%eax
401733: 8b 5d fc mov
0xfffffffc(%ebp),%ebx
401736: c9 leave
401737: c3 ret
401738: 09 cb or %ecx,%ebx
40173a: eb eb jmp 401727
<___w32_sharedptr_get+0x37>
40173c: e8 df 00 00 00 call 401820 <_abort>
401741: 90 nop
401742: 90 nop
401743: 90 nop
401744: 90 nop
401745: 90 nop
401746: 90 nop
401747: 90 nop
401748: 90 nop
401749: 90 nop
40174a: 90 nop
40174b: 90 nop
40174c: 90 nop
40174d: 90 nop
40174e: 90 nop
40174f: 90 nop

00401750 <___chkstk>:
401750: 51 push %ecx
401751: 89 e1 mov %esp,%ecx
401753: 83 c1 08 add $0x8,%ecx

00401756 <probe>:
401756: 3d 00 10 00 00 cmp $0x1000,%eax
40175b: 72 10 jb 40176d <done>
40175d: 81 e9 00 10 00 00 sub $0x1000,%ecx
401763: 83 09 00 orl $0x0,(%ecx)
401766: 2d 00 10 00 00 sub $0x1000,%eax
40176b: eb e9 jmp 401756 <probe>

0040176d <done>:
40176d: 29 c1 sub %eax,%ecx
40176f: 83 09 00 orl $0x0,(%ecx)
401772: 89 e0 mov %esp,%eax
401774: 89 cc mov %ecx,%esp
401776: 8b 08 mov (%eax),%ecx
401778: 8b 40 04 mov 0x4(%eax),%eax
40177b: ff e0 jmp *%eax
40177d: 90 nop
40177e: 90 nop
40177f: 90 nop

00401780 <___set_app_type>:
401780: ff 25 c4 40 40 00 jmp *0x4040c4
401786: 90 nop
401787: 90 nop
...

00401790 <__cexit>:
401790: ff 25 c8 40 40 00 jmp *0x4040c8
401796: 90 nop
401797: 90 nop
...

004017a0 <___p__environ>:
4017a0: ff 25 bc 40 40 00 jmp *0x4040bc
4017a6: 90 nop
4017a7: 90 nop
...

004017b0 <_signal>:
4017b0: ff 25 ec 40 40 00 jmp *0x4040ec
4017b6: 90 nop
4017b7: 90 nop
...

004017c0 <___p__fmode>:
4017c0: ff 25 c0 40 40 00 jmp *0x4040c0
4017c6: 90 nop
4017c7: 90 nop
...

004017d0 <__fileno>:
4017d0: ff 25 cc 40 40 00 jmp *0x4040cc
4017d6: 90 nop
4017d7: 90 nop
...
004017e0 <__setmode>:
4017e0: ff 25 d8 40 40 00 jmp *0x4040d8
4017e6: 90 nop
4017e7: 90 nop
...

004017f0 <___getmainargs>:
4017f0: ff 25 b8 40 40 00 jmp *0x4040b8
4017f6: 90 nop
4017f7: 90 nop
...

00401800 <_free>:
401800: ff 25 e4 40 40 00 jmp *0x4040e4
401806: 90 nop
401807: 90 nop
...

00401810 <_malloc>:
401810: ff 25 e8 40 40 00 jmp *0x4040e8
401816: 90 nop
401817: 90 nop
...

00401820 <_abort>:
401820: ff 25 dc 40 40 00 jmp *0x4040dc
401826: 90 nop
401827: 90 nop
...

00401830 <_SetUnhandledExceptionFilter@4>:
401830: ff 25 ac 40 40 00 jmp *0x4040ac
401836: 90 nop
401837: 90 nop
...

00401840 <_ExitProcess@4>:
401840: ff 25 a0 40 40 00 jmp *0x4040a0
401846: 90 nop
401847: 90 nop
...

00401850 <_FindAtomA@4>:
401850: ff 25 a4 40 40 00 jmp *0x4040a4
401856: 90 nop
401857: 90 nop
...

00401860 <_AddAtomA@4>:
401860: ff 25 9c 40 40 00 jmp *0x40409c
401866: 90 nop
401867: 90 nop
...

00401870 <_GetAtomNameA@12>:
401870: ff 25 a8 40 40 00 jmp *0x4040a8
401876: 90 nop
401877: 90 nop
...

00401880 <___sjlj_init_ctor>:
401880: 55 push %ebp
401881: 89 e5 mov %esp,%ebp
401883: 5d pop %ebp
401884: e9 37 fa ff ff jmp 4012c0
<___do_sjlj_init>
401889: 90 nop
40188a: 90 nop
40188b: 90 nop
40188c: 90 nop
40188d: 90 nop
40188e: 90 nop
40188f: 90 nop

00401890 <__CTOR_LIST__>:
401890: ff (bad)
401891: ff (bad)
401892: ff (bad)
401893: ff 80 18 40 00 00 incl 0x4018(%eax)

00401894 <.ctors>:
401894: 80 18 40 sbbb $0x40,(%eax)
401897: 00 00 add %al,(%eax)
401899: 00 00 add %al,(%eax)
...

0040189c <__DTOR_LIST__>:
40189c: ff (bad)
40189d: ff (bad)
40189e: ff (bad)
40189f: ff 00 incl (%eax)
4018a1: 00 00 add %al,(%eax)
...

004018a4 <etext>:
...

2.Hasil code disassembly code exe.asm

Tugas 4

code_O0.o: file format pe-i386

Disassembly of section .text:

00000000 <_main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 18 sub $0x18,%esp
6: 83 e4 f0 and $0xfffffff0,%esp
9: b8 00 00 00 00 mov $0x0,%eax
e: 89 45 f4 mov %eax,0xfffffff4(%ebp)
11: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
14: e8 00 00 00 00 call 19 <_main+0x19>
19: e8 00 00 00 00 call 1e <_main+0x1e>
1e: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)
25: c7 45 f8 00 00 00 00 movl $0x0,0xfffffff8(%ebp)
2c: 81 7d fc f3 01 00 00 cmpl $0x1f3,0xfffffffc(%ebp)
33: 7e 02 jle 37 <_main+0x37>
35: eb 0f jmp 46 <_main+0x46>
37: 8b 45 fc mov 0xfffffffc(%ebp),%eax
3a: 8d 55 f8 lea 0xfffffff8(%ebp),%edx
3d: 01 02 add %eax,(%edx)
3f: 8d 45 fc lea 0xfffffffc(%ebp),%eax
42: ff 00 incl (%eax)
44: eb e6 jmp 2c <_main+0x2c>
46: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
49: c9 leave
4a: c3 ret
4b: 90 nop
4c: 90 nop
4d: 90 nop
4e: 90 nop
4f: 90 nop
code_O1.o: file format pe-i386

Disassembly of section .text:

00000000 <_main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 ec 08 sub $0x8,%esp
6: 83 e4 f0 and $0xfffffff0,%esp
9: b8 00 00 00 00 mov $0x0,%eax
e: e8 00 00 00 00 call 13 <_main+0x13>
13: e8 00 00 00 00 call 18 <_main+0x18>
18: ba 00 00 00 00 mov $0x0,%edx
1d: b8 00 00 00 00 mov $0x0,%eax
22: 01 d0 add %edx,%eax
24: 42 inc %edx
25: 81 fa f3 01 00 00 cmp $0x1f3,%edx
2b: 7e f5 jle 22 <_main+0x22>
2d: c9 leave
2e: c3 ret
2f: 90 nop

code_O2.o: file format pe-i386

Disassembly of section .text:

00000000 <_main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 50 push %eax
4: 50 push %eax
5: 31 c0 xor %eax,%eax
7: 83 e4 f0 and $0xfffffff0,%esp
a: e8 00 00 00 00 call f <_main+0xf>
f: e8 00 00 00 00 call 14 <_main+0x14>
14: 31 c0 xor %eax,%eax
16: 31 d2 xor %edx,%edx
18: 01 d0 add %edx,%eax
1a: 42 inc %edx
1b: 81 fa f3 01 00 00 cmp $0x1f3,%edx
21: 7e f5 jle 18 <_main+0x18>
23: c9 leave
24: c3 ret
25: 90 nop
26: 90 nop
27: 90 nop
28: 90 nop
29: 90 nop
2a: 90 nop
2b: 90 nop
2c: 90 nop
2d: 90 nop
2e: 90 nop
2f: 90 nop

code_O3.o: file format pe-i386

Disassembly of section .text:


00000000 <_main>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 50 push %eax
4: 50 push %eax
5: 31 c0 xor %eax,%eax
7: 83 e4 f0 and $0xfffffff0,%esp
a: e8 00 00 00 00 call f <_main+0xf>
f: e8 00 00 00 00 call 14 <_main+0x14>
14: 31 c0 xor %eax,%eax
16: 31 d2 xor %edx,%edx
18: 01 d0 add %edx,%eax
1a: 42 inc %edx
1b: 81 fa f3 01 00 00 cmp $0x1f3,%edx
21: 7e f5 jle 18 <_main+0x18>
23: c9 leave
24: c3 ret
25: 90 nop
26: 90 nop
27: 90 nop
28: 90 nop
29: 90 nop
2a: 90 nop
2b: 90 nop
2c: 90 nop
2d: 90 nop
2e: 90 nop
2f: 90 nop

Tugas 5

Tugas 6
Tugas 7

Tugas 9

Anda mungkin juga menyukai