; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/Codesprints 2016/Codesprint July/Problem E/E.ll (Z5solvev)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@g = external dso_local global [50100 x %"class.std::vector"], align 16
@s = external dso_local global [50100 x %"class.std::map"], align 16
@ptr = external dso_local global [50100 x i32], align 16
@c = external dso_local global [50100 x i64], align 16
@up1 = external dso_local global [50100 x i64], align 16
@up2 = external dso_local global [50100 x i64], align 16
@ans = external dso_local global i64, align 8
@sum = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8makeSetsii(i32 noundef, 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 noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1)
  store i64 1152921504606846976, ptr @ans, align 8, !tbaa !5
  store i64 0, ptr @sum, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %44, %0
  %13 = load i32, ptr %2, align 4, !tbaa !9
  %14 = load i32, ptr %1, align 4, !tbaa !9
  %15 = icmp sle i32 %13, %14
  br i1 %15, label %17, label %16

16:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %47

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !9
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [50100 x %"class.std::vector"], ptr @g, i64 0, i64 %19
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #5
  %21 = load i32, ptr %2, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [50100 x %"class.std::map"], ptr @s, i64 0, i64 %22
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %23) #5
  %24 = load i32, ptr %2, align 4, !tbaa !9
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [50100 x i32], ptr @ptr, i64 0, i64 %26
  store i32 %24, ptr %27, align 4, !tbaa !9
  %28 = load i32, ptr %2, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i64, ptr @c, i64 %29
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %30)
  %32 = load i32, ptr %2, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [50100 x i64], ptr @c, i64 0, i64 %33
  %35 = load i64, ptr %34, align 8, !tbaa !5
  %36 = load i64, ptr @sum, align 8, !tbaa !5
  %37 = add nsw i64 %36, %35
  store i64 %37, ptr @sum, align 8, !tbaa !5
  %38 = load i32, ptr %2, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [50100 x i64], ptr @up2, i64 0, i64 %39
  store i64 -1, ptr %40, align 8, !tbaa !5
  %41 = load i32, ptr %2, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [50100 x i64], ptr @up1, i64 0, i64 %42
  store i64 -1, ptr %43, align 8, !tbaa !5
  br label %44

44:                                               ; preds = %17
  %45 = load i32, ptr %2, align 4, !tbaa !9
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %2, align 4, !tbaa !9
  br label %12, !llvm.loop !11

47:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %48

48:                                               ; preds = %61, %47
  %49 = load i32, ptr %3, align 4, !tbaa !9
  %50 = load i32, ptr %1, align 4, !tbaa !9
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %48
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %64

53:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %54 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef %4, ptr noundef %5)
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [50100 x %"class.std::vector"], ptr @g, i64 0, i64 %56
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %58 = load i32, ptr %5, align 4, !tbaa !9
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [50100 x %"class.std::vector"], ptr @g, i64 0, i64 %59
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %60, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %61

61:                                               ; preds = %53
  %62 = load i32, ptr %3, align 4, !tbaa !9
  %63 = add nsw i32 %62, 1
  store i32 %63, ptr %3, align 4, !tbaa !9
  br label %48, !llvm.loop !13

64:                                               ; preds = %52
  call void @_Z8makeSetsii(i32 noundef 1, i32 noundef -1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 2, ptr %6, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %117, %64
  %66 = load i32, ptr %6, align 4, !tbaa !9
  %67 = load i32, ptr %1, align 4, !tbaa !9
  %68 = icmp sle i32 %66, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %120

70:                                               ; preds = %65
  %71 = load i32, ptr %6, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [50100 x i64], ptr @up1, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !5
  %75 = icmp eq i64 %74, -1
  br i1 %75, label %76, label %77

76:                                               ; preds = %70
  br label %117

77:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [50100 x i64], ptr @c, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !5
  store i64 %81, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %82 = load i64, ptr @sum, align 8, !tbaa !5
  %83 = load i64, ptr %7, align 8, !tbaa !5
  %84 = mul nsw i64 %83, 2
  %85 = sub nsw i64 %82, %84
  store i64 %85, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %86 = load i32, ptr getelementptr inbounds ([50100 x i32], ptr @ptr, i64 0, i64 1), align 4, !tbaa !9
  store i32 %86, ptr %9, align 4, !tbaa !9
  %87 = load i32, ptr %9, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [50100 x %"class.std::map"], ptr @s, i64 0, i64 %88
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %89, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %91 = load i32, ptr %90, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = load i32, ptr %6, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [50100 x i64], ptr @up1, i64 0, i64 %94
  %96 = load i64, ptr %95, align 8, !tbaa !5
  %97 = icmp sgt i64 %92, %96
  br i1 %97, label %110, label %98

98:                                               ; preds = %77
  %99 = load i32, ptr %9, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [50100 x %"class.std::map"], ptr @s, i64 0, i64 %100
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %101, ptr noundef nonnull align 8 dereferenceable(8) %8)
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = load i32, ptr %6, align 4, !tbaa !9
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [50100 x i64], ptr @up2, i64 0, i64 %106
  %108 = load i64, ptr %107, align 8, !tbaa !5
  %109 = icmp sgt i64 %104, %108
  br i1 %109, label %110, label %116

110:                                              ; preds = %98, %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %111 = load i64, ptr %7, align 8, !tbaa !5
  %112 = load i64, ptr %8, align 8, !tbaa !5
  %113 = sub nsw i64 %111, %112
  store i64 %113, ptr %10, align 8, !tbaa !5
  %114 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %10)
  %115 = load i64, ptr %114, align 8, !tbaa !5
  store i64 %115, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %116

116:                                              ; preds = %110, %98
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %117

117:                                              ; preds = %116, %76
  %118 = load i32, ptr %6, align 4, !tbaa !9
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %6, align 4, !tbaa !9
  br label %65, !llvm.loop !14

120:                                              ; preds = %69
  %121 = load i64, ptr @ans, align 8, !tbaa !5
  %122 = icmp eq i64 %121, 1152921504606846976
  br i1 %122, label %123, label %124

123:                                              ; preds = %120
  store i64 -1, ptr @ans, align 8, !tbaa !5
  br label %124

124:                                              ; preds = %123, %120
  %125 = load i64, ptr @ans, align 8, !tbaa !5
  %126 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i64 noundef %125)
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  ret void
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

declare i32 @printf(ptr 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 = { 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 = { "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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, int>, std::_Select1st<std::pair<const long long, int>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@g = external dso_local global [50100 x %"class.std::vector"], align 16
@s = external dso_local global [50100 x %"class.std::map"], align 16
@ptr = external dso_local local_unnamed_addr global [50100 x i32], align 16
@c = external dso_local global [50100 x i64], align 16
@up1 = external dso_local local_unnamed_addr global [50100 x i64], align 16
@up2 = external dso_local local_unnamed_addr global [50100 x i64], align 16
@ans = external dso_local global i64, align 8
@sum = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8makeSetsii(i32 noundef, 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 noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  store i64 1152921504606846976, ptr @ans, align 8, !tbaa !5
  store i64 0, ptr @sum, align 8, !tbaa !5
  %8 = load i32, ptr %1, align 4, !tbaa !9
  %.not23 = icmp slt i32 %8, 1
  br i1 %.not23, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %9 = icmp sgt i32 %21, 1
  br i1 %9, label %.lr.ph26, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %10 = getelementptr inbounds [50100 x %"class.std::vector"], ptr @g, i64 0, i64 %indvars.iv
  call void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  %11 = getelementptr inbounds [50100 x %"class.std::map"], ptr @s, i64 0, i64 %indvars.iv
  call void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) %11) #5
  %12 = getelementptr inbounds [50100 x i32], ptr @ptr, i64 0, i64 %indvars.iv
  %13 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %13, ptr %12, align 4, !tbaa !9
  %14 = getelementptr inbounds i64, ptr @c, i64 %indvars.iv
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %14)
  %16 = load i64, ptr %14, align 8, !tbaa !5
  %17 = load i64, ptr @sum, align 8, !tbaa !5
  %18 = add nsw i64 %17, %16
  store i64 %18, ptr @sum, align 8, !tbaa !5
  %19 = getelementptr inbounds [50100 x i64], ptr @up2, i64 0, i64 %indvars.iv
  store i64 -1, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds [50100 x i64], ptr @up1, i64 0, i64 %indvars.iv
  store i64 -1, ptr %20, align 8, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %21 = load i32, ptr %1, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %.not.not = icmp slt i64 %indvars.iv, %22
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph26, %0, %.preheader
  call void @_Z8makeSetsii(i32 noundef 1, i32 noundef -1)
  %23 = load i32, ptr %1, align 4, !tbaa !9
  %.not2227 = icmp slt i32 %23, 2
  br i1 %.not2227, label %._crit_edge31, label %.lr.ph30

.lr.ph26:                                         ; preds = %.preheader, %.lr.ph26
  %.02125 = phi i32 [ %31, %.lr.ph26 ], [ 1, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [50100 x %"class.std::vector"], ptr @g, i64 0, i64 %26
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %27, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %28 = load i32, ptr %3, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [50100 x %"class.std::vector"], ptr @g, i64 0, i64 %29
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %30, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %31 = add nuw nsw i32 %.02125, 1
  %32 = load i32, ptr %1, align 4, !tbaa !9
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %.lr.ph26, label %._crit_edge, !llvm.loop !13

._crit_edge31:                                    ; preds = %68, %._crit_edge
  %34 = load i64, ptr @ans, align 8, !tbaa !5
  %35 = icmp eq i64 %34, 1152921504606846976
  br i1 %35, label %71, label %72

.lr.ph30:                                         ; preds = %._crit_edge, %68
  %36 = phi i32 [ %69, %68 ], [ %23, %._crit_edge ]
  %indvars.iv33 = phi i64 [ %indvars.iv.next34, %68 ], [ 2, %._crit_edge ]
  %37 = getelementptr inbounds [50100 x i64], ptr @up1, i64 0, i64 %indvars.iv33
  %38 = load i64, ptr %37, align 8, !tbaa !5
  %39 = icmp eq i64 %38, -1
  br i1 %39, label %68, label %40

40:                                               ; preds = %.lr.ph30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %41 = getelementptr inbounds [50100 x i64], ptr @c, i64 0, i64 %indvars.iv33
  %42 = load i64, ptr %41, align 8, !tbaa !5
  store i64 %42, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #5
  %43 = load i64, ptr @sum, align 8, !tbaa !5
  %44 = shl nsw i64 %42, 1
  %45 = sub nsw i64 %43, %44
  store i64 %45, ptr %5, align 8, !tbaa !5
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @ptr, i64 4), align 4, !tbaa !9
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [50100 x %"class.std::map"], ptr @s, i64 0, i64 %47
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %48, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %50 = load i32, ptr %49, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = load i64, ptr %37, align 8, !tbaa !5
  %53 = icmp slt i64 %52, %51
  br i1 %53, label %61, label %54

54:                                               ; preds = %40
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %48, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [50100 x i64], ptr @up2, i64 0, i64 %indvars.iv33
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = icmp slt i64 %59, %57
  br i1 %60, label %61, label %67

61:                                               ; preds = %54, %40
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  %62 = load i64, ptr %4, align 8, !tbaa !5
  %63 = load i64, ptr %5, align 8, !tbaa !5
  %64 = sub nsw i64 %62, %63
  store i64 %64, ptr %6, align 8, !tbaa !5
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) @ans, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %66 = load i64, ptr %65, align 8, !tbaa !5
  store i64 %66, ptr @ans, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  br label %67

67:                                               ; preds = %61, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  %.pre = load i32, ptr %1, align 4, !tbaa !9
  br label %68

68:                                               ; preds = %.lr.ph30, %67
  %69 = phi i32 [ %36, %.lr.ph30 ], [ %.pre, %67 ]
  %indvars.iv.next34 = add nuw nsw i64 %indvars.iv33, 1
  %70 = sext i32 %69 to i64
  %.not22.not = icmp slt i64 %indvars.iv33, %70
  br i1 %.not22.not, label %.lr.ph30, label %._crit_edge31, !llvm.loop !14

71:                                               ; preds = %._crit_edge31
  store i64 -1, ptr @ans, align 8, !tbaa !5
  br label %72

72:                                               ; preds = %71, %._crit_edge31
  %73 = phi i64 [ -1, %71 ], [ %34, %._crit_edge31 ]
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i64 noundef %73)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt3mapIxiSt4lessIxESaISt4pairIKxiEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 = { 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 #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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}


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