--- a/progs/fun2/sqr.ll Fri Dec 03 17:45:11 2021 +0000
+++ b/progs/fun2/sqr.ll Fri Dec 03 18:00:30 2021 +0000
@@ -27,10 +27,18 @@
ret void
}
-@.str = private constant [4 x i8] c"%d\0A\00"
+@.str_int = private constant [3 x i8] c"%d\00"
define void @print_int(i32 %x) {
- %t0 = getelementptr [4 x i8], [4 x i8]* @.str, i32 0, i32 0
+ %t0 = getelementptr [3 x i8], [3 x i8]* @.str_int, i32 0, i32 0
+ call i32 (i8*, ...) @printf(i8* %t0, i32 %x)
+ ret void
+}
+
+@.str_char = private constant [3 x i8] c"%c\00"
+
+define void @print_char(i32 %x) {
+ %t0 = getelementptr [3 x i8], [3 x i8]* @.str_char, i32 0, i32 0
call i32 (i8*, ...) @printf(i8* %t0, i32 %x)
ret void
}
@@ -47,16 +55,17 @@
define void @all (i32 %n) {
%tmp_22 = load i32, i32* @Max
%tmp_21 = icmp sle i32 %n, %tmp_22
- br i1 %tmp_21, label %if_branch_28, label %else_branch_29
+ br i1 %tmp_21, label %if_branch_29, label %else_branch_30
-if_branch_28:
+if_branch_29:
%tmp_23 = call i32 @sqr (i32 %n)
call void @print_int (i32 %tmp_23)
- %tmp_25 = add i32 %n, 1
- call void @all (i32 %tmp_25)
+ call void @new_line ()
+ %tmp_26 = add i32 %n, 1
+ call void @all (i32 %tmp_26)
ret void
-else_branch_29:
+else_branch_30:
call void @skip ()
ret void
}