Skip to content

Instantly share code, notes, and snippets.

@stmtk1
Created May 25, 2020 17:24
Show Gist options
  • Save stmtk1/9edd6465dbdeaaa99ee634d235521f77 to your computer and use it in GitHub Desktop.
Save stmtk1/9edd6465dbdeaaa99ee634d235521f77 to your computer and use it in GitHub Desktop.
@str1 = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 1
define i32 @main(i32, i8**) #0 {
%3 = alloca i32, align 4
store i32 0, i32* %3, align 4
%4 = load i32, i32* %3, align 4
%5 = add nsw i32 2, %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str1, i32 0, i32 0), i32 %5)
ret i32 0
}
declare i32 @printf(i8*, ...) #1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment