; LLVM IR from tangjz/acm-icpc :: lydsy (2969)

; 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 [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 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 x86_fp80, align 16
  %6 = alloca x86_fp80, align 16
  %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 x86_fp80, align 16
  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 4, ptr %4) #4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %4, ptr noundef %2, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  store x86_fp80 0xK00000000000000000000, ptr %5, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  %14 = load i32, ptr %2, align 4, !tbaa !9
  %15 = load i32, ptr %2, align 4, !tbaa !9
  %16 = mul nsw i32 %14, %15
  %17 = load i32, ptr %3, align 4, !tbaa !9
  %18 = mul nsw i32 %16, %17
  %19 = sext i32 %18 to i64
  %20 = load i32, ptr %3, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = mul nsw i64 %19, %21
  %23 = sitofp i64 %22 to x86_fp80
  store x86_fp80 %23, ptr %6, align 16, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %73, %0
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = load i32, ptr %2, align 4, !tbaa !9
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 2, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %76

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !9
  br label %30

30:                                               ; preds = %69, %29
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = load i32, ptr %3, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %72

35:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %36 = load i32, ptr %7, align 4, !tbaa !9
  %37 = add nsw i32 %36, 1
  %38 = load i32, ptr %2, align 4, !tbaa !9
  %39 = load i32, ptr %7, align 4, !tbaa !9
  %40 = sub nsw i32 %38, %39
  %41 = mul nsw i32 %37, %40
  store i32 %41, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  %44 = load i32, ptr %3, align 4, !tbaa !9
  %45 = load i32, ptr %9, align 4, !tbaa !9
  %46 = sub nsw i32 %44, %45
  %47 = mul nsw i32 %43, %46
  store i32 %47, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #4
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = add nsw i32 %48, %49
  %51 = sub nsw i32 %50, 1
  %52 = sext i32 %51 to i64
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = load i32, ptr %11, align 4, !tbaa !9
  %55 = add nsw i32 %53, %54
  %56 = sext i32 %55 to i64
  %57 = sub nsw i64 %56, 1
  %58 = mul nsw i64 %52, %57
  %59 = sitofp i64 %58 to x86_fp80
  %60 = load x86_fp80, ptr %6, align 16, !tbaa !5
  %61 = fdiv x86_fp80 %59, %60
  %62 = fsub x86_fp80 0xK3FFF8000000000000000, %61
  store x86_fp80 %62, ptr %12, align 16, !tbaa !5
  %63 = load x86_fp80, ptr %12, align 16, !tbaa !5
  %64 = load i32, ptr %4, align 4, !tbaa !9
  %65 = call noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef %63, i32 noundef %64)
  %66 = fsub x86_fp80 0xK3FFF8000000000000000, %65
  %67 = load x86_fp80, ptr %5, align 16, !tbaa !5
  %68 = fadd x86_fp80 %67, %66
  store x86_fp80 %68, ptr %5, align 16, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %69

69:                                               ; preds = %35
  %70 = load i32, ptr %9, align 4, !tbaa !9
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %9, align 4, !tbaa !9
  br label %30, !llvm.loop !11

72:                                               ; preds = %34
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %7, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %7, align 4, !tbaa !9
  br label %24, !llvm.loop !13

76:                                               ; preds = %28
  %77 = load x86_fp80, ptr %5, align 16, !tbaa !5
  %78 = fptrunc x86_fp80 %77 to double
  %79 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, double noundef %78)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, 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
  %80 = load i32, ptr %1, align 4
  ret i32 %80
}

; 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: inlinehint mustprogress uwtable
declare dso_local noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef, i32 noundef) #3

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

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

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 = { inlinehint 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 #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 = !{!"long 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 [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = mul nsw i32 %5, %5
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = mul nsw i32 %6, %7
  %9 = sext i32 %8 to i64
  %10 = sext i32 %7 to i64
  %11 = mul nsw i64 %9, %10
  %12 = sitofp i64 %11 to x86_fp80
  %13 = icmp sgt i32 %5, 0
  %14 = icmp sgt i32 %7, 0
  %or.cond = select i1 %13, i1 %14, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge24

.preheader:                                       ; preds = %0, %._crit_edge
  %15 = phi i32 [ %22, %._crit_edge ], [ %5, %0 ]
  %16 = phi i32 [ %23, %._crit_edge ], [ %7, %0 ]
  %.023 = phi x86_fp80 [ %.1.lcssa, %._crit_edge ], [ 0xK00000000000000000000, %0 ]
  %.01722 = phi i32 [ %24, %._crit_edge ], [ 0, %0 ]
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader
  %18 = shl nuw i32 %.01722, 1
  %19 = add nuw i32 %18, 2
  br label %26

._crit_edge24.loopexit:                           ; preds = %._crit_edge
  %20 = fptrunc x86_fp80 %.1.lcssa to double
  br label %._crit_edge24

._crit_edge24:                                    ; preds = %._crit_edge24.loopexit, %0
  %.0.lcssa = phi double [ 0.000000e+00, %0 ], [ %20, %._crit_edge24.loopexit ]
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, double noundef %.0.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret i32 0

._crit_edge.loopexit:                             ; preds = %26
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %22 = phi i32 [ %15, %.preheader ], [ %.pre, %._crit_edge.loopexit ]
  %23 = phi i32 [ %16, %.preheader ], [ %47, %._crit_edge.loopexit ]
  %.1.lcssa = phi x86_fp80 [ %.023, %.preheader ], [ %46, %._crit_edge.loopexit ]
  %24 = add nuw nsw i32 %.01722, 1
  %25 = icmp slt i32 %24, %22
  br i1 %25, label %.preheader, label %._crit_edge24.loopexit, !llvm.loop !9

26:                                               ; preds = %.lr.ph, %26
  %27 = phi i32 [ %16, %.lr.ph ], [ %47, %26 ]
  %.121 = phi x86_fp80 [ %.023, %.lr.ph ], [ %46, %26 ]
  %.01820 = phi i32 [ 0, %.lr.ph ], [ %30, %26 ]
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = sub nsw i32 %28, %.01722
  %30 = add nuw nsw i32 %.01820, 1
  %31 = sub nsw i32 %27, %.01820
  %32 = mul i32 %19, %29
  %33 = add nsw i32 %32, -1
  %34 = sext i32 %33 to i64
  %35 = shl nuw i32 %30, 1
  %36 = mul i32 %35, %31
  %37 = sext i32 %36 to i64
  %38 = add nsw i64 %37, -1
  %39 = mul nsw i64 %38, %34
  %40 = sitofp i64 %39 to x86_fp80
  %41 = fdiv x86_fp80 %40, %12
  %42 = fsub x86_fp80 0xK3FFF8000000000000000, %41
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = call noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef %42, i32 noundef %43)
  %45 = fsub x86_fp80 0xK3FFF8000000000000000, %44
  %46 = fadd x86_fp80 %.121, %45
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = icmp slt i32 %30, %47
  br i1 %48, label %26, label %._crit_edge.loopexit, !llvm.loop !12
}

; 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: inlinehint mustprogress uwtable
declare dso_local noundef x86_fp80 @_ZSt3powIeiEN9__gnu_cxx9__promoteIDTplcvNS1_IT_Xsr3std12__is_integerIS2_EE7__valueEE6__typeELi0EcvNS1_IT0_Xsr3std12__is_integerIS5_EE7__valueEE6__typeELi0EEXsr3std12__is_integerIS8_EE7__valueEE6__typeES2_S5_(x86_fp80 noundef, i32 noundef) local_unnamed_addr #3

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

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

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 = { 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 = { inlinehint 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 #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 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = distinct !{!12, !10}


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