; LLVM IR from tangjz/acm-icpc :: poj (2764)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@lcm = external dso_local global i32, align 4
@w = external dso_local global [5 x i32], align 16
@deg = external dso_local global i32, align 4
@low = external dso_local global i64, align 8
@poly = external dso_local global [12606 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z6chkRemx(i64 noundef) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %223, %0
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %18 = icmp eq i32 %17, 1
  br i1 %18, label %19, label %22

19:                                               ; preds = %16
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br label %22

22:                                               ; preds = %19, %16
  %23 = phi i1 [ false, %16 ], [ %21, %19 ]
  br i1 %23, label %25, label %24

24:                                               ; preds = %22
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %226

25:                                               ; preds = %22
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %26)
  store i32 1, ptr @lcm, align 4, !tbaa !5
  store i32 0, ptr @deg, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %57, %25
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = icmp slt i32 %29, %30
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %60

33:                                               ; preds = %28
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds i32, ptr @w, i64 %35
  %37 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %36)
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [5 x i32], ptr @w, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [5 x i32], ptr @w, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = load i32, ptr @lcm, align 4, !tbaa !5
  %47 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %45, i32 noundef %46)
  %48 = sdiv i32 %41, %47
  %49 = load i32, ptr @lcm, align 4, !tbaa !5
  %50 = mul nsw i32 %49, %48
  store i32 %50, ptr @lcm, align 4, !tbaa !5
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [5 x i32], ptr @w, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = load i32, ptr @deg, align 4, !tbaa !5
  %56 = add nsw i32 %55, %54
  store i32 %56, ptr @deg, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %33
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %4, align 4, !tbaa !5
  br label %28, !llvm.loop !9

60:                                               ; preds = %32
  %61 = load i32, ptr @n, align 4, !tbaa !5
  %62 = load i32, ptr @lcm, align 4, !tbaa !5
  %63 = mul nsw i32 %61, %62
  %64 = load i32, ptr @deg, align 4, !tbaa !5
  %65 = sub nsw i32 %63, %64
  store i32 %65, ptr @deg, align 4, !tbaa !5
  %66 = load i32, ptr @deg, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = mul i64 %68, 8
  call void @llvm.memset.p0.i64(ptr align 16 @poly, i8 0, i64 %69, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %98, %60
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = load i32, ptr @deg, align 4, !tbaa !5
  %73 = icmp sle i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %104

75:                                               ; preds = %70
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = and i32 %76, 1
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %82

79:                                               ; preds = %75
  %80 = load i32, ptr %7, align 4, !tbaa !5
  %81 = sub nsw i32 0, %80
  br label %84

82:                                               ; preds = %75
  %83 = load i32, ptr %7, align 4, !tbaa !5
  br label %84

84:                                               ; preds = %82, %79
  %85 = phi i32 [ %81, %79 ], [ %83, %82 ]
  %86 = sext i32 %85 to i64
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %88
  store i64 %86, ptr %89, align 8, !tbaa !11
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = sub nsw i32 %91, %92
  %94 = mul nsw i32 %90, %93
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  %97 = sdiv i32 %94, %96
  store i32 %97, ptr %7, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %84
  %99 = load i32, ptr @lcm, align 4, !tbaa !5
  %100 = load i32, ptr %5, align 4, !tbaa !5
  %101 = add nsw i32 %100, %99
  store i32 %101, ptr %5, align 4, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  store i32 %103, ptr %6, align 4, !tbaa !5
  br label %70, !llvm.loop !13

104:                                              ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %105

105:                                              ; preds = %139, %104
  %106 = load i32, ptr %8, align 4, !tbaa !5
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = icmp slt i32 %106, %107
  br i1 %108, label %110, label %109

109:                                              ; preds = %105
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %142

110:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [5 x i32], ptr @w, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  store i32 %114, ptr %9, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %135, %110
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = load i32, ptr @deg, align 4, !tbaa !5
  %118 = icmp sle i32 %116, %117
  br i1 %118, label %120, label %119

119:                                              ; preds = %115
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %138

120:                                              ; preds = %115
  %121 = load i32, ptr %9, align 4, !tbaa !5
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [5 x i32], ptr @w, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sub nsw i32 %121, %125
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %127
  %129 = load i64, ptr %128, align 8, !tbaa !11
  %130 = load i32, ptr %9, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !11
  %134 = add nsw i64 %133, %129
  store i64 %134, ptr %132, align 8, !tbaa !11
  br label %135

135:                                              ; preds = %120
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = add nsw i32 %136, 1
  store i32 %137, ptr %9, align 4, !tbaa !5
  br label %115, !llvm.loop !14

138:                                              ; preds = %119
  br label %139

139:                                              ; preds = %138
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %8, align 4, !tbaa !5
  br label %105, !llvm.loop !15

142:                                              ; preds = %109
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %143 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %10)
  br label %144

144:                                              ; preds = %221, %219, %142
  %145 = load i32, ptr %10, align 4, !tbaa !5
  %146 = add nsw i32 %145, -1
  store i32 %146, ptr %10, align 4, !tbaa !5
  %147 = icmp ne i32 %145, 0
  br i1 %147, label %148, label %222

148:                                              ; preds = %144
  %149 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef @low)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 -1, ptr %13, align 8, !tbaa !11
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %150

150:                                              ; preds = %175, %148
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = zext i32 %151 to i64
  %153 = shl i64 1, %152
  %154 = sub nsw i64 %153, 1
  store i64 %154, ptr %12, align 8, !tbaa !11
  %155 = load i64, ptr %12, align 8, !tbaa !11
  %156 = call noundef i32 @_Z6chkRemx(i64 noundef %155)
  %157 = sext i32 %156 to i64
  store i64 %157, ptr %13, align 8, !tbaa !11
  %158 = load i64, ptr %13, align 8, !tbaa !11
  %159 = icmp ne i64 %158, -1
  br i1 %159, label %160, label %167

160:                                              ; preds = %150
  %161 = load i64, ptr %12, align 8, !tbaa !11
  %162 = load i32, ptr @lcm, align 4, !tbaa !5
  %163 = sext i32 %162 to i64
  %164 = mul nsw i64 %161, %163
  %165 = load i64, ptr %13, align 8, !tbaa !11
  %166 = add nsw i64 %165, %164
  store i64 %166, ptr %13, align 8, !tbaa !11
  br label %178

167:                                              ; preds = %150
  %168 = load i64, ptr %12, align 8, !tbaa !11
  %169 = load i64, ptr @low, align 8, !tbaa !11
  %170 = mul nsw i64 100, %169
  %171 = icmp sge i64 %168, %170
  br i1 %171, label %172, label %173

172:                                              ; preds = %167
  br label %178

173:                                              ; preds = %167
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %11, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %11, align 4, !tbaa !5
  br label %150, !llvm.loop !16

178:                                              ; preds = %172, %160
  %179 = load i64, ptr %13, align 8, !tbaa !11
  %180 = icmp eq i64 %179, -1
  br i1 %180, label %181, label %183

181:                                              ; preds = %178
  %182 = call i32 @puts(ptr noundef @.str.3)
  store i32 17, ptr %3, align 4
  br label %219, !llvm.loop !17

183:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %184 = load i32, ptr %11, align 4, !tbaa !5
  %185 = sub nsw i32 %184, 2
  store i32 %185, ptr %14, align 4, !tbaa !5
  br label %186

186:                                              ; preds = %213, %183
  %187 = load i32, ptr %14, align 4, !tbaa !5
  %188 = icmp sge i32 %187, 0
  br i1 %188, label %190, label %189

189:                                              ; preds = %186
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %216

190:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %191 = load i64, ptr %12, align 8, !tbaa !11
  %192 = load i32, ptr %14, align 4, !tbaa !5
  %193 = zext i32 %192 to i64
  %194 = shl i64 1, %193
  %195 = xor i64 %191, %194
  %196 = call noundef i32 @_Z6chkRemx(i64 noundef %195)
  store i32 %196, ptr %15, align 4, !tbaa !5
  %197 = load i32, ptr %15, align 4, !tbaa !5
  %198 = icmp ne i32 %197, -1
  br i1 %198, label %199, label %212

199:                                              ; preds = %190
  %200 = load i32, ptr %14, align 4, !tbaa !5
  %201 = zext i32 %200 to i64
  %202 = shl i64 1, %201
  %203 = load i64, ptr %12, align 8, !tbaa !11
  %204 = xor i64 %203, %202
  store i64 %204, ptr %12, align 8, !tbaa !11
  %205 = load i64, ptr %12, align 8, !tbaa !11
  %206 = load i32, ptr @lcm, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = mul nsw i64 %205, %207
  %209 = load i32, ptr %15, align 4, !tbaa !5
  %210 = sext i32 %209 to i64
  %211 = add nsw i64 %208, %210
  store i64 %211, ptr %13, align 8, !tbaa !11
  br label %212

212:                                              ; preds = %199, %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %213

213:                                              ; preds = %212
  %214 = load i32, ptr %14, align 4, !tbaa !5
  %215 = add nsw i32 %214, -1
  store i32 %215, ptr %14, align 4, !tbaa !5
  br label %186, !llvm.loop !18

216:                                              ; preds = %189
  %217 = load i64, ptr %13, align 8, !tbaa !11
  %218 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i64 noundef %217)
  store i32 0, ptr %3, align 4
  br label %219

219:                                              ; preds = %216, %181
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  %220 = load i32, ptr %3, align 4
  switch i32 %220, label %227 [
    i32 0, label %221
    i32 17, label %144
  ]

221:                                              ; preds = %219
  br label %144, !llvm.loop !17

222:                                              ; preds = %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %223

223:                                              ; preds = %222
  %224 = load i32, ptr %2, align 4, !tbaa !5
  %225 = add nsw i32 %224, 1
  store i32 %225, ptr %2, align 4, !tbaa !5
  br label %16, !llvm.loop !19

226:                                              ; preds = %24
  ret i32 0

227:                                              ; preds = %219
  unreachable
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #4

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) #5

declare i32 @puts(ptr noundef) #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

@n = external dso_local global i32, align 4
@lcm = external dso_local local_unnamed_addr global i32, align 4
@w = external dso_local global [5 x i32], align 16
@deg = external dso_local local_unnamed_addr global i32, align 4
@low = external dso_local global i64, align 8
@poly = external dso_local local_unnamed_addr global [12606 x i64], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z6chkRemx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %3 = icmp eq i32 %2, 1
  %4 = load i32, ptr @n, align 4
  %5 = icmp sgt i32 %4, 0
  %6 = select i1 %3, i1 %5, i1 false
  br i1 %6, label %.lr.ph108, label %._crit_edge109

._crit_edge109:                                   ; preds = %._crit_edge105, %0
  ret i32 0

.lr.ph108:                                        ; preds = %0, %._crit_edge105
  %.0106 = phi i32 [ %108, %._crit_edge105 ], [ 1, %0 ]
  %7 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %.0106)
  store i32 1, ptr @lcm, align 4, !tbaa !5
  store i32 0, ptr @deg, align 4, !tbaa !5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph108
  %10 = phi i32 [ 0, %.lr.ph108 ], [ %29, %.lr.ph ]
  %11 = phi i32 [ 1, %.lr.ph108 ], [ %26, %.lr.ph ]
  %.lcssa = phi i32 [ %8, %.lr.ph108 ], [ %30, %.lr.ph ]
  %12 = mul nsw i32 %11, %.lcssa
  %13 = sub nsw i32 %12, %10
  store i32 %13, ptr @deg, align 4, !tbaa !5
  %14 = add nsw i32 %13, 1
  %15 = sext i32 %14 to i64
  %16 = shl nsw i64 %15, 3
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @poly, i8 0, i64 %16, i1 false)
  %.not73 = icmp slt i32 %13, 0
  br i1 %.not73, label %.preheader, label %.lr.ph78.preheader

.lr.ph78.preheader:                               ; preds = %._crit_edge
  %17 = sext i32 %11 to i64
  %18 = zext nneg i32 %13 to i64
  br label %.lr.ph78

.lr.ph:                                           ; preds = %.lr.ph108, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph108 ]
  %19 = getelementptr inbounds i32, ptr @w, i64 %indvars.iv
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %19)
  %21 = load i32, ptr %19, align 4, !tbaa !5
  %22 = load i32, ptr @lcm, align 4, !tbaa !5
  %23 = call noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef %21, i32 noundef %22)
  %24 = sdiv i32 %21, %23
  %25 = load i32, ptr @lcm, align 4, !tbaa !5
  %26 = mul nsw i32 %25, %24
  store i32 %26, ptr @lcm, align 4, !tbaa !5
  %27 = load i32, ptr %19, align 4, !tbaa !5
  %28 = load i32, ptr @deg, align 4, !tbaa !5
  %29 = add nsw i32 %28, %27
  store i32 %29, ptr @deg, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = icmp slt i64 %indvars.iv.next, %31
  br i1 %32, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader:                                       ; preds = %.lr.ph78, %._crit_edge
  %33 = icmp sgt i32 %.lcssa, 0
  br i1 %33, label %.lr.ph85.preheader, label %._crit_edge86

.lr.ph85.preheader:                               ; preds = %.preheader
  %34 = add i32 %12, 1
  %35 = sub i32 %34, %10
  %wide.trip.count = zext nneg i32 %.lcssa to i64
  br label %.lr.ph85

.lr.ph78:                                         ; preds = %.lr.ph78.preheader, %.lr.ph78
  %indvars.iv115 = phi i64 [ 0, %.lr.ph78.preheader ], [ %indvars.iv.next116, %.lr.ph78 ]
  %.05276 = phi i32 [ 1, %.lr.ph78.preheader ], [ %44, %.lr.ph78 ]
  %.05375 = phi i32 [ 0, %.lr.ph78.preheader ], [ %43, %.lr.ph78 ]
  %36 = and i32 %.05375, 1
  %.not65 = icmp eq i32 %36, 0
  %37 = sub nsw i32 0, %.05276
  %38 = select i1 %.not65, i32 %.05276, i32 %37
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %indvars.iv115
  store i64 %39, ptr %40, align 8, !tbaa !11
  %41 = sub nsw i32 %.lcssa, %.05375
  %42 = mul nsw i32 %.05276, %41
  %43 = add nuw nsw i32 %.05375, 1
  %44 = sdiv i32 %42, %43
  %indvars.iv.next116 = add nsw i64 %indvars.iv115, %17
  %.not = icmp sgt i64 %indvars.iv.next116, %18
  br i1 %.not, label %.preheader, label %.lr.ph78, !llvm.loop !13

._crit_edge86:                                    ; preds = %._crit_edge83, %.preheader
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %46 = load i32, ptr %1, align 4, !tbaa !5
  %47 = add nsw i32 %46, -1
  store i32 %47, ptr %1, align 4, !tbaa !5
  %.not60102 = icmp eq i32 %46, 0
  br i1 %.not60102, label %._crit_edge105, label %.lr.ph104

.lr.ph85:                                         ; preds = %.lr.ph85.preheader, %._crit_edge83
  %indvars.iv121 = phi i64 [ 0, %.lr.ph85.preheader ], [ %indvars.iv.next122, %._crit_edge83 ]
  %48 = getelementptr inbounds [5 x i32], ptr @w, i64 0, i64 %indvars.iv121
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %.not6479 = icmp sgt i32 %49, %13
  br i1 %.not6479, label %._crit_edge83, label %.lr.ph82.preheader

.lr.ph82.preheader:                               ; preds = %.lr.ph85
  %50 = sext i32 %49 to i64
  %51 = add i32 %10, %49
  %.neg155 = sub i32 %12, %51
  %52 = zext i32 %.neg155 to i64
  %53 = add nuw nsw i64 %52, 1
  %min.iters.check = icmp ult i32 %.neg155, 5
  br i1 %min.iters.check, label %.lr.ph82.preheader157, label %vector.memcheck

.lr.ph82.preheader157:                            ; preds = %middle.block, %vector.memcheck, %.lr.ph82.preheader
  %indvars.iv118.ph = phi i64 [ %50, %vector.memcheck ], [ %50, %.lr.ph82.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph82

vector.memcheck:                                  ; preds = %.lr.ph82.preheader
  %54 = shl nsw i64 %50, 3
  %scevgep = getelementptr i8, ptr @poly, i64 %54
  %55 = add i32 %10, %49
  %.neg156 = sub i32 %12, %55
  %56 = zext i32 %.neg156 to i64
  %57 = shl nuw nsw i64 %56, 3
  %58 = getelementptr i8, ptr getelementptr inbounds (i8, ptr @poly, i64 8), i64 %54
  %scevgep150 = getelementptr i8, ptr %58, i64 %57
  %scevgep151 = getelementptr i8, ptr getelementptr inbounds (i8, ptr @poly, i64 8), i64 %57
  %bound0 = icmp ult ptr %scevgep, %scevgep151
  %bound1 = icmp ugt ptr %scevgep150, @poly
  %found.conflict = and i1 %bound0, %bound1
  br i1 %found.conflict, label %.lr.ph82.preheader157, label %vector.ph

vector.ph:                                        ; preds = %vector.memcheck
  %n.vec = and i64 %53, 8589934588
  %ind.end = add nsw i64 %n.vec, %50
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %index, %50
  %59 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %index
  %60 = getelementptr inbounds i8, ptr %59, i64 16
  %wide.load = load <2 x i64>, ptr %59, align 16, !tbaa !11, !alias.scope !14
  %wide.load152 = load <2 x i64>, ptr %60, align 16, !tbaa !11, !alias.scope !14
  %61 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %offset.idx
  %62 = getelementptr inbounds i8, ptr %61, i64 16
  %wide.load153 = load <2 x i64>, ptr %61, align 8, !tbaa !11, !alias.scope !17, !noalias !14
  %wide.load154 = load <2 x i64>, ptr %62, align 8, !tbaa !11, !alias.scope !17, !noalias !14
  %63 = add nsw <2 x i64> %wide.load153, %wide.load
  %64 = add nsw <2 x i64> %wide.load154, %wide.load152
  store <2 x i64> %63, ptr %61, align 8, !tbaa !11, !alias.scope !17, !noalias !14
  store <2 x i64> %64, ptr %62, align 8, !tbaa !11, !alias.scope !17, !noalias !14
  %index.next = add nuw i64 %index, 4
  %65 = icmp eq i64 %index.next, %n.vec
  br i1 %65, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %53, %n.vec
  br i1 %cmp.n, label %._crit_edge83, label %.lr.ph82.preheader157

._crit_edge83:                                    ; preds = %.lr.ph82, %middle.block, %.lr.ph85
  %indvars.iv.next122 = add nuw nsw i64 %indvars.iv121, 1
  %exitcond124.not = icmp eq i64 %indvars.iv.next122, %wide.trip.count
  br i1 %exitcond124.not, label %._crit_edge86, label %.lr.ph85, !llvm.loop !22

.lr.ph82:                                         ; preds = %.lr.ph82.preheader157, %.lr.ph82
  %indvars.iv118 = phi i64 [ %indvars.iv.next119, %.lr.ph82 ], [ %indvars.iv118.ph, %.lr.ph82.preheader157 ]
  %66 = sub nsw i64 %indvars.iv118, %50
  %67 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !11
  %69 = getelementptr inbounds [12606 x i64], ptr @poly, i64 0, i64 %indvars.iv118
  %70 = load i64, ptr %69, align 8, !tbaa !11
  %71 = add nsw i64 %70, %68
  store i64 %71, ptr %69, align 8, !tbaa !11
  %indvars.iv.next119 = add nsw i64 %indvars.iv118, 1
  %lftr.wideiv = trunc i64 %indvars.iv.next119 to i32
  %exitcond.not = icmp eq i32 %35, %lftr.wideiv
  br i1 %exitcond.not, label %._crit_edge83, label %.lr.ph82, !llvm.loop !23

.lr.ph104:                                        ; preds = %._crit_edge86, %105
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull @low)
  %73 = call noundef i32 @_Z6chkRemx(i64 noundef 0)
  %.not6187 = icmp eq i32 %73, -1
  br i1 %.not6187, label %.lr.ph90, label %.thread136

.lr.ph90:                                         ; preds = %.lr.ph104, %77
  %indvars.iv125 = phi i64 [ %indvars.iv.next126, %77 ], [ 0, %.lr.ph104 ]
  %74 = phi i64 [ %78, %77 ], [ 0, %.lr.ph104 ]
  %75 = load i64, ptr @low, align 8, !tbaa !11
  %76 = mul nsw i64 %75, 100
  %.not62 = icmp sgt i64 %76, %74
  br i1 %.not62, label %77, label %.thread

77:                                               ; preds = %.lr.ph90
  %indvars.iv.next126 = add nuw nsw i64 %indvars.iv125, 1
  %notmask = shl nsw i64 -2, %indvars.iv125
  %78 = xor i64 %notmask, -1
  %79 = call noundef i32 @_Z6chkRemx(i64 noundef %78)
  %.not61 = icmp eq i32 %79, -1
  br i1 %.not61, label %.lr.ph90, label %._crit_edge91, !llvm.loop !24

._crit_edge91:                                    ; preds = %77
  %80 = sext i32 %79 to i64
  %81 = load i32, ptr @lcm, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = mul nsw i64 %78, %82
  %84 = add nsw i64 %83, %80
  %85 = icmp eq i64 %84, -1
  br i1 %85, label %.thread, label %88

.thread136:                                       ; preds = %.lr.ph104
  %86 = sext i32 %73 to i64
  br label %._crit_edge100

.thread:                                          ; preds = %.lr.ph90, %._crit_edge91
  %87 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %105, !llvm.loop !25

88:                                               ; preds = %._crit_edge91
  %89 = trunc nuw i64 %indvars.iv.next126 to i32
  %90 = icmp sgt i32 %89, 1
  br i1 %90, label %.lr.ph99.preheader, label %._crit_edge100

.lr.ph99.preheader:                               ; preds = %88
  %91 = add nuw i64 %indvars.iv125, 4294967295
  %92 = and i64 %91, 4294967295
  br label %.lr.ph99

._crit_edge100:                                   ; preds = %103, %.thread136, %88
  %.1.lcssa = phi i64 [ %84, %88 ], [ %86, %.thread136 ], [ %.2, %103 ]
  %93 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i64 noundef %.1.lcssa)
  br label %105

.lr.ph99:                                         ; preds = %.lr.ph99.preheader, %103
  %indvars.iv128 = phi i64 [ %92, %.lr.ph99.preheader ], [ %indvars.iv.next129, %103 ]
  %.196 = phi i64 [ %84, %.lr.ph99.preheader ], [ %.2, %103 ]
  %.04795 = phi i64 [ %78, %.lr.ph99.preheader ], [ %.148, %103 ]
  %94 = shl nuw i64 1, %indvars.iv128
  %95 = xor i64 %94, %.04795
  %96 = call noundef i32 @_Z6chkRemx(i64 noundef %95)
  %.not63 = icmp eq i32 %96, -1
  br i1 %.not63, label %103, label %97

97:                                               ; preds = %.lr.ph99
  %98 = load i32, ptr @lcm, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = mul nsw i64 %95, %99
  %101 = sext i32 %96 to i64
  %102 = add nsw i64 %100, %101
  br label %103

103:                                              ; preds = %97, %.lr.ph99
  %.148 = phi i64 [ %95, %97 ], [ %.04795, %.lr.ph99 ]
  %.2 = phi i64 [ %102, %97 ], [ %.196, %.lr.ph99 ]
  %indvars.iv.next129 = add nsw i64 %indvars.iv128, -1
  %104 = icmp sgt i64 %indvars.iv128, 0
  br i1 %104, label %.lr.ph99, label %._crit_edge100, !llvm.loop !26

105:                                              ; preds = %._crit_edge100, %.thread
  %106 = load i32, ptr %1, align 4, !tbaa !5
  %107 = add nsw i32 %106, -1
  store i32 %107, ptr %1, align 4, !tbaa !5
  %.not60 = icmp eq i32 %106, 0
  br i1 %.not60, label %._crit_edge105, label %.lr.ph104

._crit_edge105:                                   ; preds = %105, %._crit_edge86
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %108 = add nuw nsw i32 %.0106, 1
  %109 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %110 = icmp eq i32 %109, 1
  %111 = load i32, ptr @n, align 4
  %112 = icmp sgt i32 %111, 0
  %113 = select i1 %110, i1 %112, i1 false
  br i1 %113, label %.lr.ph108, label %._crit_edge109, !llvm.loop !27
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZSt5__gcdIiET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = !{!15}
!15 = distinct !{!15, !16}
!16 = distinct !{!16, !"LVerDomain"}
!17 = !{!18}
!18 = distinct !{!18, !16}
!19 = distinct !{!19, !10, !20, !21}
!20 = !{!"llvm.loop.isvectorized", i32 1}
!21 = !{!"llvm.loop.unroll.runtime.disable"}
!22 = distinct !{!22, !10}
!23 = distinct !{!23, !10, !20}
!24 = distinct !{!24, !10}
!25 = distinct !{!25, !10}
!26 = distinct !{!26, !10}
!27 = distinct !{!27, !10}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass