Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created July 17, 2017 21:17
Show Gist options
  • Save alexcrichton/b16c54c93f5135abf4bbf23c4ab98184 to your computer and use it in GitHub Desktop.
Save alexcrichton/b16c54c93f5135abf4bbf23c4ab98184 to your computer and use it in GitHub Desktop.
use std::io::*;
fn main() {
let mut s = String::new();
stdin().read_to_string(&mut s).unwrap();
let mut lines = s.lines().enumerate();
let start = loop {
let (i, l) = lines.next().unwrap();
if l.starts_with("define void") && l.contains("@foo") {
break i
}
};
while let Some((j, l)) = lines.next() {
if l.ends_with(":") {
continue
}
if l.contains(" alloca ") {
continue
}
println!("{} allocas", j - start);
break
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment