Intermediate Assembly Code Optimization
Budget: $30 – $250 USD
I'm seeking assistance from an Assembly programmer with an intermediate level of expertise. The primary task will involve enhancing and optimizing the performance of existing Assembly code. Additionally, the project requires integration of C and Assembly code. You'll need to:
- Understand and convert provided C code to Assembly, maintaining functionality and efficiency.
- Improve the performance of the existing Assembly code through optimization techniques.
The ideal freelancer will have a solid understanding of the following:
- Intermediate level Assembly programming
- Optimization techniques for Assembly code
- Reading and understanding C code
- Translating C code into efficient Assembly code
It's crucial that the freelancer is comfortable with Makefile structures and header files, as these are essential in this project. Experience in working with consistent AT&T syntax is a big plus. The ability to work efficiently and communicate effectively is also highly valued.
The goal of this exercise is to practice writing both basic assembly and more
advanced assembly. This exercise is composed of 2 unrelated parts. The first part
will be writing a simple game, and the second one will be about strings. Each part
will have you write different files, and use different files for its environment.
Overall, remember you need to submit the files: “main.s”, “pstrings.s” and
“func_select.s”.
In the first part of the homework assignment we’ll write a basic program using
assembly, to demonstrate ‘everyday’ functionality. E.g: calling library functions,
basic loops, conditions and defining global variables.
We’ll implement a simple number guessing game :).
A number guessing game is a simple game that acts like the following: first, the
program prompts the user to enter a configuration value - the seed for the rand()
library function. Then, it generates a random number between 0 and N. After that,
the program constantly prompts the user with the age-old question “What is your
guess?”. Each time, the user then inputs whatever number he thinks of. If the guess
is incorrect, the program prints “Incorrect.”. The application comes to a stop when
either M iterations of the game are passed, or the user guesses the number correctly.
Whichever comes first. If the user guesses the correct number after less than M tries,
the program prints “Congratz! You won!”. Otherwise, the program prints “Game
over, you lost :(. The Correct answer was X.” where X was the random number.
Your task for this part is to implement a number guessing with N = 10 and M = 5.
Write your code under a file named “main.s” and make sure it compiles using the
command “gcc main.s -no-pie”.
For the second part of the homework assignment we’ll write a simple string library.
To get working on this assignment, unzip the “pstrings.zip” file attached to this
assignment, and open the directory in your text editor of choice.
First, let’s understand the structure of the program:
● “pstrings.h” - header file where the main structure of the program and
the library function’s signatures are declared.
● “main.c” - implementation of the main function.
● “Makefile” - project builder for this part.
● “pstring.s”, “func_select.s” - the two files you are in charge of
implementing :).
The flow of the program is as follows: the main function receives from the user two
Pstrings (by length and characters), and builds them. Then, it prompts the user with
a menu - showcasing the available library functions, and which number should be
inputted for provoking the matching function. After scanning in the requested
number from the user, it calls the run_func passing references to both Pstrings and
the inputted number.
The run_func function, which you’ll implement in func_select.s, calls one of the
pstrings library functions, according to the choice number. These library functions
will also be implemented by you, in the pstring.s file.
You’ll need to submit the files “func_select.s” and “pstrings.s” for this part.
run_func in more detail
As stated above, the run_func function receives a choice integer and two Pstring
references. You can see the signature in main.c. The function should behave the
following way, according the the choice integer:
If choice is 31: the function should call pstrlen and calculate the length of each string,
- Understand and convert provided C code to Assembly, maintaining functionality and efficiency.
- Improve the performance of the existing Assembly code through optimization techniques.
The ideal freelancer will have a solid understanding of the following:
- Intermediate level Assembly programming
- Optimization techniques for Assembly code
- Reading and understanding C code
- Translating C code into efficient Assembly code
It's crucial that the freelancer is comfortable with Makefile structures and header files, as these are essential in this project. Experience in working with consistent AT&T syntax is a big plus. The ability to work efficiently and communicate effectively is also highly valued.
The goal of this exercise is to practice writing both basic assembly and more
advanced assembly. This exercise is composed of 2 unrelated parts. The first part
will be writing a simple game, and the second one will be about strings. Each part
will have you write different files, and use different files for its environment.
Overall, remember you need to submit the files: “main.s”, “pstrings.s” and
“func_select.s”.
In the first part of the homework assignment we’ll write a basic program using
assembly, to demonstrate ‘everyday’ functionality. E.g: calling library functions,
basic loops, conditions and defining global variables.
We’ll implement a simple number guessing game :).
A number guessing game is a simple game that acts like the following: first, the
program prompts the user to enter a configuration value - the seed for the rand()
library function. Then, it generates a random number between 0 and N. After that,
the program constantly prompts the user with the age-old question “What is your
guess?”. Each time, the user then inputs whatever number he thinks of. If the guess
is incorrect, the program prints “Incorrect.”. The application comes to a stop when
either M iterations of the game are passed, or the user guesses the number correctly.
Whichever comes first. If the user guesses the correct number after less than M tries,
the program prints “Congratz! You won!”. Otherwise, the program prints “Game
over, you lost :(. The Correct answer was X.” where X was the random number.
Your task for this part is to implement a number guessing with N = 10 and M = 5.
Write your code under a file named “main.s” and make sure it compiles using the
command “gcc main.s -no-pie”.
For the second part of the homework assignment we’ll write a simple string library.
To get working on this assignment, unzip the “pstrings.zip” file attached to this
assignment, and open the directory in your text editor of choice.
First, let’s understand the structure of the program:
● “pstrings.h” - header file where the main structure of the program and
the library function’s signatures are declared.
● “main.c” - implementation of the main function.
● “Makefile” - project builder for this part.
● “pstring.s”, “func_select.s” - the two files you are in charge of
implementing :).
The flow of the program is as follows: the main function receives from the user two
Pstrings (by length and characters), and builds them. Then, it prompts the user with
a menu - showcasing the available library functions, and which number should be
inputted for provoking the matching function. After scanning in the requested
number from the user, it calls the run_func passing references to both Pstrings and
the inputted number.
The run_func function, which you’ll implement in func_select.s, calls one of the
pstrings library functions, according to the choice number. These library functions
will also be implemented by you, in the pstring.s file.
You’ll need to submit the files “func_select.s” and “pstrings.s” for this part.
run_func in more detail
As stated above, the run_func function receives a choice integer and two Pstring
references. You can see the signature in main.c. The function should behave the
following way, according the the choice integer:
If choice is 31: the function should call pstrlen and calculate the length of each string,