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

; 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::node_t" = type { %"struct.DTB::path_t", ptr, ptr, ptr, i32, i32, i32, i32, i8, [16 x %"struct.DTB::prop_t"], i64 }
%"struct.DTB::path_t" = type { [16 x ptr], i64 }
%"struct.DTB::prop_t" = type { ptr, i64, i64 }
%"struct.DTB::phandle_map_t" = type { i32, ptr }
%"struct.DTB::iter_data_t" = type { %"struct.DTB::path_t", ptr, i32, ptr, i32, ptr, i8 }

@_ZN3DTB5nodesE = external dso_local global [128 x %"struct.DTB::node_t"], align 16
@_ZN3DTB6node_t5countE = external dso_local global i64, align 8
@_ZN3DTB11phandle_mapE = external dso_local global [128 x %"struct.DTB::phandle_map_t"], align 16
@_ZN3DTB13phandle_map_t5countE = external dso_local global i64, align 8
@.str.14 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1

; 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: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL9__bswap32j(i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN3DTB11dtb_init_cbEPKNS_11iter_data_tEPv(ptr noundef %0, ptr noundef %1) #3 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  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 8, ptr %5) #5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %7, i32 0, i32 6
  %9 = load i8, ptr %8, align 8, !tbaa !9
  %10 = zext i8 %9 to i64
  store i64 %10, ptr %5, align 8, !tbaa !14
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %11, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !15
  switch i32 %13, label %213 [
    i32 1, label %14
    i32 3, label %81
    i32 2, label %210
  ]

14:                                               ; preds = %2
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %15, i32 0, i32 0
  %17 = load i64, ptr %5, align 8, !tbaa !14
  %18 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %17
  %19 = getelementptr inbounds %"struct.DTB::node_t", ptr %18, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %19, ptr align 8 %16, i64 136, i1 false), !tbaa.struct !16
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %20, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !18
  %23 = load i64, ptr %5, align 8, !tbaa !14
  %24 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %23
  %25 = getelementptr inbounds %"struct.DTB::node_t", ptr %24, i32 0, i32 1
  store ptr %22, ptr %25, align 8, !tbaa !19
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %26, i32 0, i32 0
  %28 = getelementptr inbounds %"struct.DTB::path_t", ptr %27, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !21
  %30 = trunc i64 %29 to i8
  %31 = load i64, ptr %5, align 8, !tbaa !14
  %32 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %31
  %33 = getelementptr inbounds %"struct.DTB::node_t", ptr %32, i32 0, i32 8
  store i8 %30, ptr %33, align 16, !tbaa !22
  %34 = load i64, ptr %5, align 8, !tbaa !14
  %35 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %34
  %36 = getelementptr inbounds %"struct.DTB::node_t", ptr %35, i32 0, i32 4
  store i32 2, ptr %36, align 16, !tbaa !23
  %37 = load i64, ptr %5, align 8, !tbaa !14
  %38 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %37
  %39 = getelementptr inbounds %"struct.DTB::node_t", ptr %38, i32 0, i32 5
  store i32 2, ptr %39, align 4, !tbaa !24
  %40 = load i64, ptr %5, align 8, !tbaa !14
  %41 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %40
  %42 = getelementptr inbounds %"struct.DTB::node_t", ptr %41, i32 0, i32 6
  store i32 0, ptr %42, align 8, !tbaa !25
  %43 = load i64, ptr %5, align 8, !tbaa !14
  %44 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %43
  %45 = getelementptr inbounds %"struct.DTB::node_t", ptr %44, i32 0, i32 7
  store i32 0, ptr %45, align 4, !tbaa !26
  %46 = load i64, ptr %5, align 8, !tbaa !14
  %47 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %46
  %48 = getelementptr inbounds %"struct.DTB::node_t", ptr %47, i32 0, i32 3
  store ptr null, ptr %48, align 8, !tbaa !27
  %49 = load i64, ptr %5, align 8, !tbaa !14
  %50 = icmp ne i64 %49, 0
  br i1 %50, label %51, label %76

51:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %52 = load i64, ptr %5, align 8, !tbaa !14
  %53 = sub i64 %52, 1
  store i64 %53, ptr %6, align 8, !tbaa !14
  br label %54

54:                                               ; preds = %67, %51
  %55 = load i64, ptr %6, align 8, !tbaa !14
  %56 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %55
  %57 = getelementptr inbounds %"struct.DTB::node_t", ptr %56, i32 0, i32 8
  %58 = load i8, ptr %57, align 16, !tbaa !22
  %59 = zext i8 %58 to i32
  %60 = load i64, ptr %5, align 8, !tbaa !14
  %61 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %60
  %62 = getelementptr inbounds %"struct.DTB::node_t", ptr %61, i32 0, i32 8
  %63 = load i8, ptr %62, align 16, !tbaa !22
  %64 = zext i8 %63 to i32
  %65 = sub nsw i32 %64, 1
  %66 = icmp ne i32 %59, %65
  br i1 %66, label %67, label %70

67:                                               ; preds = %54
  %68 = load i64, ptr %6, align 8, !tbaa !14
  %69 = add i64 %68, -1
  store i64 %69, ptr %6, align 8, !tbaa !14
  br label %54, !llvm.loop !28

70:                                               ; preds = %54
  %71 = load i64, ptr %6, align 8, !tbaa !14
  %72 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %71
  %73 = load i64, ptr %5, align 8, !tbaa !14
  %74 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %73
  %75 = getelementptr inbounds %"struct.DTB::node_t", ptr %74, i32 0, i32 2
  store ptr %72, ptr %75, align 16, !tbaa !30
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %80

76:                                               ; preds = %14
  %77 = load i64, ptr %5, align 8, !tbaa !14
  %78 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %77
  %79 = getelementptr inbounds %"struct.DTB::node_t", ptr %78, i32 0, i32 2
  store ptr null, ptr %79, align 16, !tbaa !30
  br label %80

80:                                               ; preds = %76, %70
  br label %213

81:                                               ; preds = %2
  %82 = load ptr, ptr %3, align 8, !tbaa !5
  %83 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %82, i32 0, i32 3
  %84 = load ptr, ptr %83, align 8, !tbaa !31
  %85 = call i32 @strcmp(ptr noundef %84, ptr noundef @.str.14) #5
  %86 = icmp eq i32 %85, 0
  br i1 %86, label %87, label %97

87:                                               ; preds = %81
  %88 = load ptr, ptr %3, align 8, !tbaa !5
  %89 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %88, i32 0, i32 1
  %90 = load ptr, ptr %89, align 8, !tbaa !18
  %91 = getelementptr inbounds i32, ptr %90, i64 3
  %92 = load i32, ptr %91, align 4, !tbaa !32
  %93 = call noundef i32 @_ZL9__bswap32j(i32 noundef %92)
  %94 = load i64, ptr %5, align 8, !tbaa !14
  %95 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %94
  %96 = getelementptr inbounds %"struct.DTB::node_t", ptr %95, i32 0, i32 4
  store i32 %93, ptr %96, align 16, !tbaa !23
  br label %162

97:                                               ; preds = %81
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %98, i32 0, i32 3
  %100 = load ptr, ptr %99, align 8, !tbaa !31
  %101 = call i32 @strcmp(ptr noundef %100, ptr noundef @.str.15) #5
  %102 = icmp eq i32 %101, 0
  br i1 %102, label %103, label %113

103:                                              ; preds = %97
  %104 = load ptr, ptr %3, align 8, !tbaa !5
  %105 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %104, i32 0, i32 1
  %106 = load ptr, ptr %105, align 8, !tbaa !18
  %107 = getelementptr inbounds i32, ptr %106, i64 3
  %108 = load i32, ptr %107, align 4, !tbaa !32
  %109 = call noundef i32 @_ZL9__bswap32j(i32 noundef %108)
  %110 = load i64, ptr %5, align 8, !tbaa !14
  %111 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %110
  %112 = getelementptr inbounds %"struct.DTB::node_t", ptr %111, i32 0, i32 5
  store i32 %109, ptr %112, align 4, !tbaa !24
  br label %161

113:                                              ; preds = %97
  %114 = load ptr, ptr %3, align 8, !tbaa !5
  %115 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %114, i32 0, i32 3
  %116 = load ptr, ptr %115, align 8, !tbaa !31
  %117 = call i32 @strcmp(ptr noundef %116, ptr noundef @.str.16) #5
  %118 = icmp eq i32 %117, 0
  br i1 %118, label %119, label %129

119:                                              ; preds = %113
  %120 = load ptr, ptr %3, align 8, !tbaa !5
  %121 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %120, i32 0, i32 1
  %122 = load ptr, ptr %121, align 8, !tbaa !18
  %123 = getelementptr inbounds i32, ptr %122, i64 3
  %124 = load i32, ptr %123, align 4, !tbaa !32
  %125 = call noundef i32 @_ZL9__bswap32j(i32 noundef %124)
  %126 = load i64, ptr %5, align 8, !tbaa !14
  %127 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %126
  %128 = getelementptr inbounds %"struct.DTB::node_t", ptr %127, i32 0, i32 6
  store i32 %125, ptr %128, align 8, !tbaa !25
  br label %160

129:                                              ; preds = %113
  %130 = load ptr, ptr %3, align 8, !tbaa !5
  %131 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %130, i32 0, i32 3
  %132 = load ptr, ptr %131, align 8, !tbaa !31
  %133 = call i32 @strcmp(ptr noundef %132, ptr noundef @.str.17) #5
  %134 = icmp eq i32 %133, 0
  br i1 %134, label %135, label %159

135:                                              ; preds = %129
  %136 = load ptr, ptr %3, align 8, !tbaa !5
  %137 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %136, i32 0, i32 1
  %138 = load ptr, ptr %137, align 8, !tbaa !18
  %139 = getelementptr inbounds i32, ptr %138, i64 3
  %140 = load i32, ptr %139, align 4, !tbaa !32
  %141 = call noundef i32 @_ZL9__bswap32j(i32 noundef %140)
  %142 = load i64, ptr %5, align 8, !tbaa !14
  %143 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %142
  %144 = getelementptr inbounds %"struct.DTB::node_t", ptr %143, i32 0, i32 7
  store i32 %141, ptr %144, align 4, !tbaa !26
  %145 = load i64, ptr %5, align 8, !tbaa !14
  %146 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %145
  %147 = getelementptr inbounds %"struct.DTB::node_t", ptr %146, i32 0, i32 7
  %148 = load i32, ptr %147, align 4, !tbaa !26
  %149 = load i64, ptr @_ZN3DTB13phandle_map_t5countE, align 8, !tbaa !14
  %150 = getelementptr inbounds [128 x %"struct.DTB::phandle_map_t"], ptr @_ZN3DTB11phandle_mapE, i64 0, i64 %149
  %151 = getelementptr inbounds %"struct.DTB::phandle_map_t", ptr %150, i32 0, i32 0
  store i32 %148, ptr %151, align 16, !tbaa !33
  %152 = load i64, ptr %5, align 8, !tbaa !14
  %153 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %152
  %154 = load i64, ptr @_ZN3DTB13phandle_map_t5countE, align 8, !tbaa !14
  %155 = getelementptr inbounds [128 x %"struct.DTB::phandle_map_t"], ptr @_ZN3DTB11phandle_mapE, i64 0, i64 %154
  %156 = getelementptr inbounds %"struct.DTB::phandle_map_t", ptr %155, i32 0, i32 1
  store ptr %153, ptr %156, align 8, !tbaa !35
  %157 = load i64, ptr @_ZN3DTB13phandle_map_t5countE, align 8, !tbaa !14
  %158 = add i64 %157, 1
  store i64 %158, ptr @_ZN3DTB13phandle_map_t5countE, align 8, !tbaa !14
  br label %159

159:                                              ; preds = %135, %129
  br label %160

160:                                              ; preds = %159, %119
  br label %161

161:                                              ; preds = %160, %103
  br label %162

162:                                              ; preds = %161, %87
  %163 = load ptr, ptr %3, align 8, !tbaa !5
  %164 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %163, i32 0, i32 3
  %165 = load ptr, ptr %164, align 8, !tbaa !31
  %166 = load i64, ptr %5, align 8, !tbaa !14
  %167 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %166
  %168 = getelementptr inbounds %"struct.DTB::node_t", ptr %167, i32 0, i32 9
  %169 = load i64, ptr %5, align 8, !tbaa !14
  %170 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %169
  %171 = getelementptr inbounds %"struct.DTB::node_t", ptr %170, i32 0, i32 10
  %172 = load i64, ptr %171, align 8, !tbaa !36
  %173 = getelementptr inbounds [16 x %"struct.DTB::prop_t"], ptr %168, i64 0, i64 %172
  %174 = getelementptr inbounds %"struct.DTB::prop_t", ptr %173, i32 0, i32 0
  store ptr %165, ptr %174, align 8, !tbaa !37
  %175 = load ptr, ptr %3, align 8, !tbaa !5
  %176 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %175, i32 0, i32 1
  %177 = load ptr, ptr %176, align 8, !tbaa !18
  %178 = getelementptr inbounds i32, ptr %177, i64 3
  %179 = ptrtoint ptr %178 to i64
  %180 = load i64, ptr %5, align 8, !tbaa !14
  %181 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %180
  %182 = getelementptr inbounds %"struct.DTB::node_t", ptr %181, i32 0, i32 9
  %183 = load i64, ptr %5, align 8, !tbaa !14
  %184 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %183
  %185 = getelementptr inbounds %"struct.DTB::node_t", ptr %184, i32 0, i32 10
  %186 = load i64, ptr %185, align 8, !tbaa !36
  %187 = getelementptr inbounds [16 x %"struct.DTB::prop_t"], ptr %182, i64 0, i64 %186
  %188 = getelementptr inbounds %"struct.DTB::prop_t", ptr %187, i32 0, i32 1
  store i64 %179, ptr %188, align 8, !tbaa !39
  %189 = load ptr, ptr %3, align 8, !tbaa !5
  %190 = getelementptr inbounds %"struct.DTB::iter_data_t", ptr %189, i32 0, i32 1
  %191 = load ptr, ptr %190, align 8, !tbaa !18
  %192 = getelementptr inbounds i32, ptr %191, i64 1
  %193 = load i32, ptr %192, align 4, !tbaa !32
  %194 = call noundef i32 @_ZL9__bswap32j(i32 noundef %193)
  %195 = zext i32 %194 to i64
  %196 = load i64, ptr %5, align 8, !tbaa !14
  %197 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %196
  %198 = getelementptr inbounds %"struct.DTB::node_t", ptr %197, i32 0, i32 9
  %199 = load i64, ptr %5, align 8, !tbaa !14
  %200 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %199
  %201 = getelementptr inbounds %"struct.DTB::node_t", ptr %200, i32 0, i32 10
  %202 = load i64, ptr %201, align 8, !tbaa !36
  %203 = getelementptr inbounds [16 x %"struct.DTB::prop_t"], ptr %198, i64 0, i64 %202
  %204 = getelementptr inbounds %"struct.DTB::prop_t", ptr %203, i32 0, i32 2
  store i64 %195, ptr %204, align 8, !tbaa !40
  %205 = load i64, ptr %5, align 8, !tbaa !14
  %206 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %205
  %207 = getelementptr inbounds %"struct.DTB::node_t", ptr %206, i32 0, i32 10
  %208 = load i64, ptr %207, align 8, !tbaa !36
  %209 = add i64 %208, 1
  store i64 %209, ptr %207, align 8, !tbaa !36
  br label %213

210:                                              ; preds = %2
  %211 = load i64, ptr %5, align 8, !tbaa !14
  %212 = add i64 %211, 1
  store i64 %212, ptr @_ZN3DTB6node_t5countE, align 8, !tbaa !14
  br label %213

213:                                              ; preds = %210, %162, %80, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  ret i1 false
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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 = { 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 = { 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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, !7, i64 176}
!10 = !{!"_ZTSN3DTB11iter_data_tE", !11, i64 0, !6, i64 136, !13, i64 144, !6, i64 152, !13, i64 160, !6, i64 168, !7, i64 176}
!11 = !{!"_ZTSN3DTB6path_tE", !7, i64 0, !12, i64 128}
!12 = !{!"long", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!12, !12, i64 0}
!15 = !{!10, !13, i64 144}
!16 = !{i64 0, i64 128, !17, i64 128, i64 8, !14}
!17 = !{!7, !7, i64 0}
!18 = !{!10, !6, i64 136}
!19 = !{!20, !6, i64 136}
!20 = !{!"_ZTSN3DTB6node_tE", !11, i64 0, !6, i64 136, !6, i64 144, !6, i64 152, !13, i64 160, !13, i64 164, !13, i64 168, !13, i64 172, !7, i64 176, !7, i64 184, !12, i64 568}
!21 = !{!10, !12, i64 128}
!22 = !{!20, !7, i64 176}
!23 = !{!20, !13, i64 160}
!24 = !{!20, !13, i64 164}
!25 = !{!20, !13, i64 168}
!26 = !{!20, !13, i64 172}
!27 = !{!20, !6, i64 152}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!20, !6, i64 144}
!31 = !{!10, !6, i64 152}
!32 = !{!13, !13, i64 0}
!33 = !{!34, !13, i64 0}
!34 = !{!"_ZTSN3DTB13phandle_map_tE", !13, i64 0, !6, i64 8}
!35 = !{!34, !6, i64 8}
!36 = !{!20, !12, i64 568}
!37 = !{!38, !6, i64 0}
!38 = !{!"_ZTSN3DTB6prop_tE", !6, i64 0, !12, i64 8, !12, i64 16}
!39 = !{!38, !12, i64 8}
!40 = !{!38, !12, i64 16}


; 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::node_t" = type { %"struct.DTB::path_t", ptr, ptr, ptr, i32, i32, i32, i32, i8, [16 x %"struct.DTB::prop_t"], i64 }
%"struct.DTB::path_t" = type { [16 x ptr], i64 }
%"struct.DTB::prop_t" = type { ptr, i64, i64 }
%"struct.DTB::phandle_map_t" = type { i32, ptr }

@_ZN3DTB5nodesE = external dso_local global [128 x %"struct.DTB::node_t"], align 16
@_ZN3DTB6node_t5countE = external dso_local local_unnamed_addr global i64, align 8
@_ZN3DTB11phandle_mapE = external dso_local local_unnamed_addr global [128 x %"struct.DTB::phandle_map_t"], align 16
@_ZN3DTB13phandle_map_t5countE = external dso_local local_unnamed_addr global i64, align 8
@.str.14 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [8 x i8], align 1

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL9__bswap32j(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN3DTB11dtb_init_cbEPKNS_11iter_data_tEPv(ptr nocapture noundef readonly %0, ptr nocapture noundef readnone %1) local_unnamed_addr #2 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 176
  %4 = load i8, ptr %3, align 8, !tbaa !5
  %5 = zext i8 %4 to i64
  %6 = getelementptr inbounds i8, ptr %0, i64 144
  %7 = load i32, ptr %6, align 8, !tbaa !13
  switch i32 %7, label %99 [
    i32 1, label %8
    i32 3, label %31
    i32 2, label %97
  ]

8:                                                ; preds = %2
  %9 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %5
  tail call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(136) %9, ptr noundef nonnull align 8 dereferenceable(136) %0, i64 136, i1 false), !tbaa.struct !14
  %10 = getelementptr inbounds i8, ptr %0, i64 136
  %11 = load ptr, ptr %10, align 8, !tbaa !17
  %12 = getelementptr inbounds i8, ptr %9, i64 136
  store ptr %11, ptr %12, align 8, !tbaa !18
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  %14 = load i64, ptr %13, align 8, !tbaa !20
  %15 = trunc i64 %14 to i8
  %16 = getelementptr inbounds i8, ptr %9, i64 176
  store i8 %15, ptr %16, align 16, !tbaa !21
  %17 = getelementptr inbounds i8, ptr %9, i64 160
  store <4 x i32> <i32 2, i32 2, i32 0, i32 0>, ptr %17, align 16, !tbaa !22
  %18 = getelementptr inbounds i8, ptr %9, i64 152
  store ptr null, ptr %18, align 8, !tbaa !23
  %.not = icmp eq i8 %4, 0
  br i1 %.not, label %29, label %.preheader

.preheader:                                       ; preds = %8
  %19 = trunc i64 %14 to i32
  %20 = and i32 %19, 255
  %21 = add nsw i32 %20, -1
  br label %22

22:                                               ; preds = %.preheader, %22
  %.0.in = phi i64 [ %.0, %22 ], [ %5, %.preheader ]
  %.0 = add i64 %.0.in, -1
  %23 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %.0
  %24 = getelementptr inbounds i8, ptr %23, i64 176
  %25 = load i8, ptr %24, align 16, !tbaa !21
  %26 = zext i8 %25 to i32
  %.not46 = icmp eq i32 %21, %26
  br i1 %.not46, label %27, label %22, !llvm.loop !24

27:                                               ; preds = %22
  %28 = getelementptr inbounds i8, ptr %9, i64 144
  store ptr %23, ptr %28, align 16, !tbaa !26
  br label %99

29:                                               ; preds = %8
  %30 = getelementptr inbounds i8, ptr %9, i64 144
  store ptr null, ptr %30, align 16, !tbaa !26
  br label %99

31:                                               ; preds = %2
  %32 = getelementptr inbounds i8, ptr %0, i64 152
  %33 = load ptr, ptr %32, align 8, !tbaa !27
  %34 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.14) #4
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %43

36:                                               ; preds = %31
  %37 = getelementptr inbounds i8, ptr %0, i64 136
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  %39 = getelementptr inbounds i8, ptr %38, i64 12
  %40 = load i32, ptr %39, align 4, !tbaa !22
  %41 = tail call noundef i32 @_ZL9__bswap32j(i32 noundef %40)
  %42 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %5, i32 4
  store i32 %41, ptr %42, align 16, !tbaa !28
  br label %78

43:                                               ; preds = %31
  %44 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.15) #4
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %53

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %0, i64 136
  %48 = load ptr, ptr %47, align 8, !tbaa !17
  %49 = getelementptr inbounds i8, ptr %48, i64 12
  %50 = load i32, ptr %49, align 4, !tbaa !22
  %51 = tail call noundef i32 @_ZL9__bswap32j(i32 noundef %50)
  %52 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %5, i32 5
  store i32 %51, ptr %52, align 4, !tbaa !29
  br label %78

53:                                               ; preds = %43
  %54 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.16) #4
  %55 = icmp eq i32 %54, 0
  br i1 %55, label %56, label %63

56:                                               ; preds = %53
  %57 = getelementptr inbounds i8, ptr %0, i64 136
  %58 = load ptr, ptr %57, align 8, !tbaa !17
  %59 = getelementptr inbounds i8, ptr %58, i64 12
  %60 = load i32, ptr %59, align 4, !tbaa !22
  %61 = tail call noundef i32 @_ZL9__bswap32j(i32 noundef %60)
  %62 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %5, i32 6
  store i32 %61, ptr %62, align 8, !tbaa !30
  br label %78

63:                                               ; preds = %53
  %64 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %33, ptr noundef nonnull dereferenceable(1) @.str.17) #4
  %65 = icmp eq i32 %64, 0
  br i1 %65, label %66, label %78

66:                                               ; preds = %63
  %67 = getelementptr inbounds i8, ptr %0, i64 136
  %68 = load ptr, ptr %67, align 8, !tbaa !17
  %69 = getelementptr inbounds i8, ptr %68, i64 12
  %70 = load i32, ptr %69, align 4, !tbaa !22
  %71 = tail call noundef i32 @_ZL9__bswap32j(i32 noundef %70)
  %72 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %5
  %73 = getelementptr inbounds i8, ptr %72, i64 172
  store i32 %71, ptr %73, align 4, !tbaa !31
  %74 = load i64, ptr @_ZN3DTB13phandle_map_t5countE, align 8, !tbaa !16
  %75 = getelementptr inbounds [128 x %"struct.DTB::phandle_map_t"], ptr @_ZN3DTB11phandle_mapE, i64 0, i64 %74
  store i32 %71, ptr %75, align 16, !tbaa !32
  %76 = getelementptr inbounds [128 x %"struct.DTB::phandle_map_t"], ptr @_ZN3DTB11phandle_mapE, i64 0, i64 %74, i32 1
  store ptr %72, ptr %76, align 8, !tbaa !34
  %77 = add i64 %74, 1
  store i64 %77, ptr @_ZN3DTB13phandle_map_t5countE, align 8, !tbaa !16
  br label %78

78:                                               ; preds = %46, %63, %66, %56, %36
  %79 = load ptr, ptr %32, align 8, !tbaa !27
  %80 = getelementptr inbounds [128 x %"struct.DTB::node_t"], ptr @_ZN3DTB5nodesE, i64 0, i64 %5
  %81 = getelementptr inbounds i8, ptr %80, i64 184
  %82 = getelementptr inbounds i8, ptr %80, i64 568
  %83 = load i64, ptr %82, align 8, !tbaa !35
  %84 = getelementptr inbounds [16 x %"struct.DTB::prop_t"], ptr %81, i64 0, i64 %83
  store ptr %79, ptr %84, align 8, !tbaa !36
  %85 = getelementptr inbounds i8, ptr %0, i64 136
  %86 = load ptr, ptr %85, align 8, !tbaa !17
  %87 = getelementptr inbounds i8, ptr %86, i64 12
  %88 = ptrtoint ptr %87 to i64
  %89 = getelementptr inbounds [16 x %"struct.DTB::prop_t"], ptr %81, i64 0, i64 %83, i32 1
  store i64 %88, ptr %89, align 8, !tbaa !38
  %90 = getelementptr inbounds i8, ptr %86, i64 4
  %91 = load i32, ptr %90, align 4, !tbaa !22
  %92 = tail call noundef i32 @_ZL9__bswap32j(i32 noundef %91)
  %93 = zext i32 %92 to i64
  %94 = load i64, ptr %82, align 8, !tbaa !35
  %95 = getelementptr inbounds [16 x %"struct.DTB::prop_t"], ptr %81, i64 0, i64 %94, i32 2
  store i64 %93, ptr %95, align 8, !tbaa !39
  %96 = add i64 %94, 1
  store i64 %96, ptr %82, align 8, !tbaa !35
  br label %99

97:                                               ; preds = %2
  %98 = add nuw nsw i64 %5, 1
  store i64 %98, ptr @_ZN3DTB6node_t5countE, align 8, !tbaa !16
  br label %99

99:                                               ; preds = %27, %29, %97, %78, %2
  ret i1 false
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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 = { 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 #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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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, !8, i64 176}
!6 = !{!"_ZTSN3DTB11iter_data_tE", !7, i64 0, !11, i64 136, !12, i64 144, !11, i64 152, !12, i64 160, !11, i64 168, !8, i64 176}
!7 = !{!"_ZTSN3DTB6path_tE", !8, i64 0, !10, i64 128}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!6, !12, i64 144}
!14 = !{i64 0, i64 128, !15, i64 128, i64 8, !16}
!15 = !{!8, !8, i64 0}
!16 = !{!10, !10, i64 0}
!17 = !{!6, !11, i64 136}
!18 = !{!19, !11, i64 136}
!19 = !{!"_ZTSN3DTB6node_tE", !7, i64 0, !11, i64 136, !11, i64 144, !11, i64 152, !12, i64 160, !12, i64 164, !12, i64 168, !12, i64 172, !8, i64 176, !8, i64 184, !10, i64 568}
!20 = !{!6, !10, i64 128}
!21 = !{!19, !8, i64 176}
!22 = !{!12, !12, i64 0}
!23 = !{!19, !11, i64 152}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!19, !11, i64 144}
!27 = !{!6, !11, i64 152}
!28 = !{!19, !12, i64 160}
!29 = !{!19, !12, i64 164}
!30 = !{!19, !12, i64 168}
!31 = !{!19, !12, i64 172}
!32 = !{!33, !12, i64 0}
!33 = !{!"_ZTSN3DTB13phandle_map_tE", !12, i64 0, !11, i64 8}
!34 = !{!33, !11, i64 8}
!35 = !{!19, !10, i64 568}
!36 = !{!37, !11, i64 0}
!37 = !{!"_ZTSN3DTB6prop_tE", !11, i64 0, !10, i64 8, !10, i64 16}
!38 = !{!37, !10, i64 8}
!39 = !{!37, !10, i64 16}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass