; LLVM IR from tangjz/acm-icpc :: codeforces/complete (498B)

; 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
@tm = external dso_local global i32, align 4
@t = external dso_local global [5010 x i32], align 16
@p = external dso_local global [5010 x x86_fp80], align 16
@f = external dso_local global [2 x [5010 x x86_fp80]], align 16
@g = external dso_local global [5010 x x86_fp80], align 16
@ans = external dso_local global x86_fp80, align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z3powei(x86_fp80 noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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 x86_fp80, align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @tm)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  br label %11

11:                                               ; preds = %28, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %31

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %19)
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sitofp i32 %21 to double
  %23 = fdiv double %22, 1.000000e+02
  %24 = fpext double %23 to x86_fp80
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %26
  store x86_fp80 %24, ptr %27, align 16, !tbaa !9
  br label %28

28:                                               ; preds = %16
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !11

31:                                               ; preds = %15
  %32 = load i32, ptr @n, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %33
  store x86_fp80 0xK00000000000000000000, ptr %34, align 16, !tbaa !9
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %36
  store i32 5000, ptr %37, align 4, !tbaa !5
  store x86_fp80 0xK3FFF8000000000000000, ptr @f, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %192, %31
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %195

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = and i32 %44, 1
  store i32 %45, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %47
  %49 = load x86_fp80, ptr %48, align 16, !tbaa !9
  %50 = fsub x86_fp80 0xK3FFF8000000000000000, %49
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call noundef x86_fp80 @_Z3powei(x86_fp80 noundef %50, i32 noundef %54)
  store x86_fp80 %55, ptr %7, align 16, !tbaa !9
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = xor i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %58
  %60 = getelementptr inbounds [5010 x x86_fp80], ptr %59, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 16 %60, i8 0, i64 80160, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %77, %43
  %62 = load i32, ptr %8, align 4, !tbaa !5
  %63 = load i32, ptr @tm, align 4, !tbaa !5
  %64 = icmp sle i32 %62, %63
  br i1 %64, label %66, label %65

65:                                               ; preds = %61
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %80

66:                                               ; preds = %61
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %68
  %70 = load i32, ptr %8, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [5010 x x86_fp80], ptr %69, i64 0, i64 %71
  %73 = load x86_fp80, ptr %72, align 16, !tbaa !9
  %74 = load i32, ptr %8, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %75
  store x86_fp80 %73, ptr %76, align 16, !tbaa !9
  br label %77

77:                                               ; preds = %66
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %8, align 4, !tbaa !5
  br label %61, !llvm.loop !13

80:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %177, %80
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = load i32, ptr @tm, align 4, !tbaa !5
  %84 = icmp sle i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %180

86:                                               ; preds = %81
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %88
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [5010 x x86_fp80], ptr %89, i64 0, i64 %91
  %93 = load x86_fp80, ptr %92, align 16, !tbaa !9
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %95
  %97 = load x86_fp80, ptr %96, align 16, !tbaa !9
  %98 = fsub x86_fp80 0xK3FFF8000000000000000, %97
  %99 = load i32, ptr %6, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %100
  %102 = load i32, ptr %9, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [5010 x x86_fp80], ptr %101, i64 0, i64 %104
  %106 = load x86_fp80, ptr %105, align 16, !tbaa !9
  %107 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %93, x86_fp80 %98, x86_fp80 %106)
  store x86_fp80 %107, ptr %105, align 16, !tbaa !9
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %109
  %111 = load i32, ptr %9, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [5010 x x86_fp80], ptr %110, i64 0, i64 %112
  %114 = load x86_fp80, ptr %113, align 16, !tbaa !9
  %115 = load i32, ptr %4, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %116
  %118 = load x86_fp80, ptr %117, align 16, !tbaa !9
  %119 = load i32, ptr %6, align 4, !tbaa !5
  %120 = xor i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %121
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [5010 x x86_fp80], ptr %122, i64 0, i64 %125
  %127 = load x86_fp80, ptr %126, align 16, !tbaa !9
  %128 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %114, x86_fp80 %118, x86_fp80 %127)
  store x86_fp80 %128, ptr %126, align 16, !tbaa !9
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = load i32, ptr %4, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %131
  %133 = load i32, ptr %132, align 4, !tbaa !5
  %134 = add nsw i32 %129, %133
  %135 = load i32, ptr @tm, align 4, !tbaa !5
  %136 = icmp sle i32 %134, %135
  br i1 %136, label %137, label %176

137:                                              ; preds = %86
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %139
  %141 = load x86_fp80, ptr %140, align 16, !tbaa !9
  %142 = load x86_fp80, ptr %7, align 16, !tbaa !9
  %143 = load i32, ptr %6, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %144
  %146 = load i32, ptr %9, align 4, !tbaa !5
  %147 = load i32, ptr %4, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = add nsw i32 %146, %150
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [5010 x x86_fp80], ptr %145, i64 0, i64 %152
  %154 = load x86_fp80, ptr %153, align 16, !tbaa !9
  %155 = fneg x86_fp80 %141
  %156 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %155, x86_fp80 %142, x86_fp80 %154)
  store x86_fp80 %156, ptr %153, align 16, !tbaa !9
  %157 = load i32, ptr %9, align 4, !tbaa !5
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %158
  %160 = load x86_fp80, ptr %159, align 16, !tbaa !9
  %161 = load x86_fp80, ptr %7, align 16, !tbaa !9
  %162 = load i32, ptr %6, align 4, !tbaa !5
  %163 = xor i32 %162, 1
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %164
  %166 = load i32, ptr %9, align 4, !tbaa !5
  %167 = load i32, ptr %4, align 4, !tbaa !5
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %168
  %170 = load i32, ptr %169, align 4, !tbaa !5
  %171 = add nsw i32 %166, %170
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [5010 x x86_fp80], ptr %165, i64 0, i64 %172
  %174 = load x86_fp80, ptr %173, align 16, !tbaa !9
  %175 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %160, x86_fp80 %161, x86_fp80 %174)
  store x86_fp80 %175, ptr %173, align 16, !tbaa !9
  br label %176

176:                                              ; preds = %137, %86
  br label %177

177:                                              ; preds = %176
  %178 = load i32, ptr %9, align 4, !tbaa !5
  %179 = add nsw i32 %178, 1
  store i32 %179, ptr %9, align 4, !tbaa !5
  br label %81, !llvm.loop !14

180:                                              ; preds = %85
  %181 = load i32, ptr %4, align 4, !tbaa !5
  %182 = sitofp i32 %181 to x86_fp80
  %183 = load i32, ptr %6, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %184
  %186 = load i32, ptr @tm, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [5010 x x86_fp80], ptr %185, i64 0, i64 %187
  %189 = load x86_fp80, ptr %188, align 16, !tbaa !9
  %190 = load x86_fp80, ptr @ans, align 16, !tbaa !9
  %191 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %182, x86_fp80 %189, x86_fp80 %190)
  store x86_fp80 %191, ptr @ans, align 16, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %192

192:                                              ; preds = %180
  %193 = load i32, ptr %4, align 4, !tbaa !5
  %194 = add nsw i32 %193, 1
  store i32 %194, ptr %4, align 4, !tbaa !5
  br label %38, !llvm.loop !15

195:                                              ; preds = %42
  %196 = load x86_fp80, ptr @ans, align 16, !tbaa !9
  %197 = fptrunc x86_fp80 %196 to double
  %198 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %197)
  ret i32 0
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #5

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"long double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}


; 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
@tm = external dso_local global i32, align 4
@t = external dso_local global [5010 x i32], align 16
@p = external dso_local local_unnamed_addr global [5010 x x86_fp80], align 16
@f = external dso_local local_unnamed_addr global [2 x [5010 x x86_fp80]], align 16
@g = external dso_local local_unnamed_addr global [5010 x x86_fp80], align 16
@ans = external dso_local local_unnamed_addr global x86_fp80, align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef x86_fp80 @_Z3powei(x86_fp80 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @tm)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre76 = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre76, %.._crit_edge_crit_edge ], [ %16, %.lr.ph ]
  %5 = phi i32 [ %3, %.._crit_edge_crit_edge ], [ %15, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %6 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %.pre-phi
  store x86_fp80 0xK00000000000000000000, ptr %6, align 16, !tbaa !9
  %7 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %.pre-phi
  store i32 5000, ptr %7, align 4, !tbaa !5
  store x86_fp80 0xK3FFF8000000000000000, ptr @f, align 16, !tbaa !9
  %.not59 = icmp slt i32 %5, 0
  br i1 %.not59, label %._crit_edge.._crit_edge63_crit_edge, label %.lr.ph62

._crit_edge.._crit_edge63_crit_edge:              ; preds = %._crit_edge
  %.pre = load x86_fp80, ptr @ans, align 16, !tbaa !9
  br label %._crit_edge63

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %8 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %indvars.iv
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %8)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = sitofp i32 %10 to double
  %12 = fdiv double %11, 1.000000e+02
  %13 = fpext double %12 to x86_fp80
  %14 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %indvars.iv
  store x86_fp80 %13, ptr %14, align 16, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge63:                                    ; preds = %._crit_edge58, %._crit_edge.._crit_edge63_crit_edge
  %18 = phi x86_fp80 [ %.pre, %._crit_edge.._crit_edge63_crit_edge ], [ %62, %._crit_edge58 ]
  %19 = fptrunc x86_fp80 %18 to double
  %20 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %19)
  ret i32 0

.lr.ph62:                                         ; preds = %._crit_edge, %._crit_edge58
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %._crit_edge58 ], [ 0, %._crit_edge ]
  %21 = trunc nuw nsw i64 %indvars.iv73 to i32
  %22 = and i64 %indvars.iv73, 1
  %23 = getelementptr inbounds [5010 x x86_fp80], ptr @p, i64 0, i64 %indvars.iv73
  %24 = load x86_fp80, ptr %23, align 16, !tbaa !9
  %25 = fsub x86_fp80 0xK3FFF8000000000000000, %24
  %26 = getelementptr inbounds [5010 x i32], ptr @t, i64 0, i64 %indvars.iv73
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = call noundef x86_fp80 @_Z3powei(x86_fp80 noundef %25, i32 noundef %27)
  %29 = xor i64 %22, 1
  %30 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %29
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(80160) %30, i8 0, i64 80160, i1 false)
  %31 = load i32, ptr @tm, align 4, !tbaa !5
  %.not4550 = icmp slt i32 %31, 0
  br i1 %.not4550, label %.preheader.._crit_edge58_crit_edge, label %.lr.ph53

.lr.ph53:                                         ; preds = %.lr.ph62
  %32 = and i64 %indvars.iv73, 1
  %33 = add nuw i32 %31, 1
  %wide.trip.count = zext i32 %33 to i64
  %xtraiter = and i64 %wide.trip.count, 3
  %34 = icmp ult i32 %31, 3
  br i1 %34, label %.preheader.unr-lcssa, label %.lr.ph53.new

.lr.ph53.new:                                     ; preds = %.lr.ph53
  %unroll_iter = and i64 %wide.trip.count, 4294967292
  br label %45

.preheader.unr-lcssa:                             ; preds = %45, %.lr.ph53
  %indvars.iv65.unr = phi i64 [ 0, %.lr.ph53 ], [ %indvars.iv.next66.3, %45 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.epil.preheader

.epil.preheader:                                  ; preds = %.preheader.unr-lcssa, %.epil.preheader
  %indvars.iv65.epil = phi i64 [ %indvars.iv.next66.epil, %.epil.preheader ], [ %indvars.iv65.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.epil.preheader ], [ 0, %.preheader.unr-lcssa ]
  %35 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %32, i64 %indvars.iv65.epil
  %36 = load x86_fp80, ptr %35, align 16, !tbaa !9
  %37 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %indvars.iv65.epil
  store x86_fp80 %36, ptr %37, align 16, !tbaa !9
  %indvars.iv.next66.epil = add nuw nsw i64 %indvars.iv65.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.epil.preheader, !llvm.loop !13

.preheader:                                       ; preds = %.epil.preheader, %.preheader.unr-lcssa
  br i1 %.not4550, label %.preheader.._crit_edge58_crit_edge, label %.lr.ph57

.preheader.._crit_edge58_crit_edge:               ; preds = %.lr.ph62, %.preheader
  %.pre77 = and i64 %indvars.iv73, 1
  %.pre79 = sext i32 %31 to i64
  br label %._crit_edge58

.lr.ph57:                                         ; preds = %.preheader
  %38 = and i64 %indvars.iv73, 1
  %39 = load x86_fp80, ptr %23, align 16, !tbaa !9
  %40 = fsub x86_fp80 0xK3FFF8000000000000000, %39
  %41 = load i32, ptr %26, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = zext nneg i32 %31 to i64
  %44 = add nuw i32 %31, 1
  %wide.trip.count71 = zext i32 %44 to i64
  br label %65

45:                                               ; preds = %45, %.lr.ph53.new
  %indvars.iv65 = phi i64 [ 0, %.lr.ph53.new ], [ %indvars.iv.next66.3, %45 ]
  %niter = phi i64 [ 0, %.lr.ph53.new ], [ %niter.next.3, %45 ]
  %46 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %32, i64 %indvars.iv65
  %47 = load x86_fp80, ptr %46, align 16, !tbaa !9
  %48 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %indvars.iv65
  store x86_fp80 %47, ptr %48, align 16, !tbaa !9
  %indvars.iv.next66 = or disjoint i64 %indvars.iv65, 1
  %49 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %32, i64 %indvars.iv.next66
  %50 = load x86_fp80, ptr %49, align 16, !tbaa !9
  %51 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %indvars.iv.next66
  store x86_fp80 %50, ptr %51, align 16, !tbaa !9
  %indvars.iv.next66.1 = or disjoint i64 %indvars.iv65, 2
  %52 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %32, i64 %indvars.iv.next66.1
  %53 = load x86_fp80, ptr %52, align 16, !tbaa !9
  %54 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %indvars.iv.next66.1
  store x86_fp80 %53, ptr %54, align 16, !tbaa !9
  %indvars.iv.next66.2 = or disjoint i64 %indvars.iv65, 3
  %55 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %32, i64 %indvars.iv.next66.2
  %56 = load x86_fp80, ptr %55, align 16, !tbaa !9
  %57 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %indvars.iv.next66.2
  store x86_fp80 %56, ptr %57, align 16, !tbaa !9
  %indvars.iv.next66.3 = add nuw nsw i64 %indvars.iv65, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.unr-lcssa, label %45, !llvm.loop !15

._crit_edge58:                                    ; preds = %85, %.preheader.._crit_edge58_crit_edge
  %.pre-phi80 = phi i64 [ %.pre79, %.preheader.._crit_edge58_crit_edge ], [ %43, %85 ]
  %.pre-phi78 = phi i64 [ %.pre77, %.preheader.._crit_edge58_crit_edge ], [ %38, %85 ]
  %58 = uitofp nneg i32 %21 to x86_fp80
  %59 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %.pre-phi78, i64 %.pre-phi80
  %60 = load x86_fp80, ptr %59, align 16, !tbaa !9
  %61 = load x86_fp80, ptr @ans, align 16, !tbaa !9
  %62 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %58, x86_fp80 %60, x86_fp80 %61)
  store x86_fp80 %62, ptr @ans, align 16, !tbaa !9
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %.not.not = icmp slt i64 %indvars.iv73, %64
  br i1 %.not.not, label %.lr.ph62, label %._crit_edge63, !llvm.loop !16

65:                                               ; preds = %.lr.ph57, %85
  %indvars.iv68 = phi i64 [ 0, %.lr.ph57 ], [ %indvars.iv.next69, %85 ]
  %66 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %38, i64 %indvars.iv68
  %67 = load x86_fp80, ptr %66, align 16, !tbaa !9
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %68 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %38, i64 %indvars.iv.next69
  %69 = load x86_fp80, ptr %68, align 16, !tbaa !9
  %70 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %67, x86_fp80 %40, x86_fp80 %69)
  store x86_fp80 %70, ptr %68, align 16, !tbaa !9
  %71 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %29, i64 %indvars.iv.next69
  %72 = load x86_fp80, ptr %71, align 16, !tbaa !9
  %73 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %67, x86_fp80 %39, x86_fp80 %72)
  store x86_fp80 %73, ptr %71, align 16, !tbaa !9
  %74 = add nsw i64 %indvars.iv68, %42
  %.not47 = icmp sgt i64 %74, %43
  br i1 %.not47, label %85, label %75

75:                                               ; preds = %65
  %76 = getelementptr inbounds [5010 x x86_fp80], ptr @g, i64 0, i64 %indvars.iv68
  %77 = load x86_fp80, ptr %76, align 16, !tbaa !9
  %78 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %38, i64 %74
  %79 = load x86_fp80, ptr %78, align 16, !tbaa !9
  %80 = fneg x86_fp80 %77
  %81 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %80, x86_fp80 %28, x86_fp80 %79)
  store x86_fp80 %81, ptr %78, align 16, !tbaa !9
  %82 = getelementptr inbounds [2 x [5010 x x86_fp80]], ptr @f, i64 0, i64 %29, i64 %74
  %83 = load x86_fp80, ptr %82, align 16, !tbaa !9
  %84 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %77, x86_fp80 %28, x86_fp80 %83)
  store x86_fp80 %84, ptr %82, align 16, !tbaa !9
  br label %85

85:                                               ; preds = %65, %75
  %exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
  br i1 %exitcond72.not, label %._crit_edge58, label %65, !llvm.loop !17
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #5

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress norecurse 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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 = !{!10, !10, i64 0}
!10 = !{!"long double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass