; LLVM IR from zchrissirhcz/pixel :: legacy/NaiveCNN/src (naive_infer)

; 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.px_size_t = type { i32, i32 }
%struct.NcConvolutionParam = type { i32, i32, i32, i32, i32, i32, i32, i32, %struct.px_size_t, i8, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local ptr @nc_infer_create_convolution_param(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca %struct.px_size_t, align 4
  store i32 %0, ptr %5, align 4, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !5
  store i32 %3, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #5
  %11 = call noalias ptr @malloc(i64 noundef 96) #6
  store ptr %11, ptr %9, align 8, !tbaa !9
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = load ptr, ptr %9, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.NcConvolutionParam, ptr %13, i32 0, i32 7
  store i32 %12, ptr %14, align 4, !tbaa !11
  %15 = load i32, ptr %6, align 4, !tbaa !5
  %16 = load ptr, ptr %9, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.NcConvolutionParam, ptr %16, i32 0, i32 2
  store i32 %15, ptr %17, align 8, !tbaa !15
  %18 = load i32, ptr %7, align 4, !tbaa !5
  %19 = load ptr, ptr %9, align 8, !tbaa !9
  %20 = getelementptr inbounds %struct.NcConvolutionParam, ptr %19, i32 0, i32 3
  store i32 %18, ptr %20, align 4, !tbaa !16
  %21 = load ptr, ptr %9, align 8, !tbaa !9
  %22 = getelementptr inbounds %struct.NcConvolutionParam, ptr %21, i32 0, i32 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %23 = call i64 @px_create_stride(i32 noundef 1, i32 noundef 1)
  store i64 %23, ptr %10, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %22, ptr align 4 %10, i64 8, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = load i32, ptr %5, align 4, !tbaa !5
  %27 = load i32, ptr %6, align 4, !tbaa !5
  %28 = call ptr @nc_create_blob_random(i32 noundef %24, i32 noundef %25, i32 noundef %26, i32 noundef %27, float noundef -1.000000e+00, float noundef 1.000000e+00)
  %29 = load ptr, ptr %9, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct.NcConvolutionParam, ptr %29, i32 0, i32 10
  store ptr %28, ptr %30, align 8, !tbaa !18
  %31 = load i32, ptr %7, align 4, !tbaa !5
  %32 = call ptr @nc_create_blob(i32 noundef %31, i32 noundef 1, i32 noundef 1, i32 noundef 1)
  %33 = load ptr, ptr %9, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct.NcConvolutionParam, ptr %33, i32 0, i32 12
  store ptr %32, ptr %34, align 8, !tbaa !19
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = load ptr, ptr %9, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.NcConvolutionParam, ptr %36, i32 0, i32 6
  store i32 %35, ptr %37, align 8, !tbaa !20
  %38 = load ptr, ptr %9, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.NcConvolutionParam, ptr %38, i32 0, i32 0
  store i32 -233, ptr %39, align 8, !tbaa !21
  %40 = load ptr, ptr %9, align 8, !tbaa !9
  %41 = getelementptr inbounds %struct.NcConvolutionParam, ptr %40, i32 0, i32 1
  store i32 -233, ptr %41, align 4, !tbaa !22
  %42 = load ptr, ptr %9, align 8, !tbaa !9
  %43 = getelementptr inbounds %struct.NcConvolutionParam, ptr %42, i32 0, i32 4
  store i32 -233, ptr %43, align 8, !tbaa !23
  %44 = load ptr, ptr %9, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.NcConvolutionParam, ptr %44, i32 0, i32 5
  store i32 -233, ptr %45, align 4, !tbaa !24
  %46 = load ptr, ptr %9, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.NcConvolutionParam, ptr %46, i32 0, i32 11
  store ptr null, ptr %47, align 8, !tbaa !25
  %48 = load ptr, ptr %9, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.NcConvolutionParam, ptr %48, i32 0, i32 15
  store ptr null, ptr %49, align 8, !tbaa !26
  %50 = load ptr, ptr %9, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.NcConvolutionParam, ptr %50, i32 0, i32 13
  store ptr null, ptr %51, align 8, !tbaa !27
  %52 = load ptr, ptr %9, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.NcConvolutionParam, ptr %52, i32 0, i32 14
  store ptr null, ptr %53, align 8, !tbaa !28
  %54 = load ptr, ptr %9, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.NcConvolutionParam, ptr %54, i32 0, i32 9
  store i8 0, ptr %55, align 8, !tbaa !29
  %56 = load ptr, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  ret ptr %56
}

; 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 i64 @px_create_stride(i32 noundef, i32 noundef) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

declare ptr @nc_create_blob_random(i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef) #3

declare ptr @nc_create_blob(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #3

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 28}
!12 = !{!"NcConvolutionParam", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !13, i64 32, !14, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88}
!13 = !{!"px_size_t", !6, i64 0, !6, i64 4}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !6, i64 12}
!17 = !{i64 0, i64 4, !5, i64 4, i64 4, !5}
!18 = !{!12, !10, i64 48}
!19 = !{!12, !10, i64 64}
!20 = !{!12, !6, i64 24}
!21 = !{!12, !6, i64 0}
!22 = !{!12, !6, i64 4}
!23 = !{!12, !6, i64 16}
!24 = !{!12, !6, i64 20}
!25 = !{!12, !10, i64 56}
!26 = !{!12, !10, i64 88}
!27 = !{!12, !10, i64 72}
!28 = !{!12, !10, i64 80}
!29 = !{!12, !14, i64 40}


; 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 noalias noundef ptr @nc_infer_create_convolution_param(i32 noundef %0, i32 noundef %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = tail call noalias dereferenceable_or_null(96) ptr @malloc(i64 noundef 96) #4
  %6 = getelementptr inbounds i8, ptr %5, i64 28
  store i32 %0, ptr %6, align 4, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 %1, ptr %7, align 8, !tbaa !13
  %8 = getelementptr inbounds i8, ptr %5, i64 12
  store i32 %2, ptr %8, align 4, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %5, i64 32
  %10 = tail call i64 @px_create_stride(i32 noundef 1, i32 noundef 1) #5
  store i64 %10, ptr %9, align 8
  %11 = tail call ptr @nc_create_blob_random(i32 noundef %2, i32 noundef %0, i32 noundef %0, i32 noundef %1, float noundef -1.000000e+00, float noundef 1.000000e+00) #5
  %12 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %11, ptr %12, align 8, !tbaa !15
  %13 = tail call ptr @nc_create_blob(i32 noundef %2, i32 noundef 1, i32 noundef 1, i32 noundef 1) #5
  %14 = getelementptr inbounds i8, ptr %5, i64 64
  store ptr %13, ptr %14, align 8, !tbaa !16
  %15 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 %3, ptr %15, align 8, !tbaa !17
  store i32 -233, ptr %5, align 8, !tbaa !18
  %16 = getelementptr inbounds i8, ptr %5, i64 4
  store i32 -233, ptr %16, align 4, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %5, i64 16
  store i32 -233, ptr %17, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %5, i64 20
  store i32 -233, ptr %18, align 4, !tbaa !21
  %19 = getelementptr inbounds i8, ptr %5, i64 56
  store ptr null, ptr %19, align 8, !tbaa !22
  %20 = getelementptr inbounds i8, ptr %5, i64 72
  %21 = getelementptr inbounds i8, ptr %5, i64 40
  store i8 0, ptr %21, align 8, !tbaa !23
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %20, i8 0, i64 24, i1 false)
  ret ptr %5
}

; 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

declare i64 @px_create_stride(i32 noundef, i32 noundef) local_unnamed_addr #2

declare ptr @nc_create_blob_random(i32 noundef, i32 noundef, i32 noundef, i32 noundef, float noundef, float noundef) local_unnamed_addr #2

declare ptr @nc_create_blob(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind allocsize(0) }
attributes #5 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 28}
!6 = !{!"NcConvolutionParam", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !10, i64 32, !11, i64 40, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"px_size_t", !7, i64 0, !7, i64 4}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 12}
!15 = !{!6, !12, i64 48}
!16 = !{!6, !12, i64 64}
!17 = !{!6, !7, i64 24}
!18 = !{!6, !7, i64 0}
!19 = !{!6, !7, i64 4}
!20 = !{!6, !7, i64 16}
!21 = !{!6, !7, i64 20}
!22 = !{!6, !12, i64 56}
!23 = !{!6, !11, i64 40}


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