-
Notifications
You must be signed in to change notification settings - Fork 237
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #262 from MelindaFang-code/reverse_int
reverse_int
- Loading branch information
Showing
4 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# ARGS: 123 | ||
@main (input: int){ | ||
n: int = id input; | ||
v0: int = const 0; | ||
v1: int = const 10; | ||
result: int = id v0; | ||
v2: bool = const true; | ||
notdone: bool = id v2; | ||
.for.cond.3: | ||
v4: bool = id notdone; | ||
br v4 .for.body.3 .for.end.3; | ||
.for.body.3: | ||
v5: int = id n; | ||
a: int = div v5 v1; | ||
floor: int = mul a v1; | ||
remainder: int = sub v5 floor; | ||
result: int = mul result v1; | ||
result: int = add result remainder; | ||
n: int = id a; | ||
comp1: bool = eq n v0; | ||
br comp1 .if.body .for.incre; | ||
.if.body: | ||
notdone: bool = const false; | ||
jmp .for.cond.3; | ||
.for.incre: | ||
jmp .for.cond.3; | ||
.for.end.3: | ||
print result; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
321 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
total_dyn_inst: 46 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters