; LLVM IR from Razakhel/RaZ :: src/RaZ/Audio/AudioUtils.ll (ZN3Raz10AudioUtils13convertToMonoERNS_9AudioDataE)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::array" = type { [2 x i8] }
%"struct.Raz::AudioData" = type { i32, i32, %"class.std::vector" }

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr
@.str.1 = external hidden unnamed_addr constant [49 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz10AudioUtils13convertToMonoERNS_9AudioDataE(ptr noundef nonnull align 8 dereferenceable(32) %0) #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i8, align 1
  %8 = alloca %"class.std::vector", align 8
  %9 = alloca %"class.std::allocator", align 1
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca %"struct.std::array", align 1
  %13 = alloca %"struct.std::array", align 1
  %14 = alloca %"struct.std::array", align 1
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.Raz::AudioData", ptr %15, i32 0, i32 0
  %17 = load i32, ptr %16, align 8, !tbaa !9
  store i32 %17, ptr %3, align 4, !tbaa !17
  %18 = load i32, ptr %3, align 4, !tbaa !17
  %19 = icmp eq i32 %18, 4352
  br i1 %19, label %29, label %20

20:                                               ; preds = %1
  %21 = load i32, ptr %3, align 4, !tbaa !17
  %22 = icmp eq i32 %21, 4353
  br i1 %22, label %29, label %23

23:                                               ; preds = %20
  %24 = load i32, ptr %3, align 4, !tbaa !17
  %25 = icmp eq i32 %24, 65552
  br i1 %25, label %29, label %26

26:                                               ; preds = %23
  %27 = load i32, ptr %3, align 4, !tbaa !17
  %28 = icmp eq i32 %27, 65554
  br i1 %28, label %29, label %30

29:                                               ; preds = %26, %23, %20, %1
  store i32 1, ptr %4, align 4
  br label %165

30:                                               ; preds = %26
  %31 = load i32, ptr %3, align 4, !tbaa !17
  %32 = icmp eq i32 %31, 65553
  br i1 %32, label %36, label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %3, align 4, !tbaa !17
  %35 = icmp eq i32 %34, 65555
  br i1 %35, label %36, label %43

36:                                               ; preds = %33, %30
  %37 = call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef @.str)
          to label %38 unwind label %39

38:                                               ; preds = %36
  call void @__cxa_throw(ptr %37, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #6
  unreachable

39:                                               ; preds = %36
  %40 = landingpad { ptr, i32 }
          cleanup
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %5, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %6, align 4
  call void @__cxa_free_exception(ptr %37) #5
  br label %170

43:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #5
  store i8 0, ptr %7, align 1, !tbaa !18
  %44 = load i32, ptr %3, align 4, !tbaa !17
  switch i32 %44, label %51 [
    i32 4354, label %45
    i32 4355, label %48
  ]

45:                                               ; preds = %43
  store i8 1, ptr %7, align 1, !tbaa !18
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %"struct.Raz::AudioData", ptr %46, i32 0, i32 0
  store i32 4352, ptr %47, align 8, !tbaa !9
  br label %58

48:                                               ; preds = %43
  store i8 2, ptr %7, align 1, !tbaa !18
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %"struct.Raz::AudioData", ptr %49, i32 0, i32 0
  store i32 4353, ptr %50, align 8, !tbaa !9
  br label %58

51:                                               ; preds = %43
  %52 = call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %52, ptr noundef @.str.1)
          to label %53 unwind label %54

53:                                               ; preds = %51
  call void @__cxa_throw(ptr %52, ptr @_ZTISt16invalid_argument, ptr @_ZNSt16invalid_argumentD1Ev) #6
  unreachable

54:                                               ; preds = %51
  %55 = landingpad { ptr, i32 }
          cleanup
  %56 = extractvalue { ptr, i32 } %55, 0
  store ptr %56, ptr %5, align 8
  %57 = extractvalue { ptr, i32 } %55, 1
  store i32 %57, ptr %6, align 4
  call void @__cxa_free_exception(ptr %52) #5
  br label %169

58:                                               ; preds = %48, %45
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #5
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = getelementptr inbounds %"struct.Raz::AudioData", ptr %59, i32 0, i32 2
  %61 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %60) #5
  %62 = udiv i64 %61, 2
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %62, ptr noundef nonnull align 1 dereferenceable(1) %9)
          to label %63 unwind label %71

63:                                               ; preds = %58
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  store i64 0, ptr %10, align 8, !tbaa !19
  br label %64

64:                                               ; preds = %154, %63
  %65 = load i64, ptr %10, align 8, !tbaa !19
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %"struct.Raz::AudioData", ptr %66, i32 0, i32 2
  %68 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #5
  %69 = icmp ult i64 %65, %68
  br i1 %69, label %75, label %70

70:                                               ; preds = %64
  store i32 3, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %161

71:                                               ; preds = %58
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %5, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  br label %168

75:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %76 = load i64, ptr %10, align 8, !tbaa !19
  %77 = udiv i64 %76, 2
  store i64 %77, ptr %11, align 8, !tbaa !19
  %78 = load i8, ptr %7, align 1, !tbaa !18
  %79 = zext i8 %78 to i32
  %80 = icmp eq i32 %79, 1
  br i1 %80, label %81, label %100

81:                                               ; preds = %75
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = getelementptr inbounds %"struct.Raz::AudioData", ptr %82, i32 0, i32 2
  %84 = load i64, ptr %10, align 8, !tbaa !19
  %85 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %83, i64 noundef %84) #5
  %86 = load i8, ptr %85, align 1, !tbaa !18
  %87 = zext i8 %86 to i32
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  %89 = getelementptr inbounds %"struct.Raz::AudioData", ptr %88, i32 0, i32 2
  %90 = load i64, ptr %10, align 8, !tbaa !19
  %91 = add i64 %90, 1
  %92 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %89, i64 noundef %91) #5
  %93 = load i8, ptr %92, align 1, !tbaa !18
  %94 = zext i8 %93 to i32
  %95 = add nsw i32 %87, %94
  %96 = sdiv i32 %95, 2
  %97 = trunc i32 %96 to i8
  %98 = load i64, ptr %11, align 8, !tbaa !19
  %99 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %98) #5
  store i8 %97, ptr %99, align 1, !tbaa !18
  br label %153

100:                                              ; preds = %75
  %101 = load i8, ptr %7, align 1, !tbaa !18
  %102 = zext i8 %101 to i32
  %103 = icmp eq i32 %102, 2
  br i1 %103, label %104, label %152

104:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 2, ptr %12) #5
  %105 = getelementptr inbounds %"struct.std::array", ptr %13, i32 0, i32 0
  %106 = load ptr, ptr %2, align 8, !tbaa !5
  %107 = getelementptr inbounds %"struct.Raz::AudioData", ptr %106, i32 0, i32 2
  %108 = load i64, ptr %10, align 8, !tbaa !19
  %109 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %107, i64 noundef %108) #5
  %110 = load i8, ptr %109, align 1, !tbaa !18
  store i8 %110, ptr %105, align 1, !tbaa !18
  %111 = getelementptr inbounds i8, ptr %105, i64 1
  %112 = load ptr, ptr %2, align 8, !tbaa !5
  %113 = getelementptr inbounds %"struct.Raz::AudioData", ptr %112, i32 0, i32 2
  %114 = load i64, ptr %10, align 8, !tbaa !19
  %115 = add i64 %114, 1
  %116 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %113, i64 noundef %115) #5
  %117 = load i8, ptr %116, align 1, !tbaa !18
  store i8 %117, ptr %111, align 1, !tbaa !18
  %118 = getelementptr inbounds %"struct.std::array", ptr %14, i32 0, i32 0
  %119 = load ptr, ptr %2, align 8, !tbaa !5
  %120 = getelementptr inbounds %"struct.Raz::AudioData", ptr %119, i32 0, i32 2
  %121 = load i64, ptr %10, align 8, !tbaa !19
  %122 = add i64 %121, 2
  %123 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef %122) #5
  %124 = load i8, ptr %123, align 1, !tbaa !18
  store i8 %124, ptr %118, align 1, !tbaa !18
  %125 = getelementptr inbounds i8, ptr %118, i64 1
  %126 = load ptr, ptr %2, align 8, !tbaa !5
  %127 = getelementptr inbounds %"struct.Raz::AudioData", ptr %126, i32 0, i32 2
  %128 = load i64, ptr %10, align 8, !tbaa !19
  %129 = add i64 %128, 3
  %130 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %127, i64 noundef %129) #5
  %131 = load i8, ptr %130, align 1, !tbaa !18
  store i8 %131, ptr %125, align 1, !tbaa !18
  %132 = getelementptr inbounds %"struct.std::array", ptr %13, i32 0, i32 0
  %133 = load i16, ptr %132, align 1
  %134 = getelementptr inbounds %"struct.std::array", ptr %14, i32 0, i32 0
  %135 = load i16, ptr %134, align 1
  %136 = invoke i16 @_ZN3Raz10AudioUtils12_GLOBAL__N_114computeMonoI16ESt5arrayIhLm2EES3_(i16 %133, i16 %135)
          to label %137 unwind label %148

137:                                              ; preds = %104
  %138 = getelementptr inbounds %"struct.std::array", ptr %12, i32 0, i32 0
  store i16 %136, ptr %138, align 1
  %139 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt5arrayIhLm2EEixEm(ptr noundef nonnull align 1 dereferenceable(2) %12, i64 noundef 0) #5
  %140 = load i8, ptr %139, align 1, !tbaa !18
  %141 = load i64, ptr %11, align 8, !tbaa !19
  %142 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %141) #5
  store i8 %140, ptr %142, align 1, !tbaa !18
  %143 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt5arrayIhLm2EEixEm(ptr noundef nonnull align 1 dereferenceable(2) %12, i64 noundef 1) #5
  %144 = load i8, ptr %143, align 1, !tbaa !18
  %145 = load i64, ptr %11, align 8, !tbaa !19
  %146 = add i64 %145, 1
  %147 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %146) #5
  store i8 %144, ptr %147, align 1, !tbaa !18
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #5
  br label %152

148:                                              ; preds = %104
  %149 = landingpad { ptr, i32 }
          cleanup
  %150 = extractvalue { ptr, i32 } %149, 0
  store ptr %150, ptr %5, align 8
  %151 = extractvalue { ptr, i32 } %149, 1
  store i32 %151, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  br label %168

152:                                              ; preds = %137, %100
  br label %153

153:                                              ; preds = %152, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %154

154:                                              ; preds = %153
  %155 = load i8, ptr %7, align 1, !tbaa !18
  %156 = zext i8 %155 to i32
  %157 = mul nsw i32 %156, 2
  %158 = sext i32 %157 to i64
  %159 = load i64, ptr %10, align 8, !tbaa !19
  %160 = add i64 %159, %158
  store i64 %160, ptr %10, align 8, !tbaa !19
  br label %64, !llvm.loop !21

161:                                              ; preds = %70
  %162 = load ptr, ptr %2, align 8, !tbaa !5
  %163 = getelementptr inbounds %"struct.Raz::AudioData", ptr %162, i32 0, i32 2
  %164 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIhSaIhEEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %163, ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %8) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  store i32 0, ptr %4, align 4
  br label %165

165:                                              ; preds = %161, %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %166 = load i32, ptr %4, align 4
  switch i32 %166, label %176 [
    i32 0, label %167
    i32 1, label %167
  ]

167:                                              ; preds = %165, %165
  ret void

168:                                              ; preds = %148, %71
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #5
  br label %169

169:                                              ; preds = %168, %54
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  br label %170

170:                                              ; preds = %169, %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %171

171:                                              ; preds = %170
  %172 = load ptr, ptr %5, align 8
  %173 = load i32, ptr %6, align 4
  %174 = insertvalue { ptr, i32 } poison, ptr %172, 0
  %175 = insertvalue { ptr, i32 } %174, i32 %173, 1
  resume { ptr, i32 } %175

176:                                              ; preds = %165
  unreachable
}

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare hidden i16 @_ZN3Raz10AudioUtils12_GLOBAL__N_114computeMonoI16ESt5arrayIhLm2EES3_(i16, i16) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt5arrayIhLm2EEixEm(ptr noundef nonnull align 1 dereferenceable(2), i64 noundef) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIhSaIhEEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

attributes #0 = { mustprogress 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 = { "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 "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 = { mustprogress 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"_ZTSN3Raz9AudioDataE", !11, i64 0, !12, i64 4, !13, i64 8}
!11 = !{!"_ZTSN3Raz11AudioFormatE", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSSt6vectorIhSaIhEE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!17 = !{!11, !11, i64 0}
!18 = !{!7, !7, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"long", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::allocator" = type { i8 }
%"struct.std::array" = type { [2 x i8] }

@.str = external hidden unnamed_addr constant [78 x i8], align 1
@_ZTISt16invalid_argument = external constant ptr
@.str.1 = external hidden unnamed_addr constant [49 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3Raz10AudioUtils13convertToMonoERNS_9AudioDataE(ptr noundef nonnull align 8 dereferenceable(32) %0) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca %"class.std::allocator", align 1
  %4 = alloca %"struct.std::array", align 2
  %5 = load i32, ptr %0, align 8, !tbaa !5
  switch i32 %5, label %6 [
    i32 65554, label %71
    i32 65552, label %71
    i32 4353, label %71
    i32 4352, label %71
  ]

6:                                                ; preds = %1
  %7 = and i32 %5, -3
  %or.cond7 = icmp eq i32 %7, 65553
  br i1 %or.cond7, label %8, label %13

8:                                                ; preds = %6
  %9 = tail call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull @.str)
          to label %10 unwind label %11

10:                                               ; preds = %8
  tail call void @__cxa_throw(ptr nonnull %9, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #6
  unreachable

11:                                               ; preds = %8
  %12 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %9) #5
  br label %73

13:                                               ; preds = %6
  switch i32 %5, label %15 [
    i32 4354, label %20
    i32 4355, label %14
  ]

14:                                               ; preds = %13
  br label %20

15:                                               ; preds = %13
  %16 = tail call ptr @__cxa_allocate_exception(i64 16) #5
  invoke void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %16, ptr noundef nonnull @.str.1)
          to label %17 unwind label %18

17:                                               ; preds = %15
  tail call void @__cxa_throw(ptr nonnull %16, ptr nonnull @_ZTISt16invalid_argument, ptr nonnull @_ZNSt16invalid_argumentD1Ev) #6
  unreachable

18:                                               ; preds = %15
  %19 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %16) #5
  br label %73

20:                                               ; preds = %13, %14
  %storemerge = phi i32 [ 4353, %14 ], [ 4352, %13 ]
  %21 = phi i1 [ false, %14 ], [ true, %13 ]
  %.047 = phi i64 [ 4, %14 ], [ 2, %13 ]
  store i32 %storemerge, ptr %0, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #5
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = tail call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #5
  %24 = lshr i64 %23, 1
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #5
  call void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  invoke void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %24, ptr noundef nonnull align 1 dereferenceable(1) %3)
          to label %25 unwind label %43

25:                                               ; preds = %20
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  %26 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #5
  %.not = icmp eq i64 %26, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %25
  br i1 %21, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %.04856.us = phi i64 [ %39, %.lr.ph.split.us ], [ 0, %.lr.ph ]
  %27 = lshr exact i64 %.04856.us, 1
  %28 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %.04856.us) #5
  %29 = load i8, ptr %28, align 1, !tbaa !16
  %30 = zext i8 %29 to i16
  %31 = or disjoint i64 %.04856.us, 1
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %31) #5
  %33 = load i8, ptr %32, align 1, !tbaa !16
  %34 = zext i8 %33 to i16
  %35 = add nuw nsw i16 %34, %30
  %36 = lshr i16 %35, 1
  %37 = trunc nuw i16 %36 to i8
  %38 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %27) #5
  store i8 %37, ptr %38, align 1, !tbaa !16
  %39 = add i64 %.04856.us, %.047
  %40 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #5
  %41 = icmp ult i64 %39, %40
  br i1 %41, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !17

._crit_edge:                                      ; preds = %57, %.lr.ph.split.us, %25
  %42 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIhSaIhEEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %22, ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  br label %71

43:                                               ; preds = %20
  %44 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %3) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #5
  br label %72

.lr.ph.split:                                     ; preds = %.lr.ph, %57
  %.04856 = phi i64 [ %66, %57 ], [ 0, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %4) #5
  %45 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %.04856) #5
  %46 = load i8, ptr %45, align 1, !tbaa !16
  %47 = or disjoint i64 %.04856, 1
  %48 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %47) #5
  %49 = load i8, ptr %48, align 1, !tbaa !16
  %50 = add i64 %.04856, 2
  %51 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %50) #5
  %52 = load i8, ptr %51, align 1, !tbaa !16
  %53 = add i64 %.04856, 3
  %54 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %53) #5
  %55 = load i8, ptr %54, align 1, !tbaa !16
  %.sroa.29.0.insert.ext = zext i8 %49 to i16
  %.sroa.29.0.insert.shift = shl nuw i16 %.sroa.29.0.insert.ext, 8
  %.sroa.08.0.insert.ext = zext i8 %46 to i16
  %.sroa.08.0.insert.insert = or disjoint i16 %.sroa.29.0.insert.shift, %.sroa.08.0.insert.ext
  %.sroa.2.0.insert.ext = zext i8 %55 to i16
  %.sroa.2.0.insert.shift = shl nuw i16 %.sroa.2.0.insert.ext, 8
  %.sroa.0.0.insert.ext = zext i8 %52 to i16
  %.sroa.0.0.insert.insert = or disjoint i16 %.sroa.2.0.insert.shift, %.sroa.0.0.insert.ext
  %56 = invoke i16 @_ZN3Raz10AudioUtils12_GLOBAL__N_114computeMonoI16ESt5arrayIhLm2EES3_(i16 %.sroa.08.0.insert.insert, i16 %.sroa.0.0.insert.insert)
          to label %57 unwind label %69

57:                                               ; preds = %.lr.ph.split
  %58 = lshr exact i64 %.04856, 1
  store i16 %56, ptr %4, align 2
  %59 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt5arrayIhLm2EEixEm(ptr noundef nonnull align 1 dereferenceable(2) %4, i64 noundef 0) #5
  %60 = load i8, ptr %59, align 1, !tbaa !16
  %61 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %58) #5
  store i8 %60, ptr %61, align 1, !tbaa !16
  %62 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt5arrayIhLm2EEixEm(ptr noundef nonnull align 1 dereferenceable(2) %4, i64 noundef 1) #5
  %63 = load i8, ptr %62, align 1, !tbaa !16
  %64 = add nuw i64 %58, 1
  %65 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %64) #5
  store i8 %63, ptr %65, align 1, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #5
  %66 = add i64 %.04856, %.047
  %67 = call noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %22) #5
  %68 = icmp ult i64 %66, %67
  br i1 %68, label %.lr.ph.split, label %._crit_edge, !llvm.loop !17

69:                                               ; preds = %.lr.ph.split
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %4) #5
  call void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #5
  br label %72

71:                                               ; preds = %1, %1, %1, %1, %._crit_edge
  ret void

72:                                               ; preds = %69, %43
  %.pn = phi { ptr, i32 } [ %70, %69 ], [ %44, %43 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #5
  br label %73

73:                                               ; preds = %18, %72, %11
  %.pn54 = phi { ptr, i32 } [ %12, %11 ], [ %19, %18 ], [ %.pn, %72 ]
  resume { ptr, i32 } %.pn54
}

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt16invalid_argumentC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt16invalid_argumentD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIhSaIhEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSaIhEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEEC2EmRKS0_(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIhSaIhEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare hidden i16 @_ZN3Raz10AudioUtils12_GLOBAL__N_114computeMonoI16ESt5arrayIhLm2EES3_(i16, i16) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt5arrayIhLm2EEixEm(ptr noundef nonnull align 1 dereferenceable(2), i64 noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIhSaIhEEaSEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIhSaIhEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt15__new_allocatorIhED2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #4 align 2

attributes #0 = { mustprogress 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #4 = { mustprogress 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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 = !{!"_ZTSN3Raz9AudioDataE", !7, i64 0, !10, i64 4, !11, i64 8}
!7 = !{!"_ZTSN3Raz11AudioFormatE", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTSSt6vectorIhSaIhEE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !15, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!8, !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass