Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ECE391
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
yuhaow7
ECE391
Merge requests
!1
Master
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Master
master
into
main
Overview
0
Commits
6
Pipelines
0
Changes
5
Open
yuhaow7
requested to merge
master
into
main
2 years ago
Overview
0
Commits
6
Pipelines
0
Changes
5
Expand
0
0
Merge request reports
Compare
main
version 3
b01d743a
2 years ago
version 2
40188a2e
2 years ago
version 1
341b7e18
2 years ago
main (HEAD)
and
latest version
latest version
7a51cf8d
6 commits,
2 years ago
version 3
b01d743a
5 commits,
2 years ago
version 2
40188a2e
4 commits,
2 years ago
version 1
341b7e18
3 commits,
2 years ago
5 files
+
225
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
main.c
0 → 100644
+
73
−
0
Options
/*
* tab:2
*
* main.c - I/O and P3 setup
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF ILLINOIS BE LIABLE TO
* ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
* DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
* EVEN IF THE AUTHOR AND/OR THE UNIVERSITY OF ILLINOIS HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE AUTHOR AND THE UNIVERSITY OF ILLINOIS SPECIFICALLY DISCLAIM ANY
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND NEITHER THE AUTHOR NOR
* THE UNIVERSITY OF ILLINOIS HAS ANY OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Author: Aamir Hasan
* Version: 1
* Creation Date: Sun Aug 30 2020
* Author: Yan Miao
* Version: 2
* Modified Date: Sun Aug 29 2021
* Author: Xiang Li
* Version: 2
* Modified Date: Sun Aug 21 2022
* History:
* AH 1 Sun Aug 30 2020
* YM 2 Sun Aug 29 2021
* XL 2 Sun Aug 21 2022
*/
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdint.h>
#include
"mystery.h"
#define MAX_LENGTH 500
uint32_t
import
(
char
*
infile
,
uint32_t
*
a
,
uint32_t
*
b
)
{
FILE
*
f
=
fopen
(
infile
,
"r"
);
if
(
f
==
NULL
)
return
-
1
;
fscanf
(
f
,
"%u %u
\n
"
,
a
,
b
);
fclose
(
f
);
return
0
;
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
<
2
)
{
printf
(
"Usage: ./mystery <input file>
\n
"
);
return
-
1
;
}
uint32_t
x
,
y
,
out
;
import
(
argv
[
1
],
&
x
,
&
y
);
printf
(
"
\n
Running C Code
\n
"
);
out
=
mystery_c
(
x
,
y
);
printf
(
"Mystery(%u, %u) = %u
\n\n
"
,
x
,
y
,
out
);
printf
(
"Running x86 Assembly Code
\n
"
);
out
=
mystery_asm
(
x
,
y
);
printf
(
"Mystery(%u, %u) = %u
\n\n
"
,
x
,
y
,
out
);
return
0
;
}
mystery.c
0 → 100644
+
61
−
0
Options
/*
* tab:2
*
* mystery.c
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF ILLINOIS BE LIABLE TO
* ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
* DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
* EVEN IF THE AUTHOR AND/OR THE UNIVERSITY OF ILLINOIS HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE AUTHOR AND THE UNIVERSITY OF ILLINOIS SPECIFICALLY DISCLAIM ANY
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND NEITHER THE AUTHOR NOR
* THE UNIVERSITY OF ILLINOIS HAS ANY OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Author: Yan Miao
* Version: 1
* Creation Date: Sun Aug 29 2021
* Author: Xiang Li
* Version: 2
* Modified Date: Sun Aug 21 2022
* History:
* YM 1 Sun Aug 29 2021
* XL 2 Sun Aug 21 2022
*/
#include
"mystery.h"
uint32_t
mystery_c
(
uint32_t
x
,
uint32_t
y
)
{
//------- YOUR CODE HERE -------
if
(
y
>
24
)
return
0
;
if
(
x
>=
42
)
return
0
;
int32_t
EDI
=
0
;
int32_t
ESI
=
1
;
while
(
x
>
ESI
){
EDI
=
EDI
+
ESI
;
ESI
++
;
}
int32_t
EDX
=
1
;
int32_t
ESI
=
1
;
while
(
y
>=
ESI
){
EDX
=
ESI
*
EDX
;
ESI
++
;
}
EDX
=
EDI
|
EDX
;
return
EDX
;
//------------------------------
}
mystery.h
0 → 100644
+
53
−
0
Options
/*
* tab:2
*
* mystery.h - mystery function declarations
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice and the following
* two paragraphs appear in all copies of this software.
*
* IN NO EVENT SHALL THE AUTHOR OR THE UNIVERSITY OF ILLINOIS BE LIABLE TO
* ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
* DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION,
* EVEN IF THE AUTHOR AND/OR THE UNIVERSITY OF ILLINOIS HAS BEEN ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE AUTHOR AND THE UNIVERSITY OF ILLINOIS SPECIFICALLY DISCLAIM ANY
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
* PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND NEITHER THE AUTHOR NOR
* THE UNIVERSITY OF ILLINOIS HAS ANY OBLIGATION TO PROVIDE MAINTENANCE,
* SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Author: Aamir Hasan
* Version: 1
* Creation Date: Sun Aug 30 2020
* Author: Yan Miao
* Version: 2
* Modified Date: Sun Aug 29 2021
* History:
* AH 1 Sun Aug 30 2020
* YM 2 Sun Aug 29 2021
*/
#ifndef MYSTERY_H
#define MYSTERY_H
#include
<stdio.h>
#include
<stdlib.h>
#include
<stdint.h>
// mystery_asm
// Calculates the mystery function of the two input number
extern
uint32_t
mystery_asm
(
int32_t
x
,
int32_t
y
);
// mystery_c
// Same as above
uint32_t
mystery_c
(
uint32_t
x
,
uint32_t
y
);
#endif
Loading