Skip to content

Instantly share code, notes, and snippets.

@mehcode

mehcode/main.ll Secret

Created February 10, 2017 21:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mehcode/e8f4e7c5b7eb7a3bf5a004a9983172c4 to your computer and use it in GitHub Desktop.
Save mehcode/e8f4e7c5b7eb7a3bf5a004a9983172c4 to your computer and use it in GitHub Desktop.
; [...]
%1 = load i8, i8* %value
switch i8 %1, label %bb21 [
i8 0, label %bb1
i8 1, label %bb2
i8 2, label %bb3
i8 3, label %bb4
i8 4, label %bb5
i8 5, label %bb6
i8 6, label %bb7
i8 7, label %bb8
i8 8, label %bb9
i8 9, label %bb10
i8 10, label %bb11
i8 11, label %bb12
i8 12, label %bb13
i8 13, label %bb14
i8 14, label %bb15
i8 15, label %bb16
i8 16, label %bb17
i8 17, label %bb18
i8 18, label %bb19
i8 19, label %bb20
]
; [...]
use std::io;
use std::io::BufRead;
pub fn match_(value: u8) {
match value {
0x0 => println!("0x0"),
0x1 => println!("0x1"),
0x2 => println!("0x2"),
0x3 => println!("0x3"),
0x4 => println!("0x4"),
0x5 => println!("0x5"),
0x6 => println!("0x6"),
0x7 => println!("0x7"),
0x8 => println!("0x8"),
0x9 => println!("0x9"),
0xA => println!("0xA"),
0xB => println!("0xB"),
0xC => println!("0xC"),
0xD => println!("0xD"),
0xE => println!("0xE"),
0xF => println!("0xF"),
0x10 => println!("0x10"),
0x11 => println!("0x11"),
0x12 => println!("0x12"),
0x13 => println!("0x13"),
_ => { }
}
}
fn main() {
let mut line = String::new();
let stdin = io::stdin();
stdin.lock().read_line(&mut line).unwrap();
let len = line.len();
line.truncate(len - 1);
let value: u8 = line.parse().unwrap();
match_(value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment