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

; 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::dt_prop_fmt_t" = type { ptr, i32 }

@_ZN3DTB5propsE = external dso_local constant [20 x %"struct.DTB::dt_prop_fmt_t"], align 16

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

; Function Attrs: nounwind
declare i32 @strcmp(ptr noundef, ptr noundef) #1

; 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 i32 @_ZN3DTB7get_fmtEPKc(ptr noundef nonnull align 1 dereferenceable(1) %0, ptr noundef %1) #2 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 0, ptr %6, align 8, !tbaa !11
  br label %8

8:                                                ; preds = %26, %2
  %9 = load i64, ptr %6, align 8, !tbaa !11
  %10 = icmp ult i64 %9, 20
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %8
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load i64, ptr %6, align 8, !tbaa !11
  %15 = getelementptr inbounds [20 x %"struct.DTB::dt_prop_fmt_t"], ptr @_ZN3DTB5propsE, i64 0, i64 %14
  %16 = getelementptr inbounds %"struct.DTB::dt_prop_fmt_t", ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 16, !tbaa !13
  %18 = call i32 @strcmp(ptr noundef %13, ptr noundef %17) #3
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %20, label %25

20:                                               ; preds = %12
  %21 = load i64, ptr %6, align 8, !tbaa !11
  %22 = getelementptr inbounds [20 x %"struct.DTB::dt_prop_fmt_t"], ptr @_ZN3DTB5propsE, i64 0, i64 %21
  %23 = getelementptr inbounds %"struct.DTB::dt_prop_fmt_t", ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !15
  store i32 %24, ptr %5, align 4, !tbaa !9
  br label %25

25:                                               ; preds = %20, %12
  br label %26

26:                                               ; preds = %25
  %27 = load i64, ptr %6, align 8, !tbaa !11
  %28 = add i64 %27, 1
  store i64 %28, ptr %6, align 8, !tbaa !11
  br label %8, !llvm.loop !16

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 = !{!10, !10, i64 0}
!10 = !{!"_ZTSN3DTB8dt_fmt_tE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSN3DTB13dt_prop_fmt_tE", !6, i64 0, !10, i64 8}
!15 = !{!14, !10, i64 8}
!16 = distinct !{!16, !17}
!17 = !{!"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"

%"struct.DTB::dt_prop_fmt_t" = type { ptr, i32 }

@_ZN3DTB5propsE = external dso_local local_unnamed_addr constant [20 x %"struct.DTB::dt_prop_fmt_t"], align 16

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(read, inaccessiblemem: none) uwtable
define dso_local noundef i32 @_ZN3DTB7get_fmtEPKc(ptr nocapture noundef nonnull readnone align 1 dereferenceable(1) %0, ptr nocapture noundef readonly %1) local_unnamed_addr #1 align 2 {
  %3 = load ptr, ptr @_ZN3DTB5propsE, align 16, !tbaa !5
  %4 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %3) #2
  %5 = icmp eq i32 %4, 0
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 8), align 8
  %spec.select = select i1 %5, i32 %6, i32 0
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 16), align 16, !tbaa !5
  %8 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %7) #2
  %9 = icmp eq i32 %8, 0
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 24), align 8
  %.1.1 = select i1 %9, i32 %10, i32 %spec.select
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 32), align 16, !tbaa !5
  %12 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %11) #2
  %13 = icmp eq i32 %12, 0
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 40), align 8
  %.1.2 = select i1 %13, i32 %14, i32 %.1.1
  %15 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 48), align 16, !tbaa !5
  %16 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %15) #2
  %17 = icmp eq i32 %16, 0
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 56), align 8
  %.1.3 = select i1 %17, i32 %18, i32 %.1.2
  %19 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 64), align 16, !tbaa !5
  %20 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %19) #2
  %21 = icmp eq i32 %20, 0
  %22 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 72), align 8
  %.1.4 = select i1 %21, i32 %22, i32 %.1.3
  %23 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 80), align 16, !tbaa !5
  %24 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %23) #2
  %25 = icmp eq i32 %24, 0
  %26 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 88), align 8
  %.1.5 = select i1 %25, i32 %26, i32 %.1.4
  %27 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 96), align 16, !tbaa !5
  %28 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %27) #2
  %29 = icmp eq i32 %28, 0
  %30 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 104), align 8
  %.1.6 = select i1 %29, i32 %30, i32 %.1.5
  %31 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 112), align 16, !tbaa !5
  %32 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %31) #2
  %33 = icmp eq i32 %32, 0
  %34 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 120), align 8
  %.1.7 = select i1 %33, i32 %34, i32 %.1.6
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 128), align 16, !tbaa !5
  %36 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %35) #2
  %37 = icmp eq i32 %36, 0
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 136), align 8
  %.1.8 = select i1 %37, i32 %38, i32 %.1.7
  %39 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 144), align 16, !tbaa !5
  %40 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %39) #2
  %41 = icmp eq i32 %40, 0
  %42 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 152), align 8
  %.1.9 = select i1 %41, i32 %42, i32 %.1.8
  %43 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 160), align 16, !tbaa !5
  %44 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %43) #2
  %45 = icmp eq i32 %44, 0
  %46 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 168), align 8
  %.1.10 = select i1 %45, i32 %46, i32 %.1.9
  %47 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 176), align 16, !tbaa !5
  %48 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %47) #2
  %49 = icmp eq i32 %48, 0
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 184), align 8
  %.1.11 = select i1 %49, i32 %50, i32 %.1.10
  %51 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 192), align 16, !tbaa !5
  %52 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %51) #2
  %53 = icmp eq i32 %52, 0
  %54 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 200), align 8
  %.1.12 = select i1 %53, i32 %54, i32 %.1.11
  %55 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 208), align 16, !tbaa !5
  %56 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %55) #2
  %57 = icmp eq i32 %56, 0
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 216), align 8
  %.1.13 = select i1 %57, i32 %58, i32 %.1.12
  %59 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 224), align 16, !tbaa !5
  %60 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %59) #2
  %61 = icmp eq i32 %60, 0
  %62 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 232), align 8
  %.1.14 = select i1 %61, i32 %62, i32 %.1.13
  %63 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 240), align 16, !tbaa !5
  %64 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %63) #2
  %65 = icmp eq i32 %64, 0
  %66 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 248), align 8
  %.1.15 = select i1 %65, i32 %66, i32 %.1.14
  %67 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 256), align 16, !tbaa !5
  %68 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %67) #2
  %69 = icmp eq i32 %68, 0
  %70 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 264), align 8
  %.1.16 = select i1 %69, i32 %70, i32 %.1.15
  %71 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 272), align 16, !tbaa !5
  %72 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %71) #2
  %73 = icmp eq i32 %72, 0
  %74 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 280), align 8
  %.1.17 = select i1 %73, i32 %74, i32 %.1.16
  %75 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 288), align 16, !tbaa !5
  %76 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %75) #2
  %77 = icmp eq i32 %76, 0
  %78 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 296), align 8
  %.1.18 = select i1 %77, i32 %78, i32 %.1.17
  %79 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 304), align 16, !tbaa !5
  %80 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %1, ptr noundef nonnull dereferenceable(1) %79) #2
  %81 = icmp eq i32 %80, 0
  %82 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN3DTB5propsE, i64 312), align 8
  %.1.19 = select i1 %81, i32 %82, i32 %.1.18
  ret i32 %.1.19
}

attributes #0 = { 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 #1 = { 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 #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, !7, i64 0}
!6 = !{!"_ZTSN3DTB13dt_prop_fmt_tE", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN3DTB8dt_fmt_tE", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass