; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (2048)

; 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"

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [20 x double], align 16
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr %5) #3
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  %7 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 1
  store double 0.000000e+00, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 2
  store double 1.000000e+00, ptr %8, align 16, !tbaa !5
  store i32 3, ptr %2, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %31, %0
  %10 = load i32, ptr %2, align 4, !tbaa !9
  %11 = icmp sle i32 %10, 20
  br i1 %11, label %12, label %34

12:                                               ; preds = %9
  %13 = load i32, ptr %2, align 4, !tbaa !9
  %14 = sub nsw i32 %13, 1
  %15 = sitofp i32 %14 to double
  %16 = load i32, ptr %2, align 4, !tbaa !9
  %17 = sub nsw i32 %16, 1
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 %18
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !9
  %22 = sub nsw i32 %21, 2
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 %23
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = fadd double %20, %25
  %27 = fmul double %15, %26
  %28 = load i32, ptr %2, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 %29
  store double %27, ptr %30, align 8, !tbaa !5
  br label %31

31:                                               ; preds = %12
  %32 = load i32, ptr %2, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %2, align 4, !tbaa !9
  br label %9, !llvm.loop !11

34:                                               ; preds = %9
  br label %35

35:                                               ; preds = %56, %34
  %36 = load i32, ptr %3, align 4, !tbaa !9
  %37 = add nsw i32 %36, -1
  store i32 %37, ptr %3, align 4, !tbaa !9
  %38 = icmp ne i32 %36, 0
  br i1 %38, label %39, label %63

39:                                               ; preds = %35
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4)
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %41

41:                                               ; preds = %53, %39
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = icmp sle i32 %42, %43
  br i1 %44, label %45, label %56

45:                                               ; preds = %41
  %46 = load i32, ptr %2, align 4, !tbaa !9
  %47 = sitofp i32 %46 to double
  %48 = load i32, ptr %4, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 %49
  %51 = load double, ptr %50, align 8, !tbaa !5
  %52 = fdiv double %51, %47
  store double %52, ptr %50, align 8, !tbaa !5
  br label %53

53:                                               ; preds = %45
  %54 = load i32, ptr %2, align 4, !tbaa !9
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %2, align 4, !tbaa !9
  br label %41, !llvm.loop !13

56:                                               ; preds = %41
  %57 = load i32, ptr %4, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [20 x double], ptr %5, i64 0, i64 %58
  %60 = load double, ptr %59, align 8, !tbaa !5
  %61 = fmul double %60, 1.000000e+02
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %61, i32 noundef 37)
  br label %35, !llvm.loop !14

63:                                               ; preds = %35
  call void @llvm.lifetime.end.p0(i64 160, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  ret i32 0
}

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

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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"

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader:
  %0 = alloca i32, align 4
  %1 = alloca i32, align 4
  %2 = alloca [20 x double], align 16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %0) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 160, ptr nonnull %2) #3
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0)
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  store <2 x double> <double 0.000000e+00, double 1.000000e+00>, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %2, i64 24
  store <2 x double> <double 2.000000e+00, double 9.000000e+00>, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %2, i64 40
  store <2 x double> <double 4.400000e+01, double 2.650000e+02>, ptr %6, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %2, i64 56
  store <2 x double> <double 1.854000e+03, double 1.483300e+04>, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %2, i64 72
  store <2 x double> <double 1.334960e+05, double 0x41345EB100000000>, ptr %8, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %2, i64 88
  store <2 x double> <double 0x416C023340000000, double 0x41A501A672000000>, ptr %9, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %2, i64 104
  store <2 x double> <double 0x41E111573C800000, double 0x421DDE58A9E40000>, ptr %10, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %2, i64 120
  store <2 x double> <double 0x425C00731F458000, double 0x429C00731F458400>, ptr %11, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %2, i64 136
  store <2 x double> <double 0x42DDC07A5139DC00, double 0x4320BC44CDB08BC2>, ptr %12, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %2, i64 152
  store <2 x double> <double 0x4363DF91B441A5F6, double 0x43A8D77621520F73>, ptr %13, align 8, !tbaa !5
  %14 = load i32, ptr %0, align 4, !tbaa !9
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %0, align 4, !tbaa !9
  %.not16 = icmp eq i32 %14, 0
  br i1 %.not16, label %._crit_edge18, label %.lr.ph17

.lr.ph17:                                         ; preds = %.preheader, %51
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %17 = load i32, ptr %1, align 4, !tbaa !9
  %.not1113 = icmp slt i32 %17, 1
  br i1 %.not1113, label %.lr.ph17._crit_edge, label %.lr.ph

.lr.ph17._crit_edge:                              ; preds = %.lr.ph17
  %.phi.trans.insert = sext i32 %17 to i64
  %.phi.trans.insert20 = getelementptr inbounds [20 x double], ptr %2, i64 0, i64 %.phi.trans.insert
  %.pre = load double, ptr %.phi.trans.insert20, align 8, !tbaa !5
  br label %51

.lr.ph:                                           ; preds = %.lr.ph17
  %18 = zext nneg i32 %17 to i64
  %19 = getelementptr inbounds [20 x double], ptr %2, i64 0, i64 %18
  %.promoted = load double, ptr %19, align 8, !tbaa !5
  %xtraiter = and i32 %17, 7
  %20 = icmp ult i32 %17, 8
  br i1 %20, label %._crit_edge.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i32 %17, 2147483640
  br label %21

21:                                               ; preds = %21, %.lr.ph.new
  %22 = phi double [ %.promoted, %.lr.ph.new ], [ %45, %21 ]
  %.114 = phi i32 [ 1, %.lr.ph.new ], [ %46, %21 ]
  %niter = phi i32 [ 0, %.lr.ph.new ], [ %niter.next.7, %21 ]
  %23 = uitofp nneg i32 %.114 to double
  %24 = fdiv double %22, %23
  %25 = add nuw nsw i32 %.114, 1
  %26 = uitofp nneg i32 %25 to double
  %27 = fdiv double %24, %26
  %28 = add nuw nsw i32 %.114, 2
  %29 = uitofp nneg i32 %28 to double
  %30 = fdiv double %27, %29
  %31 = add nuw nsw i32 %.114, 3
  %32 = uitofp nneg i32 %31 to double
  %33 = fdiv double %30, %32
  %34 = add nuw nsw i32 %.114, 4
  %35 = uitofp nneg i32 %34 to double
  %36 = fdiv double %33, %35
  %37 = add nuw nsw i32 %.114, 5
  %38 = uitofp nneg i32 %37 to double
  %39 = fdiv double %36, %38
  %40 = add nuw nsw i32 %.114, 6
  %41 = uitofp nneg i32 %40 to double
  %42 = fdiv double %39, %41
  %43 = add nuw i32 %.114, 7
  %44 = uitofp nneg i32 %43 to double
  %45 = fdiv double %42, %44
  %46 = add nuw i32 %.114, 8
  %niter.next.7 = add i32 %niter, 8
  %niter.ncmp.7 = icmp eq i32 %niter.next.7, %unroll_iter
  br i1 %niter.ncmp.7, label %._crit_edge.unr-lcssa, label %21, !llvm.loop !11

._crit_edge.unr-lcssa:                            ; preds = %21, %.lr.ph
  %.lcssa.ph = phi double [ poison, %.lr.ph ], [ %45, %21 ]
  %.unr = phi double [ %.promoted, %.lr.ph ], [ %45, %21 ]
  %.114.unr = phi i32 [ 1, %.lr.ph ], [ %46, %21 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.unr-lcssa, %.epil.preheader
  %47 = phi double [ %49, %.epil.preheader ], [ %.unr, %._crit_edge.unr-lcssa ]
  %.114.epil = phi i32 [ %50, %.epil.preheader ], [ %.114.unr, %._crit_edge.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.epil.preheader ], [ 0, %._crit_edge.unr-lcssa ]
  %48 = uitofp nneg i32 %.114.epil to double
  %49 = fdiv double %47, %48
  %50 = add nuw i32 %.114.epil, 1
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge, label %.epil.preheader, !llvm.loop !13

._crit_edge:                                      ; preds = %.epil.preheader, %._crit_edge.unr-lcssa
  %.lcssa = phi double [ %.lcssa.ph, %._crit_edge.unr-lcssa ], [ %49, %.epil.preheader ]
  store double %.lcssa, ptr %19, align 8, !tbaa !5
  br label %51

51:                                               ; preds = %.lr.ph17._crit_edge, %._crit_edge
  %52 = phi double [ %.pre, %.lr.ph17._crit_edge ], [ %.lcssa, %._crit_edge ]
  %53 = fmul double %52, 1.000000e+02
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %53, i32 noundef 37)
  %55 = load i32, ptr %0, align 4, !tbaa !9
  %56 = add nsw i32 %55, -1
  store i32 %56, ptr %0, align 4, !tbaa !9
  %.not = icmp eq i32 %55, 0
  br i1 %.not, label %._crit_edge18, label %.lr.ph17, !llvm.loop !15

._crit_edge18:                                    ; preds = %51, %.preheader
  call void @llvm.lifetime.end.p0(i64 160, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %0) #3
  ret i32 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: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

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

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

attributes #0 = { mustprogress nofree 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = distinct !{!15, !12}


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