1; RUN: llc < %s -mtriple=armv7-apple-darwin -O3 -mcpu=arm1136jf-s
2; PR7421
3
4%struct.CONTENTBOX = type { i32, i32, i32, i32, i32 }
5%struct.FILE = type { i8* }
6%struct.tilebox = type { %struct.tilebox*, double, double, double, double, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
7%struct.UNCOMBOX = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
8%struct.cellbox = type { i8*, i32, i32, i32, [9 x i32], i32, i32, i32, i32, i32, i32, i32, double, double, double, double, double, i32, i32, %struct.CONTENTBOX*, %struct.UNCOMBOX*, [8 x %struct.tilebox*] }
9%struct.termbox = type { %struct.termbox*, i32, i32, i32, i32, i32 }
10
11@.str2708 = external constant [14 x i8], align 4  ; <[14 x i8]*> [#uses=1]
12
13define void @TW_oldinput(%struct.FILE* nocapture %fp) nounwind {
14entry:
15  %xcenter = alloca i32, align 4                  ; <i32*> [#uses=2]
16  %0 = call i32 (%struct.FILE*, i8*, ...)* @fscanf(%struct.FILE* %fp, i8* getelementptr inbounds ([14 x i8]* @.str2708, i32 0, i32 0), i32* undef, i32* undef, i32* %xcenter, i32* null) nounwind ; <i32> [#uses=1]
17  %1 = icmp eq i32 %0, 4                          ; <i1> [#uses=1]
18  br i1 %1, label %bb, label %return
19
20bb:                                               ; preds = %bb445, %entry
21  %2 = load %struct.cellbox** undef, align 4      ; <%struct.cellbox*> [#uses=2]
22  %3 = getelementptr inbounds %struct.cellbox* %2, i32 0, i32 3 ; <i32*> [#uses=1]
23  store i32 undef, i32* %3, align 4
24  %4 = load i32* undef, align 4                   ; <i32> [#uses=3]
25  %5 = icmp eq i32 undef, 1                       ; <i1> [#uses=1]
26  br i1 %5, label %bb10, label %bb445
27
28bb10:                                             ; preds = %bb
29  br i1 undef, label %bb11, label %bb445
30
31bb11:                                             ; preds = %bb10
32  %6 = load %struct.tilebox** undef, align 4      ; <%struct.tilebox*> [#uses=3]
33  %7 = load %struct.termbox** null, align 4       ; <%struct.termbox*> [#uses=1]
34  %8 = getelementptr inbounds %struct.tilebox* %6, i32 0, i32 13 ; <i32*> [#uses=1]
35  %9 = load i32* %8, align 4                      ; <i32> [#uses=3]
36  %10 = getelementptr inbounds %struct.tilebox* %6, i32 0, i32 15 ; <i32*> [#uses=1]
37  %11 = load i32* %10, align 4                    ; <i32> [#uses=1]
38  br i1 false, label %bb12, label %bb13
39
40bb12:                                             ; preds = %bb11
41  unreachable
42
43bb13:                                             ; preds = %bb11
44  %iftmp.40.0.neg = sdiv i32 0, -2                ; <i32> [#uses=2]
45  %12 = sub nsw i32 0, %9                         ; <i32> [#uses=1]
46  %13 = sitofp i32 %12 to double                  ; <double> [#uses=1]
47  %14 = fdiv double %13, 0.000000e+00             ; <double> [#uses=1]
48  %15 = fptosi double %14 to i32                  ; <i32> [#uses=1]
49  %iftmp.41.0.in = add i32 0, %15                 ; <i32> [#uses=1]
50  %iftmp.41.0.neg = sdiv i32 %iftmp.41.0.in, -2   ; <i32> [#uses=3]
51  br i1 undef, label %bb43.loopexit, label %bb21
52
53bb21:                                             ; preds = %bb13
54  %16 = fptosi double undef to i32                ; <i32> [#uses=1]
55  %17 = fsub double undef, 0.000000e+00           ; <double> [#uses=1]
56  %not.460 = fcmp oge double %17, 5.000000e-01    ; <i1> [#uses=1]
57  %18 = zext i1 %not.460 to i32                   ; <i32> [#uses=1]
58  %iftmp.42.0 = add i32 %16, %iftmp.41.0.neg      ; <i32> [#uses=1]
59  %19 = add i32 %iftmp.42.0, %18                  ; <i32> [#uses=1]
60  store i32 %19, i32* undef, align 4
61  %20 = sub nsw i32 0, %9                         ; <i32> [#uses=1]
62  %21 = sitofp i32 %20 to double                  ; <double> [#uses=1]
63  %22 = fdiv double %21, 0.000000e+00             ; <double> [#uses=2]
64  %23 = fptosi double %22 to i32                  ; <i32> [#uses=1]
65  %24 = fsub double %22, undef                    ; <double> [#uses=1]
66  %not.461 = fcmp oge double %24, 5.000000e-01    ; <i1> [#uses=1]
67  %25 = zext i1 %not.461 to i32                   ; <i32> [#uses=1]
68  %iftmp.43.0 = add i32 %23, %iftmp.41.0.neg      ; <i32> [#uses=1]
69  %26 = add i32 %iftmp.43.0, %25                  ; <i32> [#uses=1]
70  %27 = getelementptr inbounds %struct.tilebox* %6, i32 0, i32 10 ; <i32*> [#uses=1]
71  store i32 %26, i32* %27, align 4
72  %28 = fptosi double undef to i32                ; <i32> [#uses=1]
73  %iftmp.45.0 = add i32 %28, %iftmp.40.0.neg      ; <i32> [#uses=1]
74  %29 = add i32 %iftmp.45.0, 0                    ; <i32> [#uses=1]
75  store i32 %29, i32* undef, align 4
76  br label %bb43.loopexit
77
78bb36:                                             ; preds = %bb43.loopexit, %bb36
79  %termptr.0478 = phi %struct.termbox* [ %42, %bb36 ], [ %7, %bb43.loopexit ] ; <%struct.termbox*> [#uses=1]
80  %30 = load i32* undef, align 4                  ; <i32> [#uses=1]
81  %31 = sub nsw i32 %30, %9                       ; <i32> [#uses=1]
82  %32 = sitofp i32 %31 to double                  ; <double> [#uses=1]
83  %33 = fdiv double %32, 0.000000e+00             ; <double> [#uses=1]
84  %34 = fptosi double %33 to i32                  ; <i32> [#uses=1]
85  %iftmp.46.0 = add i32 %34, %iftmp.41.0.neg      ; <i32> [#uses=1]
86  %35 = add i32 %iftmp.46.0, 0                    ; <i32> [#uses=1]
87  store i32 %35, i32* undef, align 4
88  %36 = sub nsw i32 0, %11                        ; <i32> [#uses=1]
89  %37 = sitofp i32 %36 to double                  ; <double> [#uses=1]
90  %38 = fmul double %37, 0.000000e+00             ; <double> [#uses=1]
91  %39 = fptosi double %38 to i32                  ; <i32> [#uses=1]
92  %iftmp.47.0 = add i32 %39, %iftmp.40.0.neg      ; <i32> [#uses=1]
93  %40 = add i32 %iftmp.47.0, 0                    ; <i32> [#uses=1]
94  store i32 %40, i32* undef, align 4
95  %41 = getelementptr inbounds %struct.termbox* %termptr.0478, i32 0, i32 0 ; <%struct.termbox**> [#uses=1]
96  %42 = load %struct.termbox** %41, align 4       ; <%struct.termbox*> [#uses=2]
97  %43 = icmp eq %struct.termbox* %42, null        ; <i1> [#uses=1]
98  br i1 %43, label %bb52.loopexit, label %bb36
99
100bb43.loopexit:                                    ; preds = %bb21, %bb13
101  br i1 undef, label %bb52.loopexit, label %bb36
102
103bb52.loopexit:                                    ; preds = %bb43.loopexit, %bb36
104  %44 = icmp eq i32 %4, 0                         ; <i1> [#uses=1]
105  br i1 %44, label %bb.nph485, label %bb54
106
107bb54:                                             ; preds = %bb52.loopexit
108  switch i32 %4, label %bb62 [
109    i32 2, label %bb56
110    i32 3, label %bb57
111  ]
112
113bb56:                                             ; preds = %bb54
114  br label %bb62
115
116bb57:                                             ; preds = %bb54
117  br label %bb62
118
119bb62:                                             ; preds = %bb57, %bb56, %bb54
120  unreachable
121
122bb.nph485:                                        ; preds = %bb52.loopexit
123  br label %bb248
124
125bb248:                                            ; preds = %bb322, %bb.nph485
126  %45 = icmp eq i32 undef, %4                     ; <i1> [#uses=1]
127  br i1 %45, label %bb322, label %bb249
128
129bb249:                                            ; preds = %bb248
130  %46 = getelementptr inbounds %struct.cellbox* %2, i32 0, i32 21, i32 undef ; <%struct.tilebox**> [#uses=1]
131  %47 = load %struct.tilebox** %46, align 4       ; <%struct.tilebox*> [#uses=1]
132  %48 = getelementptr inbounds %struct.tilebox* %47, i32 0, i32 11 ; <i32*> [#uses=1]
133  store i32 undef, i32* %48, align 4
134  unreachable
135
136bb322:                                            ; preds = %bb248
137  br i1 undef, label %bb248, label %bb445
138
139bb445:                                            ; preds = %bb322, %bb10, %bb
140  %49 = call i32 (%struct.FILE*, i8*, ...)* @fscanf(%struct.FILE* %fp, i8* getelementptr inbounds ([14 x i8]* @.str2708, i32 0, i32 0), i32* undef, i32* undef, i32* %xcenter, i32* null) nounwind ; <i32> [#uses=1]
141  %50 = icmp eq i32 %49, 4                        ; <i1> [#uses=1]
142  br i1 %50, label %bb, label %return
143
144return:                                           ; preds = %bb445, %entry
145  ret void
146}
147
148declare i32 @fscanf(%struct.FILE* nocapture, i8* nocapture, ...) nounwind
149