; LLVM IR from HarshCasper/NeoAlgo :: C/operating_system (bankers)

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

@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @CalculateRemainingNeed(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr 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: nounwind uwtable
declare dso_local i32 @CheckDeadlock(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @DisplaySafeSequence(ptr noundef, i32 noundef) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #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 ptr, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %2)
  %20 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %3)
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = zext i32 %22 to i64
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %6, align 8
  %27 = mul nuw i64 %23, %25
  %28 = alloca i32, i64 %27, align 16
  store i64 %23, ptr %7, align 8
  store i64 %25, ptr %8, align 8
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = zext i32 %29 to i64
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = zext i32 %31 to i64
  %33 = mul nuw i64 %30, %32
  %34 = alloca i32, i64 %33, align 16
  store i64 %30, ptr %9, align 8
  store i64 %32, ptr %10, align 8
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = zext i32 %35 to i64
  %37 = alloca i32, i64 %36, align 16
  store i64 %36, ptr %11, align 8
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = zext i32 %38 to i64
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = zext i32 %40 to i64
  %42 = mul nuw i64 %39, %41
  %43 = alloca i32, i64 %42, align 16
  store i64 %39, ptr %12, align 8
  store i64 %41, ptr %13, align 8
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = zext i32 %44 to i64
  %46 = alloca i32, i64 %45, align 16
  store i64 %45, ptr %14, align 8
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = zext i32 %47 to i64
  %49 = alloca i32, i64 %48, align 16
  store i64 %48, ptr %15, align 8
  %50 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %60, %0
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %55, label %63

55:                                               ; preds = %51
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds i32, ptr %37, i64 %57
  %59 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %58)
  br label %60

60:                                               ; preds = %55
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %4, align 4, !tbaa !5
  br label %51, !llvm.loop !9

63:                                               ; preds = %51
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.7)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %65

65:                                               ; preds = %88, %63
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = load i32, ptr %2, align 4, !tbaa !5
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %69, label %91

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

70:                                               ; preds = %84, %69
  %71 = load i32, ptr %16, align 4, !tbaa !5
  %72 = load i32, ptr %3, align 4, !tbaa !5
  %73 = icmp slt i32 %71, %72
  br i1 %73, label %75, label %74

74:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  br label %87

75:                                               ; preds = %70
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = mul nsw i64 %77, %25
  %79 = getelementptr inbounds i32, ptr %28, i64 %78
  %80 = load i32, ptr %16, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %79, i64 %81
  %83 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %82)
  br label %84

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

87:                                               ; preds = %74
  br label %88

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

91:                                               ; preds = %65
  %92 = call i32 (ptr, ...) @printf(ptr noundef @.str.8)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %115, %91
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = load i32, ptr %2, align 4, !tbaa !5
  %96 = icmp slt i32 %94, %95
  br i1 %96, label %97, label %118

97:                                               ; preds = %93
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %98

98:                                               ; preds = %111, %97
  %99 = load i32, ptr %5, align 4, !tbaa !5
  %100 = load i32, ptr %3, align 4, !tbaa !5
  %101 = icmp slt i32 %99, %100
  br i1 %101, label %102, label %114

102:                                              ; preds = %98
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = mul nsw i64 %104, %32
  %106 = getelementptr inbounds i32, ptr %34, i64 %105
  %107 = load i32, ptr %5, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds i32, ptr %106, i64 %108
  %110 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %109)
  br label %111

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

114:                                              ; preds = %98
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %4, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %4, align 4, !tbaa !5
  br label %93, !llvm.loop !14

118:                                              ; preds = %93
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %127, %118
  %120 = load i32, ptr %4, align 4, !tbaa !5
  %121 = load i32, ptr %2, align 4, !tbaa !5
  %122 = icmp slt i32 %120, %121
  br i1 %122, label %123, label %130

123:                                              ; preds = %119
  %124 = load i32, ptr %4, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds i32, ptr %46, i64 %125
  store i32 0, ptr %126, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %123
  %128 = load i32, ptr %4, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %4, align 4, !tbaa !5
  br label %119, !llvm.loop !15

130:                                              ; preds = %119
  %131 = load i32, ptr %2, align 4, !tbaa !5
  %132 = load i32, ptr %3, align 4, !tbaa !5
  call void @CalculateRemainingNeed(i32 noundef %131, i32 noundef %132, ptr noundef %43, ptr noundef %28, ptr noundef %34)
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #4
  %133 = load i32, ptr %2, align 4, !tbaa !5
  %134 = load i32, ptr %3, align 4, !tbaa !5
  %135 = call i32 @CheckDeadlock(i32 noundef %133, i32 noundef %134, ptr noundef %43, ptr noundef %37, ptr noundef %28, ptr noundef %46, ptr noundef %49)
  store i32 %135, ptr %17, align 4, !tbaa !5
  %136 = load i32, ptr %17, align 4, !tbaa !5
  %137 = icmp eq i32 %136, 1
  br i1 %137, label %138, label %140

138:                                              ; preds = %130
  %139 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  br label %142

140:                                              ; preds = %130
  %141 = load i32, ptr %2, align 4, !tbaa !5
  call void @DisplaySafeSequence(ptr noundef %49, i32 noundef %141)
  br label %142

142:                                              ; preds = %140, %138
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  %143 = load ptr, ptr %6, align 8
  call void @llvm.stackrestore.p0(ptr %143)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %144 = load i32, ptr %1, align 4
  ret i32 %144
}

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

attributes #0 = { 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 = { "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 = { nocallback nofree nosync nounwind willreturn }
attributes #4 = { 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/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}


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

@.str.3 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [46 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @CalculateRemainingNeed(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr 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: nounwind uwtable
declare dso_local i32 @CheckDeadlock(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @DisplaySafeSequence(ptr noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %1)
  %5 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %2)
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = zext i32 %7 to i64
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = zext i32 %9 to i64
  %11 = call ptr @llvm.stacksave.p0()
  %12 = mul nuw i64 %10, %8
  %13 = alloca i32, i64 %12, align 16
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = zext i32 %16 to i64
  %18 = mul nuw i64 %17, %15
  %19 = alloca i32, i64 %18, align 16
  %20 = alloca i32, i64 %17, align 16
  %21 = alloca i32, i64 %18, align 16
  %22 = alloca i32, i64 %15, align 16
  %23 = alloca i32, i64 %15, align 16
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = icmp sgt i32 %25, 0
  br i1 %26, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %27 = getelementptr inbounds i32, ptr %20, i64 %indvars.iv
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %27)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %0
  %32 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.7)
  %33 = load i32, ptr %1, align 4, !tbaa !5
  %34 = icmp sgt i32 %33, 0
  %35 = load i32, ptr %2, align 4
  %36 = icmp sgt i32 %35, 0
  %or.cond = select i1 %34, i1 %36, i1 false
  br i1 %or.cond, label %.preheader24, label %._crit_edge30

.preheader24:                                     ; preds = %._crit_edge, %._crit_edge28
  %37 = phi i32 [ %42, %._crit_edge28 ], [ %33, %._crit_edge ]
  %38 = phi i32 [ %43, %._crit_edge28 ], [ %35, %._crit_edge ]
  %indvars.iv45 = phi i64 [ %indvars.iv.next46, %._crit_edge28 ], [ 0, %._crit_edge ]
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph27, label %._crit_edge28

.lr.ph27:                                         ; preds = %.preheader24
  %40 = mul nuw nsw i64 %indvars.iv45, %10
  %41 = getelementptr inbounds i32, ptr %13, i64 %40
  br label %46

._crit_edge28.loopexit:                           ; preds = %46
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge28

._crit_edge28:                                    ; preds = %._crit_edge28.loopexit, %.preheader24
  %42 = phi i32 [ %.pre, %._crit_edge28.loopexit ], [ %37, %.preheader24 ]
  %43 = phi i32 [ %49, %._crit_edge28.loopexit ], [ %38, %.preheader24 ]
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %44 = sext i32 %42 to i64
  %45 = icmp slt i64 %indvars.iv.next46, %44
  br i1 %45, label %.preheader24, label %._crit_edge30, !llvm.loop !11

46:                                               ; preds = %.lr.ph27, %46
  %indvars.iv42 = phi i64 [ 0, %.lr.ph27 ], [ %indvars.iv.next43, %46 ]
  %47 = getelementptr inbounds i32, ptr %41, i64 %indvars.iv42
  %48 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %47)
  %indvars.iv.next43 = add nuw nsw i64 %indvars.iv42, 1
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = icmp slt i64 %indvars.iv.next43, %50
  br i1 %51, label %46, label %._crit_edge28.loopexit, !llvm.loop !13

._crit_edge30:                                    ; preds = %._crit_edge28, %._crit_edge
  %52 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.8)
  %53 = load i32, ptr %1, align 4, !tbaa !5
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %.preheader23.lr.ph, label %._crit_edge37

.preheader23.lr.ph:                               ; preds = %._crit_edge30
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = icmp sgt i32 %55, 0
  br i1 %56, label %.preheader23, label %.lr.ph36.preheader

.preheader23:                                     ; preds = %.preheader23.lr.ph, %._crit_edge33
  %57 = phi i32 [ %71, %._crit_edge33 ], [ %53, %.preheader23.lr.ph ]
  %58 = phi i32 [ %72, %._crit_edge33 ], [ %55, %.preheader23.lr.ph ]
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %._crit_edge33 ], [ 0, %.preheader23.lr.ph ]
  %59 = icmp sgt i32 %58, 0
  br i1 %59, label %.lr.ph32, label %._crit_edge33

.lr.ph32:                                         ; preds = %.preheader23
  %60 = mul nuw nsw i64 %indvars.iv51, %17
  %61 = getelementptr inbounds i32, ptr %19, i64 %60
  br label %65

.preheader:                                       ; preds = %._crit_edge33
  %62 = icmp sgt i32 %71, 0
  br i1 %62, label %.lr.ph36.preheader, label %._crit_edge37

.lr.ph36.preheader:                               ; preds = %.preheader23.lr.ph, %.preheader
  %.lcssa60 = phi i32 [ %71, %.preheader ], [ %53, %.preheader23.lr.ph ]
  %63 = zext nneg i32 %.lcssa60 to i64
  %64 = shl nuw nsw i64 %63, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 %22, i8 0, i64 %64, i1 false), !tbaa !5
  br label %._crit_edge37

65:                                               ; preds = %.lr.ph32, %65
  %indvars.iv48 = phi i64 [ 0, %.lr.ph32 ], [ %indvars.iv.next49, %65 ]
  %66 = getelementptr inbounds i32, ptr %61, i64 %indvars.iv48
  %67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull %66)
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = icmp slt i64 %indvars.iv.next49, %69
  br i1 %70, label %65, label %._crit_edge33.loopexit, !llvm.loop !14

._crit_edge33.loopexit:                           ; preds = %65
  %.pre57 = load i32, ptr %1, align 4, !tbaa !5
  br label %._crit_edge33

._crit_edge33:                                    ; preds = %._crit_edge33.loopexit, %.preheader23
  %71 = phi i32 [ %.pre57, %._crit_edge33.loopexit ], [ %57, %.preheader23 ]
  %72 = phi i32 [ %68, %._crit_edge33.loopexit ], [ %58, %.preheader23 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %73 = sext i32 %71 to i64
  %74 = icmp slt i64 %indvars.iv.next52, %73
  br i1 %74, label %.preheader23, label %.preheader, !llvm.loop !15

._crit_edge37:                                    ; preds = %._crit_edge30, %.lr.ph36.preheader, %.preheader
  %.lcssa59 = phi i32 [ %.lcssa60, %.lr.ph36.preheader ], [ %71, %.preheader ], [ %53, %._crit_edge30 ]
  %75 = load i32, ptr %2, align 4, !tbaa !5
  call void @CalculateRemainingNeed(i32 noundef %.lcssa59, i32 noundef %75, ptr noundef nonnull %21, ptr noundef nonnull %13, ptr noundef nonnull %19)
  %76 = load i32, ptr %1, align 4, !tbaa !5
  %77 = load i32, ptr %2, align 4, !tbaa !5
  %78 = call i32 @CheckDeadlock(i32 noundef %76, i32 noundef %77, ptr noundef nonnull %21, ptr noundef nonnull %20, ptr noundef nonnull %13, ptr noundef nonnull %22, ptr noundef nonnull %23)
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %82

80:                                               ; preds = %._crit_edge37
  %81 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.9)
  br label %84

82:                                               ; preds = %._crit_edge37
  %83 = load i32, ptr %1, align 4, !tbaa !5
  call void @DisplaySafeSequence(ptr noundef nonnull %23, i32 noundef %83)
  br label %84

84:                                               ; preds = %82, %80
  call void @llvm.stackrestore.p0(ptr %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { 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 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #4 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { nounwind }

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

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


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass