; LLVM IR from TobiasKozel/VAE :: external/portaudio/src/common (pa_process)

; 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.PaUtilBufferProcessor = type { i64, i64, i32, i32, i32, i32, i64, i32, i32, i32, i32, ptr, ptr, i32, i32, i32, i32, ptr, ptr, i64, i64, ptr, ptr, i64, ptr, ptr, i64, ptr, i64, i32, [2 x i64], [2 x ptr], i32, [2 x i64], [2 x ptr], %struct.PaUtilTriangularDitherGenerator, double, ptr, ptr }
%struct.PaUtilTriangularDitherGenerator = type { i32, i32, i32 }

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@__PRETTY_FUNCTION__.PaUtil_Set2ndNonInterleavedOutputChannel = external hidden unnamed_addr constant [93 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @PaUtil_Set2ndOutputChannel(ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @PaUtil_Set2ndNonInterleavedOutputChannel(ptr noundef %0, i32 noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load i32, ptr %5, align 4, !tbaa !9
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %8, i32 0, i32 13
  %10 = load i32, ptr %9, align 8, !tbaa !11
  %11 = icmp ult i32 %7, %10
  br i1 %11, label %12, label %13

12:                                               ; preds = %3
  br label %14

13:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 662, ptr noundef @__PRETTY_FUNCTION__.PaUtil_Set2ndNonInterleavedOutputChannel) #2
  unreachable

14:                                               ; preds = %12
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.PaUtilBufferProcessor, ptr %15, i32 0, i32 32
  %17 = load i32, ptr %16, align 8, !tbaa !16
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %20, label %19

19:                                               ; preds = %14
  br label %21

20:                                               ; preds = %14
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.1, i32 noundef 663, ptr noundef @__PRETTY_FUNCTION__.PaUtil_Set2ndNonInterleavedOutputChannel) #2
  unreachable

21:                                               ; preds = %19
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = load i32, ptr %5, align 4, !tbaa !9
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  call void @PaUtil_Set2ndOutputChannel(ptr noundef %22, i32 noundef %23, ptr noundef %24, i32 noundef 1)
  ret void
}

attributes #0 = { noreturn nounwind "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 = { 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 = { noreturn 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 72}
!12 = !{!"", !13, i64 0, !13, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !13, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !6, i64 56, !6, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !6, i64 88, !6, i64 96, !13, i64 104, !13, i64 112, !6, i64 120, !6, i64 128, !13, i64 136, !6, i64 144, !6, i64 152, !13, i64 160, !6, i64 168, !13, i64 176, !10, i64 184, !7, i64 192, !7, i64 208, !10, i64 224, !7, i64 232, !7, i64 248, !14, i64 264, !15, i64 280, !6, i64 288, !6, i64 296}
!13 = !{!"long", !7, i64 0}
!14 = !{!"PaUtilTriangularDitherGenerator", !10, i64 0, !10, i64 4, !10, i64 8}
!15 = !{!"double", !7, i64 0}
!16 = !{!12, !10, i64 224}


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

@.str.1 = external hidden unnamed_addr constant [92 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@__PRETTY_FUNCTION__.PaUtil_Set2ndNonInterleavedOutputChannel = external hidden unnamed_addr constant [93 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @PaUtil_Set2ndOutputChannel(ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @PaUtil_Set2ndNonInterleavedOutputChannel(ptr noundef %0, i32 noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %0, i64 72
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = icmp ugt i32 %5, %1
  br i1 %6, label %8, label %7

7:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 662, ptr noundef nonnull @__PRETTY_FUNCTION__.PaUtil_Set2ndNonInterleavedOutputChannel) #2
  unreachable

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 224
  %10 = load i32, ptr %9, align 8, !tbaa !14
  %.not = icmp eq i32 %10, 0
  br i1 %.not, label %12, label %11

11:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i32 noundef 663, ptr noundef nonnull @__PRETTY_FUNCTION__.PaUtil_Set2ndNonInterleavedOutputChannel) #2
  unreachable

12:                                               ; preds = %8
  tail call void @PaUtil_Set2ndOutputChannel(ptr noundef nonnull %0, i32 noundef %1, ptr noundef %2, i32 noundef 1)
  ret void
}

attributes #0 = { noreturn nounwind "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 = { 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 = { noreturn 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 72}
!6 = !{!"", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !7, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !11, i64 56, !11, i64 64, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !11, i64 88, !11, i64 96, !7, i64 104, !7, i64 112, !11, i64 120, !11, i64 128, !7, i64 136, !11, i64 144, !11, i64 152, !7, i64 160, !11, i64 168, !7, i64 176, !10, i64 184, !8, i64 192, !8, i64 208, !10, i64 224, !8, i64 232, !8, i64 248, !12, i64 264, !13, i64 280, !11, i64 288, !11, i64 296}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"PaUtilTriangularDitherGenerator", !10, i64 0, !10, i64 4, !10, i64 8}
!13 = !{!"double", !8, i64 0}
!14 = !{!6, !10, i64 224}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass