; LLVM IR from HarshCasper/NeoAlgo :: C/ds (Finding_a_pair_of_element)

; 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.Array = type { ptr, i32 }

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

; Function Attrs: nounwind uwtable
define dso_local void @pairwithsumhash(ptr %0, i32 %1) #0 {
  %3 = alloca %struct.Array, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = getelementptr inbounds { ptr, i32 }, ptr %3, i32 0, i32 0
  store ptr %0, ptr %11, align 8
  %12 = getelementptr inbounds { ptr, i32 }, ptr %3, i32 0, i32 1
  store i32 %1, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 32767, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %8)
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %53, %2
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !9
  %19 = icmp slt i32 %16, %18
  br i1 %19, label %20, label %56

20:                                               ; preds = %15
  %21 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !12
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr %22, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = icmp sgt i32 %26, %27
  br i1 %28, label %29, label %36

29:                                               ; preds = %20
  %30 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !12
  %32 = load i32, ptr %4, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr %31, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  store i32 %35, ptr %5, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %29, %20
  %37 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !12
  %39 = load i32, ptr %4, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds i32, ptr %38, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr %6, align 4, !tbaa !5
  %44 = icmp slt i32 %42, %43
  br i1 %44, label %45, label %52

45:                                               ; preds = %36
  %46 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %47 = load ptr, ptr %46, align 8, !tbaa !12
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  store i32 %51, ptr %6, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %45, %36
  br label %53

53:                                               ; preds = %52
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = add nsw i32 %54, 1
  store i32 %55, ptr %4, align 4, !tbaa !5
  br label %15, !llvm.loop !13

56:                                               ; preds = %15
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = add nsw i32 %57, 1
  %59 = sext i32 %58 to i64
  %60 = mul i64 %59, 4
  %61 = call noalias ptr @malloc(i64 noundef %60) #6
  store ptr %61, ptr %7, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %73, %56
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  %66 = icmp slt i32 %63, %65
  br i1 %66, label %68, label %67

67:                                               ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %76

68:                                               ; preds = %62
  %69 = load ptr, ptr %7, align 8, !tbaa !15
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds i32, ptr %69, i64 %71
  store i32 0, ptr %72, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %68
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !5
  br label %62, !llvm.loop !16

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

77:                                               ; preds = %93, %76
  %78 = load i32, ptr %10, align 4, !tbaa !5
  %79 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 1
  %80 = load i32, ptr %79, align 8, !tbaa !9
  %81 = icmp slt i32 %78, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %96

83:                                               ; preds = %77
  %84 = load ptr, ptr %7, align 8, !tbaa !15
  %85 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !12
  %87 = load i32, ptr %10, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds i32, ptr %86, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i32, ptr %84, i64 %91
  store i32 1, ptr %92, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %83
  %94 = load i32, ptr %10, align 4, !tbaa !5
  %95 = add nsw i32 %94, 1
  store i32 %95, ptr %10, align 4, !tbaa !5
  br label %77, !llvm.loop !17

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

97:                                               ; preds = %155, %96
  %98 = load i32, ptr %4, align 4, !tbaa !5
  %99 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 1
  %100 = load i32, ptr %99, align 8, !tbaa !9
  %101 = icmp slt i32 %98, %100
  br i1 %101, label %102, label %158

102:                                              ; preds = %97
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %105 = load ptr, ptr %104, align 8, !tbaa !12
  %106 = load i32, ptr %4, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds i32, ptr %105, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = sub nsw i32 %103, %109
  %111 = icmp sge i32 %110, 0
  br i1 %111, label %112, label %154

112:                                              ; preds = %102
  %113 = load ptr, ptr %7, align 8, !tbaa !15
  %114 = load i32, ptr %8, align 4, !tbaa !5
  %115 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %116 = load ptr, ptr %115, align 8, !tbaa !12
  %117 = load i32, ptr %4, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds i32, ptr %116, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = sub nsw i32 %114, %120
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds i32, ptr %113, i64 %122
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = icmp ne i32 %124, 0
  br i1 %125, label %126, label %154

126:                                              ; preds = %112
  %127 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %128 = load ptr, ptr %127, align 8, !tbaa !12
  %129 = load i32, ptr %4, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds i32, ptr %128, i64 %130
  %132 = load i32, ptr %131, align 4, !tbaa !5
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !12
  %136 = load i32, ptr %4, align 4, !tbaa !5
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i32, ptr %135, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !5
  %140 = sub nsw i32 %133, %139
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %132, i32 noundef %140, i32 noundef %141)
  %143 = load ptr, ptr %7, align 8, !tbaa !15
  %144 = getelementptr inbounds %struct.Array, ptr %3, i32 0, i32 0
  %145 = load ptr, ptr %144, align 8, !tbaa !12
  %146 = load i32, ptr %4, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds i32, ptr %145, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !5
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds i32, ptr %143, i64 %150
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = add nsw i32 %152, -1
  store i32 %153, ptr %151, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %126, %112, %102
  br label %155

155:                                              ; preds = %154
  %156 = load i32, ptr %4, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %4, align 4, !tbaa !5
  br label %97, !llvm.loop !18

158:                                              ; preds = %97
  %159 = load ptr, ptr %7, align 8, !tbaa !15
  call void @free(ptr noundef %159) #5
  store ptr null, ptr %7, align 8, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  ret void
}

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

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #3

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #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 = { 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 = { nounwind allocsize(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 = { 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 #5 = { nounwind }
attributes #6 = { nounwind allocsize(0) }

!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 = !{!10, !6, i64 8}
!10 = !{!"Array", !11, i64 0, !6, i64 8}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!11, !11, i64 0}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}


; 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 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @pairwithsumhash(ptr nocapture readonly %0, i32 %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3)
  %6 = icmp sgt i32 %1, 0
  br i1 %6, label %.lr.ph.preheader, label %.preheader49.thread

.preheader49.thread:                              ; preds = %2
  %calloc77 = call dereferenceable_or_null(4) ptr @calloc(i64 1, i64 4)
  br label %._crit_edge61

.lr.ph.preheader:                                 ; preds = %2
  %wide.trip.count = zext nneg i32 %1 to i64
  %min.iters.check = icmp ult i32 %1, 8
  br i1 %min.iters.check, label %.lr.ph.preheader80, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  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> [ zeroinitializer, %vector.ph ], [ %9, %vector.body ]
  %vec.phi78 = phi <4 x i32> [ zeroinitializer, %vector.ph ], [ %10, %vector.body ]
  %7 = getelementptr inbounds i32, ptr %0, i64 %index
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  %wide.load = load <4 x i32>, ptr %7, align 4, !tbaa !5
  %wide.load79 = load <4 x i32>, ptr %8, align 4, !tbaa !5
  %9 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load, <4 x i32> %vec.phi)
  %10 = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %wide.load79, <4 x i32> %vec.phi78)
  %index.next = add nuw i64 %index, 8
  %11 = icmp eq i64 %index.next, %n.vec
  br i1 %11, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %rdx.minmax = call <4 x i32> @llvm.smax.v4i32(<4 x i32> %9, <4 x i32> %10)
  %12 = call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax)
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader49, label %.lr.ph.preheader80

.lr.ph.preheader80:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  %.04051.ph = phi i32 [ 0, %.lr.ph.preheader ], [ %12, %middle.block ]
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader80, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader80 ]
  %.04051 = phi i32 [ %spec.select, %.lr.ph ], [ %.04051.ph, %.lr.ph.preheader80 ]
  %13 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %spec.select = call i32 @llvm.smax.i32(i32 %14, i32 %.04051)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader49, label %.lr.ph, !llvm.loop !13

.preheader49:                                     ; preds = %.lr.ph, %middle.block
  %spec.select.lcssa = phi i32 [ %12, %middle.block ], [ %spec.select, %.lr.ph ]
  %15 = add nuw i32 %spec.select.lcssa, 1
  %16 = zext i32 %15 to i64
  %17 = shl nuw nsw i64 %16, 2
  %calloc = call ptr @calloc(i64 1, i64 %17)
  br i1 %6, label %.lr.ph58.preheader, label %._crit_edge61

.lr.ph58.preheader:                               ; preds = %.preheader49
  %wide.trip.count69 = zext nneg i32 %1 to i64
  %xtraiter = and i64 %wide.trip.count69, 3
  %18 = icmp ult i32 %1, 4
  br i1 %18, label %.preheader.unr-lcssa, label %.lr.ph58.preheader.new

.lr.ph58.preheader.new:                           ; preds = %.lr.ph58.preheader
  %unroll_iter = and i64 %wide.trip.count69, 2147483644
  br label %.lr.ph58

.preheader.unr-lcssa:                             ; preds = %.lr.ph58, %.lr.ph58.preheader
  %indvars.iv66.unr = phi i64 [ 0, %.lr.ph58.preheader ], [ %indvars.iv.next67.3, %.lr.ph58 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph58.epil

.lr.ph58.epil:                                    ; preds = %.preheader.unr-lcssa, %.lr.ph58.epil
  %indvars.iv66.epil = phi i64 [ %indvars.iv.next67.epil, %.lr.ph58.epil ], [ %indvars.iv66.unr, %.preheader.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph58.epil ], [ 0, %.preheader.unr-lcssa ]
  %19 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv66.epil
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr %calloc, i64 %21
  store i32 1, ptr %22, align 4, !tbaa !5
  %indvars.iv.next67.epil = add nuw nsw i64 %indvars.iv66.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader, label %.lr.ph58.epil, !llvm.loop !14

.preheader:                                       ; preds = %.lr.ph58.epil, %.preheader.unr-lcssa
  br i1 %6, label %.lr.ph60.preheader, label %._crit_edge61

.lr.ph60.preheader:                               ; preds = %.preheader
  %wide.trip.count74 = zext nneg i32 %1 to i64
  br label %.lr.ph60

.lr.ph58:                                         ; preds = %.lr.ph58, %.lr.ph58.preheader.new
  %indvars.iv66 = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %indvars.iv.next67.3, %.lr.ph58 ]
  %niter = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %niter.next.3, %.lr.ph58 ]
  %23 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv66
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds i32, ptr %calloc, i64 %25
  store i32 1, ptr %26, align 4, !tbaa !5
  %indvars.iv.next67 = or disjoint i64 %indvars.iv66, 1
  %27 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv.next67
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr %calloc, i64 %29
  store i32 1, ptr %30, align 4, !tbaa !5
  %indvars.iv.next67.1 = or disjoint i64 %indvars.iv66, 2
  %31 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv.next67.1
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds i32, ptr %calloc, i64 %33
  store i32 1, ptr %34, align 4, !tbaa !5
  %indvars.iv.next67.2 = or disjoint i64 %indvars.iv66, 3
  %35 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv.next67.2
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds i32, ptr %calloc, i64 %37
  store i32 1, ptr %38, align 4, !tbaa !5
  %indvars.iv.next67.3 = add nuw nsw i64 %indvars.iv66, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader.unr-lcssa, label %.lr.ph58, !llvm.loop !16

.lr.ph60:                                         ; preds = %.lr.ph60.preheader, %55
  %indvars.iv71 = phi i64 [ 0, %.lr.ph60.preheader ], [ %indvars.iv.next72, %55 ]
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = getelementptr inbounds i32, ptr %0, i64 %indvars.iv71
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = sub nsw i32 %39, %41
  %43 = icmp sgt i32 %42, -1
  br i1 %43, label %44, label %55

44:                                               ; preds = %.lr.ph60
  %45 = zext nneg i32 %42 to i64
  %46 = getelementptr inbounds i32, ptr %calloc, i64 %45
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %.not48 = icmp eq i32 %47, 0
  br i1 %.not48, label %55, label %48

48:                                               ; preds = %44
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %41, i32 noundef %42, i32 noundef %39)
  %50 = load i32, ptr %40, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr %calloc, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = add nsw i32 %53, -1
  store i32 %54, ptr %52, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %.lr.ph60, %44, %48
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %exitcond75.not = icmp eq i64 %indvars.iv.next72, %wide.trip.count74
  br i1 %exitcond75.not, label %._crit_edge61, label %.lr.ph60, !llvm.loop !17

._crit_edge61:                                    ; preds = %55, %.preheader49, %.preheader49.thread, %.preheader
  %56 = phi ptr [ %calloc, %.preheader ], [ %calloc, %.preheader49 ], [ %calloc77, %.preheader49.thread ], [ %calloc, %55 ]
  call void @free(ptr noundef %56) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret void
}

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

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

; 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 memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

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

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #5

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #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 nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
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/C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


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