; LLVM IR from introlab/odas :: src/signal (mixture)

; 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.mixture_obj = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.assignations_obj = type { i32, i32, ptr }

; Function Attrs: nounwind uwtable
define dso_local ptr @mixture_construct_zero(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %6 = call noalias ptr @malloc(i64 noundef 72) #6
  store ptr %6, ptr %5, align 8, !tbaa !9
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = load i32, ptr %4, align 4, !tbaa !5
  %9 = call ptr @combining_generate(i32 noundef %7, i32 noundef %8)
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  %11 = getelementptr inbounds %struct.mixture_obj, ptr %10, i32 0, i32 4
  store ptr %9, ptr %11, align 8, !tbaa !11
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !9
  %14 = getelementptr inbounds %struct.mixture_obj, ptr %13, i32 0, i32 0
  store i32 %12, ptr %14, align 8, !tbaa !13
  %15 = load i32, ptr %4, align 4, !tbaa !5
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.mixture_obj, ptr %16, i32 0, i32 1
  store i32 %15, ptr %17, align 4, !tbaa !14
  %18 = load i32, ptr %4, align 4, !tbaa !5
  %19 = add i32 %18, 2
  %20 = load ptr, ptr %5, align 8, !tbaa !9
  %21 = getelementptr inbounds %struct.mixture_obj, ptr %20, i32 0, i32 2
  store i32 %19, ptr %21, align 8, !tbaa !15
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds %struct.mixture_obj, ptr %22, i32 0, i32 4
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  %25 = getelementptr inbounds %struct.assignations_obj, ptr %24, i32 0, i32 0
  %26 = load i32, ptr %25, align 8, !tbaa !16
  %27 = load ptr, ptr %5, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct.mixture_obj, ptr %27, i32 0, i32 3
  store i32 %26, ptr %28, align 4, !tbaa !18
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = add i32 3, %29
  %31 = zext i32 %30 to i64
  %32 = mul i64 4, %31
  %33 = load ptr, ptr %5, align 8, !tbaa !9
  %34 = getelementptr inbounds %struct.mixture_obj, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !13
  %36 = zext i32 %35 to i64
  %37 = mul i64 %32, %36
  %38 = call noalias ptr @malloc(i64 noundef %37) #6
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.mixture_obj, ptr %39, i32 0, i32 5
  store ptr %38, ptr %40, align 8, !tbaa !19
  %41 = load ptr, ptr %5, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.mixture_obj, ptr %41, i32 0, i32 5
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = add i32 3, %44
  %46 = zext i32 %45 to i64
  %47 = mul i64 4, %46
  %48 = load ptr, ptr %5, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.mixture_obj, ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 8, !tbaa !13
  %51 = zext i32 %50 to i64
  %52 = mul i64 %47, %51
  call void @llvm.memset.p0.i64(ptr align 4 %43, i8 0, i64 %52, i1 false)
  %53 = load ptr, ptr %5, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.mixture_obj, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !15
  %56 = zext i32 %55 to i64
  %57 = mul i64 4, %56
  %58 = load ptr, ptr %5, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.mixture_obj, ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 8, !tbaa !13
  %61 = zext i32 %60 to i64
  %62 = mul i64 %57, %61
  %63 = call noalias ptr @malloc(i64 noundef %62) #6
  %64 = load ptr, ptr %5, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct.mixture_obj, ptr %64, i32 0, i32 6
  store ptr %63, ptr %65, align 8, !tbaa !20
  %66 = load ptr, ptr %5, align 8, !tbaa !9
  %67 = getelementptr inbounds %struct.mixture_obj, ptr %66, i32 0, i32 6
  %68 = load ptr, ptr %67, align 8, !tbaa !20
  %69 = load ptr, ptr %5, align 8, !tbaa !9
  %70 = getelementptr inbounds %struct.mixture_obj, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 8, !tbaa !15
  %72 = zext i32 %71 to i64
  %73 = mul i64 4, %72
  %74 = load ptr, ptr %5, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.mixture_obj, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !13
  %77 = zext i32 %76 to i64
  %78 = mul i64 %73, %77
  call void @llvm.memset.p0.i64(ptr align 4 %68, i8 0, i64 %78, i1 false)
  %79 = load ptr, ptr %5, align 8, !tbaa !9
  %80 = getelementptr inbounds %struct.mixture_obj, ptr %79, i32 0, i32 2
  %81 = load i32, ptr %80, align 8, !tbaa !15
  %82 = zext i32 %81 to i64
  %83 = mul i64 4, %82
  %84 = load ptr, ptr %5, align 8, !tbaa !9
  %85 = getelementptr inbounds %struct.mixture_obj, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !13
  %87 = zext i32 %86 to i64
  %88 = mul i64 %83, %87
  %89 = call noalias ptr @malloc(i64 noundef %88) #6
  %90 = load ptr, ptr %5, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct.mixture_obj, ptr %90, i32 0, i32 7
  store ptr %89, ptr %91, align 8, !tbaa !21
  %92 = load ptr, ptr %5, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.mixture_obj, ptr %92, i32 0, i32 7
  %94 = load ptr, ptr %93, align 8, !tbaa !21
  %95 = load ptr, ptr %5, align 8, !tbaa !9
  %96 = getelementptr inbounds %struct.mixture_obj, ptr %95, i32 0, i32 2
  %97 = load i32, ptr %96, align 8, !tbaa !15
  %98 = zext i32 %97 to i64
  %99 = mul i64 4, %98
  %100 = load ptr, ptr %5, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct.mixture_obj, ptr %100, i32 0, i32 0
  %102 = load i32, ptr %101, align 8, !tbaa !13
  %103 = zext i32 %102 to i64
  %104 = mul i64 %99, %103
  call void @llvm.memset.p0.i64(ptr align 4 %94, i8 0, i64 %104, i1 false)
  %105 = load ptr, ptr %5, align 8, !tbaa !9
  %106 = getelementptr inbounds %struct.mixture_obj, ptr %105, i32 0, i32 3
  %107 = load i32, ptr %106, align 4, !tbaa !18
  %108 = zext i32 %107 to i64
  %109 = mul i64 4, %108
  %110 = call noalias ptr @malloc(i64 noundef %109) #6
  %111 = load ptr, ptr %5, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct.mixture_obj, ptr %111, i32 0, i32 8
  store ptr %110, ptr %112, align 8, !tbaa !22
  %113 = load ptr, ptr %5, align 8, !tbaa !9
  %114 = getelementptr inbounds %struct.mixture_obj, ptr %113, i32 0, i32 8
  %115 = load ptr, ptr %114, align 8, !tbaa !22
  %116 = load ptr, ptr %5, align 8, !tbaa !9
  %117 = getelementptr inbounds %struct.mixture_obj, ptr %116, i32 0, i32 3
  %118 = load i32, ptr %117, align 4, !tbaa !18
  %119 = zext i32 %118 to i64
  %120 = mul i64 4, %119
  call void @llvm.memset.p0.i64(ptr align 4 %115, i8 0, i64 %120, i1 false)
  %121 = load ptr, ptr %5, align 8, !tbaa !9
  %122 = getelementptr inbounds %struct.mixture_obj, ptr %121, i32 0, i32 3
  %123 = load i32, ptr %122, align 4, !tbaa !18
  %124 = zext i32 %123 to i64
  %125 = mul i64 4, %124
  %126 = call noalias ptr @malloc(i64 noundef %125) #6
  %127 = load ptr, ptr %5, align 8, !tbaa !9
  %128 = getelementptr inbounds %struct.mixture_obj, ptr %127, i32 0, i32 9
  store ptr %126, ptr %128, align 8, !tbaa !23
  %129 = load ptr, ptr %5, align 8, !tbaa !9
  %130 = getelementptr inbounds %struct.mixture_obj, ptr %129, i32 0, i32 9
  %131 = load ptr, ptr %130, align 8, !tbaa !23
  %132 = load ptr, ptr %5, align 8, !tbaa !9
  %133 = getelementptr inbounds %struct.mixture_obj, ptr %132, i32 0, i32 3
  %134 = load i32, ptr %133, align 4, !tbaa !18
  %135 = zext i32 %134 to i64
  %136 = mul i64 4, %135
  call void @llvm.memset.p0.i64(ptr align 4 %131, i8 0, i64 %136, i1 false)
  %137 = load ptr, ptr %5, align 8, !tbaa !9
  %138 = getelementptr inbounds %struct.mixture_obj, ptr %137, i32 0, i32 3
  %139 = load i32, ptr %138, align 4, !tbaa !18
  %140 = zext i32 %139 to i64
  %141 = mul i64 4, %140
  %142 = call noalias ptr @malloc(i64 noundef %141) #6
  %143 = load ptr, ptr %5, align 8, !tbaa !9
  %144 = getelementptr inbounds %struct.mixture_obj, ptr %143, i32 0, i32 10
  store ptr %142, ptr %144, align 8, !tbaa !24
  %145 = load ptr, ptr %5, align 8, !tbaa !9
  %146 = getelementptr inbounds %struct.mixture_obj, ptr %145, i32 0, i32 10
  %147 = load ptr, ptr %146, align 8, !tbaa !24
  %148 = load ptr, ptr %5, align 8, !tbaa !9
  %149 = getelementptr inbounds %struct.mixture_obj, ptr %148, i32 0, i32 3
  %150 = load i32, ptr %149, align 4, !tbaa !18
  %151 = zext i32 %150 to i64
  %152 = mul i64 4, %151
  call void @llvm.memset.p0.i64(ptr align 4 %147, i8 0, i64 %152, i1 false)
  %153 = load ptr, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret ptr %153
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, 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

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: write) }
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, !10, i64 16}
!12 = !{!"mixture_obj", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!13 = !{!12, !6, i64 0}
!14 = !{!12, !6, i64 4}
!15 = !{!12, !6, i64 8}
!16 = !{!17, !6, i64 0}
!17 = !{!"assignations_obj", !6, i64 0, !6, i64 4, !10, i64 8}
!18 = !{!12, !6, i64 12}
!19 = !{!12, !10, i64 24}
!20 = !{!12, !10, i64 32}
!21 = !{!12, !10, i64 40}
!22 = !{!12, !10, i64 48}
!23 = !{!12, !10, i64 56}
!24 = !{!12, !10, i64 64}


; 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 @mixture_construct_zero(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = tail call noalias dereferenceable_or_null(72) ptr @malloc(i64 noundef 72) #4
  %4 = tail call ptr @combining_generate(i32 noundef %0, i32 noundef %1) #5
  %5 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %4, ptr %5, align 8, !tbaa !5
  store i32 %0, ptr %3, align 8, !tbaa !11
  %6 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %1, ptr %6, align 4, !tbaa !12
  %7 = add i32 %1, 2
  %8 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %7, ptr %8, align 8, !tbaa !13
  %9 = load i32, ptr %4, align 8, !tbaa !14
  %10 = getelementptr inbounds i8, ptr %3, i64 12
  store i32 %9, ptr %10, align 4, !tbaa !16
  %11 = add i32 %1, 3
  %12 = zext i32 %11 to i64
  %13 = shl nuw nsw i64 %12, 2
  %14 = zext i32 %0 to i64
  %15 = mul i64 %13, %14
  %calloc = tail call ptr @calloc(i64 1, i64 %15)
  %16 = getelementptr inbounds i8, ptr %3, i64 24
  store ptr %calloc, ptr %16, align 8, !tbaa !17
  %17 = zext i32 %7 to i64
  %18 = shl nuw nsw i64 %17, 2
  %19 = mul i64 %18, %14
  %calloc41 = tail call ptr @calloc(i64 1, i64 %19)
  %20 = getelementptr inbounds i8, ptr %3, i64 32
  store ptr %calloc41, ptr %20, align 8, !tbaa !18
  %calloc42 = tail call ptr @calloc(i64 1, i64 %19)
  %21 = getelementptr inbounds i8, ptr %3, i64 40
  store ptr %calloc42, ptr %21, align 8, !tbaa !19
  %22 = zext i32 %9 to i64
  %23 = shl nuw nsw i64 %22, 2
  %calloc43 = tail call ptr @calloc(i64 1, i64 %23)
  %24 = getelementptr inbounds i8, ptr %3, i64 48
  store ptr %calloc43, ptr %24, align 8, !tbaa !20
  %calloc44 = tail call ptr @calloc(i64 1, i64 %23)
  %25 = getelementptr inbounds i8, ptr %3, i64 56
  store ptr %calloc44, ptr %25, align 8, !tbaa !21
  %calloc45 = tail call ptr @calloc(i64 1, i64 %23)
  %26 = getelementptr inbounds i8, ptr %3, i64 64
  store ptr %calloc45, ptr %26, align 8, !tbaa !22
  ret ptr %3
}

; 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 ptr @combining_generate(i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #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 = { nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
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, !10, i64 16}
!6 = !{!"mixture_obj", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!15, !7, i64 0}
!15 = !{!"assignations_obj", !7, i64 0, !7, i64 4, !10, i64 8}
!16 = !{!6, !7, i64 12}
!17 = !{!6, !10, i64 24}
!18 = !{!6, !10, i64 32}
!19 = !{!6, !10, i64 40}
!20 = !{!6, !10, i64 48}
!21 = !{!6, !10, i64 56}
!22 = !{!6, !10, i64 64}


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