; LLVM IR from tangjz/acm-icpc :: lydsy/1221.ll (Z4calci)

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

%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@cc = external dso_local global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@dsu = external dso_local global [1001 x i32], align 16
@res = external dso_local global [1001 x i32], align 16
@p = external dso_local global [2 x %"struct.std::pair"], align 16

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z4calci(i32 noundef %0) #0 {
  %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 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 i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = load i32, ptr @cc, align 4, !tbaa !5
  %15 = mul nsw i32 %13, %14
  store i32 %15, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %139, %1
  %17 = load i32, ptr %5, align 4, !tbaa !5
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store i32 2, ptr %6, align 4
  br label %142

21:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #3
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %23
  %25 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %26 = load i32, ptr %25, align 4, !tbaa !5
  store i32 %26, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %28
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = sub nsw i32 %30, %31
  store i32 %32, ptr %8, align 4, !tbaa !5
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sub nsw i32 %34, %33
  store i32 %35, ptr %3, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %77, %21
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = icmp ne i32 %37, 0
  br i1 %38, label %39, label %78

39:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = load i32, ptr getelementptr inbounds ([2 x %"struct.std::pair"], ptr @p, i64 0, i64 1), align 8, !tbaa !9
  %42 = sub nsw i32 %40, %41
  %43 = call noundef i32 @_Z8dsu_findi(i32 noundef %42)
  store i32 %43, ptr %9, align 4, !tbaa !5
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = icmp slt i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %39
  store i32 6, ptr %6, align 4
  br label %75

47:                                               ; preds = %39
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  %48 = load i32, ptr %9, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %49
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %50)
  %52 = load i32, ptr %51, align 4, !tbaa !5
  store i32 %52, ptr %10, align 4, !tbaa !5
  %53 = load i32, ptr %10, align 4, !tbaa !5
  %54 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr getelementptr inbounds ([2 x %"struct.std::pair"], ptr @p, i64 0, i64 1), i32 0, i32 1), align 4, !tbaa !11
  %55 = mul nsw i32 %53, %54
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = add nsw i32 %56, %55
  store i32 %57, ptr %4, align 4, !tbaa !5
  %58 = load i32, ptr %10, align 4, !tbaa !5
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = sub nsw i32 %59, %58
  store i32 %60, ptr %8, align 4, !tbaa !5
  %61 = load i32, ptr %10, align 4, !tbaa !5
  %62 = load i32, ptr %9, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sub nsw i32 %65, %61
  store i32 %66, ptr %64, align 4, !tbaa !5
  %67 = icmp ne i32 %66, 0
  br i1 %67, label %74, label %68

68:                                               ; preds = %47
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = sub nsw i32 %69, 1
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %72
  store i32 %70, ptr %73, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %68, %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  store i32 0, ptr %6, align 4
  br label %75

75:                                               ; preds = %74, %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  %76 = load i32, ptr %6, align 4
  switch i32 %76, label %148 [
    i32 0, label %77
    i32 6, label %78
  ]

77:                                               ; preds = %75
  br label %36, !llvm.loop !12

78:                                               ; preds = %75, %36
  br label %79

79:                                               ; preds = %120, %78
  %80 = load i32, ptr %8, align 4, !tbaa !5
  %81 = icmp ne i32 %80, 0
  br i1 %81, label %82, label %121

82:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = load i32, ptr @p, align 16, !tbaa !9
  %85 = sub nsw i32 %83, %84
  %86 = call noundef i32 @_Z8dsu_findi(i32 noundef %85)
  store i32 %86, ptr %11, align 4, !tbaa !5
  %87 = load i32, ptr %11, align 4, !tbaa !5
  %88 = icmp slt i32 %87, 0
  br i1 %88, label %89, label %90

89:                                               ; preds = %82
  store i32 8, ptr %6, align 4
  br label %118

90:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  %91 = load i32, ptr %11, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %92
  %94 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %8, ptr noundef nonnull align 4 dereferenceable(4) %93)
  %95 = load i32, ptr %94, align 4, !tbaa !5
  store i32 %95, ptr %12, align 4, !tbaa !5
  %96 = load i32, ptr %12, align 4, !tbaa !5
  %97 = load i32, ptr getelementptr inbounds (%"struct.std::pair", ptr @p, i32 0, i32 1), align 4, !tbaa !11
  %98 = mul nsw i32 %96, %97
  %99 = load i32, ptr %4, align 4, !tbaa !5
  %100 = add nsw i32 %99, %98
  store i32 %100, ptr %4, align 4, !tbaa !5
  %101 = load i32, ptr %12, align 4, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = sub nsw i32 %102, %101
  store i32 %103, ptr %8, align 4, !tbaa !5
  %104 = load i32, ptr %12, align 4, !tbaa !5
  %105 = load i32, ptr %11, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %106
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = sub nsw i32 %108, %104
  store i32 %109, ptr %107, align 4, !tbaa !5
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %117, label %111

111:                                              ; preds = %90
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = sub nsw i32 %112, 1
  %114 = load i32, ptr %11, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %115
  store i32 %113, ptr %116, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %111, %90
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  store i32 0, ptr %6, align 4
  br label %118

118:                                              ; preds = %117, %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  %119 = load i32, ptr %6, align 4
  switch i32 %119, label %148 [
    i32 0, label %120
    i32 8, label %121
  ]

120:                                              ; preds = %118
  br label %79, !llvm.loop !14

121:                                              ; preds = %118, %79
  %122 = load i32, ptr %8, align 4, !tbaa !5
  %123 = icmp ne i32 %122, 0
  br i1 %123, label %124, label %125

124:                                              ; preds = %121
  store i32 1061109567, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %136

125:                                              ; preds = %121
  %126 = load i32, ptr %5, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %127
  store i32 -2, ptr %128, align 4, !tbaa !5
  %129 = load i32, ptr %5, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %134
  store i32 %132, ptr %135, align 4, !tbaa !5
  store i32 0, ptr %6, align 4
  br label %136

136:                                              ; preds = %125, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #3
  %137 = load i32, ptr %6, align 4
  switch i32 %137, label %142 [
    i32 0, label %138
  ]

138:                                              ; preds = %136
  br label %139

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

142:                                              ; preds = %136, %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  %143 = load i32, ptr %6, align 4
  switch i32 %143, label %146 [
    i32 2, label %144
  ]

144:                                              ; preds = %142
  %145 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %145, ptr %2, align 4
  store i32 1, ptr %6, align 4
  br label %146

146:                                              ; preds = %144, %142
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %147 = load i32, ptr %2, align 4
  ret i32 %147

148:                                              ; preds = %118, %75
  unreachable
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = distinct !{!15, !13}


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

%"struct.std::pair" = type { i32, i32 }

@n = external dso_local local_unnamed_addr global i32, align 4
@cc = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [1001 x i32], align 16
@dsu = external dso_local local_unnamed_addr global [1001 x i32], align 16
@res = external dso_local global [1001 x i32], align 16
@p = external dso_local local_unnamed_addr global [2 x %"struct.std::pair"], align 16

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z8dsu_findi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z4calci(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 %0, ptr %2, align 4, !tbaa !5
  %4 = load i32, ptr @cc, align 4, !tbaa !5
  %5 = mul nsw i32 %4, %0
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not5177 = icmp sgt i32 %6, 0
  br i1 %.not5177, label %.lr.ph82, label %.loopexit

.lr.ph82:                                         ; preds = %1, %.thread63
  %indvars.iv = phi i64 [ %indvars.iv.next, %.thread63 ], [ 0, %1 ]
  %.03680 = phi i32 [ %.466, %.thread63 ], [ %5, %1 ]
  %7 = getelementptr inbounds [1001 x i32], ptr @a, i64 0, i64 %indvars.iv
  %8 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %9 = load i32, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  %10 = load i32, ptr %7, align 4, !tbaa !5
  %11 = sub nsw i32 %10, %9
  store i32 %11, ptr %3, align 4, !tbaa !5
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = sub nsw i32 %12, %9
  store i32 %13, ptr %2, align 4, !tbaa !5
  %.not68 = icmp eq i32 %10, %9
  br i1 %.not68, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph82
  %14 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph

thread-pre-split:                                 ; preds = %31, %19
  %.not = icmp eq i32 %27, %23
  br i1 %.not, label %.thread63, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %thread-pre-split
  %.13769 = phi i32 [ %26, %thread-pre-split ], [ %.03680, %.lr.ph.preheader ]
  %15 = load i32, ptr getelementptr inbounds (i8, ptr @p, i64 8), align 8, !tbaa !9
  %16 = sub nsw i32 %14, %15
  %17 = call noundef i32 @_Z8dsu_findi(i32 noundef %16)
  %18 = icmp slt i32 %17, 0
  br i1 %18, label %.lr.ph.._crit_edge.loopexit_crit_edge, label %19

.lr.ph.._crit_edge.loopexit_crit_edge:            ; preds = %.lr.ph
  %.pre.pre = load i32, ptr %3, align 4, !tbaa !5
  br label %._crit_edge

19:                                               ; preds = %.lr.ph
  %20 = zext nneg i32 %17 to i64
  %21 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %20
  %22 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %21)
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @p, i64 12), align 4, !tbaa !11
  %25 = mul nsw i32 %24, %23
  %26 = add nsw i32 %25, %.13769
  %27 = load i32, ptr %3, align 4, !tbaa !5
  %28 = sub nsw i32 %27, %23
  store i32 %28, ptr %3, align 4, !tbaa !5
  %29 = load i32, ptr %21, align 4, !tbaa !5
  %30 = sub nsw i32 %29, %23
  store i32 %30, ptr %21, align 4, !tbaa !5
  %.not47 = icmp eq i32 %29, %23
  br i1 %.not47, label %31, label %thread-pre-split

31:                                               ; preds = %19
  %32 = add nsw i32 %17, -1
  %33 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %20
  store i32 %32, ptr %33, align 4, !tbaa !5
  br label %thread-pre-split

._crit_edge:                                      ; preds = %.lr.ph.._crit_edge.loopexit_crit_edge, %.lr.ph82
  %34 = phi i32 [ %11, %.lr.ph82 ], [ %.pre.pre, %.lr.ph.._crit_edge.loopexit_crit_edge ]
  %.137.lcssa = phi i32 [ %.03680, %.lr.ph82 ], [ %.13769, %.lr.ph.._crit_edge.loopexit_crit_edge ]
  %.not4872 = icmp eq i32 %34, 0
  br i1 %.not4872, label %.thread63, label %.lr.ph75.preheader

.lr.ph75.preheader:                               ; preds = %._crit_edge
  %35 = trunc nuw nsw i64 %indvars.iv to i32
  br label %.lr.ph75

.lr.ph75:                                         ; preds = %.lr.ph75.preheader, %55
  %.473 = phi i32 [ %47, %55 ], [ %.137.lcssa, %.lr.ph75.preheader ]
  %36 = load i32, ptr @p, align 16, !tbaa !9
  %37 = sub nsw i32 %35, %36
  %38 = call noundef i32 @_Z8dsu_findi(i32 noundef %37)
  %39 = icmp slt i32 %38, 0
  br i1 %39, label %56, label %40

40:                                               ; preds = %.lr.ph75
  %41 = zext nneg i32 %38 to i64
  %42 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %41
  %43 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %42)
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %45 = load i32, ptr getelementptr inbounds (i8, ptr @p, i64 4), align 4, !tbaa !11
  %46 = mul nsw i32 %45, %44
  %47 = add nsw i32 %46, %.473
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sub nsw i32 %48, %44
  store i32 %49, ptr %3, align 4, !tbaa !5
  %50 = load i32, ptr %42, align 4, !tbaa !5
  %51 = sub nsw i32 %50, %44
  store i32 %51, ptr %42, align 4, !tbaa !5
  %.not49 = icmp eq i32 %50, %44
  br i1 %.not49, label %52, label %55

52:                                               ; preds = %40
  %53 = add nsw i32 %38, -1
  %54 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %41
  store i32 %53, ptr %54, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %40, %52
  %.not48 = icmp eq i32 %48, %44
  br i1 %.not48, label %.thread63, label %.lr.ph75

56:                                               ; preds = %.lr.ph75
  %.pr62 = load i32, ptr %3, align 4, !tbaa !5
  %.not50 = icmp eq i32 %.pr62, 0
  br i1 %.not50, label %.thread63, label %.critedge

.thread63:                                        ; preds = %thread-pre-split, %55, %._crit_edge, %56
  %.466 = phi i32 [ %.473, %56 ], [ %.137.lcssa, %._crit_edge ], [ %47, %55 ], [ %26, %thread-pre-split ]
  %57 = getelementptr inbounds [1001 x i32], ptr @dsu, i64 0, i64 %indvars.iv
  store i32 -2, ptr %57, align 4, !tbaa !5
  %58 = load i32, ptr %7, align 4, !tbaa !5
  %59 = getelementptr inbounds [1001 x i32], ptr @res, i64 0, i64 %indvars.iv
  store i32 %58, ptr %59, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %.not51 = icmp slt i64 %indvars.iv.next, %61
  br i1 %.not51, label %.lr.ph82, label %.loopexit, !llvm.loop !12

.critedge:                                        ; preds = %56
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  br label %.loopexit

.loopexit:                                        ; preds = %.thread63, %1, %.critedge
  %spec.select = phi i32 [ 1061109567, %.critedge ], [ %5, %1 ], [ %.466, %.thread63 ]
  ret i32 %spec.select
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) 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 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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTSSt4pairIiiE", !6, i64 0, !6, i64 4}
!11 = !{!10, !6, i64 4}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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