It’s probably:
xorl %ebx, %ebx
This is a common idiom for zeroing a register on x86. This would correspond with i = 0
in the C code.
If you are curious “but why ?” the short answer is that the xor
instruction is fewer bytes than mov $0, %ebx
. The long answer includes other subtle reasons.
I am leaving out the rest of the exercise since there’s nothing idiosyncratic left.
Related Posts:
- need help understanding the movzbl call in this function
- Display value found at given address gdb
- What does the MOVZBL instruction do in IA-32 AT&T syntax?
- The point of test %eax %eax
- What does the MOVZBL instruction do in IA-32 AT&T syntax?
- ARM Assembler – How do I use CMP, BLT and BGT?
- The difference between cmpl and cmp
- x86 cmpl and jne
- What is callq instruction?
- x86 assembly: How does the ‘subl’ command work in AT&T syntax
- X86 assembly – Handling the IDIV instruction
- What is the difference between MOV and LEA?
- GDB no such file or directory
- What does the LEAL assembly instruction do?
- `js` and `jb` instructions in assembly
- How big can a 64 bit unsigned integer be?
- What’s the purpose of the LEA instruction?
- How to use execvp()
- How to use execvp() to execute a command
- How does strtok() split the string into tokens in C?
- what is Segmentation fault (core dumped)? [duplicate]
- How to convert an int to string in C?
- How to print in C
- Why should we typedef a struct so often in C?
- What is a string of hexadecimal digits?
- What is newline character — ‘\n’
- Why does ENOENT mean “No such file or directory”?
- What does the question mark character (‘?’) mean?
- makefile:4: *** missing separator. Stop
- Stack smashing detected
- How do I determine the size of my array in C?
- What is the difference between C and embedded C?
- Understanding cmp instruction
- Undefined reference to pthread_create
- Difference between malloc and calloc?
- What is Bit Masking?
- segmentation fault : 11
- Why use bzero over memset?
- what is the meaning of == sign?
- Assembly: How does fld st(0) duplicates the top stack value in the following code?
- How do I use extern to share variables between source files?
- Cannot assign requested address – possible causes?
- Invalid read of size 8 – Valgrind + C
- error: called object is not a function or function pointer
- munmap_chunk(): invalid pointer
- strcpy vs strdup
- Warning comparison between pointer and integer in C language
- No Symbol Table using GDB on Compiled Programs
- What is char ** in C?
- Difference between scanf() and fgets()
- Return char[]/string from a function [duplicate]
- Is there a printf converter to print in binary format?
- What is a bus error? Is it different from a segmentation fault?
- Difference between char* and const char*?
- C to assembly – leaq instruction
- Output single character in C
- Get the current time in C
- Does connect() block for TCP socket?
- Converting a C program to MIPS
- C: linker command failed with exit code 1
- What’s the equivalent of new/delete of C++ in C?
- Get text from user input using C
- How do I lowercase a string in C?
- warning: expression result unused
- error: indirection requires pointer operand (‘int’ invalid)
- What is the difference between exit(0) and exit(1) in C?
- What does “%.*s” mean in printf?
- Purpose of ESI & EDI registers?
- Array definition – Expression must have a constant value
- What are the ESP and the EBP registers?
- How to print a char array in C through printf?
- How to clear all the elements of array in C?
- Constant pointer vs Pointer to constant
- Variable warning set but not used
- Expected declaration specifier error in function
- strcmp not working
- C char* to int conversion
- error: aggregate value used where an integer was expected
- char pointers: invalid conversion from ‘char*’ to ‘char’?
- Purpose of ESI & EDI registers?
- Difference between “move” and “li” in MIPS assembly language
- When and why do we sign extend and use cdq with mul/div?
- How can one see content of stack with GDB?
- Does C have a string type?
- how use EOF stdin in C
- Execution of printf() and Segmentation Fault
- How does the strtok function in C work? [duplicate]
- Printing out a number in assembly language?
- error: function returns address of local variable
- Difference between JA and JG in assembly
- Return a `struct` from a function in C
- C: scanf to array
- What are “prototypes” in a C program?
- What’s the difference between “mod” and “remainder”?
- undefined reference to `std::ios_base::Init::Init()’
- previous declaration of ‘function’ was here in C [duplicate]
- MIPS to C Translation
- Difference between movq and movabsq in x86-64
- How to Compare 2 Character Arrays [duplicate]
- error: `itoa` was not declared in this scope