; LLVM IR from merpheus-dev/LavaEngine :: src/Utils/soloud/src/audiosource/wav (dr_impl)

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

@.str.16 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm = 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: mustprogress uwtable
define dso_local noundef i32 @_Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store i32 %2, ptr %9, align 4, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !11
  store ptr %4, ptr %11, align 8, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %5
  br label %17

15:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str.18, ptr noundef @.str.16, i32 noundef 1731, ptr noundef @__PRETTY_FUNCTION__._Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm) #2
  unreachable

16:                                               ; No predecessors!
  br label %17

17:                                               ; preds = %16, %14
  %18 = load ptr, ptr %11, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %17
  br label %23

21:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.16, i32 noundef 1732, ptr noundef @__PRETTY_FUNCTION__._Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm) #2
  unreachable

22:                                               ; No predecessors!
  br label %23

23:                                               ; preds = %22, %20
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = load i32, ptr %10, align 4, !tbaa !11
  %28 = call noundef i32 %24(ptr noundef %25, i32 noundef %26, i32 noundef %27)
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %31, label %30

30:                                               ; preds = %23
  store i32 0, ptr %6, align 4
  br label %45

31:                                               ; preds = %23
  %32 = load i32, ptr %10, align 4, !tbaa !11
  %33 = icmp eq i32 %32, 0
  br i1 %33, label %34, label %38

34:                                               ; preds = %31
  %35 = load i32, ptr %9, align 4, !tbaa !9
  %36 = sext i32 %35 to i64
  %37 = load ptr, ptr %11, align 8, !tbaa !5
  store i64 %36, ptr %37, align 8, !tbaa !13
  br label %44

38:                                               ; preds = %31
  %39 = load i32, ptr %9, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = load ptr, ptr %11, align 8, !tbaa !5
  %42 = load i64, ptr %41, align 8, !tbaa !13
  %43 = add i64 %42, %40
  store i64 %43, ptr %41, align 8, !tbaa !13
  br label %44

44:                                               ; preds = %38, %34
  store i32 1, ptr %6, align 4
  br label %45

45:                                               ; preds = %44, %30
  %46 = load i32, ptr %6, align 4
  ret i32 %46
}

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 = { 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 #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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"_ZTS17drwav_seek_origin", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"long", !7, i64 0}


; 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.16 = external hidden unnamed_addr constant [103 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm = 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: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm(ptr noundef readonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

6:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.18, ptr noundef nonnull @.str.16, i32 noundef 1731, ptr noundef nonnull @__PRETTY_FUNCTION__._Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm) #2
  unreachable

7:                                                ; preds = %5
  %.not13 = icmp eq ptr %4, null
  br i1 %.not13, label %8, label %9

8:                                                ; preds = %7
  tail call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.16, i32 noundef 1732, ptr noundef nonnull @__PRETTY_FUNCTION__._Z14drwav__on_seekPFjPvi17drwav_seek_originES_iS0_Pm) #2
  unreachable

9:                                                ; preds = %7
  %10 = tail call noundef i32 %0(ptr noundef %1, i32 noundef %2, i32 noundef %3)
  %.not14 = icmp eq i32 %10, 0
  br i1 %.not14, label %18, label %11

11:                                               ; preds = %9
  %12 = icmp eq i32 %3, 0
  %13 = sext i32 %2 to i64
  br i1 %12, label %17, label %14

14:                                               ; preds = %11
  %15 = load i64, ptr %4, align 8, !tbaa !5
  %16 = add i64 %15, %13
  br label %17

17:                                               ; preds = %11, %14
  %storemerge = phi i64 [ %16, %14 ], [ %13, %11 ]
  store i64 %storemerge, ptr %4, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %9, %17
  %.0 = phi i32 [ 1, %17 ], [ 0, %9 ]
  ret i32 %.0
}

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 = { 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 #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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass