forked from rafaelbeckel/test-c-rust-wasm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc_maths.ll
60 lines (51 loc) · 1.99 KB
/
c_maths.ll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
; ModuleID = './maths.c'
source_filename = "./maths.c"
target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-n32:64-S128-ni:1:10:20"
target triple = "wasm32"
; Function Attrs: noinline nounwind optnone
define hidden i32 @add(i32 noundef %0, i32 noundef %1) #0 {
%3 = alloca i32, align 4
%4 = alloca i32, align 4
store i32 %0, ptr %3, align 4
store i32 %1, ptr %4, align 4
%5 = load i32, ptr %3, align 4
%6 = load i32, ptr %4, align 4
%7 = add nsw i32 %5, %6
ret i32 %7
}
; Function Attrs: noinline nounwind optnone
define hidden i32 @divide(i32 noundef %0, i32 noundef %1) #0 {
%3 = alloca i32, align 4
%4 = alloca i32, align 4
%5 = alloca i32, align 4
store i32 %0, ptr %3, align 4
store i32 %1, ptr %4, align 4
store i32 0, ptr %5, align 4
br label %6
6: ; preds = %10, %2
%7 = load i32, ptr %3, align 4
%8 = load i32, ptr %4, align 4
%9 = icmp sge i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i32, ptr %3, align 4
%12 = load i32, ptr %4, align 4
%13 = call i32 @subtract(i32 noundef %11, i32 noundef %12)
store i32 %13, ptr %3, align 4
%14 = load i32, ptr %5, align 4
%15 = call i32 @add(i32 noundef %14, i32 noundef 1)
store i32 %15, ptr %5, align 4
br label %6, !llvm.loop !2
16: ; preds = %6
%17 = load i32, ptr %5, align 4
ret i32 %17
}
declare i32 @subtract(i32 noundef, i32 noundef) #1
attributes #0 = { noinline nounwind optnone "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+mutable-globals,+sign-ext" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="generic" "target-features"="+mutable-globals,+sign-ext" }
!llvm.module.flags = !{!0}
!llvm.ident = !{!1}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{!"Homebrew clang version 18.1.5"}
!2 = distinct !{!2, !3}
!3 = !{!"llvm.loop.mustprogress"}