; LLVM IR from jgaeddert/liquid-dsp :: sandbox (iirdes_gradsearch_test)

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

; 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 ptr @gs_create(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %4 = call noalias ptr @malloc(i64 noundef 104) #4
  store ptr %4, ptr %3, align 8, !tbaa !9
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = load ptr, ptr %3, align 8, !tbaa !9
  %7 = getelementptr inbounds %struct.gs_s, ptr %6, i32 0, i32 0
  store i32 %5, ptr %7, align 8, !tbaa !11
  %8 = load ptr, ptr %3, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.gs_s, ptr %8, i32 0, i32 0
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = urem i32 %10, 2
  %12 = load ptr, ptr %3, align 8, !tbaa !9
  %13 = getelementptr inbounds %struct.gs_s, ptr %12, i32 0, i32 2
  store i32 %11, ptr %13, align 8, !tbaa !14
  %14 = load ptr, ptr %3, align 8, !tbaa !9
  %15 = getelementptr inbounds %struct.gs_s, ptr %14, i32 0, i32 0
  %16 = load i32, ptr %15, align 8, !tbaa !11
  %17 = load ptr, ptr %3, align 8, !tbaa !9
  %18 = getelementptr inbounds %struct.gs_s, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 8, !tbaa !14
  %20 = sub i32 %16, %19
  %21 = udiv i32 %20, 2
  %22 = load ptr, ptr %3, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.gs_s, ptr %22, i32 0, i32 1
  store i32 %21, ptr %23, align 4, !tbaa !15
  %24 = load ptr, ptr %3, align 8, !tbaa !9
  %25 = getelementptr inbounds %struct.gs_s, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !15
  %27 = mul i32 4, %26
  %28 = load ptr, ptr %3, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.gs_s, ptr %28, i32 0, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !14
  %31 = mul i32 2, %30
  %32 = add i32 %27, %31
  %33 = add i32 %32, 1
  %34 = load ptr, ptr %3, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.gs_s, ptr %34, i32 0, i32 4
  store i32 %33, ptr %35, align 8, !tbaa !16
  %36 = load ptr, ptr %3, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.gs_s, ptr %36, i32 0, i32 1
  %38 = load i32, ptr %37, align 4, !tbaa !15
  %39 = load ptr, ptr %3, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.gs_s, ptr %39, i32 0, i32 2
  %41 = load i32, ptr %40, align 8, !tbaa !14
  %42 = add i32 %38, %41
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = getelementptr inbounds %struct.gs_s, ptr %43, i32 0, i32 3
  store i32 %42, ptr %44, align 4, !tbaa !17
  %45 = load ptr, ptr %3, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.gs_s, ptr %45, i32 0, i32 12
  store i32 1024, ptr %46, align 8, !tbaa !18
  %47 = load ptr, ptr %3, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.gs_s, ptr %47, i32 0, i32 0
  %49 = load i32, ptr %48, align 8, !tbaa !11
  %50 = zext i32 %49 to i64
  %51 = mul i64 %50, 8
  %52 = call noalias ptr @malloc(i64 noundef %51) #4
  %53 = load ptr, ptr %3, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.gs_s, ptr %53, i32 0, i32 5
  store ptr %52, ptr %54, align 8, !tbaa !19
  %55 = load ptr, ptr %3, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.gs_s, ptr %55, i32 0, i32 0
  %57 = load i32, ptr %56, align 8, !tbaa !11
  %58 = zext i32 %57 to i64
  %59 = mul i64 %58, 8
  %60 = call noalias ptr @malloc(i64 noundef %59) #4
  %61 = load ptr, ptr %3, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.gs_s, ptr %61, i32 0, i32 6
  store ptr %60, ptr %62, align 8, !tbaa !20
  %63 = load ptr, ptr %3, align 8, !tbaa !9
  %64 = getelementptr inbounds %struct.gs_s, ptr %63, i32 0, i32 3
  %65 = load i32, ptr %64, align 4, !tbaa !17
  %66 = mul i32 3, %65
  %67 = zext i32 %66 to i64
  %68 = mul i64 %67, 4
  %69 = call noalias ptr @malloc(i64 noundef %68) #4
  %70 = load ptr, ptr %3, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.gs_s, ptr %70, i32 0, i32 11
  store ptr %69, ptr %71, align 8, !tbaa !21
  %72 = load ptr, ptr %3, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.gs_s, ptr %72, i32 0, i32 3
  %74 = load i32, ptr %73, align 4, !tbaa !17
  %75 = mul i32 3, %74
  %76 = zext i32 %75 to i64
  %77 = mul i64 %76, 4
  %78 = call noalias ptr @malloc(i64 noundef %77) #4
  %79 = load ptr, ptr %3, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.gs_s, ptr %79, i32 0, i32 10
  store ptr %78, ptr %80, align 8, !tbaa !22
  %81 = load ptr, ptr %3, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.gs_s, ptr %81, i32 0, i32 12
  %83 = load i32, ptr %82, align 8, !tbaa !18
  %84 = zext i32 %83 to i64
  %85 = mul i64 %84, 4
  %86 = call noalias ptr @malloc(i64 noundef %85) #4
  %87 = load ptr, ptr %3, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.gs_s, ptr %87, i32 0, i32 13
  store ptr %86, ptr %88, align 8, !tbaa !23
  %89 = load ptr, ptr %3, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.gs_s, ptr %89, i32 0, i32 14
  store float 0x3FC99999A0000000, ptr %90, align 8, !tbaa !24
  %91 = load ptr, ptr %3, align 8, !tbaa !9
  %92 = getelementptr inbounds %struct.gs_s, ptr %91, i32 0, i32 15
  store float 0x3FD3333340000000, ptr %92, align 4, !tbaa !25
  %93 = load ptr, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret ptr %93
}

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(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(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 }
attributes #4 = { 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 0}
!12 = !{!"gs_s", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !10, i64 24, !10, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !10, i64 56, !10, i64 64, !6, i64 72, !10, i64 80, !13, i64 88, !13, i64 92, !13, i64 96}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !6, i64 8}
!15 = !{!12, !6, i64 4}
!16 = !{!12, !6, i64 16}
!17 = !{!12, !6, i64 12}
!18 = !{!12, !6, i64 72}
!19 = !{!12, !10, i64 24}
!20 = !{!12, !10, i64 32}
!21 = !{!12, !10, i64 64}
!22 = !{!12, !10, i64 56}
!23 = !{!12, !10, i64 80}
!24 = !{!12, !13, i64 88}
!25 = !{!12, !13, i64 92}


; 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 nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) uwtable
define dso_local noalias noundef ptr @gs_create(i32 noundef %0) local_unnamed_addr #0 {
  %2 = tail call noalias dereferenceable_or_null(104) ptr @malloc(i64 noundef 104) #2
  store i32 %0, ptr %2, align 8, !tbaa !5
  %3 = and i32 %0, 1
  %4 = getelementptr inbounds i8, ptr %2, i64 8
  store i32 %3, ptr %4, align 8, !tbaa !12
  %5 = lshr i32 %0, 1
  %6 = getelementptr inbounds i8, ptr %2, i64 4
  store i32 %5, ptr %6, align 4, !tbaa !13
  %7 = shl i32 %0, 1
  %8 = or disjoint i32 %7, 1
  %9 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 %8, ptr %9, align 8, !tbaa !14
  %10 = add nuw i32 %5, %3
  %11 = getelementptr inbounds i8, ptr %2, i64 12
  store i32 %10, ptr %11, align 4, !tbaa !15
  %12 = getelementptr inbounds i8, ptr %2, i64 72
  store i32 1024, ptr %12, align 8, !tbaa !16
  %13 = zext i32 %0 to i64
  %14 = shl nuw nsw i64 %13, 3
  %15 = tail call noalias ptr @malloc(i64 noundef %14) #2
  %16 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr %15, ptr %16, align 8, !tbaa !17
  %17 = tail call noalias ptr @malloc(i64 noundef %14) #2
  %18 = getelementptr inbounds i8, ptr %2, i64 32
  store ptr %17, ptr %18, align 8, !tbaa !18
  %19 = mul i32 %10, 3
  %20 = zext i32 %19 to i64
  %21 = shl nuw nsw i64 %20, 2
  %22 = tail call noalias ptr @malloc(i64 noundef %21) #2
  %23 = getelementptr inbounds i8, ptr %2, i64 64
  store ptr %22, ptr %23, align 8, !tbaa !19
  %24 = tail call noalias ptr @malloc(i64 noundef %21) #2
  %25 = getelementptr inbounds i8, ptr %2, i64 56
  store ptr %24, ptr %25, align 8, !tbaa !20
  %26 = tail call noalias dereferenceable_or_null(4096) ptr @malloc(i64 noundef 4096) #2
  %27 = getelementptr inbounds i8, ptr %2, i64 80
  store ptr %26, ptr %27, align 8, !tbaa !21
  %28 = getelementptr inbounds i8, ptr %2, i64 88
  store <2 x float> <float 0x3FC99999A0000000, float 0x3FD3333340000000>, ptr %28, align 8, !tbaa !22
  ret ptr %2
}

; 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

attributes #0 = { mustprogress nofree nounwind willreturn memory(write, argmem: none, inaccessiblemem: readwrite) 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 = { 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, !7, i64 0}
!6 = !{!"gs_s", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !10, i64 24, !10, i64 32, !11, i64 40, !11, i64 44, !11, i64 48, !10, i64 56, !10, i64 64, !7, i64 72, !10, i64 80, !11, i64 88, !11, i64 92, !11, i64 96}
!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 = !{!6, !7, i64 8}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !7, i64 16}
!15 = !{!6, !7, i64 12}
!16 = !{!6, !7, i64 72}
!17 = !{!6, !10, i64 24}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !10, i64 64}
!20 = !{!6, !10, i64 56}
!21 = !{!6, !10, i64 80}
!22 = !{!11, !11, i64 0}


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