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

; 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 [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 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 double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  br label %8

8:                                                ; preds = %77, %0
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  %10 = icmp ne i32 %9, -1
  br i1 %10, label %11, label %78

11:                                               ; preds = %8
  store double 0.000000e+00, ptr %7, align 8, !tbaa !5
  store double 0.000000e+00, ptr %4, align 8, !tbaa !5
  store i32 0, ptr %3, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %64, %11
  %13 = load i32, ptr %3, align 4, !tbaa !9
  %14 = load i32, ptr %2, align 4, !tbaa !9
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %16, label %67

16:                                               ; preds = %12
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5, ptr noundef %6)
  %18 = load double, ptr %6, align 8, !tbaa !5
  %19 = fcmp oeq double %18, -1.000000e+00
  br i1 %19, label %20, label %21

20:                                               ; preds = %16
  store double 0.000000e+00, ptr %5, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %20, %16
  %22 = load double, ptr %6, align 8, !tbaa !5
  %23 = fcmp olt double %22, 6.000000e+01
  br i1 %23, label %24, label %28

24:                                               ; preds = %21
  %25 = load double, ptr %6, align 8, !tbaa !5
  %26 = fcmp oge double %25, 0.000000e+00
  br i1 %26, label %27, label %28

27:                                               ; preds = %24
  store double 0.000000e+00, ptr %6, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %27, %24, %21
  %29 = load double, ptr %6, align 8, !tbaa !5
  %30 = fcmp oge double %29, 6.000000e+01
  br i1 %30, label %31, label %35

31:                                               ; preds = %28
  %32 = load double, ptr %6, align 8, !tbaa !5
  %33 = fcmp olt double %32, 7.000000e+01
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  store double 1.000000e+00, ptr %6, align 8, !tbaa !5
  br label %35

35:                                               ; preds = %34, %31, %28
  %36 = load double, ptr %6, align 8, !tbaa !5
  %37 = fcmp oge double %36, 7.000000e+01
  br i1 %37, label %38, label %42

38:                                               ; preds = %35
  %39 = load double, ptr %6, align 8, !tbaa !5
  %40 = fcmp olt double %39, 8.000000e+01
  br i1 %40, label %41, label %42

41:                                               ; preds = %38
  store double 2.000000e+00, ptr %6, align 8, !tbaa !5
  br label %42

42:                                               ; preds = %41, %38, %35
  %43 = load double, ptr %6, align 8, !tbaa !5
  %44 = fcmp oge double %43, 8.000000e+01
  br i1 %44, label %45, label %49

45:                                               ; preds = %42
  %46 = load double, ptr %6, align 8, !tbaa !5
  %47 = fcmp olt double %46, 9.000000e+01
  br i1 %47, label %48, label %49

48:                                               ; preds = %45
  store double 3.000000e+00, ptr %6, align 8, !tbaa !5
  br label %49

49:                                               ; preds = %48, %45, %42
  %50 = load double, ptr %6, align 8, !tbaa !5
  %51 = fcmp oge double %50, 9.000000e+01
  br i1 %51, label %52, label %56

52:                                               ; preds = %49
  %53 = load double, ptr %6, align 8, !tbaa !5
  %54 = fcmp ole double %53, 1.000000e+02
  br i1 %54, label %55, label %56

55:                                               ; preds = %52
  store double 4.000000e+00, ptr %6, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %55, %52, %49
  %57 = load double, ptr %5, align 8, !tbaa !5
  %58 = load double, ptr %4, align 8, !tbaa !5
  %59 = fadd double %58, %57
  store double %59, ptr %4, align 8, !tbaa !5
  %60 = load double, ptr %5, align 8, !tbaa !5
  %61 = load double, ptr %6, align 8, !tbaa !5
  %62 = load double, ptr %7, align 8, !tbaa !5
  %63 = call double @llvm.fmuladd.f64(double %60, double %61, double %62)
  store double %63, ptr %7, align 8, !tbaa !5
  br label %64

64:                                               ; preds = %56
  %65 = load i32, ptr %3, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %3, align 4, !tbaa !9
  br label %12, !llvm.loop !11

67:                                               ; preds = %12
  %68 = load double, ptr %4, align 8, !tbaa !5
  %69 = fcmp oeq double %68, 0.000000e+00
  br i1 %69, label %70, label %72

70:                                               ; preds = %67
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %77

72:                                               ; preds = %67
  %73 = load double, ptr %7, align 8, !tbaa !5
  %74 = load double, ptr %4, align 8, !tbaa !5
  %75 = fdiv double %73, %74
  %76 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %75)
  br label %77

77:                                               ; preds = %72, %70
  br label %8, !llvm.loop !13

78:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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}


; 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 [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #4
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %.not21 = icmp eq i32 %4, -1
  br i1 %.not21, label %._crit_edge22, label %.preheader

.preheader:                                       ; preds = %0, %42
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge.thread

.lr.ph:                                           ; preds = %.preheader, %.thread33
  %.019 = phi double [ %33, %.thread33 ], [ 0.000000e+00, %.preheader ]
  %.01518 = phi double [ %32, %.thread33 ], [ 0.000000e+00, %.preheader ]
  %.01617 = phi i32 [ %34, %.thread33 ], [ 0, %.preheader ]
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %8 = load double, ptr %3, align 8
  %9 = fcmp oeq double %8, -1.000000e+00
  br i1 %9, label %10, label %11

10:                                               ; preds = %.lr.ph
  store double 0.000000e+00, ptr %2, align 8, !tbaa !9
  br label %11

11:                                               ; preds = %10, %.lr.ph
  %12 = fcmp olt double %8, 6.000000e+01
  %13 = fcmp oge double %8, 0.000000e+00
  %or.cond = and i1 %12, %13
  br i1 %or.cond, label %.thread, label %14

.thread:                                          ; preds = %11
  store double 0.000000e+00, ptr %3, align 8, !tbaa !9
  br label %.thread33

14:                                               ; preds = %11
  %15 = fcmp oge double %8, 6.000000e+01
  %16 = fcmp olt double %8, 7.000000e+01
  %or.cond3 = and i1 %15, %16
  br i1 %or.cond3, label %17, label %18

17:                                               ; preds = %14
  store double 1.000000e+00, ptr %3, align 8, !tbaa !9
  br label %.thread33

18:                                               ; preds = %14
  %19 = fcmp oge double %8, 7.000000e+01
  %20 = fcmp olt double %8, 8.000000e+01
  %or.cond5 = and i1 %19, %20
  br i1 %or.cond5, label %21, label %22

21:                                               ; preds = %18
  store double 2.000000e+00, ptr %3, align 8, !tbaa !9
  br label %.thread33

22:                                               ; preds = %18
  %23 = fcmp oge double %8, 8.000000e+01
  %24 = fcmp olt double %8, 9.000000e+01
  %or.cond7 = and i1 %23, %24
  br i1 %or.cond7, label %25, label %26

25:                                               ; preds = %22
  store double 3.000000e+00, ptr %3, align 8, !tbaa !9
  br label %.thread33

26:                                               ; preds = %22
  %27 = fcmp oge double %8, 9.000000e+01
  %28 = fcmp ole double %8, 1.000000e+02
  %or.cond9 = and i1 %27, %28
  br i1 %or.cond9, label %29, label %.thread33

29:                                               ; preds = %26
  store double 4.000000e+00, ptr %3, align 8, !tbaa !9
  br label %.thread33

.thread33:                                        ; preds = %.thread, %17, %21, %25, %29, %26
  %30 = phi double [ 4.000000e+00, %29 ], [ %8, %26 ], [ 3.000000e+00, %25 ], [ 2.000000e+00, %21 ], [ 0.000000e+00, %.thread ], [ 1.000000e+00, %17 ]
  %31 = load double, ptr %2, align 8, !tbaa !9
  %32 = fadd double %.01518, %31
  %33 = call double @llvm.fmuladd.f64(double %31, double %30, double %.019)
  %34 = add nuw nsw i32 %.01617, 1
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge:                                      ; preds = %.thread33
  %37 = fcmp oeq double %32, 0.000000e+00
  br i1 %37, label %._crit_edge.thread, label %39

._crit_edge.thread:                               ; preds = %.preheader, %._crit_edge
  %38 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %42

39:                                               ; preds = %._crit_edge
  %40 = fdiv double %33, %32
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %40)
  br label %42

42:                                               ; preds = %39, %._crit_edge.thread
  %43 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %.not = icmp eq i32 %43, -1
  br i1 %.not, label %._crit_edge22, label %.preheader, !llvm.loop !13

._crit_edge22:                                    ; preds = %42, %0
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  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: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #3

; 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #4 = { 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 = !{!"double", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass