; LLVM IR from ubaldot/defrecs :: stm32f4x/ADC_Readings/Drivers/CMSIS/NN/Source/PoolingFunctions (s8)

; 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.cmsis_nn_dims = type { i32, i32, i32, i32 }
%struct.cmsis_nn_pool_params = type { %struct.cmsis_nn_tile, %struct.cmsis_nn_tile, %struct.cmsis_nn_activation }
%struct.cmsis_nn_tile = type { i32, i32 }
%struct.cmsis_nn_activation = type { i32, i32 }

; Function Attrs: nounwind uwtable
define dso_local i32 @arm_max_pool_s8(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6) #0 {
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  %25 = alloca i32, align 4
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  %28 = alloca ptr, align 8
  %29 = alloca i32, align 4
  %30 = alloca i32, align 4
  %31 = alloca i32, align 4
  %32 = alloca i32, align 4
  %33 = alloca i32, align 4
  %34 = alloca i32, align 4
  %35 = alloca i32, align 4
  %36 = alloca i32, align 4
  %37 = alloca i32, align 4
  %38 = alloca i32, align 4
  %39 = alloca i32, align 4
  %40 = alloca i32, align 4
  %41 = alloca ptr, align 8
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  store ptr %6, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %42 = load ptr, ptr %10, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %42, i32 0, i32 1
  %44 = load i32, ptr %43, align 4, !tbaa !9
  store i32 %44, ptr %15, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #3
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %45, i32 0, i32 2
  %47 = load i32, ptr %46, align 4, !tbaa !13
  store i32 %47, ptr %16, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #3
  %48 = load ptr, ptr %13, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %48, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !9
  store i32 %50, ptr %17, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #3
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %51, i32 0, i32 2
  %53 = load i32, ptr %52, align 4, !tbaa !13
  store i32 %53, ptr %18, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #3
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.cmsis_nn_pool_params, ptr %54, i32 0, i32 0
  %56 = getelementptr inbounds %struct.cmsis_nn_tile, ptr %55, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !14
  store i32 %57, ptr %19, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #3
  %58 = load ptr, ptr %9, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.cmsis_nn_pool_params, ptr %58, i32 0, i32 0
  %60 = getelementptr inbounds %struct.cmsis_nn_tile, ptr %59, i32 0, i32 0
  %61 = load i32, ptr %60, align 4, !tbaa !17
  store i32 %61, ptr %20, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #3
  %62 = load ptr, ptr %12, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %62, i32 0, i32 1
  %64 = load i32, ptr %63, align 4, !tbaa !9
  store i32 %64, ptr %21, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #3
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 4, !tbaa !13
  store i32 %67, ptr %22, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #3
  %68 = load ptr, ptr %9, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.cmsis_nn_pool_params, ptr %68, i32 0, i32 1
  %70 = getelementptr inbounds %struct.cmsis_nn_tile, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !18
  store i32 %71, ptr %23, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #3
  %72 = load ptr, ptr %9, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.cmsis_nn_pool_params, ptr %72, i32 0, i32 1
  %74 = getelementptr inbounds %struct.cmsis_nn_tile, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 4, !tbaa !19
  store i32 %75, ptr %24, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %25) #3
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.cmsis_nn_pool_params, ptr %76, i32 0, i32 2
  %78 = getelementptr inbounds %struct.cmsis_nn_activation, ptr %77, i32 0, i32 0
  %79 = load i32, ptr %78, align 4, !tbaa !20
  store i32 %79, ptr %25, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #3
  %80 = load ptr, ptr %9, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.cmsis_nn_pool_params, ptr %80, i32 0, i32 2
  %82 = getelementptr inbounds %struct.cmsis_nn_activation, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !21
  store i32 %83, ptr %26, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #3
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.cmsis_nn_dims, ptr %84, i32 0, i32 3
  %86 = load i32, ptr %85, align 4, !tbaa !22
  store i32 %86, ptr %27, align 4, !tbaa !12
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #3
  %88 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %88, ptr %28, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %29) #3
  store i32 0, ptr %29, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %30) #3
  %89 = load i32, ptr %23, align 4, !tbaa !12
  %90 = sub nsw i32 0, %89
  store i32 %90, ptr %30, align 4, !tbaa !12
  br label %91

91:                                               ; preds = %209, %7
  %92 = load i32, ptr %29, align 4, !tbaa !12
  %93 = load i32, ptr %17, align 4, !tbaa !12
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 2, ptr %31, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %30) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %29) #3
  br label %215

96:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %32) #3
  store i32 0, ptr %32, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %33) #3
  %97 = load i32, ptr %24, align 4, !tbaa !12
  %98 = sub nsw i32 0, %97
  store i32 %98, ptr %33, align 4, !tbaa !12
  br label %99

99:                                               ; preds = %202, %96
  %100 = load i32, ptr %32, align 4, !tbaa !12
  %101 = load i32, ptr %18, align 4, !tbaa !12
  %102 = icmp slt i32 %100, %101
  br i1 %102, label %104, label %103

103:                                              ; preds = %99
  store i32 5, ptr %31, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %33) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %32) #3
  br label %208

104:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %34) #3
  %105 = load i32, ptr %30, align 4, !tbaa !12
  %106 = sub nsw i32 0, %105
  %107 = icmp sgt i32 0, %106
  br i1 %107, label %108, label %109

108:                                              ; preds = %104
  br label %112

109:                                              ; preds = %104
  %110 = load i32, ptr %30, align 4, !tbaa !12
  %111 = sub nsw i32 0, %110
  br label %112

112:                                              ; preds = %109, %108
  %113 = phi i32 [ 0, %108 ], [ %111, %109 ]
  store i32 %113, ptr %34, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %35) #3
  %114 = load i32, ptr %33, align 4, !tbaa !12
  %115 = sub nsw i32 0, %114
  %116 = icmp sgt i32 0, %115
  br i1 %116, label %117, label %118

117:                                              ; preds = %112
  br label %121

118:                                              ; preds = %112
  %119 = load i32, ptr %33, align 4, !tbaa !12
  %120 = sub nsw i32 0, %119
  br label %121

121:                                              ; preds = %118, %117
  %122 = phi i32 [ 0, %117 ], [ %120, %118 ]
  store i32 %122, ptr %35, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %36) #3
  %123 = load i32, ptr %21, align 4, !tbaa !12
  %124 = load i32, ptr %15, align 4, !tbaa !12
  %125 = load i32, ptr %30, align 4, !tbaa !12
  %126 = sub nsw i32 %124, %125
  %127 = icmp slt i32 %123, %126
  br i1 %127, label %128, label %130

128:                                              ; preds = %121
  %129 = load i32, ptr %21, align 4, !tbaa !12
  br label %134

130:                                              ; preds = %121
  %131 = load i32, ptr %15, align 4, !tbaa !12
  %132 = load i32, ptr %30, align 4, !tbaa !12
  %133 = sub nsw i32 %131, %132
  br label %134

134:                                              ; preds = %130, %128
  %135 = phi i32 [ %129, %128 ], [ %133, %130 ]
  store i32 %135, ptr %36, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %37) #3
  %136 = load i32, ptr %22, align 4, !tbaa !12
  %137 = load i32, ptr %16, align 4, !tbaa !12
  %138 = load i32, ptr %33, align 4, !tbaa !12
  %139 = sub nsw i32 %137, %138
  %140 = icmp slt i32 %136, %139
  br i1 %140, label %141, label %143

141:                                              ; preds = %134
  %142 = load i32, ptr %22, align 4, !tbaa !12
  br label %147

143:                                              ; preds = %134
  %144 = load i32, ptr %16, align 4, !tbaa !12
  %145 = load i32, ptr %33, align 4, !tbaa !12
  %146 = sub nsw i32 %144, %145
  br label %147

147:                                              ; preds = %143, %141
  %148 = phi i32 [ %142, %141 ], [ %146, %143 ]
  store i32 %148, ptr %37, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %38) #3
  store i32 0, ptr %38, align 4, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %39) #3
  %149 = load i32, ptr %34, align 4, !tbaa !12
  store i32 %149, ptr %39, align 4, !tbaa !12
  br label %150

150:                                              ; preds = %194, %147
  %151 = load i32, ptr %39, align 4, !tbaa !12
  %152 = load i32, ptr %36, align 4, !tbaa !12
  %153 = icmp slt i32 %151, %152
  br i1 %153, label %155, label %154

154:                                              ; preds = %150
  store i32 8, ptr %31, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %39) #3
  br label %197

155:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %40) #3
  %156 = load i32, ptr %35, align 4, !tbaa !12
  store i32 %156, ptr %40, align 4, !tbaa !12
  br label %157

157:                                              ; preds = %190, %155
  %158 = load i32, ptr %40, align 4, !tbaa !12
  %159 = load i32, ptr %37, align 4, !tbaa !12
  %160 = icmp slt i32 %158, %159
  br i1 %160, label %162, label %161

161:                                              ; preds = %157
  store i32 11, ptr %31, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %40) #3
  br label %193

162:                                              ; preds = %157
  call void @llvm.lifetime.start.p0(i64 8, ptr %41) #3
  %163 = load ptr, ptr %11, align 8, !tbaa !5
  %164 = load i32, ptr %27, align 4, !tbaa !12
  %165 = load i32, ptr %40, align 4, !tbaa !12
  %166 = load i32, ptr %33, align 4, !tbaa !12
  %167 = add nsw i32 %165, %166
  %168 = load i32, ptr %39, align 4, !tbaa !12
  %169 = load i32, ptr %30, align 4, !tbaa !12
  %170 = add nsw i32 %168, %169
  %171 = load i32, ptr %16, align 4, !tbaa !12
  %172 = mul nsw i32 %170, %171
  %173 = add nsw i32 %167, %172
  %174 = mul nsw i32 %164, %173
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds i8, ptr %163, i64 %175
  store ptr %176, ptr %41, align 8, !tbaa !5
  %177 = load i32, ptr %38, align 4, !tbaa !12
  %178 = icmp eq i32 %177, 0
  br i1 %178, label %179, label %185

179:                                              ; preds = %162
  %180 = load ptr, ptr %14, align 8, !tbaa !5
  %181 = load ptr, ptr %41, align 8, !tbaa !5
  %182 = load i32, ptr %27, align 4, !tbaa !12
  call void @arm_memcpy_q7(ptr noundef %180, ptr noundef %181, i32 noundef %182)
  %183 = load i32, ptr %38, align 4, !tbaa !12
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %38, align 4, !tbaa !12
  br label %189

185:                                              ; preds = %162
  %186 = load ptr, ptr %14, align 8, !tbaa !5
  %187 = load ptr, ptr %41, align 8, !tbaa !5
  %188 = load i32, ptr %27, align 4, !tbaa !12
  call void @compare_and_replace_if_larger_q7(ptr noundef %186, ptr noundef %187, i32 noundef %188)
  br label %189

189:                                              ; preds = %185, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %41) #3
  br label %190

190:                                              ; preds = %189
  %191 = load i32, ptr %40, align 4, !tbaa !12
  %192 = add nsw i32 %191, 1
  store i32 %192, ptr %40, align 4, !tbaa !12
  br label %157, !llvm.loop !23

193:                                              ; preds = %161
  br label %194

194:                                              ; preds = %193
  %195 = load i32, ptr %39, align 4, !tbaa !12
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %39, align 4, !tbaa !12
  br label %150, !llvm.loop !25

197:                                              ; preds = %154
  %198 = load i32, ptr %27, align 4, !tbaa !12
  %199 = load ptr, ptr %14, align 8, !tbaa !5
  %200 = sext i32 %198 to i64
  %201 = getelementptr inbounds i8, ptr %199, i64 %200
  store ptr %201, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %38) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %37) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %36) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %35) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %34) #3
  br label %202

202:                                              ; preds = %197
  %203 = load i32, ptr %20, align 4, !tbaa !12
  %204 = load i32, ptr %33, align 4, !tbaa !12
  %205 = add nsw i32 %204, %203
  store i32 %205, ptr %33, align 4, !tbaa !12
  %206 = load i32, ptr %32, align 4, !tbaa !12
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %32, align 4, !tbaa !12
  br label %99, !llvm.loop !26

208:                                              ; preds = %103
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %19, align 4, !tbaa !12
  %211 = load i32, ptr %30, align 4, !tbaa !12
  %212 = add nsw i32 %211, %210
  store i32 %212, ptr %30, align 4, !tbaa !12
  %213 = load i32, ptr %29, align 4, !tbaa !12
  %214 = add nsw i32 %213, 1
  store i32 %214, ptr %29, align 4, !tbaa !12
  br label %91, !llvm.loop !27

215:                                              ; preds = %95
  %216 = load ptr, ptr %28, align 8, !tbaa !5
  %217 = load i32, ptr %18, align 4, !tbaa !12
  %218 = load i32, ptr %17, align 4, !tbaa !12
  %219 = mul nsw i32 %217, %218
  %220 = load i32, ptr %27, align 4, !tbaa !12
  %221 = mul nsw i32 %219, %220
  %222 = load i32, ptr %25, align 4, !tbaa !12
  %223 = load i32, ptr %26, align 4, !tbaa !12
  call void @clamp_output(ptr noundef %216, i32 noundef %221, i32 noundef %222, i32 noundef %223)
  store i32 1, ptr %31, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %25) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  ret i32 0
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @arm_memcpy_q7(ptr noalias noundef, ptr noalias noundef, i32 noundef) #2

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

; 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 hidden void @clamp_output(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

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 = { alwaysinline 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 #3 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 4}
!10 = !{!"", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = !{!10, !11, i64 8}
!14 = !{!15, !11, i64 4}
!15 = !{!"", !16, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"", !11, i64 0, !11, i64 4}
!17 = !{!15, !11, i64 0}
!18 = !{!15, !11, i64 12}
!19 = !{!15, !11, i64 8}
!20 = !{!15, !11, i64 16}
!21 = !{!15, !11, i64 20}
!22 = !{!10, !11, i64 12}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = distinct !{!25, !24}
!26 = distinct !{!26, !24}
!27 = distinct !{!27, !24}


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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @arm_max_pool_s8(ptr nocapture noundef readnone %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2, ptr noundef %3, ptr nocapture noundef readonly %4, ptr nocapture noundef readonly %5, ptr noundef %6) local_unnamed_addr #0 {
  %8 = getelementptr inbounds i8, ptr %2, i64 4
  %9 = load i32, ptr %8, align 4, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load i32, ptr %10, align 4, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %5, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %5, i64 8
  %15 = load i32, ptr %14, align 4, !tbaa !10
  %16 = getelementptr inbounds i8, ptr %1, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = load i32, ptr %1, align 4, !tbaa !14
  %19 = getelementptr inbounds i8, ptr %4, i64 4
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %4, i64 8
  %22 = load i32, ptr %21, align 4, !tbaa !10
  %23 = getelementptr inbounds i8, ptr %1, i64 16
  %24 = load i32, ptr %23, align 4, !tbaa !15
  %25 = getelementptr inbounds i8, ptr %1, i64 20
  %26 = load i32, ptr %25, align 4, !tbaa !16
  %27 = getelementptr inbounds i8, ptr %2, i64 12
  %28 = load i32, ptr %27, align 4, !tbaa !17
  %29 = icmp sgt i32 %13, 0
  br i1 %29, label %.lr.ph101, label %._crit_edge102

.lr.ph101:                                        ; preds = %7
  %30 = getelementptr inbounds i8, ptr %1, i64 8
  %31 = load i32, ptr %30, align 4, !tbaa !18
  %32 = sub nsw i32 0, %31
  %33 = icmp sgt i32 %15, 0
  %34 = sext i32 %28 to i64
  br i1 %33, label %.lr.ph.us.preheader, label %._crit_edge102

.lr.ph.us.preheader:                              ; preds = %.lr.ph101
  %35 = getelementptr inbounds i8, ptr %1, i64 12
  %36 = load i32, ptr %35, align 4, !tbaa !19
  %37 = sub i32 0, %36
  %38 = zext nneg i32 %15 to i64
  %39 = mul nsw i64 %38, %34
  %40 = zext i32 %37 to i64
  %41 = zext i32 %17 to i64
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv123 = phi i64 [ %40, %.lr.ph.us.preheader ], [ %indvars.iv.next124, %._crit_edge.us ]
  %indvars.iv117 = phi i32 [ %36, %.lr.ph.us.preheader ], [ %indvars.iv.next118, %._crit_edge.us ]
  %.099.us = phi ptr [ %6, %.lr.ph.us.preheader ], [ %.us-phi.us, %._crit_edge.us ]
  %.07798.us = phi i32 [ 0, %.lr.ph.us.preheader ], [ %51, %._crit_edge.us ]
  %smax119 = tail call i32 @llvm.smax.i32(i32 %indvars.iv117, i32 0)
  %42 = zext nneg i32 %smax119 to i64
  %43 = trunc i64 %indvars.iv123 to i32
  %44 = sub i32 0, %43
  %45 = tail call i32 @llvm.smax.i32(i32 %44, i32 0)
  %46 = trunc i64 %indvars.iv123 to i32
  %47 = sub i32 %9, %46
  %48 = tail call i32 @llvm.smin.i32(i32 %20, i32 %47)
  %49 = icmp slt i32 %45, %48
  br i1 %49, label %.preheader.lr.ph.us.us.preheader, label %.lr.ph.split.us108.preheader

.lr.ph.split.us108.preheader:                     ; preds = %.lr.ph.us
  %scevgep = getelementptr i8, ptr %.099.us, i64 %39
  br label %._crit_edge.us

.preheader.lr.ph.us.us.preheader:                 ; preds = %.lr.ph.us
  %50 = zext nneg i32 %48 to i64
  br label %.preheader.lr.ph.us.us

._crit_edge.us:                                   ; preds = %._crit_edge86.us.us, %.lr.ph.split.us108.preheader
  %.us-phi.us = phi ptr [ %scevgep, %.lr.ph.split.us108.preheader ], [ %59, %._crit_edge86.us.us ]
  %indvars.iv.next124 = add i64 %indvars.iv123, %41
  %51 = add nuw nsw i32 %.07798.us, 1
  %indvars.iv.next118 = sub i32 %indvars.iv117, %17
  %exitcond126.not = icmp eq i32 %51, %13
  br i1 %exitcond126.not, label %._crit_edge102, label %.lr.ph.us, !llvm.loop !20

.preheader.lr.ph.us.us:                           ; preds = %.preheader.lr.ph.us.us.preheader, %._crit_edge86.us.us
  %indvars.iv = phi i32 [ %31, %.preheader.lr.ph.us.us.preheader ], [ %indvars.iv.next, %._crit_edge86.us.us ]
  %.190.us.us = phi ptr [ %.099.us, %.preheader.lr.ph.us.us.preheader ], [ %59, %._crit_edge86.us.us ]
  %.07989.us.us = phi i32 [ 0, %.preheader.lr.ph.us.us.preheader ], [ %61, %._crit_edge86.us.us ]
  %.08087.us.us = phi i32 [ %32, %.preheader.lr.ph.us.us.preheader ], [ %60, %._crit_edge86.us.us ]
  %smax = tail call i32 @llvm.smax.i32(i32 %indvars.iv, i32 0)
  %52 = sub nsw i32 0, %.08087.us.us
  %53 = tail call i32 @llvm.smax.i32(i32 %52, i32 0)
  %54 = sub nsw i32 %11, %.08087.us.us
  %55 = tail call i32 @llvm.smin.i32(i32 %22, i32 %54)
  %56 = icmp slt i32 %53, %55
  br i1 %56, label %.preheader.us.us.us.preheader, label %._crit_edge86.us.us

.preheader.us.us.us.preheader:                    ; preds = %.preheader.lr.ph.us.us
  %57 = zext nneg i32 %55 to i64
  %narrow = add nuw i32 %smax, 1
  %indvars.iv.next114.peel = zext i32 %narrow to i64
  %58 = icmp ult i32 %narrow, %55
  br label %.preheader.us.us.us

._crit_edge86.us.us:                              ; preds = %._crit_edge.us.us.us, %.preheader.lr.ph.us.us
  %59 = getelementptr inbounds i8, ptr %.190.us.us, i64 %34
  %60 = add nsw i32 %.08087.us.us, %18
  %61 = add nuw nsw i32 %.07989.us.us, 1
  %indvars.iv.next = sub i32 %indvars.iv, %18
  %exitcond.not = icmp eq i32 %61, %15
  br i1 %exitcond.not, label %._crit_edge.us, label %.preheader.lr.ph.us.us, !llvm.loop !22

.preheader.us.us.us:                              ; preds = %.preheader.us.us.us.preheader, %._crit_edge.us.us.us
  %indvars.iv120 = phi i64 [ %42, %.preheader.us.us.us.preheader ], [ %indvars.iv.next121, %._crit_edge.us.us.us ]
  %62 = phi i1 [ true, %.preheader.us.us.us.preheader ], [ false, %._crit_edge.us.us.us ]
  %63 = add i64 %indvars.iv120, %indvars.iv123
  %64 = trunc i64 %63 to i32
  %65 = mul i32 %11, %64
  %66 = add i32 %65, %.08087.us.us
  %67 = add i32 %66, %smax
  %68 = mul nsw i32 %67, %28
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds i8, ptr %3, i64 %69
  br i1 %62, label %72, label %71

71:                                               ; preds = %.preheader.us.us.us
  tail call void @compare_and_replace_if_larger_q7(ptr noundef %.190.us.us, ptr noundef %70, i32 noundef %28)
  br label %73

72:                                               ; preds = %.preheader.us.us.us
  tail call void @arm_memcpy_q7(ptr noundef %.190.us.us, ptr noundef %70, i32 noundef %28)
  br label %73

73:                                               ; preds = %72, %71
  br i1 %58, label %.peel.next, label %._crit_edge.us.us.us

.peel.next:                                       ; preds = %73, %.peel.next
  %indvars.iv113 = phi i64 [ %indvars.iv.next114, %.peel.next ], [ %indvars.iv.next114.peel, %73 ]
  %74 = trunc nuw nsw i64 %indvars.iv113 to i32
  %75 = add i32 %66, %74
  %76 = mul nsw i32 %75, %28
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds i8, ptr %3, i64 %77
  tail call void @compare_and_replace_if_larger_q7(ptr noundef %.190.us.us, ptr noundef %78, i32 noundef %28)
  %indvars.iv.next114 = add nuw nsw i64 %indvars.iv113, 1
  %79 = icmp ult i64 %indvars.iv.next114, %57
  br i1 %79, label %.peel.next, label %._crit_edge.us.us.us, !llvm.loop !23

._crit_edge.us.us.us:                             ; preds = %.peel.next, %73
  %indvars.iv.next121 = add nuw nsw i64 %indvars.iv120, 1
  %80 = icmp ult i64 %indvars.iv.next121, %50
  br i1 %80, label %.preheader.us.us.us, label %._crit_edge86.us.us, !llvm.loop !25

._crit_edge102:                                   ; preds = %._crit_edge.us, %.lr.ph101, %7
  %81 = mul nsw i32 %15, %13
  %82 = mul nsw i32 %81, %28
  tail call void @clamp_output(ptr noundef %6, i32 noundef %82, i32 noundef %24, i32 noundef %26)
  ret i32 0
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @arm_memcpy_q7(ptr noalias noundef, ptr noalias noundef, i32 noundef) local_unnamed_addr #1

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

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

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

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

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 = { alwaysinline 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 4}
!6 = !{!"", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !7, i64 4}
!12 = !{!"", !13, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"", !7, i64 0, !7, i64 4}
!14 = !{!12, !7, i64 0}
!15 = !{!12, !7, i64 16}
!16 = !{!12, !7, i64 20}
!17 = !{!6, !7, i64 12}
!18 = !{!12, !7, i64 8}
!19 = !{!12, !7, i64 12}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = distinct !{!23, !21, !24}
!24 = !{!"llvm.loop.peeled.count", i32 1}
!25 = distinct !{!25, !21}


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