Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8384927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:32:11+00:00 2026-06-09T17:32:11+00:00

I am trying to understand the disassembled version of this program: #include <stdio.h> int

  • 0

I am trying to understand the disassembled version of this program:

#include <stdio.h>

int main(){
   int i=0;
   printf("HELLO VIK");
   return 0;
}

gdb disassembly:

(gdb) disass main
Dump of assembler code for function main:
0x0000000100000ef0 <main+0>:    push   rbp
0x0000000100000ef1 <main+1>:    mov    rbp,rsp
0x0000000100000ef4 <main+4>:    sub    rsp,0x10
0x0000000100000ef8 <main+8>:    mov    DWORD PTR [rbp-0xc],0x0
0x0000000100000eff <main+15>:   xor    al,al
0x0000000100000f01 <main+17>:   lea    rcx,[rip+0x50]        # 0x100000f58
0x0000000100000f08 <main+24>:   mov    rdi,rcx
0x0000000100000f0b <main+27>:   call   0x100000f2c <dyld_stub_printf>
0x0000000100000f10 <main+32>:   mov    DWORD PTR [rbp-0x8],0x0
0x0000000100000f17 <main+39>:   mov    eax,DWORD PTR [rbp-0x8]
0x0000000100000f1a <main+42>:   mov    DWORD PTR [rbp-0x4],eax
0x0000000100000f1d <main+45>:   mov    eax,DWORD PTR [rbp-0x4]
0x0000000100000f20 <main+48>:   add    rsp,0x10
0x0000000100000f24 <main+52>:   pop    rbp
0x0000000100000f25 <main+53>:   ret

If I understand the first 3 lines correctly, the base pointer is being pushed to the stack as the return address. Then the base pointer is set to the current stack pointer. The size of the stack is set to 16 bytes (x10). The size of the int i is 12 bytes(0xc) and is set to 0. I’m not sure what (xor al, al) does. Did i interpet this correctly? What does the xor al, al line do?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:32:12+00:00Added an answer on June 9, 2026 at 5:32 pm

    xor al,al is a quick way to zero out a register. It’s a one-byte opcode in x86 assembler, v.s. 2bytes for mov al, 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to understand PNG format. Consider this PNG Image: The Image is taken from
Trying to understand Ruby a bit better, I ran into this code surfing the
Trying to understand the math of this code snippet. A token is provided which
Im trying to understand how class generics work and this bit just doesnt make
I'm trying to understand an old classic Mac application's entry point. I've disassembled the
Trying to understand why this doesn't work. I keep getting the following errors: left
Trying to understand this binding process of the WPF. See the code at the
Trying to understand, how to redirect program output to a file... Code : import
Trying to understand how CoffeeScript instance and class variable works I came with this
Trying to understand this open source app on github, it has a gem file:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.