; LLVM IR from ravireddy07/cpp-book :: src/Code-Chef/JAN2021-Long/FAIRELCT.ll (Z9harry_expv)

; 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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue.0" = type <{ %"class.std::vector", [8 x i8] }>

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@temp = external dso_local global i64, align 8
@minn = external dso_local global i64, align 8
@maxx = external dso_local global i64, align 8
@JackSum = external dso_local global i64, align 8
@JohnSum = external dso_local global i64, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9harry_expv() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::priority_queue", align 8
  %2 = alloca %"class.std::priority_queue.0", align 8
  %3 = alloca ptr, align 8
  %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 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 32, ptr %1) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  call void @llvm.lifetime.start.p0(i64 32, ptr %2) #5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %10 unwind label %17

10:                                               ; preds = %0
  store i64 0, ptr @JohnSum, align 8, !tbaa !5
  store i64 0, ptr @JackSum, align 8, !tbaa !5
  store i64 0, ptr @temp, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %11

11:                                               ; preds = %28, %10
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = sext i32 %12 to i64
  %14 = load i64, ptr @n, align 8, !tbaa !5
  %15 = icmp slt i64 %13, %14
  br i1 %15, label %21, label %16

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

17:                                               ; preds = %0
  %18 = landingpad { ptr, i32 }
          cleanup
  %19 = extractvalue { ptr, i32 } %18, 0
  store ptr %19, ptr %3, align 8
  %20 = extractvalue { ptr, i32 } %18, 1
  store i32 %20, ptr %4, align 4
  br label %119

21:                                               ; preds = %11
  %22 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @temp)
          to label %23 unwind label %31

23:                                               ; preds = %21
  %24 = load i64, ptr @temp, align 8, !tbaa !5
  %25 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %26 = add nsw i64 %25, %24
  store i64 %26, ptr @JohnSum, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(8) @temp)
          to label %27 unwind label %31

27:                                               ; preds = %23
  br label %28

28:                                               ; preds = %27
  %29 = load i32, ptr %5, align 4, !tbaa !9
  %30 = add nsw i32 %29, 1
  store i32 %30, ptr %5, align 4, !tbaa !9
  br label %11, !llvm.loop !11

31:                                               ; preds = %23, %21
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %3, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %118

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

36:                                               ; preds = %49, %35
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = sext i32 %37 to i64
  %39 = load i64, ptr @m, align 8, !tbaa !5
  %40 = icmp slt i64 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %36
  %43 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.5, ptr noundef @temp)
          to label %44 unwind label %52

44:                                               ; preds = %42
  %45 = load i64, ptr @temp, align 8, !tbaa !5
  %46 = load i64, ptr @JackSum, align 8, !tbaa !5
  %47 = add nsw i64 %46, %45
  store i64 %47, ptr @JackSum, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) @temp)
          to label %48 unwind label %52

48:                                               ; preds = %44
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %6, align 4, !tbaa !9
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %6, align 4, !tbaa !9
  br label %36, !llvm.loop !13

52:                                               ; preds = %44, %42
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %3, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %118

56:                                               ; preds = %41
  %57 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %58 = load i64, ptr @JackSum, align 8, !tbaa !5
  %59 = icmp sgt i64 %57, %58
  br i1 %59, label %60, label %67

60:                                               ; preds = %56
  %61 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.6)
          to label %62 unwind label %63

62:                                               ; preds = %60
  store i32 1, ptr %7, align 4
  br label %117

63:                                               ; preds = %114, %60
  %64 = landingpad { ptr, i32 }
          cleanup
  %65 = extractvalue { ptr, i32 } %64, 0
  store ptr %65, ptr %3, align 8
  %66 = extractvalue { ptr, i32 } %64, 1
  store i32 %66, ptr %4, align 4
  br label %118

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

68:                                               ; preds = %108, %67
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = load i64, ptr @n, align 8, !tbaa !5
  %72 = icmp slt i64 %70, %71
  br i1 %72, label %74, label %73

73:                                               ; preds = %68
  store i32 8, ptr %7, align 4
  br label %111

74:                                               ; preds = %68
  %75 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %76 unwind label %103

76:                                               ; preds = %74
  %77 = load i64, ptr %75, align 8, !tbaa !5
  store i64 %77, ptr @minn, align 8, !tbaa !5
  %78 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %79 unwind label %103

79:                                               ; preds = %76
  %80 = load i64, ptr %78, align 8, !tbaa !5
  store i64 %80, ptr @maxx, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %81 unwind label %103

81:                                               ; preds = %79
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %82 unwind label %103

82:                                               ; preds = %81
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(8) @maxx)
          to label %83 unwind label %103

83:                                               ; preds = %82
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) @minn)
          to label %84 unwind label %103

84:                                               ; preds = %83
  %85 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %86 = load i64, ptr @minn, align 8, !tbaa !5
  %87 = sub nsw i64 %85, %86
  %88 = load i64, ptr @maxx, align 8, !tbaa !5
  %89 = add nsw i64 %87, %88
  store i64 %89, ptr @JohnSum, align 8, !tbaa !5
  %90 = load i64, ptr @JackSum, align 8, !tbaa !5
  %91 = load i64, ptr @maxx, align 8, !tbaa !5
  %92 = sub nsw i64 %90, %91
  %93 = load i64, ptr @minn, align 8, !tbaa !5
  %94 = add nsw i64 %92, %93
  store i64 %94, ptr @JackSum, align 8, !tbaa !5
  %95 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %96 = load i64, ptr @JackSum, align 8, !tbaa !5
  %97 = icmp sgt i64 %95, %96
  br i1 %97, label %98, label %107

98:                                               ; preds = %84
  %99 = load i32, ptr %8, align 4, !tbaa !9
  %100 = add nsw i32 %99, 1
  %101 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %100)
          to label %102 unwind label %103

102:                                              ; preds = %98
  store i32 1, ptr %7, align 4
  br label %111

103:                                              ; preds = %98, %83, %82, %81, %79, %76, %74
  %104 = landingpad { ptr, i32 }
          cleanup
  %105 = extractvalue { ptr, i32 } %104, 0
  store ptr %105, ptr %3, align 8
  %106 = extractvalue { ptr, i32 } %104, 1
  store i32 %106, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %118

107:                                              ; preds = %84
  br label %108

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

111:                                              ; preds = %102, %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %112 = load i32, ptr %7, align 4
  switch i32 %112, label %117 [
    i32 8, label %113
  ]

113:                                              ; preds = %111
  br label %114

114:                                              ; preds = %113
  %115 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2)
          to label %116 unwind label %63

116:                                              ; preds = %114
  store i32 1, ptr %7, align 4
  br label %117

117:                                              ; preds = %116, %111, %62
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #5
  ret void

118:                                              ; preds = %103, %63, %52, %31
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  br label %119

119:                                              ; preds = %118, %17
  call void @llvm.lifetime.end.p0(i64 32, ptr %2) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %1) #5
  br label %120

120:                                              ; preds = %119
  %121 = load ptr, ptr %3, align 8
  %122 = load i32, ptr %4, align 4
  %123 = insertvalue { ptr, i32 } poison, ptr %121, 0
  %124 = insertvalue { ptr, i32 } %123, i32 %122, 1
  resume { ptr, i32 } %124
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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::priority_queue" = type <{ %"class.std::vector", [8 x i8] }>
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::priority_queue.0" = type <{ %"class.std::vector", [8 x i8] }>

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@temp = external dso_local global i64, align 8
@minn = external dso_local global i64, align 8
@maxx = external dso_local global i64, align 8
@JackSum = external dso_local local_unnamed_addr global i64, align 8
@JohnSum = external dso_local local_unnamed_addr global i64, align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z9harry_expv() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::priority_queue", align 8
  %2 = alloca %"class.std::priority_queue.0", align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n, ptr noundef nonnull @m)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %1) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %2) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  store i64 0, ptr @JohnSum, align 8, !tbaa !5
  store i64 0, ptr @JackSum, align 8, !tbaa !5
  store i64 0, ptr @temp, align 8, !tbaa !5
  %4 = load i64, ptr @n, align 8, !tbaa !5
  %5 = icmp sgt i64 %4, 0
  br i1 %5, label %.lr.ph, label %.preheader15

.preheader15:                                     ; preds = %12, %0
  %6 = load i64, ptr @m, align 8, !tbaa !5
  %7 = icmp sgt i64 %6, 0
  br i1 %7, label %.lr.ph20, label %._crit_edge

.lr.ph:                                           ; preds = %0, %12
  %indvars.iv = phi i64 [ %indvars.iv.next, %12 ], [ 0, %0 ]
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @temp)
  %9 = load i64, ptr @temp, align 8, !tbaa !5
  %10 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %11 = add nsw i64 %10, %9
  store i64 %11, ptr @JohnSum, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(8) @temp)
          to label %12 unwind label %15

12:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i64, ptr @n, align 8, !tbaa !5
  %14 = icmp sgt i64 %13, %indvars.iv.next
  br i1 %14, label %.lr.ph, label %.preheader15, !llvm.loop !9

15:                                               ; preds = %.lr.ph
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %59

._crit_edge:                                      ; preds = %25, %.preheader15
  %17 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %18 = load i64, ptr @JackSum, align 8, !tbaa !5
  %19 = icmp sgt i64 %17, %18
  br i1 %19, label %30, label %.preheader

.preheader:                                       ; preds = %._crit_edge
  %20 = load i64, ptr @n, align 8, !tbaa !5
  %.not21 = icmp sgt i64 %20, 0
  br i1 %.not21, label %.lr.ph23, label %.critedge

.lr.ph20:                                         ; preds = %.preheader15, %25
  %indvars.iv27 = phi i64 [ %indvars.iv.next28, %25 ], [ 0, %.preheader15 ]
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.5, ptr noundef nonnull @temp)
  %22 = load i64, ptr @temp, align 8, !tbaa !5
  %23 = load i64, ptr @JackSum, align 8, !tbaa !5
  %24 = add nsw i64 %23, %22
  store i64 %24, ptr @JackSum, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) @temp)
          to label %25 unwind label %28

25:                                               ; preds = %.lr.ph20
  %indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
  %26 = load i64, ptr @m, align 8, !tbaa !5
  %27 = icmp sgt i64 %26, %indvars.iv.next28
  br i1 %27, label %.lr.ph20, label %._crit_edge, !llvm.loop !11

28:                                               ; preds = %.lr.ph20
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %59

30:                                               ; preds = %._crit_edge
  %31 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %58

.lr.ph23:                                         ; preds = %.preheader, %55
  %indvars.iv30 = phi i64 [ %indvars.iv.next31, %55 ], [ 0, %.preheader ]
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
  %33 = load i64, ptr %32, align 8, !tbaa !5
  store i64 %33, ptr @minn, align 8, !tbaa !5
  %34 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
  %35 = load i64, ptr %34, align 8, !tbaa !5
  store i64 %35, ptr @maxx, align 8, !tbaa !5
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %1)
          to label %36 unwind label %53

36:                                               ; preds = %.lr.ph23
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25) %2)
          to label %37 unwind label %53

37:                                               ; preds = %36
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %1, ptr noundef nonnull align 8 dereferenceable(8) @maxx)
          to label %38 unwind label %53

38:                                               ; preds = %37
  invoke void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25) %2, ptr noundef nonnull align 8 dereferenceable(8) @minn)
          to label %39 unwind label %53

39:                                               ; preds = %38
  %40 = load i64, ptr @JohnSum, align 8, !tbaa !5
  %41 = load i64, ptr @minn, align 8, !tbaa !5
  %42 = sub nsw i64 %40, %41
  %43 = load i64, ptr @maxx, align 8, !tbaa !5
  %44 = add nsw i64 %42, %43
  store i64 %44, ptr @JohnSum, align 8, !tbaa !5
  %45 = load i64, ptr @JackSum, align 8, !tbaa !5
  %46 = sub nsw i64 %45, %43
  %47 = add nsw i64 %46, %41
  store i64 %47, ptr @JackSum, align 8, !tbaa !5
  %48 = icmp sgt i64 %44, %47
  br i1 %48, label %49, label %55

49:                                               ; preds = %39
  %50 = trunc nuw nsw i64 %indvars.iv30 to i32
  %51 = add nuw nsw i32 %50, 1
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %51)
  br label %58

53:                                               ; preds = %38, %37, %36, %.lr.ph23
  %54 = landingpad { ptr, i32 }
          cleanup
  br label %59

55:                                               ; preds = %39
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %56 = load i64, ptr @n, align 8, !tbaa !5
  %.not = icmp sgt i64 %56, %indvars.iv.next31
  br i1 %.not, label %.lr.ph23, label %.critedge, !llvm.loop !12

.critedge:                                        ; preds = %55, %.preheader
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %58

58:                                               ; preds = %49, %.critedge, %30
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  ret void

59:                                               ; preds = %53, %28, %15
  %.pn = phi { ptr, i32 } [ %16, %15 ], [ %29, %28 ], [ %54, %53 ]
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %2) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %2) #5
  call void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25) %1) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %1) #5
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE4pushERKx(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3topEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEE3popEv(ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt4lessIxEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt14priority_queueIxSt6vectorIxSaIxEESt7greaterIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(25)) unnamed_addr #4 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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