; LLVM IR from hans-ob1/neural_cam_ros :: src/detector (maxpool_layer)

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

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

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

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nounwind allocsize(1) "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 }
attributes #4 = { nounwind allocsize(1) }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 96}
!12 = !{!"layer", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !10, i64 164, !10, i64 168, !10, i64 172, !10, i64 176, !13, i64 180, !13, i64 184, !13, i64 188, !13, i64 192, !13, i64 196, !13, i64 200, !13, i64 204, !10, i64 208, !10, i64 212, !10, i64 216, !10, i64 220, !10, i64 224, !10, i64 228, !10, i64 232, !10, i64 236, !10, i64 240, !10, i64 244, !10, i64 248, !10, i64 252, !13, i64 256, !13, i64 260, !13, i64 264, !10, i64 268, !13, i64 272, !13, i64 276, !13, i64 280, !13, i64 284, !13, i64 288, !13, i64 292, !13, i64 296, !10, i64 300, !10, i64 304, !13, i64 308, !10, i64 312, !10, i64 316, !10, i64 320, !10, i64 324, !13, i64 328, !13, i64 332, !13, i64 336, !6, i64 344, !6, i64 352, !6, i64 360, !6, i64 368, !6, i64 376, !6, i64 384, !6, i64 392, !6, i64 400, !6, i64 408, !6, i64 416, !6, i64 424, !6, i64 432, !6, i64 440, !6, i64 448, !6, i64 456, !6, i64 464, !6, i64 472, !6, i64 480, !6, i64 488, !6, i64 496, !6, i64 504, !6, i64 512, !6, i64 520, !6, i64 528, !6, i64 536, !6, i64 544, !6, i64 552, !6, i64 560, !6, i64 568, !6, i64 576, !6, i64 584, !6, i64 592, !6, i64 600, !6, i64 608, !6, i64 616, !6, i64 624, !6, i64 632, !6, i64 640, !6, i64 648, !6, i64 656, !6, i64 664, !6, i64 672, !6, i64 680, !6, i64 688, !6, i64 696, !6, i64 704, !6, i64 712, !6, i64 720, !6, i64 728, !6, i64 736, !6, i64 744, !6, i64 752, !6, i64 760, !6, i64 768, !6, i64 776, !6, i64 784, !6, i64 792, !14, i64 800}
!13 = !{!"float", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !10, i64 100}
!16 = !{!12, !10, i64 104}
!17 = !{!12, !10, i64 84}
!18 = !{!12, !10, i64 148}
!19 = !{!12, !10, i64 140}
!20 = !{!12, !10, i64 112}
!21 = !{!12, !10, i64 108}
!22 = !{!12, !10, i64 88}
!23 = !{!12, !10, i64 72}
!24 = !{!12, !6, i64 352}
!25 = !{!12, !6, i64 528}
!26 = !{!12, !6, i64 520}


; 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: mustprogress nounwind willreturn uwtable
define dso_local void @resize_maxpool_layer(ptr nocapture noundef %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 96
  store i32 %2, ptr %4, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 100
  store i32 %1, ptr %5, align 4, !tbaa !13
  %6 = mul nsw i32 %2, %1
  %7 = getelementptr inbounds i8, ptr %0, i64 104
  %8 = load i32, ptr %7, align 8, !tbaa !14
  %9 = mul nsw i32 %6, %8
  %10 = getelementptr inbounds i8, ptr %0, i64 84
  store i32 %9, ptr %10, align 4, !tbaa !15
  %11 = getelementptr inbounds i8, ptr %0, i64 148
  %12 = load i32, ptr %11, align 4, !tbaa !16
  %13 = shl nsw i32 %12, 1
  %14 = add nsw i32 %13, %1
  %15 = getelementptr inbounds i8, ptr %0, i64 140
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %17 = sdiv i32 %14, %16
  %18 = getelementptr inbounds i8, ptr %0, i64 112
  store i32 %17, ptr %18, align 8, !tbaa !18
  %19 = add nsw i32 %13, %2
  %20 = sdiv i32 %19, %16
  %21 = getelementptr inbounds i8, ptr %0, i64 108
  store i32 %20, ptr %21, align 4, !tbaa !19
  %22 = mul i32 %17, %8
  %23 = mul i32 %22, %20
  %24 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 %23, ptr %24, align 8, !tbaa !20
  %25 = getelementptr inbounds i8, ptr %0, i64 72
  %26 = load i32, ptr %25, align 8, !tbaa !21
  %27 = mul nsw i32 %26, %23
  %28 = getelementptr inbounds i8, ptr %0, i64 352
  %29 = load ptr, ptr %28, align 8, !tbaa !22
  %30 = sext i32 %27 to i64
  %31 = shl nsw i64 %30, 2
  %32 = tail call ptr @realloc(ptr noundef %29, i64 noundef %31) #2
  store ptr %32, ptr %28, align 8, !tbaa !22
  %33 = getelementptr inbounds i8, ptr %0, i64 528
  %34 = load ptr, ptr %33, align 8, !tbaa !23
  %35 = tail call ptr @realloc(ptr noundef %34, i64 noundef %31) #2
  store ptr %35, ptr %33, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %0, i64 520
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  %38 = tail call ptr @realloc(ptr noundef %37, i64 noundef %31) #2
  store ptr %38, ptr %36, align 8, !tbaa !24
  ret void
}

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nounwind willreturn 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 nounwind willreturn allockind("realloc") allocsize(1) 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 #2 = { nounwind allocsize(1) }

!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 96}
!6 = !{!"layer", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !7, i64 144, !7, i64 148, !7, i64 152, !7, i64 156, !7, i64 160, !7, i64 164, !7, i64 168, !7, i64 172, !7, i64 176, !11, i64 180, !11, i64 184, !11, i64 188, !11, i64 192, !11, i64 196, !11, i64 200, !11, i64 204, !7, i64 208, !7, i64 212, !7, i64 216, !7, i64 220, !7, i64 224, !7, i64 228, !7, i64 232, !7, i64 236, !7, i64 240, !7, i64 244, !7, i64 248, !7, i64 252, !11, i64 256, !11, i64 260, !11, i64 264, !7, i64 268, !11, i64 272, !11, i64 276, !11, i64 280, !11, i64 284, !11, i64 288, !11, i64 292, !11, i64 296, !7, i64 300, !7, i64 304, !11, i64 308, !7, i64 312, !7, i64 316, !7, i64 320, !7, i64 324, !11, i64 328, !11, i64 332, !11, i64 336, !10, i64 344, !10, i64 352, !10, i64 360, !10, i64 368, !10, i64 376, !10, i64 384, !10, i64 392, !10, i64 400, !10, i64 408, !10, i64 416, !10, i64 424, !10, i64 432, !10, i64 440, !10, i64 448, !10, i64 456, !10, i64 464, !10, i64 472, !10, i64 480, !10, i64 488, !10, i64 496, !10, i64 504, !10, i64 512, !10, i64 520, !10, i64 528, !10, i64 536, !10, i64 544, !10, i64 552, !10, i64 560, !10, i64 568, !10, i64 576, !10, i64 584, !10, i64 592, !10, i64 600, !10, i64 608, !10, i64 616, !10, i64 624, !10, i64 632, !10, i64 640, !10, i64 648, !10, i64 656, !10, i64 664, !10, i64 672, !10, i64 680, !10, i64 688, !10, i64 696, !10, i64 704, !10, i64 712, !10, i64 720, !10, i64 728, !10, i64 736, !10, i64 744, !10, i64 752, !10, i64 760, !10, i64 768, !10, i64 776, !10, i64 784, !10, i64 792, !12, i64 800}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!"long", !8, i64 0}
!13 = !{!6, !7, i64 100}
!14 = !{!6, !7, i64 104}
!15 = !{!6, !7, i64 84}
!16 = !{!6, !7, i64 148}
!17 = !{!6, !7, i64 140}
!18 = !{!6, !7, i64 112}
!19 = !{!6, !7, i64 108}
!20 = !{!6, !7, i64 88}
!21 = !{!6, !7, i64 72}
!22 = !{!6, !10, i64 352}
!23 = !{!6, !10, i64 528}
!24 = !{!6, !10, i64 520}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,TailCallElimPass