; LLVM IR from brpapa/algorithms :: solutions/uri (2065)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.reg = type { i32, i32, i32 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3minP3regi(ptr 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 norecurse uwtable
define dso_local noundef i32 @main() #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [10000 x %struct.reg], align 16
  %6 = alloca i32, align 4
  %7 = alloca %"class.std::queue", align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3, ptr noundef %4)
  call void @llvm.lifetime.start.p0(i64 120000, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %35, %0
  %16 = load i32, ptr %6, align 4, !tbaa !5
  %17 = load i32, ptr %3, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %38

20:                                               ; preds = %15
  %21 = load i32, ptr %6, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.reg, ptr %23, i32 0, i32 1
  %25 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %24)
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.reg, ptr %28, i32 0, i32 2
  store i32 0, ptr %29, align 4, !tbaa !9
  %30 = load i32, ptr %6, align 4, !tbaa !5
  %31 = load i32, ptr %6, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.reg, ptr %33, i32 0, i32 0
  store i32 %30, ptr %34, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %20
  %36 = load i32, ptr %6, align 4, !tbaa !5
  %37 = add nsw i32 %36, 1
  store i32 %37, ptr %6, align 4, !tbaa !5
  br label %15, !llvm.loop !12

38:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 80, ptr %7) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %48, %38
  %40 = load i32, ptr %8, align 4, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = icmp slt i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %55

44:                                               ; preds = %39
  %45 = invoke i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %2)
          to label %46 unwind label %51

46:                                               ; preds = %44
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 4 dereferenceable(4) %2)
          to label %47 unwind label %51

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %8, align 4, !tbaa !5
  br label %39, !llvm.loop !14

51:                                               ; preds = %46, %44
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %9, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %124

55:                                               ; preds = %43
  br label %56

56:                                               ; preds = %79, %55
  %57 = invoke noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %58 unwind label %80

58:                                               ; preds = %56
  %59 = xor i1 %57, true
  br i1 %59, label %60, label %88

60:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %61 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 0
  %62 = load i32, ptr %3, align 4, !tbaa !5
  %63 = call noundef i32 @_Z3minP3regi(ptr noundef %61, i32 noundef %62)
  store i32 %63, ptr %11, align 4, !tbaa !5
  %64 = load i32, ptr %11, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %65
  %67 = getelementptr inbounds %struct.reg, ptr %66, i32 0, i32 1
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %70 unwind label %84

70:                                               ; preds = %60
  %71 = load i32, ptr %69, align 4, !tbaa !5
  %72 = mul nsw i32 %68, %71
  %73 = load i32, ptr %11, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %74
  %76 = getelementptr inbounds %struct.reg, ptr %75, i32 0, i32 2
  %77 = load i32, ptr %76, align 4, !tbaa !9
  %78 = add nsw i32 %77, %72
  store i32 %78, ptr %76, align 4, !tbaa !9
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %79 unwind label %84

79:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %56, !llvm.loop !16

80:                                               ; preds = %56
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %9, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %10, align 4
  br label %124

84:                                               ; preds = %70, %60
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %9, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %124

88:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %89 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 0
  %90 = getelementptr inbounds %struct.reg, ptr %89, i32 0, i32 2
  %91 = load i32, ptr %90, align 8, !tbaa !9
  store i32 %91, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %112, %88
  %93 = load i32, ptr %13, align 4, !tbaa !5
  %94 = load i32, ptr %3, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %115

97:                                               ; preds = %92
  %98 = load i32, ptr %13, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %99
  %101 = getelementptr inbounds %struct.reg, ptr %100, i32 0, i32 2
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = load i32, ptr %12, align 4, !tbaa !5
  %104 = icmp sgt i32 %102, %103
  br i1 %104, label %105, label %111

105:                                              ; preds = %97
  %106 = load i32, ptr %13, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [10000 x %struct.reg], ptr %5, i64 0, i64 %107
  %109 = getelementptr inbounds %struct.reg, ptr %108, i32 0, i32 2
  %110 = load i32, ptr %109, align 4, !tbaa !9
  store i32 %110, ptr %12, align 4, !tbaa !5
  br label %111

111:                                              ; preds = %105, %97
  br label %112

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

115:                                              ; preds = %96
  %116 = load i32, ptr %12, align 4, !tbaa !5
  %117 = invoke i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %116)
          to label %118 unwind label %120

118:                                              ; preds = %115
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 120000, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %119 = load i32, ptr %1, align 4
  ret i32 %119

120:                                              ; preds = %115
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %9, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %124

124:                                              ; preds = %120, %84, %80, %51
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #6
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 120000, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %125

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

attributes #0 = { 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 #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 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 = { 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 #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 8}
!10 = !{!"_ZTS3reg", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = !{!10, !6, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = distinct !{!14, !13}
!15 = !{!10, !6, i64 4}
!16 = distinct !{!16, !13}
!17 = distinct !{!17, !13}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.reg = type { i32, i32, i32 }
%"class.std::queue" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl" = type { %"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" }
%"struct.std::_Deque_base<int, std::allocator<int>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3minP3regi(ptr 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca [10000 x %struct.reg], align 16
  %5 = alloca %"class.std::queue", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2, ptr noundef nonnull %3)
  call void @llvm.lifetime.start.p0(i64 120000, ptr nonnull %4) #7
  %7 = load i32, ptr %2, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %5) #7
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph25, label %.preheader

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %indvars.iv
  %12 = getelementptr inbounds i8, ptr %11, i64 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %12)
  %14 = getelementptr inbounds i8, ptr %11, i64 8
  store i32 0, ptr %14, align 4, !tbaa !9
  %15 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %15, ptr %11, align 4, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.preheader:                                       ; preds = %21, %._crit_edge
  %19 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %19, label %._crit_edge27, label %.lr.ph26

.lr.ph25:                                         ; preds = %._crit_edge, %21
  %.02023 = phi i32 [ %22, %21 ], [ 0, %._crit_edge ]
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1)
  invoke void @_ZNSt5queueIiSt5dequeIiSaIiEEE4pushERKi(ptr noundef nonnull align 8 dereferenceable(80) %5, ptr noundef nonnull align 4 dereferenceable(4) %1)
          to label %21 unwind label %25

21:                                               ; preds = %.lr.ph25
  %22 = add nuw nsw i32 %.02023, 1
  %23 = load i32, ptr %3, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %.lr.ph25, label %.preheader, !llvm.loop !14

25:                                               ; preds = %.lr.ph25
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 120000, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  resume { ptr, i32 } %26

.lr.ph26:                                         ; preds = %.preheader, %.lr.ph26
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = call noundef i32 @_Z3minP3regi(ptr noundef nonnull %4, i32 noundef %27)
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %29
  %31 = getelementptr inbounds i8, ptr %30, i64 4
  %32 = load i32, ptr %31, align 4, !tbaa !15
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = mul nsw i32 %34, %32
  %36 = getelementptr inbounds i8, ptr %30, i64 8
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = add nsw i32 %37, %35
  store i32 %38, ptr %36, align 4, !tbaa !9
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  %39 = call noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %5)
  br i1 %39, label %._crit_edge27, label %.lr.ph26, !llvm.loop !16

._crit_edge27:                                    ; preds = %.lr.ph26, %.preheader
  %40 = getelementptr inbounds i8, ptr %4, i64 8
  %41 = load i32, ptr %40, align 8, !tbaa !9
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = icmp sgt i32 %42, 1
  br i1 %43, label %.lr.ph31.preheader, label %._crit_edge32

.lr.ph31.preheader:                               ; preds = %._crit_edge27
  %wide.trip.count = zext nneg i32 %42 to i64
  %min.iters.check = icmp ult i32 %42, 10
  br i1 %min.iters.check, label %.lr.ph31.preheader38, label %vector.ph

.lr.ph31.preheader38:                             ; preds = %middle.block, %.lr.ph31.preheader
  %indvars.iv34.ph = phi i64 [ 1, %.lr.ph31.preheader ], [ %ind.end, %middle.block ]
  %.01828.ph = phi i32 [ %41, %.lr.ph31.preheader ], [ %81, %middle.block ]
  br label %.lr.ph31

vector.ph:                                        ; preds = %.lr.ph31.preheader
  %44 = add nsw i64 %wide.trip.count, -1
  %n.mod.vf = and i64 %44, 7
  %45 = icmp eq i64 %n.mod.vf, 0
  %46 = select i1 %45, i64 8, i64 %n.mod.vf
  %n.vec = sub nsw i64 %44, %46
  %ind.end = add nsw i64 %n.vec, 1
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %41, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %78, %vector.body ]
  %vec.phi37 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %79, %vector.body ]
  %offset.idx = or disjoint i64 %index, 1
  %47 = or disjoint i64 %index, 2
  %48 = or disjoint i64 %index, 3
  %49 = or disjoint i64 %index, 4
  %50 = or disjoint i64 %index, 5
  %51 = or disjoint i64 %index, 6
  %52 = or disjoint i64 %index, 7
  %53 = add i64 %index, 8
  %54 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %offset.idx, i32 2
  %55 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %47, i32 2
  %56 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %48, i32 2
  %57 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %49, i32 2
  %58 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %50, i32 2
  %59 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %51, i32 2
  %60 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %52, i32 2
  %61 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %53, i32 2
  %62 = load i32, ptr %54, align 4, !tbaa !9
  %63 = load i32, ptr %55, align 16, !tbaa !9
  %64 = load i32, ptr %56, align 4, !tbaa !9
  %65 = load i32, ptr %57, align 8, !tbaa !9
  %66 = insertelement <4 x i32> poison, i32 %62, i64 0
  %67 = insertelement <4 x i32> %66, i32 %63, i64 1
  %68 = insertelement <4 x i32> %67, i32 %64, i64 2
  %69 = insertelement <4 x i32> %68, i32 %65, i64 3
  %70 = load i32, ptr %58, align 4, !tbaa !9
  %71 = load i32, ptr %59, align 16, !tbaa !9
  %72 = load i32, ptr %60, align 4, !tbaa !9
  %73 = load i32, ptr %61, align 8, !tbaa !9
  %74 = insertelement <4 x i32> poison, i32 %70, i64 0
  %75 = insertelement <4 x i32> %74, i32 %71, i64 1
  %76 = insertelement <4 x i32> %75, i32 %72, i64 2
  %77 = insertelement <4 x i32> %76, i32 %73, i64 3
  %78 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %69, <4 x i32> %vec.phi)
  %79 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %77, <4 x i32> %vec.phi37)
  %index.next = add nuw i64 %index, 8
  %80 = icmp eq i64 %index.next, %n.vec
  br i1 %80, label %middle.block, label %vector.body, !llvm.loop !17

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %78, <4 x i32> %79)
  %81 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  br label %.lr.ph31.preheader38

._crit_edge32:                                    ; preds = %.lr.ph31, %._crit_edge27
  %.018.lcssa = phi i32 [ %41, %._crit_edge27 ], [ %spec.select, %.lr.ph31 ]
  %82 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.018.lcssa)
  call void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %5) #7
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 120000, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

.lr.ph31:                                         ; preds = %.lr.ph31.preheader38, %.lr.ph31
  %indvars.iv34 = phi i64 [ %indvars.iv.next35, %.lr.ph31 ], [ %indvars.iv34.ph, %.lr.ph31.preheader38 ]
  %.01828 = phi i32 [ %spec.select, %.lr.ph31 ], [ %.01828.ph, %.lr.ph31.preheader38 ]
  %83 = getelementptr inbounds [10000 x %struct.reg], ptr %4, i64 0, i64 %indvars.iv34, i32 2
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %spec.select = call i32 @llvm.smax.i32(i32 %84, i32 %.01828)
  %indvars.iv.next35 = add nuw nsw i64 %indvars.iv34, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next35, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge32, label %.lr.ph31, !llvm.loop !20
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEEC2IS2_vEEv(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #4 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueIiSt5dequeIiSaIiEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt5queueIiSt5dequeIiSaIiEEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueIiSt5dequeIiSaIiEEED2Ev(ptr noundef nonnull align 8 dereferenceable(80)) unnamed_addr #5 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #6

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #6

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


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