; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2015-16/Feb 2016/Bronze (16 Feb B1)

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

%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }

@posi = external dso_local global [1001 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %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
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #5
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.1, i32 noundef 16)
          to label %14 unwind label %29

14:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %15 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %16 unwind label %33

16:                                               ; preds = %14
  %17 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %7)
          to label %18 unwind label %33

18:                                               ; preds = %16
  %19 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 4 dereferenceable(4) %8)
          to label %20 unwind label %33

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

21:                                               ; preds = %43, %20
  %22 = load i32, ptr %9, align 4, !tbaa !5
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = load i32, ptr %6, align 4, !tbaa !5
  %25 = sdiv i32 %23, %24
  %26 = add nsw i32 %25, 1
  %27 = icmp slt i32 %22, %26
  br i1 %27, label %37, label %28

28:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %46

29:                                               ; preds = %0
  %30 = landingpad { ptr, i32 }
          cleanup
  %31 = extractvalue { ptr, i32 } %30, 0
  store ptr %31, ptr %4, align 8
  %32 = extractvalue { ptr, i32 } %30, 1
  store i32 %32, ptr %5, align 4
  br label %123

33:                                               ; preds = %18, %16, %14
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %4, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %5, align 4
  br label %122

37:                                               ; preds = %21
  %38 = load i32, ptr %9, align 4, !tbaa !5
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = mul nsw i32 %38, %39
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %41
  store i32 1, ptr %42, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %37
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %9, align 4, !tbaa !5
  br label %21, !llvm.loop !9

46:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %47

47:                                               ; preds = %88, %46
  %48 = load i32, ptr %10, align 4, !tbaa !5
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = load i32, ptr %7, align 4, !tbaa !5
  %51 = sdiv i32 %49, %50
  %52 = add nsw i32 %51, 1
  %53 = icmp slt i32 %48, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %47
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %91

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %84, %55
  %57 = load i32, ptr %12, align 4, !tbaa !5
  %58 = load i32, ptr %8, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %87

61:                                               ; preds = %56
  %62 = load i32, ptr %12, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %67, label %83

67:                                               ; preds = %61
  %68 = load i32, ptr %12, align 4, !tbaa !5
  %69 = load i32, ptr %10, align 4, !tbaa !5
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = mul nsw i32 %69, %70
  %72 = add nsw i32 %68, %71
  %73 = load i32, ptr %8, align 4, !tbaa !5
  %74 = icmp sle i32 %72, %73
  br i1 %74, label %75, label %83

75:                                               ; preds = %67
  %76 = load i32, ptr %12, align 4, !tbaa !5
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = mul nsw i32 %77, %78
  %80 = add nsw i32 %76, %79
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %81
  store i32 1, ptr %82, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %75, %67, %61
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %12, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %12, align 4, !tbaa !5
  br label %56, !llvm.loop !11

87:                                               ; preds = %60
  br label %88

88:                                               ; preds = %87
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr %10, align 4, !tbaa !5
  br label %47, !llvm.loop !12

91:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %92 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %92, ptr %13, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %112, %91
  %94 = load i32, ptr %13, align 4, !tbaa !5
  %95 = icmp sge i32 %94, 0
  br i1 %95, label %97, label %96

96:                                               ; preds = %93
  store i32 11, ptr %11, align 4
  br label %115

97:                                               ; preds = %93
  %98 = load i32, ptr %13, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = icmp ne i32 %101, 0
  br i1 %102, label %103, label %111

103:                                              ; preds = %97
  %104 = load i32, ptr %13, align 4, !tbaa !5
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %104)
          to label %106 unwind label %107

106:                                              ; preds = %103
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  br label %115

107:                                              ; preds = %103
  %108 = landingpad { ptr, i32 }
          cleanup
  %109 = extractvalue { ptr, i32 } %108, 0
  store ptr %109, ptr %4, align 8
  %110 = extractvalue { ptr, i32 } %108, 1
  store i32 %110, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %122

111:                                              ; preds = %97
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %13, align 4, !tbaa !5
  %114 = add nsw i32 %113, -1
  store i32 %114, ptr %13, align 4, !tbaa !5
  br label %93, !llvm.loop !13

115:                                              ; preds = %106, %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  %116 = load i32, ptr %11, align 4
  switch i32 %116, label %118 [
    i32 11, label %117
  ]

117:                                              ; preds = %115
  store i32 0, ptr %11, align 4
  br label %118

118:                                              ; preds = %117, %115
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #5
  %119 = load i32, ptr %11, align 4
  switch i32 %119, label %129 [
    i32 0, label %120
    i32 1, label %120
  ]

120:                                              ; preds = %118, %118
  %121 = load i32, ptr %1, align 4
  ret i32 %121

122:                                              ; preds = %107, %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #5
  br label %123

123:                                              ; preds = %122, %29
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #5
  br label %124

124:                                              ; preds = %123
  %125 = load ptr, ptr %4, align 8
  %126 = load i32, ptr %5, align 4
  %127 = insertvalue { ptr, i32 } poison, ptr %125, 0
  %128 = insertvalue { ptr, i32 } %127, i32 %126, 1
  resume { ptr, i32 } %128

129:                                              ; preds = %118
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #4 align 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 = { 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 #3 = { "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 = { 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 #5 = { 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 = distinct !{!13, !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"

%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }

@posi = external dso_local local_unnamed_addr global [1001 x i32], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #5
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.1, i32 noundef 16)
          to label %6 unwind label %53

6:                                                ; preds = %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %7 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %3)
          to label %8 unwind label %55

8:                                                ; preds = %6
  %9 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(4) %4)
          to label %10 unwind label %55

10:                                               ; preds = %8
  %11 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %.preheader37 unwind label %55

.preheader37:                                     ; preds = %10
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = sdiv i32 %12, %13
  %.not39 = icmp slt i32 %14, 0
  br i1 %.not39, label %.preheader36, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.preheader37
  %15 = sext i32 %13 to i64
  %16 = add nuw i32 %14, 1
  %wide.trip.count = zext i32 %16 to i64
  %min.iters.check = icmp ugt i32 %14, 6
  %ident.check.not = icmp eq i32 %13, 1
  %or.cond62 = and i1 %min.iters.check, %ident.check.not
  br i1 %or.cond62, label %vector.ph, label %.lr.ph.preheader64

.lr.ph.preheader64:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %17 = zext nneg i32 %14 to i64
  %18 = sub nsw i64 %17, %indvars.iv.ph
  %xtraiter = and i64 %wide.trip.count, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol

.lr.ph.prol:                                      ; preds = %.lr.ph.preheader64, %.lr.ph.prol
  %indvars.iv.prol = phi i64 [ %indvars.iv.next.prol, %.lr.ph.prol ], [ %indvars.iv.ph, %.lr.ph.preheader64 ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph.prol ], [ 0, %.lr.ph.preheader64 ]
  %19 = mul nsw i64 %indvars.iv.prol, %15
  %20 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %19
  store i32 1, ptr %20, align 4, !tbaa !5
  %indvars.iv.next.prol = add nuw nsw i64 %indvars.iv.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph.prol.loopexit, label %.lr.ph.prol, !llvm.loop !9

.lr.ph.prol.loopexit:                             ; preds = %.lr.ph.prol, %.lr.ph.preheader64
  %indvars.iv.unr = phi i64 [ %indvars.iv.ph, %.lr.ph.preheader64 ], [ %indvars.iv.next.prol, %.lr.ph.prol ]
  %21 = icmp ult i64 %18, 3
  br i1 %21, label %.preheader36, label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %22 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %index
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %22, align 16, !tbaa !5
  store <4 x i32> <i32 1, i32 1, i32 1, i32 1>, ptr %23, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader36, label %.lr.ph.preheader64

.preheader36:                                     ; preds = %.lr.ph.prol.loopexit, %.lr.ph, %middle.block, %.preheader37
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sdiv i32 %12, %25
  %.not2943 = icmp sgt i32 %26, -1
  %27 = icmp sgt i32 %12, 0
  %or.cond = and i1 %.not2943, %27
  br i1 %or.cond, label %.preheader35.us.preheader, label %.preheader

.preheader35.us.preheader:                        ; preds = %.preheader36
  %28 = zext nneg i32 %12 to i64
  %29 = sext i32 %25 to i64
  %30 = add nuw i32 %26, 1
  %wide.trip.count58 = zext i32 %30 to i64
  %wide.trip.count53 = zext nneg i32 %12 to i64
  %xtraiter65 = and i64 %wide.trip.count53, 1
  %31 = icmp eq i32 %12, 1
  %unroll_iter = and i64 %wide.trip.count53, 2147483646
  %lcmp.mod66.not = icmp eq i64 %xtraiter65, 0
  br label %.preheader35.us

.preheader35.us:                                  ; preds = %.preheader35.us.preheader, %._crit_edge.us
  %indvars.iv55 = phi i64 [ 0, %.preheader35.us.preheader ], [ %indvars.iv.next56, %._crit_edge.us ]
  %32 = mul nsw i64 %indvars.iv55, %29
  br i1 %31, label %._crit_edge.us.unr-lcssa, label %.preheader35.us.new

.preheader35.us.new:                              ; preds = %.preheader35.us, %46
  %indvars.iv50 = phi i64 [ %indvars.iv.next51.1, %46 ], [ 0, %.preheader35.us ]
  %niter = phi i64 [ %niter.next.1, %46 ], [ 0, %.preheader35.us ]
  %33 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %indvars.iv50
  %34 = load i32, ptr %33, align 8, !tbaa !5
  %.not33.us = icmp eq i32 %34, 0
  br i1 %.not33.us, label %39, label %35

35:                                               ; preds = %.preheader35.us.new
  %36 = add nsw i64 %indvars.iv50, %32
  %.not34.us = icmp sgt i64 %36, %28
  br i1 %.not34.us, label %39, label %37

37:                                               ; preds = %35
  %38 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %36
  store i32 1, ptr %38, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %37, %35, %.preheader35.us.new
  %indvars.iv.next51 = or disjoint i64 %indvars.iv50, 1
  %40 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %indvars.iv.next51
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %.not33.us.1 = icmp eq i32 %41, 0
  br i1 %.not33.us.1, label %46, label %42

42:                                               ; preds = %39
  %43 = add nsw i64 %indvars.iv.next51, %32
  %.not34.us.1 = icmp sgt i64 %43, %28
  br i1 %.not34.us.1, label %46, label %44

44:                                               ; preds = %42
  %45 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %43
  store i32 1, ptr %45, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %44, %42, %39
  %indvars.iv.next51.1 = add nuw nsw i64 %indvars.iv50, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.us.unr-lcssa, label %.preheader35.us.new, !llvm.loop !15

._crit_edge.us.unr-lcssa:                         ; preds = %46, %.preheader35.us
  %indvars.iv50.unr = phi i64 [ 0, %.preheader35.us ], [ %indvars.iv.next51.1, %46 ]
  br i1 %lcmp.mod66.not, label %._crit_edge.us, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.us.unr-lcssa
  %47 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %indvars.iv50.unr
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %.not33.us.epil = icmp eq i32 %48, 0
  br i1 %.not33.us.epil, label %._crit_edge.us, label %49

49:                                               ; preds = %.epil.preheader
  %50 = add nsw i64 %indvars.iv50.unr, %32
  %.not34.us.epil = icmp sgt i64 %50, %28
  br i1 %.not34.us.epil, label %._crit_edge.us, label %51

51:                                               ; preds = %49
  %52 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %50
  store i32 1, ptr %52, align 4, !tbaa !5
  br label %._crit_edge.us

._crit_edge.us:                                   ; preds = %.epil.preheader, %49, %51, %._crit_edge.us.unr-lcssa
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %exitcond59.not = icmp eq i64 %indvars.iv.next56, %wide.trip.count58
  br i1 %exitcond59.not, label %.preheader, label %.preheader35.us, !llvm.loop !16

53:                                               ; preds = %0
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %77

55:                                               ; preds = %10, %8, %6
  %56 = landingpad { ptr, i32 }
          cleanup
  br label %76

.lr.ph:                                           ; preds = %.lr.ph.prol.loopexit, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next.3, %.lr.ph ], [ %indvars.iv.unr, %.lr.ph.prol.loopexit ]
  %57 = mul nsw i64 %indvars.iv, %15
  %58 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %57
  store i32 1, ptr %58, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %59 = mul nsw i64 %indvars.iv.next, %15
  %60 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %59
  store i32 1, ptr %60, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %61 = mul nsw i64 %indvars.iv.next.1, %15
  %62 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %61
  store i32 1, ptr %62, align 4, !tbaa !5
  %indvars.iv.next.2 = add nuw nsw i64 %indvars.iv, 3
  %63 = mul nsw i64 %indvars.iv.next.2, %15
  %64 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %63
  store i32 1, ptr %64, align 4, !tbaa !5
  %indvars.iv.next.3 = add nuw nsw i64 %indvars.iv, 4
  %exitcond.not.3 = icmp eq i64 %indvars.iv.next.3, %wide.trip.count
  br i1 %exitcond.not.3, label %.preheader36, label %.lr.ph, !llvm.loop !17

.preheader:                                       ; preds = %._crit_edge.us, %.preheader36
  %65 = icmp sgt i32 %12, -1
  br i1 %65, label %.lr.ph46, label %.loopexit

.lr.ph46:                                         ; preds = %.preheader, %73
  %.045 = phi i32 [ %74, %73 ], [ %12, %.preheader ]
  %66 = zext nneg i32 %.045 to i64
  %67 = getelementptr inbounds [1001 x i32], ptr @posi, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %.not30 = icmp eq i32 %68, 0
  br i1 %.not30, label %73, label %69

69:                                               ; preds = %.lr.ph46
  %70 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %.045)
          to label %.loopexit unwind label %71

71:                                               ; preds = %69
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %76

73:                                               ; preds = %.lr.ph46
  %74 = add nsw i32 %.045, -1
  %75 = icmp sgt i32 %.045, 0
  br i1 %75, label %.lr.ph46, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %73, %.preheader, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #5
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #5
  ret i32 0

76:                                               ; preds = %71, %55
  %.pn = phi { ptr, i32 } [ %72, %71 ], [ %56, %55 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #5
  br label %77

77:                                               ; preds = %76, %53
  %.pn.pn = phi { ptr, i32 } [ %.pn, %76 ], [ %54, %53 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #5
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #5
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn.pn
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #2 align 2

declare i32 @__gxx_personality_v0(...)

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) 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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256)) unnamed_addr #4 align 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 = { 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 #3 = { "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 = { 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 #5 = { 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.unroll.disable"}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12, !13}
!18 = distinct !{!18, !12}


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