; LLVM IR from redhatdragon/EchoEngine :: HAL/ExampleImplimentations/Windows/OpenMP3/[resources]/example.ll (Z8ParseMP3PKvj)

; 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.OpenMP3::Library" = type { i8 }
%"class.OpenMP3::Iterator" = type <{ ptr, ptr, ptr, i8, [7 x i8] }>
%"class.OpenMP3::Frame" = type { i8, i8, i32, i8, ptr, i32, i32 }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8ParseMP3PKvj(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca %"class.OpenMP3::Library", align 1
  %6 = alloca %"class.OpenMP3::Iterator", align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca %"class.OpenMP3::Frame", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 1, ptr %5) #3
  call void @_ZN7OpenMP37LibraryC1Ev(ptr noundef nonnull align 1 dereferenceable(1) %5)
  call void @llvm.lifetime.start.p0(i64 32, ptr %6) #3
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = load i32, ptr %4, align 4, !tbaa !9
  call void @_ZN7OpenMP38IteratorC1ERKNS_7LibraryEPKhj(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 1 dereferenceable(1) %5, ptr noundef %10, i32 noundef %11)
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  store i8 1, ptr %7, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #3
  call void @_ZN7OpenMP35FrameC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %9)
  br label %12

12:                                               ; preds = %26, %2
  %13 = call noundef zeroext i1 @_ZN7OpenMP38Iterator7GetNextERNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(25) %6, ptr noundef nonnull align 8 dereferenceable(32) %9)
  br i1 %13, label %14, label %29

14:                                               ; preds = %12
  %15 = call noundef i32 @_ZNK7OpenMP35Frame10GetBitRateEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %16 = load i32, ptr %8, align 4, !tbaa !9
  %17 = icmp ugt i32 %15, %16
  br i1 %17, label %18, label %20

18:                                               ; preds = %14
  %19 = call noundef i32 @_ZNK7OpenMP35Frame10GetBitRateEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  store i32 %19, ptr %8, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %18, %14
  %21 = load i8, ptr %7, align 1, !tbaa !11, !range !13, !noundef !14
  %22 = trunc i8 %21 to i1
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  %24 = call noundef i32 @_ZNK7OpenMP35Frame7GetModeEv(ptr noundef nonnull align 8 dereferenceable(32) %9)
  %25 = icmp eq i32 %24, 3
  br label %26

26:                                               ; preds = %23, %20
  %27 = phi i1 [ false, %20 ], [ %25, %23 ]
  %28 = zext i1 %27 to i8
  store i8 %28, ptr %7, align 1, !tbaa !11
  br label %12, !llvm.loop !15

29:                                               ; preds = %12
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %5) #3
  ret void
}

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

declare void @_ZN7OpenMP37LibraryC1Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2

declare void @_ZN7OpenMP38IteratorC1ERKNS_7LibraryEPKhj(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i32 noundef) unnamed_addr #2

declare void @_ZN7OpenMP35FrameC1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

declare noundef zeroext i1 @_ZN7OpenMP38Iterator7GetNextERNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(32)) #2

declare noundef i32 @_ZNK7OpenMP35Frame10GetBitRateEv(ptr noundef nonnull align 8 dereferenceable(32)) #2

declare noundef i32 @_ZNK7OpenMP35Frame7GetModeEv(ptr noundef nonnull align 8 dereferenceable(32)) #2

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

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 }

!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 = !{!"bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = distinct !{!15, !16}
!16 = !{!"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.OpenMP3::Library" = type { i8 }
%"class.OpenMP3::Iterator" = type <{ ptr, ptr, ptr, i8, [7 x i8] }>
%"class.OpenMP3::Frame" = type { i8, i8, i32, i8, ptr, i32, i32 }

; Function Attrs: mustprogress uwtable
define dso_local void @_Z8ParseMP3PKvj(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = alloca %"class.OpenMP3::Library", align 1
  %4 = alloca %"class.OpenMP3::Iterator", align 8
  %5 = alloca %"class.OpenMP3::Frame", align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %3) #3
  call void @_ZN7OpenMP37LibraryC1Ev(ptr noundef nonnull align 1 dereferenceable(1) %3)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #3
  call void @_ZN7OpenMP38IteratorC1ERKNS_7LibraryEPKhj(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 1 dereferenceable(1) %3, ptr noundef %0, i32 noundef %1)
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #3
  call void @_ZN7OpenMP35FrameC1Ev(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %6 = call noundef zeroext i1 @_ZN7OpenMP38Iterator7GetNextERNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 8 dereferenceable(32) %5)
  br i1 %6, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %15
  %.05 = phi i32 [ %.1, %15 ], [ 0, %2 ]
  %.034 = phi i1 [ %16, %15 ], [ true, %2 ]
  %7 = call noundef i32 @_ZNK7OpenMP35Frame10GetBitRateEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %8 = icmp ugt i32 %7, %.05
  br i1 %8, label %9, label %11

9:                                                ; preds = %.lr.ph
  %10 = call noundef i32 @_ZNK7OpenMP35Frame10GetBitRateEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  br label %11

11:                                               ; preds = %9, %.lr.ph
  %.1 = phi i32 [ %10, %9 ], [ %.05, %.lr.ph ]
  br i1 %.034, label %12, label %15

12:                                               ; preds = %11
  %13 = call noundef i32 @_ZNK7OpenMP35Frame7GetModeEv(ptr noundef nonnull align 8 dereferenceable(32) %5)
  %14 = icmp eq i32 %13, 3
  br label %15

15:                                               ; preds = %12, %11
  %16 = phi i1 [ false, %11 ], [ %14, %12 ]
  %17 = call noundef zeroext i1 @_ZN7OpenMP38Iterator7GetNextERNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(25) %4, ptr noundef nonnull align 8 dereferenceable(32) %5)
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %15, %2
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %3) #3
  ret void
}

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

declare void @_ZN7OpenMP37LibraryC1Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2

declare void @_ZN7OpenMP38IteratorC1ERKNS_7LibraryEPKhj(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i32 noundef) unnamed_addr #2

declare void @_ZN7OpenMP35FrameC1Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

declare noundef zeroext i1 @_ZN7OpenMP38Iterator7GetNextERNS_5FrameE(ptr noundef nonnull align 8 dereferenceable(25), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

declare noundef i32 @_ZNK7OpenMP35Frame10GetBitRateEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

declare noundef i32 @_ZNK7OpenMP35Frame7GetModeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

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

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 }

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass