; LLVM IR from simonaertssen/MIT-6.172-Performance-Engineering-of-Software-Systems :: Week 2 Bentleys rules and bit hacks/homework (tests)

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

@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@randomSeed = external hidden global i32, align 4
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [24 x i8], align 1
@stderr = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [26 x i8], align 1
@__func__.test_subarray = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test_subarray(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #0 {
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !9
  store i32 %4, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !5
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = mul i64 %20, 4
  %22 = call noalias ptr @malloc(i64 noundef %21) #8
  store ptr %22, ptr %11, align 8, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = mul i64 %24, 4
  %26 = call noalias ptr @malloc(i64 noundef %25) #8
  store ptr %26, ptr %12, align 8, !tbaa !9
  %27 = load ptr, ptr %11, align 8, !tbaa !9
  %28 = icmp eq ptr %27, null
  br i1 %28, label %32, label %29

29:                                               ; preds = %5
  %30 = load ptr, ptr %12, align 8, !tbaa !9
  %31 = icmp eq ptr %30, null
  br i1 %31, label %32, label %36

32:                                               ; preds = %29, %5
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %34 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %34) #7
  %35 = load ptr, ptr %12, align 8, !tbaa !9
  call void @free(ptr noundef %35) #7
  call void @exit(i32 noundef -1) #9
  unreachable

36:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %57, %36
  %38 = load i32, ptr %14, align 4, !tbaa !5
  %39 = load i32, ptr %7, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %60

42:                                               ; preds = %37
  %43 = call i32 @rand_r(ptr noundef @randomSeed) #7
  %44 = load ptr, ptr %11, align 8, !tbaa !9
  %45 = load i32, ptr %14, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds i32, ptr %44, i64 %46
  store i32 %43, ptr %47, align 4, !tbaa !5
  %48 = load ptr, ptr %11, align 8, !tbaa !9
  %49 = load i32, ptr %14, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr %48, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = load i32, ptr %14, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %53, i64 %55
  store i32 %52, ptr %56, align 4, !tbaa !5
  br label %57

57:                                               ; preds = %42
  %58 = load i32, ptr %14, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %14, align 4, !tbaa !5
  br label %37, !llvm.loop !11

60:                                               ; preds = %41
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = icmp ne i32 %61, 0
  br i1 %62, label %63, label %67

63:                                               ; preds = %60
  %64 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %65 = load ptr, ptr %11, align 8, !tbaa !9
  %66 = load i32, ptr %7, align 4, !tbaa !5
  call void @display_array(ptr noundef %65, i32 noundef %66)
  br label %67

67:                                               ; preds = %63, %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %68 = call i32 @rand_r(ptr noundef @randomSeed) #7
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = srem i32 %68, %69
  store i32 %70, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = sub nsw i32 %71, 1
  %73 = load i32, ptr %15, align 4, !tbaa !5
  %74 = sub nsw i32 %72, %73
  store i32 %74, ptr %16, align 4, !tbaa !5
  %75 = load i32, ptr %15, align 4, !tbaa !5
  %76 = load i32, ptr %16, align 4, !tbaa !5
  %77 = icmp sgt i32 %75, %76
  br i1 %77, label %78, label %82

78:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  %79 = load i32, ptr %15, align 4, !tbaa !5
  store i32 %79, ptr %17, align 4, !tbaa !5
  %80 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %80, ptr %15, align 4, !tbaa !5
  %81 = load i32, ptr %17, align 4, !tbaa !5
  store i32 %81, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  br label %82

82:                                               ; preds = %78, %67
  %83 = load i32, ptr %15, align 4, !tbaa !5
  %84 = load i32, ptr %16, align 4, !tbaa !5
  %85 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %83, i32 noundef %84)
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  store i32 0, ptr %18, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %116, %82
  %87 = load i32, ptr %18, align 4, !tbaa !5
  %88 = load i32, ptr %10, align 4, !tbaa !5
  %89 = icmp slt i32 %87, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  br label %119

91:                                               ; preds = %86
  %92 = load ptr, ptr %9, align 8, !tbaa !9
  %93 = load i32, ptr %18, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds %struct.testFunc_t, ptr %92, i64 %94
  %96 = getelementptr inbounds %struct.testFunc_t, ptr %95, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8, !tbaa !13
  %98 = load ptr, ptr %11, align 8, !tbaa !9
  %99 = load i32, ptr %15, align 4, !tbaa !5
  %100 = load i32, ptr %16, align 4, !tbaa !5
  call void %97(ptr noundef %98, i32 noundef %99, i32 noundef %100)
  %101 = load ptr, ptr %11, align 8, !tbaa !9
  %102 = load ptr, ptr %12, align 8, !tbaa !9
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = load ptr, ptr %9, align 8, !tbaa !9
  %106 = load i32, ptr %18, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds %struct.testFunc_t, ptr %105, i64 %107
  %109 = getelementptr inbounds %struct.testFunc_t, ptr %108, i32 0, i32 1
  %110 = load ptr, ptr %109, align 8, !tbaa !15
  %111 = load i32, ptr %15, align 4, !tbaa !5
  %112 = load i32, ptr %16, align 4, !tbaa !5
  %113 = call i32 @post_process(ptr noundef %101, ptr noundef %102, i32 noundef %103, i32 noundef %104, ptr noundef %110, i32 noundef %111, i32 noundef %112)
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = and i32 %114, %113
  store i32 %115, ptr %13, align 4, !tbaa !5
  br label %116

116:                                              ; preds = %91
  %117 = load i32, ptr %18, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %18, align 4, !tbaa !5
  br label %86, !llvm.loop !16

119:                                              ; preds = %90
  %120 = load i32, ptr %13, align 4, !tbaa !5
  %121 = icmp ne i32 %120, 0
  br i1 %121, label %122, label %126

122:                                              ; preds = %119
  %123 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %124 = load ptr, ptr @stderr, align 8, !tbaa !9
  %125 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %124, ptr noundef @.str.6, ptr noundef @__func__.test_subarray, i32 noundef 313) #7
  br label %136

126:                                              ; preds = %119
  br label %127

127:                                              ; preds = %126
  %128 = load ptr, ptr @stderr, align 8, !tbaa !9
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str.7, ptr noundef @__func__.test_subarray, i32 noundef 315) #7
  %130 = load ptr, ptr @stderr, align 8, !tbaa !9
  %131 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %130, ptr noundef @.str.8) #7
  %132 = load ptr, ptr @stderr, align 8, !tbaa !9
  %133 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %132, ptr noundef @.str.9) #7
  br label %134

134:                                              ; preds = %127
  br label %135

135:                                              ; preds = %134
  br label %136

136:                                              ; preds = %135, %122
  %137 = load ptr, ptr %11, align 8, !tbaa !9
  call void @free(ptr noundef %137) #7
  %138 = load ptr, ptr %12, align 8, !tbaa !9
  call void @free(ptr noundef %138) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  ret void
}

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

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

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #5

; Function Attrs: nounwind
declare i32 @rand_r(ptr noundef) #4

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @display_array(ptr noundef, i32 noundef) #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @post_process(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) #6

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, 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 = { 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 #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 = { 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 = { noreturn 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 #6 = { inlinehint 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 #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { noreturn 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 0}
!14 = !{!"testFunc_t", !10, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = distinct !{!16, !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"

%struct.testFunc_t = type { ptr, ptr }

@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@randomSeed = external hidden global i32, align 4
@.str.3 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [24 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [26 x i8], align 1
@__func__.test_subarray = external hidden unnamed_addr constant [14 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @test_subarray(i32 noundef %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef readonly %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = sext i32 %1 to i64
  %7 = shl nsw i64 %6, 2
  %8 = tail call noalias ptr @malloc(i64 noundef %7) #8
  %9 = tail call noalias ptr @malloc(i64 noundef %7) #8
  %10 = icmp eq ptr %8, null
  %11 = icmp eq ptr %9, null
  %or.cond = or i1 %10, %11
  br i1 %or.cond, label %13, label %.preheader

.preheader:                                       ; preds = %5
  %12 = icmp sgt i32 %1, 0
  br i1 %12, label %.lr.ph.preheader, label %._crit_edge

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

13:                                               ; preds = %5
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  tail call void @free(ptr noundef %8) #9
  tail call void @free(ptr noundef %9) #9
  tail call void @exit(i32 noundef -1) #10
  unreachable

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.not = icmp eq i32 %0, 0
  br i1 %.not, label %20, label %18

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %15 = tail call i32 @rand_r(ptr noundef nonnull @randomSeed) #9
  %16 = getelementptr inbounds i32, ptr %8, i64 %indvars.iv
  store i32 %15, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds i32, ptr %9, i64 %indvars.iv
  store i32 %15, ptr %17, align 4, !tbaa !5
  %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 %._crit_edge, label %.lr.ph, !llvm.loop !9

18:                                               ; preds = %._crit_edge
  %19 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  tail call void @display_array(ptr noundef nonnull %8, i32 noundef %1)
  br label %20

20:                                               ; preds = %18, %._crit_edge
  %21 = tail call i32 @rand_r(ptr noundef nonnull @randomSeed) #9
  %22 = srem i32 %21, %1
  %23 = xor i32 %22, -1
  %24 = add i32 %23, %1
  %spec.select = tail call i32 @llvm.smin.i32(i32 %22, i32 %24)
  %spec.select59 = tail call i32 @llvm.smax.i32(i32 %22, i32 %24)
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %spec.select, i32 noundef %spec.select59)
  %26 = icmp sgt i32 %4, 0
  br i1 %26, label %.lr.ph64.preheader, label %._crit_edge65.thread

.lr.ph64.preheader:                               ; preds = %20
  %wide.trip.count70 = zext nneg i32 %4 to i64
  br label %.lr.ph64

._crit_edge65:                                    ; preds = %.lr.ph64
  %27 = icmp eq i32 %33, 0
  br i1 %27, label %37, label %._crit_edge65.thread

.lr.ph64:                                         ; preds = %.lr.ph64.preheader, %.lr.ph64
  %indvars.iv67 = phi i64 [ 0, %.lr.ph64.preheader ], [ %indvars.iv.next68, %.lr.ph64 ]
  %.04861 = phi i32 [ 1, %.lr.ph64.preheader ], [ %33, %.lr.ph64 ]
  %28 = getelementptr inbounds %struct.testFunc_t, ptr %3, i64 %indvars.iv67
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  tail call void %29(ptr noundef %8, i32 noundef %spec.select, i32 noundef %spec.select59) #9
  %30 = getelementptr inbounds i8, ptr %28, i64 8
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = tail call i32 @post_process(ptr noundef %8, ptr noundef %9, i32 noundef %1, i32 noundef %0, ptr noundef %31, i32 noundef %spec.select, i32 noundef %spec.select59)
  %33 = and i32 %32, %.04861
  %indvars.iv.next68 = add nuw nsw i64 %indvars.iv67, 1
  %exitcond71.not = icmp eq i64 %indvars.iv.next68, %wide.trip.count70
  br i1 %exitcond71.not, label %._crit_edge65, label %.lr.ph64, !llvm.loop !15

._crit_edge65.thread:                             ; preds = %20, %._crit_edge65
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %35 = load ptr, ptr @stderr, align 8, !tbaa !16
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef nonnull @.str.6, ptr noundef nonnull @__func__.test_subarray, i32 noundef 313) #11
  br label %44

37:                                               ; preds = %._crit_edge65
  %38 = load ptr, ptr @stderr, align 8, !tbaa !16
  %39 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %38, ptr noundef nonnull @.str.7, ptr noundef nonnull @__func__.test_subarray, i32 noundef 315) #11
  %40 = load ptr, ptr @stderr, align 8, !tbaa !16
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef nonnull @.str.8) #11
  %42 = load ptr, ptr @stderr, align 8, !tbaa !16
  %43 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef nonnull @.str.9) #11
  br label %44

44:                                               ; preds = %37, %._crit_edge65.thread
  tail call void @free(ptr noundef %8) #9
  tail call void @free(ptr noundef %9) #9
  ret void
}

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

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

; 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: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind
declare i32 @rand_r(ptr noundef) local_unnamed_addr #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @display_array(ptr noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @post_process(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #6

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

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

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

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 nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #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 = { noreturn 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 "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 = { inlinehint 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { noreturn nounwind }
attributes #11 = { cold 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 = !{!12, !13, i64 0}
!12 = !{!"testFunc_t", !13, i64 0, !13, i64 8}
!13 = !{!"any pointer", !7, i64 0}
!14 = !{!12, !13, i64 8}
!15 = distinct !{!15, !10}
!16 = !{!13, !13, i64 0}


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