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

; 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
@m = external dso_local global i32, align 4
@val = external dso_local global [15 x i32], align 16
@msk = external dso_local global [15 x i32], align 16
@cur = external dso_local global i32, align 4
@pre = external dso_local global i32, align 4
@f = external dso_local global [2 x [32769 x double]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = 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 i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca double, align 8
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  br label %9

9:                                                ; preds = %33, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr @m, align 4, !tbaa !5
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %36

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr @val, i64 %16
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %17, ptr noundef %3)
  br label %19

19:                                               ; preds = %22, %14
  %20 = load i32, ptr %3, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %32

22:                                               ; preds = %19
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = add nsw i32 %23, -1
  store i32 %24, ptr %3, align 4, !tbaa !5
  %25 = shl i32 1, %24
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [15 x i32], ptr @msk, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = or i32 %29, %25
  store i32 %30, ptr %28, align 4, !tbaa !5
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %3)
  br label %19, !llvm.loop !9

32:                                               ; preds = %19
  br label %33

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

36:                                               ; preds = %13
  br label %37

37:                                               ; preds = %143, %36
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = add nsw i32 %38, -1
  store i32 %39, ptr @n, align 4, !tbaa !5
  %40 = icmp ne i32 %38, 0
  br i1 %40, label %41, label %144

41:                                               ; preds = %37
  %42 = load i32, ptr @pre, align 4, !tbaa !5
  %43 = xor i32 %42, 1
  store i32 %43, ptr @pre, align 4, !tbaa !5
  %44 = load i32, ptr @cur, align 4, !tbaa !5
  %45 = xor i32 %44, 1
  store i32 %45, ptr @cur, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %140, %41
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr @m, align 4, !tbaa !5
  %49 = shl i32 1, %48
  %50 = icmp slt i32 %47, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %46
  store i32 9, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %143

52:                                               ; preds = %46
  %53 = load i32, ptr @cur, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %54
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [32769 x double], ptr %55, i64 0, i64 %57
  store double 0.000000e+00, ptr %58, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %126, %52
  %60 = load i32, ptr %6, align 4, !tbaa !5
  %61 = load i32, ptr @m, align 4, !tbaa !5
  %62 = icmp slt i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 12, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %129

64:                                               ; preds = %59
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [15 x i32], ptr @msk, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = and i32 %65, %69
  %71 = load i32, ptr %6, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [15 x i32], ptr @msk, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %70, %74
  br i1 %75, label %76, label %109

76:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %77 = load i32, ptr @pre, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %78
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = shl i32 1, %81
  %83 = or i32 %80, %82
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [32769 x double], ptr %79, i64 0, i64 %84
  %86 = load double, ptr %85, align 8, !tbaa !12
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [15 x i32], ptr @val, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sitofp i32 %90 to double
  %92 = fadd double %86, %91
  store double %92, ptr %7, align 8, !tbaa !12
  %93 = load i32, ptr @pre, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %94
  %96 = load i32, ptr %4, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [32769 x double], ptr %95, i64 0, i64 %97
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %98)
  %100 = load double, ptr %99, align 8, !tbaa !12
  %101 = load i32, ptr @cur, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %102
  %104 = load i32, ptr %4, align 4, !tbaa !5
  %105 = sext i32 %104 to i64
  %106 = getelementptr inbounds [32769 x double], ptr %103, i64 0, i64 %105
  %107 = load double, ptr %106, align 8, !tbaa !12
  %108 = fadd double %107, %100
  store double %108, ptr %106, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  br label %125

109:                                              ; preds = %64
  %110 = load i32, ptr @pre, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %111
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [32769 x double], ptr %112, i64 0, i64 %114
  %116 = load double, ptr %115, align 8, !tbaa !12
  %117 = load i32, ptr @cur, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %118
  %120 = load i32, ptr %4, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [32769 x double], ptr %119, i64 0, i64 %121
  %123 = load double, ptr %122, align 8, !tbaa !12
  %124 = fadd double %123, %116
  store double %124, ptr %122, align 8, !tbaa !12
  br label %125

125:                                              ; preds = %109, %76
  br label %126

126:                                              ; preds = %125
  %127 = load i32, ptr %6, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %6, align 4, !tbaa !5
  br label %59, !llvm.loop !14

129:                                              ; preds = %63
  %130 = load i32, ptr @m, align 4, !tbaa !5
  %131 = sitofp i32 %130 to double
  %132 = load i32, ptr @cur, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %133
  %135 = load i32, ptr %4, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [32769 x double], ptr %134, i64 0, i64 %136
  %138 = load double, ptr %137, align 8, !tbaa !12
  %139 = fdiv double %138, %131
  store double %139, ptr %137, align 8, !tbaa !12
  br label %140

140:                                              ; preds = %129
  %141 = load i32, ptr %4, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %4, align 4, !tbaa !5
  br label %46, !llvm.loop !15

143:                                              ; preds = %51
  br label %37, !llvm.loop !16

144:                                              ; preds = %37
  %145 = load i32, ptr @cur, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %146
  %148 = getelementptr inbounds [32769 x double], ptr %147, i64 0, i64 0
  %149 = load double, ptr %148, align 8, !tbaa !12
  %150 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, double noundef %149)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #3

declare i32 @printf(ptr noundef, ...) #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 = { "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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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
@m = external dso_local global i32, align 4
@val = external dso_local global [15 x i32], align 16
@msk = external dso_local local_unnamed_addr global [15 x i32], align 16
@cur = external dso_local local_unnamed_addr global i32, align 4
@pre = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local global [2 x [32769 x double]], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

._crit_edge29:                                    ; preds = %._crit_edge, %0
  %6 = phi i32 [ %4, %0 ], [ %21, %._crit_edge ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr @n, align 4, !tbaa !5
  %.not37 = icmp eq i32 %7, 0
  %.pre56 = load i32, ptr @cur, align 4, !tbaa !5
  br i1 %.not37, label %._crit_edge40, label %.lr.ph39

.lr.ph28:                                         ; preds = %0, %._crit_edge
  %indvars.iv = phi i64 [ %indvars.iv.next, %._crit_edge ], [ 0, %0 ]
  %9 = getelementptr inbounds i32, ptr @val, i64 %indvars.iv
  %10 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %9, ptr noundef nonnull %1)
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %.not2425 = icmp eq i32 %11, 0
  br i1 %.not2425, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph28
  %12 = getelementptr inbounds [15 x i32], ptr @msk, i64 0, i64 %indvars.iv
  br label %13

13:                                               ; preds = %.lr.ph, %13
  %14 = phi i32 [ %11, %.lr.ph ], [ %20, %13 ]
  %15 = add nsw i32 %14, -1
  store i32 %15, ptr %1, align 4, !tbaa !5
  %16 = shl nuw i32 1, %15
  %17 = load i32, ptr %12, align 4, !tbaa !5
  %18 = or i32 %17, %16
  store i32 %18, ptr %12, align 4, !tbaa !5
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %.not24 = icmp eq i32 %20, 0
  br i1 %.not24, label %._crit_edge, label %13, !llvm.loop !9

._crit_edge:                                      ; preds = %13, %.lr.ph28
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr @m, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = icmp slt i64 %indvars.iv.next, %22
  br i1 %23, label %.lr.ph28, label %._crit_edge29, !llvm.loop !11

.loopexit.loopexit:                               ; preds = %._crit_edge33
  %.pre55 = load i32, ptr @n, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %vector.body, %scalar.ph, %scalar.ph.1, %scalar.ph.2, %.loopexit.loopexit, %.lr.ph39
  %24 = phi i32 [ %.pre55, %.loopexit.loopexit ], [ %31, %.lr.ph39 ], [ %31, %scalar.ph.2 ], [ %31, %scalar.ph.1 ], [ %31, %scalar.ph ], [ %31, %vector.body ]
  %25 = phi i32 [ %60, %.loopexit.loopexit ], [ %32, %.lr.ph39 ], [ %32, %scalar.ph.2 ], [ %32, %scalar.ph.1 ], [ %32, %scalar.ph ], [ %32, %vector.body ]
  %26 = phi i32 [ %60, %.loopexit.loopexit ], [ %33, %.lr.ph39 ], [ %33, %scalar.ph.2 ], [ %33, %scalar.ph.1 ], [ %33, %scalar.ph ], [ %33, %vector.body ]
  %27 = phi i32 [ %60, %.loopexit.loopexit ], [ %34, %.lr.ph39 ], [ %33, %scalar.ph.2 ], [ %33, %scalar.ph.1 ], [ %33, %scalar.ph ], [ %33, %vector.body ]
  %28 = phi i32 [ %60, %.loopexit.loopexit ], [ 31, %.lr.ph39 ], [ %33, %scalar.ph.2 ], [ %33, %scalar.ph.1 ], [ %33, %scalar.ph ], [ %33, %vector.body ]
  %29 = phi i32 [ %61, %.loopexit.loopexit ], [ %39, %.lr.ph39 ], [ %39, %scalar.ph.2 ], [ %39, %scalar.ph.1 ], [ %39, %scalar.ph ], [ %39, %vector.body ]
  %30 = add nsw i32 %24, -1
  store i32 %30, ptr @n, align 4, !tbaa !5
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %._crit_edge40, label %.lr.ph39, !llvm.loop !12

.lr.ph39:                                         ; preds = %._crit_edge29, %.loopexit
  %31 = phi i32 [ %30, %.loopexit ], [ %8, %._crit_edge29 ]
  %32 = phi i32 [ %25, %.loopexit ], [ %6, %._crit_edge29 ]
  %33 = phi i32 [ %26, %.loopexit ], [ %6, %._crit_edge29 ]
  %34 = phi i32 [ %27, %.loopexit ], [ %6, %._crit_edge29 ]
  %35 = phi i32 [ %28, %.loopexit ], [ %6, %._crit_edge29 ]
  %36 = phi i32 [ %29, %.loopexit ], [ %.pre56, %._crit_edge29 ]
  %37 = load i32, ptr @pre, align 4, !tbaa !5
  %38 = xor i32 %37, 1
  store i32 %38, ptr @pre, align 4, !tbaa !5
  %39 = xor i32 %36, 1
  store i32 %39, ptr @cur, align 4, !tbaa !5
  %.not41 = icmp eq i32 %35, 31
  br i1 %.not41, label %.loopexit, label %.lr.ph36

.lr.ph36:                                         ; preds = %.lr.ph39
  %40 = icmp sgt i32 %34, 0
  br i1 %40, label %.lr.ph36.split, label %.lr.ph36.split.us

.lr.ph36.split.us:                                ; preds = %.lr.ph36
  %41 = sext i32 %39 to i64
  %42 = sitofp i32 %33 to double
  %43 = shl nuw i32 1, %33
  %44 = fdiv double 0.000000e+00, %42
  %min.iters.check = icmp slt i32 %43, 4
  br i1 %min.iters.check, label %scalar.ph, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph36.split.us
  %45 = and i32 %43, 2147483644
  %n.vec = zext nneg i32 %45 to i64
  %broadcast.splatinsert = insertelement <2 x double> poison, double %44, i64 0
  %broadcast.splat = shufflevector <2 x double> %broadcast.splatinsert, <2 x double> poison, <2 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %46 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %41, i64 %index
  %47 = getelementptr inbounds i8, ptr %46, i64 16
  store <2 x double> %broadcast.splat, ptr %46, align 8, !tbaa !13
  store <2 x double> %broadcast.splat, ptr %47, align 8, !tbaa !13
  %index.next = add nuw i64 %index, 4
  %48 = icmp eq i64 %index.next, %n.vec
  br i1 %48, label %.loopexit, label %vector.body, !llvm.loop !15

scalar.ph:                                        ; preds = %.lr.ph36.split.us
  %49 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %41, i64 0
  store double %44, ptr %49, align 8, !tbaa !13
  %exitcond.not = icmp slt i32 %43, 2
  br i1 %exitcond.not, label %.loopexit, label %scalar.ph.1, !llvm.loop !18

scalar.ph.1:                                      ; preds = %scalar.ph
  %50 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %41, i64 1
  store double %44, ptr %50, align 8, !tbaa !13
  %exitcond.not.1 = icmp eq i32 %33, 1
  br i1 %exitcond.not.1, label %.loopexit, label %scalar.ph.2, !llvm.loop !18

scalar.ph.2:                                      ; preds = %scalar.ph.1
  %51 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %41, i64 2
  store double %44, ptr %51, align 8, !tbaa !13
  br label %.loopexit

.lr.ph36.split:                                   ; preds = %.lr.ph36, %._crit_edge33
  %52 = phi i32 [ %60, %._crit_edge33 ], [ %32, %.lr.ph36 ]
  %53 = phi i32 [ %61, %._crit_edge33 ], [ %39, %.lr.ph36 ]
  %54 = phi i32 [ %60, %._crit_edge33 ], [ %33, %.lr.ph36 ]
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %._crit_edge33 ], [ 0, %.lr.ph36 ]
  %55 = sext i32 %53 to i64
  %56 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %55, i64 %indvars.iv51
  store double 0.000000e+00, ptr %56, align 8, !tbaa !13
  %57 = icmp sgt i32 %54, 0
  br i1 %57, label %.lr.ph32.preheader, label %._crit_edge33

.lr.ph32.preheader:                               ; preds = %.lr.ph36.split
  %58 = trunc nuw nsw i64 %indvars.iv51 to i32
  br label %.lr.ph32

._crit_edge33.loopexit:                           ; preds = %106
  %.pre = sext i32 %108 to i64
  %.phi.trans.insert = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %.pre, i64 %indvars.iv51
  %.pre57 = load double, ptr %.phi.trans.insert, align 8, !tbaa !13
  br label %._crit_edge33

._crit_edge33:                                    ; preds = %._crit_edge33.loopexit, %.lr.ph36.split
  %59 = phi double [ %.pre57, %._crit_edge33.loopexit ], [ 0.000000e+00, %.lr.ph36.split ]
  %.pre-phi = phi i64 [ %.pre, %._crit_edge33.loopexit ], [ %55, %.lr.ph36.split ]
  %60 = phi i32 [ %107, %._crit_edge33.loopexit ], [ %52, %.lr.ph36.split ]
  %61 = phi i32 [ %108, %._crit_edge33.loopexit ], [ %53, %.lr.ph36.split ]
  %.lcssa = phi i32 [ %109, %._crit_edge33.loopexit ], [ %54, %.lr.ph36.split ]
  %62 = sitofp i32 %.lcssa to double
  %63 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %.pre-phi, i64 %indvars.iv51
  %64 = fdiv double %59, %62
  store double %64, ptr %63, align 8, !tbaa !13
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %65 = shl nuw i32 1, %60
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next52, %66
  br i1 %67, label %.lr.ph36.split, label %.loopexit.loopexit, !llvm.loop !19

.lr.ph32:                                         ; preds = %.lr.ph32.preheader, %106
  %68 = phi i32 [ %52, %.lr.ph32.preheader ], [ %107, %106 ]
  %69 = phi i32 [ %53, %.lr.ph32.preheader ], [ %108, %106 ]
  %70 = phi i32 [ %54, %.lr.ph32.preheader ], [ %109, %106 ]
  %71 = phi i32 [ %53, %.lr.ph32.preheader ], [ %110, %106 ]
  %indvars.iv48 = phi i64 [ 0, %.lr.ph32.preheader ], [ %indvars.iv.next49, %106 ]
  %72 = getelementptr inbounds [15 x i32], ptr @msk, i64 0, i64 %indvars.iv48
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = and i32 %73, %58
  %75 = icmp eq i32 %74, %73
  br i1 %75, label %76, label %97

76:                                               ; preds = %.lr.ph32
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #4
  %77 = load i32, ptr @pre, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = trunc nuw nsw i64 %indvars.iv48 to i32
  %80 = shl nuw i32 1, %79
  %81 = or i32 %80, %58
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %78, i64 %82
  %84 = load double, ptr %83, align 8, !tbaa !13
  %85 = getelementptr inbounds [15 x i32], ptr @val, i64 0, i64 %indvars.iv48
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = sitofp i32 %86 to double
  %88 = fadd double %84, %87
  store double %88, ptr %2, align 8, !tbaa !13
  %89 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %78, i64 %indvars.iv51
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %89)
  %91 = load double, ptr %90, align 8, !tbaa !13
  %92 = load i32, ptr @cur, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %93, i64 %indvars.iv51
  %95 = load double, ptr %94, align 8, !tbaa !13
  %96 = fadd double %91, %95
  store double %96, ptr %94, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #4
  %.pre54 = load i32, ptr @m, align 4, !tbaa !5
  br label %106

97:                                               ; preds = %.lr.ph32
  %98 = load i32, ptr @pre, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %99, i64 %indvars.iv51
  %101 = load double, ptr %100, align 8, !tbaa !13
  %102 = sext i32 %71 to i64
  %103 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %102, i64 %indvars.iv51
  %104 = load double, ptr %103, align 8, !tbaa !13
  %105 = fadd double %101, %104
  store double %105, ptr %103, align 8, !tbaa !13
  br label %106

106:                                              ; preds = %76, %97
  %107 = phi i32 [ %.pre54, %76 ], [ %68, %97 ]
  %108 = phi i32 [ %92, %76 ], [ %69, %97 ]
  %109 = phi i32 [ %.pre54, %76 ], [ %70, %97 ]
  %110 = phi i32 [ %92, %76 ], [ %71, %97 ]
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %111 = sext i32 %109 to i64
  %112 = icmp slt i64 %indvars.iv.next49, %111
  br i1 %112, label %.lr.ph32, label %._crit_edge33.loopexit, !llvm.loop !21

._crit_edge40:                                    ; preds = %.loopexit, %._crit_edge29
  %113 = phi i32 [ %.pre56, %._crit_edge29 ], [ %29, %.loopexit ]
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [2 x [32769 x double]], ptr @f, i64 0, i64 %114
  %116 = load double, ptr %115, align 8, !tbaa !13
  %117 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, double noundef %116)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIdERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3

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

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint 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 #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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = distinct !{!15, !10, !16, !17}
!16 = !{!"llvm.loop.isvectorized", i32 1}
!17 = !{!"llvm.loop.unroll.runtime.disable"}
!18 = distinct !{!18, !10, !17, !16}
!19 = distinct !{!19, !10, !20}
!20 = !{!"llvm.loop.unswitch.partial.disable"}
!21 = distinct !{!21, !10}


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