; LLVM IR from Simple-XX/SimpleKernel :: src/drv/dtb/dtb.ll (ZN3DTB6path_teqEPKc)

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

%"struct.DTB::path_t" = type { [16 x ptr], i64 }

; 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 nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3DTB6path_teqEPKc(ptr noundef nonnull align 8 dereferenceable(136) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %4, align 8
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 0
  %12 = load i8, ptr %11, align 1, !tbaa !9
  %13 = sext i8 %12 to i32
  %14 = icmp ne i32 %13, 47
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  store i1 false, ptr %3, align 1
  br label %56

16:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !10
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !10
  br label %17

17:                                               ; preds = %49, %16
  %18 = load i64, ptr %7, align 8, !tbaa !10
  %19 = getelementptr inbounds %"struct.DTB::path_t", ptr %9, i32 0, i32 1
  %20 = load i64, ptr %19, align 8, !tbaa !12
  %21 = icmp ult i64 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %17
  store i32 2, ptr %8, align 4
  br label %52

23:                                               ; preds = %17
  %24 = getelementptr inbounds %"struct.DTB::path_t", ptr %9, i32 0, i32 0
  %25 = load i64, ptr %7, align 8, !tbaa !10
  %26 = getelementptr inbounds [16 x ptr], ptr %24, i64 0, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = load i64, ptr %6, align 8, !tbaa !10
  %30 = load i64, ptr %7, align 8, !tbaa !10
  %31 = add i64 %29, %30
  %32 = getelementptr inbounds i8, ptr %28, i64 %31
  %33 = getelementptr inbounds %"struct.DTB::path_t", ptr %9, i32 0, i32 0
  %34 = load i64, ptr %7, align 8, !tbaa !10
  %35 = getelementptr inbounds [16 x ptr], ptr %33, i64 0, i64 %34
  %36 = load ptr, ptr %35, align 8, !tbaa !5
  %37 = call i64 @strlen(ptr noundef %36) #3
  %38 = call i32 @strncmp(ptr noundef %27, ptr noundef %32, i64 noundef %37) #3
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %41

40:                                               ; preds = %23
  store i1 false, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %52

41:                                               ; preds = %23
  %42 = getelementptr inbounds %"struct.DTB::path_t", ptr %9, i32 0, i32 0
  %43 = load i64, ptr %7, align 8, !tbaa !10
  %44 = getelementptr inbounds [16 x ptr], ptr %42, i64 0, i64 %43
  %45 = load ptr, ptr %44, align 8, !tbaa !5
  %46 = call i64 @strlen(ptr noundef %45) #3
  %47 = load i64, ptr %6, align 8, !tbaa !10
  %48 = add i64 %47, %46
  store i64 %48, ptr %6, align 8, !tbaa !10
  br label %49

49:                                               ; preds = %41
  %50 = load i64, ptr %7, align 8, !tbaa !10
  %51 = add i64 %50, 1
  store i64 %51, ptr %7, align 8, !tbaa !10
  br label %17, !llvm.loop !14

52:                                               ; preds = %40, %22
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %53 = load i32, ptr %8, align 4
  switch i32 %53, label %55 [
    i32 2, label %54
  ]

54:                                               ; preds = %52
  store i1 true, ptr %3, align 1
  store i32 1, ptr %8, align 4
  br label %55

55:                                               ; preds = %54, %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %56

56:                                               ; preds = %55, %15
  %57 = load i1, ptr %3, align 1
  ret i1 %57
}

; Function Attrs: nounwind
declare i32 @strncmp(ptr noundef, ptr noundef, i64 noundef) #2

; Function Attrs: nounwind
declare i64 @strlen(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 128}
!13 = !{!"_ZTSN3DTB6path_tE", !7, i64 0, !11, i64 128}
!14 = distinct !{!14, !15}
!15 = !{!"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 nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @_ZN3DTB6path_teqEPKc(ptr nocapture noundef nonnull readonly align 8 dereferenceable(136) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 align 2 {
  %3 = load i8, ptr %1, align 1, !tbaa !5
  %.not = icmp eq i8 %3, 47
  br i1 %.not, label %.preheader, label %.critedge

.preheader:                                       ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 128
  %5 = load i64, ptr %4, align 8, !tbaa !8
  %.not16.not17.not = icmp eq i64 %5, 0
  br i1 %.not16.not17.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %12
  %.01219 = phi i64 [ %14, %12 ], [ 0, %.preheader ]
  %.01318 = phi i64 [ %13, %12 ], [ 0, %.preheader ]
  %6 = getelementptr inbounds [16 x ptr], ptr %0, i64 0, i64 %.01219
  %7 = load ptr, ptr %6, align 8, !tbaa !11
  %8 = getelementptr i8, ptr %1, i64 %.01318
  %9 = getelementptr i8, ptr %8, i64 %.01219
  %10 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %7) #2
  %11 = tail call i32 @strncmp(ptr noundef %7, ptr noundef %9, i64 noundef %10) #2
  %.not15 = icmp eq i32 %11, 0
  br i1 %.not15, label %12, label %.critedge

12:                                               ; preds = %.lr.ph
  %13 = add i64 %10, %.01318
  %14 = add nuw i64 %.01219, 1
  %exitcond.not = icmp eq i64 %14, %5
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !13

.critedge:                                        ; preds = %.lr.ph, %12, %.preheader, %2
  %.2 = phi i1 [ false, %2 ], [ true, %.preheader ], [ %.not15, %12 ], [ %.not15, %.lr.ph ]
  ret i1 %.2
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) 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 nofree nounwind willreturn memory(argmem: read) "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 = { 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !10, i64 128}
!9 = !{!"_ZTSN3DTB6path_tE", !6, i64 0, !10, i64 128}
!10 = !{!"long", !6, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !6, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


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