; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui (imgui_draw)

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN24ImFontGlyphRangesBuilder7AddCharEt(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN24ImFontGlyphRangesBuilder9AddRangesEPKt(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  br label %7

7:                                                ; preds = %37, %2
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds i16, ptr %8, i64 0
  %10 = load i16, ptr %9, align 2, !tbaa !9
  %11 = icmp ne i16 %10, 0
  br i1 %11, label %12, label %40

12:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds i16, ptr %13, i64 0
  %15 = load i16, ptr %14, align 2, !tbaa !9
  %16 = zext i16 %15 to i32
  store i32 %16, ptr %5, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %33, %12
  %18 = load i32, ptr %5, align 4, !tbaa !11
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = getelementptr inbounds i16, ptr %19, i64 1
  %21 = load i16, ptr %20, align 2, !tbaa !9
  %22 = zext i16 %21 to i32
  %23 = icmp ule i32 %18, %22
  br i1 %23, label %24, label %27

24:                                               ; preds = %17
  %25 = load i32, ptr %5, align 4, !tbaa !11
  %26 = icmp ule i32 %25, 65535
  br label %27

27:                                               ; preds = %24, %17
  %28 = phi i1 [ false, %17 ], [ %26, %24 ]
  br i1 %28, label %30, label %29

29:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  br label %36

30:                                               ; preds = %27
  %31 = load i32, ptr %5, align 4, !tbaa !11
  %32 = trunc i32 %31 to i16
  call void @_ZN24ImFontGlyphRangesBuilder7AddCharEt(ptr noundef nonnull align 8 dereferenceable(16) %6, i16 noundef zeroext %32)
  br label %33

33:                                               ; preds = %30
  %34 = load i32, ptr %5, align 4, !tbaa !11
  %35 = add i32 %34, 1
  store i32 %35, ptr %5, align 4, !tbaa !11
  br label %17, !llvm.loop !13

36:                                               ; preds = %29
  br label %37

37:                                               ; preds = %36
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds i16, ptr %38, i64 2
  store ptr %39, ptr %4, align 8, !tbaa !5
  br label %7, !llvm.loop !15

40:                                               ; preds = %7
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { 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 #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 = !{!"short", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZN24ImFontGlyphRangesBuilder7AddCharEt(ptr noundef nonnull align 8 dereferenceable(16), i16 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN24ImFontGlyphRangesBuilder9AddRangesEPKt(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 align 2 {
  %3 = load i16, ptr %1, align 2, !tbaa !5
  %.not11 = icmp eq i16 %3, 0
  br i1 %.not11, label %._crit_edge15, label %.lr.ph14

.lr.ph14:                                         ; preds = %2, %._crit_edge
  %4 = phi i16 [ %9, %._crit_edge ], [ %3, %2 ]
  %.0812 = phi ptr [ %8, %._crit_edge ], [ %1, %2 ]
  %5 = getelementptr inbounds i8, ptr %.0812, i64 2
  %6 = load i16, ptr %5, align 2, !tbaa !5
  %.not16 = icmp ugt i16 %4, %6
  br i1 %.not16, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph14
  %7 = zext i16 %4 to i32
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph14
  %8 = getelementptr inbounds i8, ptr %.0812, i64 4
  %9 = load i16, ptr %8, align 2, !tbaa !5
  %.not = icmp eq i16 %9, 0
  br i1 %.not, label %._crit_edge15, label %.lr.ph14, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.010 = phi i32 [ %11, %.lr.ph ], [ %7, %.lr.ph.preheader ]
  %10 = trunc nuw i32 %.010 to i16
  tail call void @_ZN24ImFontGlyphRangesBuilder7AddCharEt(ptr noundef nonnull align 8 dereferenceable(16) %0, i16 noundef zeroext %10)
  %11 = add nuw nsw i32 %.010, 1
  %12 = load i16, ptr %5, align 2, !tbaa !5
  %13 = zext i16 %12 to i32
  %14 = icmp ult i32 %.010, %13
  %15 = icmp ult i32 %.010, 65535
  %16 = and i1 %15, %14
  br i1 %16, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge15:                                    ; preds = %._crit_edge, %2
  ret void
}

attributes #0 = { inlinehint 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 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" }

!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 = !{!"short", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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