; LLVM IR from ShahjalalShohag/code-library :: Graph Theory (System Of Difference Constraints)

; 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_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"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::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@vis = external dso_local global [300009 x i8], align 16
@d = external dso_local global [300009 x i32], align 16
@a = external dso_local global [300009 x i32], align 16
@ans = external dso_local global [300009 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4spfai(i32 noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3addiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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 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 %1, align 4
  %13 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %23

23:                                               ; preds = %33, %0
  %24 = load i32, ptr %6, align 4, !tbaa !8
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

27:                                               ; preds = %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  br label %36

28:                                               ; preds = %23
  %29 = load i32, ptr %6, align 4, !tbaa !8
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %31)
  br label %33

33:                                               ; preds = %28
  %34 = load i32, ptr %6, align 4, !tbaa !8
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %6, align 4, !tbaa !8
  br label %23, !llvm.loop !11

36:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 1, ptr %7, align 4, !tbaa !8
  br label %37

37:                                               ; preds = %89, %36
  %38 = load i32, ptr %7, align 4, !tbaa !8
  %39 = load i32, ptr %2, align 4, !tbaa !8
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %92

42:                                               ; preds = %37
  %43 = load i32, ptr %7, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !8
  %47 = load i32, ptr %7, align 4, !tbaa !8
  %48 = add nsw i32 %47, 1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !8
  %52 = icmp slt i32 %46, %51
  br i1 %52, label %53, label %61

53:                                               ; preds = %42
  %54 = load i32, ptr %7, align 4, !tbaa !8
  %55 = add nsw i32 %54, 1
  %56 = load i32, ptr %7, align 4, !tbaa !8
  %57 = load i32, ptr %5, align 4, !tbaa !8
  call void @_Z3addiiii(i32 noundef %55, i32 noundef %56, i32 noundef %57, i32 noundef 0)
  %58 = load i32, ptr %7, align 4, !tbaa !8
  %59 = load i32, ptr %7, align 4, !tbaa !8
  %60 = add nsw i32 %59, 1
  call void @_Z3addiiii(i32 noundef %58, i32 noundef %60, i32 noundef -1, i32 noundef 0)
  br label %88

61:                                               ; preds = %42
  %62 = load i32, ptr %7, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !8
  %66 = load i32, ptr %7, align 4, !tbaa !8
  %67 = add nsw i32 %66, 1
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !8
  %71 = icmp sgt i32 %65, %70
  br i1 %71, label %72, label %80

72:                                               ; preds = %61
  %73 = load i32, ptr %7, align 4, !tbaa !8
  %74 = load i32, ptr %7, align 4, !tbaa !8
  %75 = add nsw i32 %74, 1
  %76 = load i32, ptr %5, align 4, !tbaa !8
  call void @_Z3addiiii(i32 noundef %73, i32 noundef %75, i32 noundef %76, i32 noundef 0)
  %77 = load i32, ptr %7, align 4, !tbaa !8
  %78 = add nsw i32 %77, 1
  %79 = load i32, ptr %7, align 4, !tbaa !8
  call void @_Z3addiiii(i32 noundef %78, i32 noundef %79, i32 noundef -1, i32 noundef 0)
  br label %87

80:                                               ; preds = %61
  %81 = load i32, ptr %7, align 4, !tbaa !8
  %82 = add nsw i32 %81, 1
  %83 = load i32, ptr %7, align 4, !tbaa !8
  call void @_Z3addiiii(i32 noundef %82, i32 noundef %83, i32 noundef 0, i32 noundef 0)
  %84 = load i32, ptr %7, align 4, !tbaa !8
  %85 = load i32, ptr %7, align 4, !tbaa !8
  %86 = add nsw i32 %85, 1
  call void @_Z3addiiii(i32 noundef %84, i32 noundef %86, i32 noundef 0, i32 noundef 0)
  br label %87

87:                                               ; preds = %80, %72
  br label %88

88:                                               ; preds = %87, %53
  br label %89

89:                                               ; preds = %88
  %90 = load i32, ptr %7, align 4, !tbaa !8
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %7, align 4, !tbaa !8
  br label %37, !llvm.loop !13

92:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %93 = load i32, ptr %2, align 4, !tbaa !8
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %8, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 1, ptr %9, align 4, !tbaa !8
  br label %95

95:                                               ; preds = %108, %92
  %96 = load i32, ptr %9, align 4, !tbaa !8
  %97 = load i32, ptr %2, align 4, !tbaa !8
  %98 = icmp sle i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %111

100:                                              ; preds = %95
  %101 = load i32, ptr %9, align 4, !tbaa !8
  %102 = load i32, ptr %8, align 4, !tbaa !8
  %103 = load i32, ptr %4, align 4, !tbaa !8
  call void @_Z3addiiii(i32 noundef %101, i32 noundef %102, i32 noundef %103, i32 noundef 0)
  %104 = load i32, ptr %8, align 4, !tbaa !8
  %105 = load i32, ptr %9, align 4, !tbaa !8
  %106 = load i32, ptr %3, align 4, !tbaa !8
  %107 = sub nsw i32 0, %106
  call void @_Z3addiiii(i32 noundef %104, i32 noundef %105, i32 noundef %107, i32 noundef 0)
  br label %108

108:                                              ; preds = %100
  %109 = load i32, ptr %9, align 4, !tbaa !8
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %9, align 4, !tbaa !8
  br label %95, !llvm.loop !14

111:                                              ; preds = %99
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 300009, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 1, ptr %10, align 4, !tbaa !8
  br label %112

112:                                              ; preds = %121, %111
  %113 = load i32, ptr %10, align 4, !tbaa !8
  %114 = load i32, ptr %8, align 4, !tbaa !8
  %115 = icmp sle i32 %113, %114
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %124

117:                                              ; preds = %112
  %118 = load i32, ptr %10, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %119
  store i32 -1000000009, ptr %120, align 4, !tbaa !8
  br label %121

121:                                              ; preds = %117
  %122 = load i32, ptr %10, align 4, !tbaa !8
  %123 = add nsw i32 %122, 1
  store i32 %123, ptr %10, align 4, !tbaa !8
  br label %112, !llvm.loop !15

124:                                              ; preds = %116
  %125 = load i32, ptr %8, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %126
  store i32 0, ptr %127, align 4, !tbaa !8
  %128 = load i32, ptr %8, align 4, !tbaa !8
  %129 = call noundef zeroext i1 @_Z4spfai(i32 noundef %128)
  br i1 %129, label %132, label %130

130:                                              ; preds = %124
  %131 = call i32 @puts(ptr noundef @.str)
  br label %176

132:                                              ; preds = %124
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 1, ptr %11, align 4, !tbaa !8
  br label %133

133:                                              ; preds = %151, %132
  %134 = load i32, ptr %11, align 4, !tbaa !8
  %135 = load i32, ptr %2, align 4, !tbaa !8
  %136 = icmp sle i32 %134, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %154

138:                                              ; preds = %133
  %139 = load i32, ptr %11, align 4, !tbaa !8
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !8
  %143 = load i32, ptr %8, align 4, !tbaa !8
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !8
  %147 = sub nsw i32 %142, %146
  %148 = load i32, ptr %11, align 4, !tbaa !8
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [300009 x i32], ptr @ans, i64 0, i64 %149
  store i32 %147, ptr %150, align 4, !tbaa !8
  br label %151

151:                                              ; preds = %138
  %152 = load i32, ptr %11, align 4, !tbaa !8
  %153 = add nsw i32 %152, 1
  store i32 %153, ptr %11, align 4, !tbaa !8
  br label %133, !llvm.loop !16

154:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 1, ptr %12, align 4, !tbaa !8
  br label %155

155:                                              ; preds = %171, %154
  %156 = load i32, ptr %12, align 4, !tbaa !8
  %157 = load i32, ptr %2, align 4, !tbaa !8
  %158 = icmp sle i32 %156, %157
  br i1 %158, label %160, label %159

159:                                              ; preds = %155
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %174

160:                                              ; preds = %155
  %161 = load i32, ptr %12, align 4, !tbaa !8
  %162 = icmp sgt i32 %161, 1
  br i1 %162, label %163, label %165

163:                                              ; preds = %160
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 32)
  br label %165

165:                                              ; preds = %163, %160
  %166 = load i32, ptr %12, align 4, !tbaa !8
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds [300009 x i32], ptr @ans, i64 0, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !8
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %169)
  br label %171

171:                                              ; preds = %165
  %172 = load i32, ptr %12, align 4, !tbaa !8
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %12, align 4, !tbaa !8
  br label %155, !llvm.loop !17

174:                                              ; preds = %159
  %175 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  br label %176

176:                                              ; preds = %174, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #4 align 2

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

declare i32 @puts(ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

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

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 = { 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 #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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"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::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@vis = external dso_local local_unnamed_addr global [300009 x i8], align 16
@d = external dso_local local_unnamed_addr global [300009 x i32], align 16
@a = external dso_local global [300009 x i32], align 16
@ans = external dso_local local_unnamed_addr global [300009 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

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

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #8
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %15 = load i32, ptr %1, align 4, !tbaa !8
  %.not57 = icmp slt i32 %15, 1
  br i1 %.not57, label %._crit_edge.thread, label %.lr.ph

._crit_edge.thread:                               ; preds = %0
  %16 = add nsw i32 %15, 1
  br label %._crit_edge65

.preheader56:                                     ; preds = %.lr.ph
  %17 = icmp sgt i32 %20, 1
  br i1 %17, label %.lr.ph60, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %18 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %indvars.iv
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr %1, align 4, !tbaa !8
  %21 = sext i32 %20 to i64
  %.not.not = icmp slt i64 %indvars.iv, %21
  br i1 %.not.not, label %.lr.ph, label %.preheader56, !llvm.loop !11

._crit_edge:                                      ; preds = %39, %.preheader56
  %22 = phi i32 [ %20, %.preheader56 ], [ %40, %39 ]
  %23 = add nsw i32 %22, 1
  %.not5161 = icmp slt i32 %22, 1
  br i1 %.not5161, label %._crit_edge65, label %.lr.ph64

.lr.ph60:                                         ; preds = %.preheader56, %39
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %39 ], [ 1, %.preheader56 ]
  %24 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %indvars.iv80
  %25 = load i32, ptr %24, align 4, !tbaa !8
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %indvars = trunc i64 %indvars.iv.next81 to i32
  %26 = getelementptr inbounds [300009 x i32], ptr @a, i64 0, i64 %indvars.iv.next81
  %27 = load i32, ptr %26, align 4, !tbaa !8
  %28 = icmp slt i32 %25, %27
  br i1 %28, label %29, label %32

29:                                               ; preds = %.lr.ph60
  %30 = load i32, ptr %4, align 4, !tbaa !8
  %31 = trunc nuw nsw i64 %indvars.iv80 to i32
  call void @_Z3addiiii(i32 noundef %indvars, i32 noundef %31, i32 noundef %30, i32 noundef 0)
  call void @_Z3addiiii(i32 noundef %31, i32 noundef %indvars, i32 noundef -1, i32 noundef 0)
  br label %39

32:                                               ; preds = %.lr.ph60
  %33 = icmp sgt i32 %25, %27
  br i1 %33, label %34, label %37

34:                                               ; preds = %32
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = trunc nuw nsw i64 %indvars.iv80 to i32
  call void @_Z3addiiii(i32 noundef %36, i32 noundef %indvars, i32 noundef %35, i32 noundef 0)
  call void @_Z3addiiii(i32 noundef %indvars, i32 noundef %36, i32 noundef -1, i32 noundef 0)
  br label %39

37:                                               ; preds = %32
  %38 = trunc nuw nsw i64 %indvars.iv80 to i32
  call void @_Z3addiiii(i32 noundef %indvars, i32 noundef %38, i32 noundef 0, i32 noundef 0)
  call void @_Z3addiiii(i32 noundef %38, i32 noundef %indvars, i32 noundef 0, i32 noundef 0)
  br label %39

39:                                               ; preds = %29, %37, %34
  %40 = load i32, ptr %1, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next81, %41
  br i1 %42, label %.lr.ph60, label %._crit_edge, !llvm.loop !13

._crit_edge65:                                    ; preds = %.lr.ph64, %._crit_edge.thread, %._crit_edge
  %43 = phi i32 [ %16, %._crit_edge.thread ], [ %23, %._crit_edge ], [ %23, %.lr.ph64 ]
  %44 = phi i32 [ %15, %._crit_edge.thread ], [ %22, %._crit_edge ], [ %22, %.lr.ph64 ]
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(300009) @vis, i8 0, i64 300009, i1 false)
  %.not5266 = icmp slt i32 %44, 0
  br i1 %.not5266, label %._crit_edge70, label %.lr.ph69.preheader

.lr.ph69.preheader:                               ; preds = %._crit_edge65
  %45 = add nuw i32 %44, 2
  %wide.trip.count = zext i32 %45 to i64
  %46 = add nsw i64 %wide.trip.count, -1
  %min.iters.check = icmp ult i32 %44, 7
  br i1 %min.iters.check, label %.lr.ph69.preheader115, label %vector.ph

.lr.ph69.preheader115:                            ; preds = %middle.block, %.lr.ph69.preheader
  %indvars.iv83.ph = phi i64 [ 1, %.lr.ph69.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph69

vector.ph:                                        ; preds = %.lr.ph69.preheader
  %n.vec = and i64 %46, -8
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %47 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %offset.idx
  %48 = getelementptr inbounds i8, ptr %47, i64 16
  store <4 x i32> <i32 -1000000009, i32 -1000000009, i32 -1000000009, i32 -1000000009>, ptr %47, align 4, !tbaa !8
  store <4 x i32> <i32 -1000000009, i32 -1000000009, i32 -1000000009, i32 -1000000009>, ptr %48, align 4, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %49 = icmp eq i64 %index.next, %n.vec
  br i1 %49, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %46, %n.vec
  br i1 %cmp.n, label %._crit_edge70, label %.lr.ph69.preheader115

.lr.ph64:                                         ; preds = %._crit_edge, %.lr.ph64
  %.04462 = phi i32 [ %53, %.lr.ph64 ], [ 1, %._crit_edge ]
  %50 = load i32, ptr %3, align 4, !tbaa !8
  call void @_Z3addiiii(i32 noundef %.04462, i32 noundef %23, i32 noundef %50, i32 noundef 0)
  %51 = load i32, ptr %2, align 4, !tbaa !8
  %52 = sub nsw i32 0, %51
  call void @_Z3addiiii(i32 noundef %23, i32 noundef %.04462, i32 noundef %52, i32 noundef 0)
  %53 = add nuw nsw i32 %.04462, 1
  %54 = load i32, ptr %1, align 4, !tbaa !8
  %.not51.not = icmp slt i32 %.04462, %54
  br i1 %.not51.not, label %.lr.ph64, label %._crit_edge65, !llvm.loop !17

._crit_edge70:                                    ; preds = %.lr.ph69, %middle.block, %._crit_edge65
  %55 = sext i32 %43 to i64
  %56 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %55
  store i32 0, ptr %56, align 4, !tbaa !8
  %57 = call noundef zeroext i1 @_Z4spfai(i32 noundef %43)
  br i1 %57, label %.preheader55, label %70

.preheader55:                                     ; preds = %._crit_edge70
  %58 = load i32, ptr %1, align 4, !tbaa !8
  %.not5371 = icmp slt i32 %58, 1
  br i1 %.not5371, label %._crit_edge77, label %.lr.ph73

.lr.ph73:                                         ; preds = %.preheader55
  %59 = load i32, ptr %56, align 4, !tbaa !8
  %60 = add nuw i32 %58, 1
  %wide.trip.count91 = zext i32 %60 to i64
  %61 = zext nneg i32 %58 to i64
  %min.iters.check103 = icmp ult i32 %58, 8
  br i1 %min.iters.check103, label %scalar.ph102.preheader, label %vector.ph104

scalar.ph102.preheader:                           ; preds = %middle.block101, %.lr.ph73
  %indvars.iv87.ph = phi i64 [ 1, %.lr.ph73 ], [ %ind.end107, %middle.block101 ]
  br label %scalar.ph102

vector.ph104:                                     ; preds = %.lr.ph73
  %n.vec106 = and i64 %61, 2147483640
  %ind.end107 = or disjoint i64 %n.vec106, 1
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %59, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body109

vector.body109:                                   ; preds = %vector.body109, %vector.ph104
  %index110 = phi i64 [ 0, %vector.ph104 ], [ %index.next113, %vector.body109 ]
  %offset.idx111 = or disjoint i64 %index110, 1
  %62 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %offset.idx111
  %63 = getelementptr inbounds i8, ptr %62, i64 16
  %wide.load = load <4 x i32>, ptr %62, align 4, !tbaa !8
  %wide.load112 = load <4 x i32>, ptr %63, align 4, !tbaa !8
  %64 = sub nsw <4 x i32> %wide.load, %broadcast.splat
  %65 = sub nsw <4 x i32> %wide.load112, %broadcast.splat
  %66 = getelementptr inbounds [300009 x i32], ptr @ans, i64 0, i64 %offset.idx111
  %67 = getelementptr inbounds i8, ptr %66, i64 16
  store <4 x i32> %64, ptr %66, align 4, !tbaa !8
  store <4 x i32> %65, ptr %67, align 4, !tbaa !8
  %index.next113 = add nuw i64 %index110, 8
  %68 = icmp eq i64 %index.next113, %n.vec106
  br i1 %68, label %middle.block101, label %vector.body109, !llvm.loop !18

middle.block101:                                  ; preds = %vector.body109
  %cmp.n114 = icmp eq i64 %n.vec106, %61
  br i1 %cmp.n114, label %.preheader, label %scalar.ph102.preheader

.lr.ph69:                                         ; preds = %.lr.ph69.preheader115, %.lr.ph69
  %indvars.iv83 = phi i64 [ %indvars.iv.next84, %.lr.ph69 ], [ %indvars.iv83.ph, %.lr.ph69.preheader115 ]
  %69 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %indvars.iv83
  store i32 -1000000009, ptr %69, align 4, !tbaa !8
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond = icmp eq i64 %indvars.iv.next84, %wide.trip.count
  br i1 %exitcond, label %._crit_edge70, label %.lr.ph69, !llvm.loop !19

70:                                               ; preds = %._crit_edge70
  %71 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str)
  br label %85

.preheader:                                       ; preds = %scalar.ph102, %middle.block101
  br i1 %.not5371, label %._crit_edge77, label %.lr.ph76.preheader._crit_edge

.lr.ph76.preheader._crit_edge:                    ; preds = %.preheader
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !8
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.pre)
  %73 = load i32, ptr %1, align 4, !tbaa !8
  %.not54.not.peel = icmp sgt i32 %73, 1
  br i1 %.not54.not.peel, label %.lr.ph76.peel.next, label %._crit_edge77

scalar.ph102:                                     ; preds = %scalar.ph102.preheader, %scalar.ph102
  %indvars.iv87 = phi i64 [ %indvars.iv.next88, %scalar.ph102 ], [ %indvars.iv87.ph, %scalar.ph102.preheader ]
  %74 = getelementptr inbounds [300009 x i32], ptr @d, i64 0, i64 %indvars.iv87
  %75 = load i32, ptr %74, align 4, !tbaa !8
  %76 = sub nsw i32 %75, %59
  %77 = getelementptr inbounds [300009 x i32], ptr @ans, i64 0, i64 %indvars.iv87
  store i32 %76, ptr %77, align 4, !tbaa !8
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond92.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count91
  br i1 %exitcond92.not, label %.preheader, label %scalar.ph102, !llvm.loop !20

._crit_edge77:                                    ; preds = %.lr.ph76.peel.next, %.preheader55, %.lr.ph76.preheader._crit_edge, %.preheader
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 10)
  br label %85

.lr.ph76.peel.next:                               ; preds = %.lr.ph76.preheader._crit_edge, %.lr.ph76.peel.next
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %.lr.ph76.peel.next ], [ 2, %.lr.ph76.preheader._crit_edge ]
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i8 noundef signext 32)
  %80 = getelementptr inbounds [300009 x i32], ptr @ans, i64 0, i64 %indvars.iv93
  %81 = load i32, ptr %80, align 4, !tbaa !8
  %82 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %81)
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %83 = load i32, ptr %1, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %.not54.not = icmp slt i64 %indvars.iv93, %84
  br i1 %.not54.not, label %.lr.ph76.peel.next, label %._crit_edge77, !llvm.loop !21

85:                                               ; preds = %._crit_edge77, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #4 align 2

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 nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #7

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

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 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { 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 #8 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !15, !16}
!19 = distinct !{!19, !12, !16, !15}
!20 = distinct !{!20, !12, !16, !15}
!21 = distinct !{!21, !12, !22}
!22 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass