- [DONE] popq
- [DONE] pushq
- [DONE] movq
- [DONE] movl
- [DONE] movw
- [DONE] movb
- [DONE] movzbl
- [DONE] movsbl
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
#include <stdio.h> | |
typedef struct Node Node; | |
struct Node { | |
int value; | |
Node *left; | |
Node *right; | |
}; |
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
use std::io::{self, Read}; | |
macro_rules! input { | |
($it: expr) => ($it.next().unwrap().parse().unwrap()); | |
($it: expr, $T: ty) => ($it.next().unwrap().parse::<$T>().unwrap()); | |
} | |
fn main() { | |
let mut buf = String::new(); | |
io::stdin().read_to_string(&mut buf).unwrap(); |
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
// build and execute | |
// $ gcc -o fizzbuzz fizzbuzz.s | |
// $ ./fizzbuzz | |
.section .rodata | |
.Sfizzbuzz: | |
.string "FizzBuzz\n" | |
.Sfizz: | |
.string "Fizz\n" | |
.Sbuzz: |
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
// $ gcc gen_hello.c -o gen_hello | |
// $ ./gen_hello | |
// $ ./hello | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <elf.h> | |
#define SEGMENTS 1 | |
#define SEG_EXEC 0 |
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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <elf.h> | |
int main(int argc, char *argv[]) { | |
if (argc != 3) { | |
fprintf(stderr, "usage: ./gen_obj [integer] [output file]\n"); | |
exit(1); | |
} | |
int n = atoi(argv[1]); |
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
# generated by https://tool-taro.com/image_to_ascii/ | |
AA = <<-EOS | |