-
Notifications
You must be signed in to change notification settings - Fork 1
/
scaffold-wd.llvm
62 lines (48 loc) · 1.71 KB
/
scaffold-wd.llvm
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
61
%wd$state$ = type opaque
@.str = private unnamed_addr constant [31 x i8] c"s: start, t: tick, e: expired\0A\00", align 1
@$wd = external global %wd$state$
@.str1 = private unnamed_addr constant [4 x i8] c"%i\0A\00", align 1
define i32 @main() nounwind uwtable ssp {
%1 = alloca i32, align 4
%c = alloca i32, align 4
%e = alloca i1, align 1
store i32 0, i32* %1
call void @$init$()
br label %2
; <label>:2 ; preds = %0, %13
%3 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([31 x i8]* @.str, i32 0, i32 0))
%4 = call i32 @getchar()
store i32 %4, i32* %c, align 4
%5 = call i32 @getchar()
%6 = load i32* %c, align 4
switch i32 %6, label %13 [
i32 115, label %7
i32 116, label %8
i32 101, label %9
]
; <label>:7 ; preds = %2
call void @wd$start(%wd$state$* @$wd)
br label %13
; <label>:8 ; preds = %2
call void @wd$tick(%wd$state$* @$wd)
br label %13
; <label>:9 ; preds = %2
call void @wd$expired(%wd$state$* @$wd, i1* %e)
%10 = load i1* %e, align 1
%11 = zext i1 %10 to i32
%12 = call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([4 x i8]* @.str1, i32 0, i32 0), i32 %11)
br label %13
; <label>:13 ; preds = %2, %9, %8, %7
call void @$print$()
br label %2
; No predecessors!
%15 = load i32* %1
ret i32 %15
}
declare void @$init$()
declare void @$print$()
declare i32 @printf(i8*, ...)
declare i32 @getchar()
declare void @wd$start(%wd$state$*)
declare void @wd$tick(%wd$state$*)
declare void @wd$expired(%wd$state$*,i1*)