; LLVM IR from Samson-Mano/EM_Propogation_simulation :: EM_Propogation_simulation/src/ImGui/imgui.ll (Z9ImStricmpPKcS0_)

; 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: mustprogress uwtable
define dso_local noundef i32 @_Z9ImStricmpPKcS0_(ptr noundef %0, ptr noundef %1) #1 {
  %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
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  br label %6

6:                                                ; preds = %23, %2
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = load i8, ptr %7, align 1, !tbaa !9
  %9 = call noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext %8)
  %10 = sext i8 %9 to i32
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = call noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext %12)
  %14 = sext i8 %13 to i32
  %15 = sub nsw i32 %10, %14
  store i32 %15, ptr %5, align 4, !tbaa !10
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %21

17:                                               ; preds = %6
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = load i8, ptr %18, align 1, !tbaa !9
  %20 = icmp ne i8 %19, 0
  br label %21

21:                                               ; preds = %17, %6
  %22 = phi i1 [ false, %6 ], [ %20, %17 ]
  br i1 %22, label %23, label %28

23:                                               ; preds = %21
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i32 1
  store ptr %25, ptr %3, align 8, !tbaa !5
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %26, i32 1
  store ptr %27, ptr %4, align 8, !tbaa !5
  br label %6, !llvm.loop !12

28:                                               ; preds = %21
  %29 = load i32, ptr %5, align 4, !tbaa !10
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %29
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint 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 #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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"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"

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef range(i32 -255, 256) i32 @_Z9ImStricmpPKcS0_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  %4 = tail call noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext %3)
  %5 = load i8, ptr %0, align 1, !tbaa !5
  %6 = tail call noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext %5)
  %7 = icmp eq i8 %4, %6
  br i1 %7, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %2
  %8 = load i8, ptr %0, align 1, !tbaa !5
  %.not13 = icmp eq i8 %8, 0
  br i1 %.not13, label %.critedge, label %.lr.ph16

.lr.ph:                                           ; preds = %.lr.ph16
  %9 = load i8, ptr %10, align 1, !tbaa !5
  %.not = icmp eq i8 %9, 0
  br i1 %.not, label %.critedge, label %.lr.ph16, !llvm.loop !8

.lr.ph16:                                         ; preds = %.lr.ph.preheader, %.lr.ph
  %.05715 = phi ptr [ %11, %.lr.ph ], [ %1, %.lr.ph.preheader ]
  %.0814 = phi ptr [ %10, %.lr.ph ], [ %0, %.lr.ph.preheader ]
  %10 = getelementptr inbounds i8, ptr %.0814, i64 1
  %11 = getelementptr inbounds i8, ptr %.05715, i64 1
  %12 = load i8, ptr %11, align 1, !tbaa !5
  %13 = tail call noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext %12)
  %14 = load i8, ptr %10, align 1, !tbaa !5
  %15 = tail call noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext %14)
  %16 = icmp eq i8 %13, %15
  br i1 %16, label %.lr.ph, label %.critedge, !llvm.loop !8

.critedge:                                        ; preds = %.lr.ph16, %.lr.ph, %.lr.ph.preheader, %2
  %.lcssa6 = phi i8 [ %4, %2 ], [ %4, %.lr.ph.preheader ], [ %13, %.lr.ph ], [ %13, %.lr.ph16 ]
  %.lcssa = phi i8 [ %6, %2 ], [ %4, %.lr.ph.preheader ], [ %13, %.lr.ph ], [ %15, %.lr.ph16 ]
  %17 = sext i8 %.lcssa to i32
  %18 = sext i8 %.lcssa6 to i32
  %19 = sub nsw i32 %18, %17
  ret i32 %19
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef signext i8 @_ZL9ImToUpperc(i8 noundef signext) local_unnamed_addr #1

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

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


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass