; LLVM IR from theolundqvist/parallax-voxel-ray-marcher :: src/external/Dear ImGui/imgui_draw.ll (Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv)

; 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.ImVector.11 = type { i32, i32, ptr }
%struct.ImFontAtlas = type <{ i32, [4 x i8], ptr, i32, i32, i8, i8, i8, [5 x i8], ptr, ptr, i32, i32, %struct.ImVec2, %struct.ImVec2, %struct.ImVector.8, %struct.ImVector.9, %struct.ImVector.10, [64 x %struct.ImVec4], ptr, i32, i32, i32, [4 x i8] }>
%struct.ImVec2 = type { float, float }
%struct.ImVector.8 = type { i32, i32, ptr }
%struct.ImVector.9 = type { i32, i32, ptr }
%struct.ImVector.10 = type { i32, i32, ptr }
%struct.ImVec4 = type { float, float, float, float }
%struct.ImFontAtlasCustomRect = type { i16, i16, i16, i16, i32, float, %struct.ImVec2, ptr }
%struct.stbrp_rect = type { i32, i16, i16, i16, i16, i32 }

@.str.1 = external hidden unnamed_addr constant [113 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [23 x i8], align 1
@__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv = external hidden unnamed_addr constant [60 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [82 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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL5ImMaxIiET_S0_S0_(i32 noundef, i32 noundef) #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv(ptr noundef %0, ptr noundef %1) #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.ImVector.11, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = 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 8, ptr %5) #6
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %12, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %16

15:                                               ; preds = %2
  br label %18

16:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str.25, ptr noundef @.str.1, i32 noundef 2616, ptr noundef @__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv) #7
  unreachable

17:                                               ; No predecessors!
  br label %18

18:                                               ; preds = %17, %15
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.ImFontAtlas, ptr %19, i32 0, i32 16
  store ptr %20, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.ImVector.9, ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = icmp sge i32 %23, 1
  br i1 %24, label %25, label %26

25:                                               ; preds = %18
  br label %28

26:                                               ; preds = %18
  call void @__assert_fail(ptr noundef @.str.26, ptr noundef @.str.1, i32 noundef 2619, ptr noundef @__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv) #7
  unreachable

27:                                               ; No predecessors!
  br label %28

28:                                               ; preds = %27, %25
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #6
  call void @_ZN8ImVectorI10stbrp_rectEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.ImVector.9, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 8, !tbaa !9
  invoke void @_ZN8ImVectorI10stbrp_rectE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %31)
          to label %32 unwind label %45

32:                                               ; preds = %28
  %33 = getelementptr inbounds %struct.ImVector.11, ptr %7, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %35 = invoke noundef i32 @_ZNK8ImVectorI10stbrp_rectE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %36 unwind label %45

36:                                               ; preds = %32
  %37 = sext i32 %35 to i64
  call void @llvm.memset.p0.i64(ptr align 4 %34, i8 0, i64 %37, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !14
  br label %38

38:                                               ; preds = %70, %36
  %39 = load i32, ptr %10, align 4, !tbaa !14
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.ImVector.9, ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 8, !tbaa !9
  %43 = icmp slt i32 %39, %42
  br i1 %43, label %49, label %44

44:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %77

45:                                               ; preds = %80, %77, %32, %28
  %46 = landingpad { ptr, i32 }
          cleanup
  %47 = extractvalue { ptr, i32 } %46, 0
  store ptr %47, ptr %8, align 8
  %48 = extractvalue { ptr, i32 } %46, 1
  store i32 %48, ptr %9, align 4
  br label %183

49:                                               ; preds = %38
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = load i32, ptr %10, align 4, !tbaa !14
  %52 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %50, i32 noundef %51)
          to label %53 unwind label %73

53:                                               ; preds = %49
  %54 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %52, i32 0, i32 0
  %55 = load i16, ptr %54, align 8, !tbaa !15
  %56 = load i32, ptr %10, align 4, !tbaa !14
  %57 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %56)
          to label %58 unwind label %73

58:                                               ; preds = %53
  %59 = getelementptr inbounds %struct.stbrp_rect, ptr %57, i32 0, i32 1
  store i16 %55, ptr %59, align 4, !tbaa !20
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = load i32, ptr %10, align 4, !tbaa !14
  %62 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %60, i32 noundef %61)
          to label %63 unwind label %73

63:                                               ; preds = %58
  %64 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %62, i32 0, i32 1
  %65 = load i16, ptr %64, align 2, !tbaa !22
  %66 = load i32, ptr %10, align 4, !tbaa !14
  %67 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %66)
          to label %68 unwind label %73

68:                                               ; preds = %63
  %69 = getelementptr inbounds %struct.stbrp_rect, ptr %67, i32 0, i32 2
  store i16 %65, ptr %69, align 2, !tbaa !23
  br label %70

70:                                               ; preds = %68
  %71 = load i32, ptr %10, align 4, !tbaa !14
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %10, align 4, !tbaa !14
  br label %38, !llvm.loop !24

73:                                               ; preds = %63, %58, %53, %49
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %8, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %183

77:                                               ; preds = %44
  %78 = load ptr, ptr %5, align 8, !tbaa !5
  %79 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef 0)
          to label %80 unwind label %45

80:                                               ; preds = %77
  %81 = getelementptr inbounds %struct.ImVector.11, ptr %7, i32 0, i32 0
  %82 = load i32, ptr %81, align 8, !tbaa !26
  %83 = invoke noundef i32 @_ZL16stbrp_pack_rectsP13stbrp_contextP10stbrp_recti(ptr noundef %78, ptr noundef %79, i32 noundef %82)
          to label %84 unwind label %45

84:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 0, ptr %11, align 4, !tbaa !14
  br label %85

85:                                               ; preds = %179, %84
  %86 = load i32, ptr %11, align 4, !tbaa !14
  %87 = getelementptr inbounds %struct.ImVector.11, ptr %7, i32 0, i32 0
  %88 = load i32, ptr %87, align 8, !tbaa !26
  %89 = icmp slt i32 %86, %88
  br i1 %89, label %91, label %90

90:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %182

91:                                               ; preds = %85
  %92 = load i32, ptr %11, align 4, !tbaa !14
  %93 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %92)
          to label %94 unwind label %152

94:                                               ; preds = %91
  %95 = getelementptr inbounds %struct.stbrp_rect, ptr %93, i32 0, i32 5
  %96 = load i32, ptr %95, align 4, !tbaa !27
  %97 = icmp ne i32 %96, 0
  br i1 %97, label %98, label %178

98:                                               ; preds = %94
  %99 = load i32, ptr %11, align 4, !tbaa !14
  %100 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %99)
          to label %101 unwind label %152

101:                                              ; preds = %98
  %102 = getelementptr inbounds %struct.stbrp_rect, ptr %100, i32 0, i32 3
  %103 = load i16, ptr %102, align 4, !tbaa !28
  %104 = load ptr, ptr %6, align 8, !tbaa !5
  %105 = load i32, ptr %11, align 4, !tbaa !14
  %106 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %104, i32 noundef %105)
          to label %107 unwind label %152

107:                                              ; preds = %101
  %108 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %106, i32 0, i32 2
  store i16 %103, ptr %108, align 4, !tbaa !29
  %109 = load i32, ptr %11, align 4, !tbaa !14
  %110 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %109)
          to label %111 unwind label %152

111:                                              ; preds = %107
  %112 = getelementptr inbounds %struct.stbrp_rect, ptr %110, i32 0, i32 4
  %113 = load i16, ptr %112, align 2, !tbaa !30
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = load i32, ptr %11, align 4, !tbaa !14
  %116 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %114, i32 noundef %115)
          to label %117 unwind label %152

117:                                              ; preds = %111
  %118 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %116, i32 0, i32 3
  store i16 %113, ptr %118, align 2, !tbaa !31
  %119 = load i32, ptr %11, align 4, !tbaa !14
  %120 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %119)
          to label %121 unwind label %152

121:                                              ; preds = %117
  %122 = getelementptr inbounds %struct.stbrp_rect, ptr %120, i32 0, i32 1
  %123 = load i16, ptr %122, align 4, !tbaa !20
  %124 = zext i16 %123 to i32
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = load i32, ptr %11, align 4, !tbaa !14
  %127 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %125, i32 noundef %126)
          to label %128 unwind label %152

128:                                              ; preds = %121
  %129 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %127, i32 0, i32 0
  %130 = load i16, ptr %129, align 8, !tbaa !15
  %131 = zext i16 %130 to i32
  %132 = icmp eq i32 %124, %131
  br i1 %132, label %133, label %148

133:                                              ; preds = %128
  %134 = load i32, ptr %11, align 4, !tbaa !14
  %135 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %134)
          to label %136 unwind label %152

136:                                              ; preds = %133
  %137 = getelementptr inbounds %struct.stbrp_rect, ptr %135, i32 0, i32 2
  %138 = load i16, ptr %137, align 2, !tbaa !23
  %139 = zext i16 %138 to i32
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = load i32, ptr %11, align 4, !tbaa !14
  %142 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %140, i32 noundef %141)
          to label %143 unwind label %152

143:                                              ; preds = %136
  %144 = getelementptr inbounds %struct.ImFontAtlasCustomRect, ptr %142, i32 0, i32 1
  %145 = load i16, ptr %144, align 2, !tbaa !22
  %146 = zext i16 %145 to i32
  %147 = icmp eq i32 %139, %146
  br label %148

148:                                              ; preds = %143, %128
  %149 = phi i1 [ false, %128 ], [ %147, %143 ]
  br i1 %149, label %150, label %151

150:                                              ; preds = %148
  br label %157

151:                                              ; preds = %148
  call void @__assert_fail(ptr noundef @.str.27, ptr noundef @.str.1, i32 noundef 2635, ptr noundef @__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv) #7
  unreachable

152:                                              ; preds = %169, %163, %157, %136, %133, %121, %117, %111, %107, %101, %98, %91
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %8, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %183

156:                                              ; No predecessors!
  br label %157

157:                                              ; preds = %156, %150
  %158 = load ptr, ptr %3, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.ImFontAtlas, ptr %158, i32 0, i32 12
  %160 = load i32, ptr %159, align 4, !tbaa !32
  %161 = load i32, ptr %11, align 4, !tbaa !14
  %162 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %161)
          to label %163 unwind label %152

163:                                              ; preds = %157
  %164 = getelementptr inbounds %struct.stbrp_rect, ptr %162, i32 0, i32 4
  %165 = load i16, ptr %164, align 2, !tbaa !30
  %166 = zext i16 %165 to i32
  %167 = load i32, ptr %11, align 4, !tbaa !14
  %168 = invoke noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %167)
          to label %169 unwind label %152

169:                                              ; preds = %163
  %170 = getelementptr inbounds %struct.stbrp_rect, ptr %168, i32 0, i32 2
  %171 = load i16, ptr %170, align 2, !tbaa !23
  %172 = zext i16 %171 to i32
  %173 = add nsw i32 %166, %172
  %174 = invoke noundef i32 @_ZL5ImMaxIiET_S0_S0_(i32 noundef %160, i32 noundef %173)
          to label %175 unwind label %152

175:                                              ; preds = %169
  %176 = load ptr, ptr %3, align 8, !tbaa !5
  %177 = getelementptr inbounds %struct.ImFontAtlas, ptr %176, i32 0, i32 12
  store i32 %174, ptr %177, align 4, !tbaa !32
  br label %178

178:                                              ; preds = %175, %94
  br label %179

179:                                              ; preds = %178
  %180 = load i32, ptr %11, align 4, !tbaa !14
  %181 = add nsw i32 %180, 1
  store i32 %181, ptr %11, align 4, !tbaa !14
  br label %85, !llvm.loop !37

182:                                              ; preds = %90
  call void @_ZN8ImVectorI10stbrp_rectED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void

183:                                              ; preds = %152, %73, %45
  call void @_ZN8ImVectorI10stbrp_rectED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %184

184:                                              ; preds = %183
  %185 = load ptr, ptr %8, align 8
  %186 = load i32, ptr %9, align 4
  %187 = insertvalue { ptr, i32 } poison, ptr %185, 0
  %188 = insertvalue { ptr, i32 } %187, i32 %186, 1
  resume { ptr, i32 } %188
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI10stbrp_rectEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI10stbrp_rectE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8ImVectorI10stbrp_rectE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL16stbrp_pack_rectsP13stbrp_contextP10stbrp_recti(ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI10stbrp_rectED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { noreturn 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 = { 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 #4 = { 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 #5 = { 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 #6 = { nounwind }
attributes #7 = { noreturn 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, !11, i64 0}
!10 = !{!"_ZTS8ImVectorI21ImFontAtlasCustomRectE", !11, i64 0, !11, i64 4, !6, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 8}
!13 = !{!"_ZTS8ImVectorI10stbrp_rectE", !11, i64 0, !11, i64 4, !6, i64 8}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !17, i64 0}
!16 = !{!"_ZTS21ImFontAtlasCustomRect", !17, i64 0, !17, i64 2, !17, i64 4, !17, i64 6, !11, i64 8, !18, i64 12, !19, i64 16, !6, i64 24}
!17 = !{!"short", !7, i64 0}
!18 = !{!"float", !7, i64 0}
!19 = !{!"_ZTS6ImVec2", !18, i64 0, !18, i64 4}
!20 = !{!21, !17, i64 4}
!21 = !{!"_ZTS10stbrp_rect", !11, i64 0, !17, i64 4, !17, i64 6, !17, i64 8, !17, i64 10, !11, i64 12}
!22 = !{!16, !17, i64 2}
!23 = !{!21, !17, i64 6}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!13, !11, i64 0}
!27 = !{!21, !11, i64 12}
!28 = !{!21, !17, i64 8}
!29 = !{!16, !17, i64 4}
!30 = !{!21, !17, i64 10}
!31 = !{!16, !17, i64 6}
!32 = !{!33, !11, i64 52}
!33 = !{!"_ZTS11ImFontAtlas", !11, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !34, i64 24, !34, i64 25, !34, i64 26, !6, i64 32, !6, i64 40, !11, i64 48, !11, i64 52, !19, i64 56, !19, i64 64, !35, i64 72, !10, i64 88, !36, i64 104, !7, i64 120, !6, i64 1144, !11, i64 1152, !11, i64 1156, !11, i64 1160}
!34 = !{!"bool", !7, i64 0}
!35 = !{!"_ZTS8ImVectorIP6ImFontE", !11, i64 0, !11, i64 4, !6, i64 8}
!36 = !{!"_ZTS8ImVectorI12ImFontConfigE", !11, i64 0, !11, i64 4, !6, i64 8}
!37 = distinct !{!37, !25}


; 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.ImVector.11 = type { i32, i32, ptr }

@.str.1 = external hidden unnamed_addr constant [113 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [23 x i8], align 1
@__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv = external hidden unnamed_addr constant [60 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [82 x i8], align 1

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL5ImMaxIiET_S0_S0_(i32 noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local void @_Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv(ptr noundef %0, ptr noundef %1) local_unnamed_addr #4 personality ptr @__gxx_personality_v0 {
  %3 = alloca %struct.ImVector.11, align 8
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str.25, ptr noundef nonnull @.str.1, i32 noundef 2616, ptr noundef nonnull @__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv) #6
  unreachable

5:                                                ; preds = %2
  %6 = getelementptr inbounds i8, ptr %0, i64 88
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %10, label %9

9:                                                ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str.26, ptr noundef nonnull @.str.1, i32 noundef 2619, ptr noundef nonnull @__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv) #6
  unreachable

10:                                               ; preds = %5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #7
  call void @_ZN8ImVectorI10stbrp_rectEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %11 = load i32, ptr %6, align 8, !tbaa !5
  invoke void @_ZN8ImVectorI10stbrp_rectE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %11)
          to label %12 unwind label %25

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %3, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !11
  %15 = call noundef i32 @_ZNK8ImVectorI10stbrp_rectE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %16 = sext i32 %15 to i64
  call void @llvm.memset.p0.i64(ptr align 4 %14, i8 0, i64 %16, i1 false)
  %17 = load i32, ptr %6, align 8, !tbaa !5
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %12
  %19 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef 0)
  %20 = load i32, ptr %3, align 8, !tbaa !13
  %21 = invoke noundef i32 @_ZL16stbrp_pack_rectsP13stbrp_contextP10stbrp_recti(ptr noundef nonnull %1, ptr noundef nonnull %19, i32 noundef %20)
          to label %.preheader unwind label %25

.preheader:                                       ; preds = %._crit_edge
  %22 = load i32, ptr %3, align 8, !tbaa !13
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %.preheader
  %24 = getelementptr inbounds i8, ptr %0, i64 52
  br label %39

25:                                               ; preds = %._crit_edge, %10
  %26 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN8ImVectorI10stbrp_rectED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  resume { ptr, i32 } %26

.lr.ph:                                           ; preds = %12, %.lr.ph
  %.03538 = phi i32 [ %36, %.lr.ph ], [ 0, %12 ]
  %27 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %.03538)
  %28 = load i16, ptr %27, align 8, !tbaa !14
  %29 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.03538)
  %30 = getelementptr inbounds i8, ptr %29, i64 4
  store i16 %28, ptr %30, align 4, !tbaa !19
  %31 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %.03538)
  %32 = getelementptr inbounds i8, ptr %31, i64 2
  %33 = load i16, ptr %32, align 2, !tbaa !21
  %34 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.03538)
  %35 = getelementptr inbounds i8, ptr %34, i64 6
  store i16 %33, ptr %35, align 2, !tbaa !22
  %36 = add nuw nsw i32 %.03538, 1
  %37 = load i32, ptr %6, align 8, !tbaa !5
  %38 = icmp slt i32 %36, %37
  br i1 %38, label %.lr.ph, label %._crit_edge, !llvm.loop !23

._crit_edge41:                                    ; preds = %80, %.preheader
  call void @_ZN8ImVectorI10stbrp_rectED2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #7
  ret void

39:                                               ; preds = %.lr.ph40, %80
  %.039 = phi i32 [ 0, %.lr.ph40 ], [ %81, %80 ]
  %40 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %41 = getelementptr inbounds i8, ptr %40, i64 12
  %42 = load i32, ptr %41, align 4, !tbaa !25
  %.not37 = icmp eq i32 %42, 0
  br i1 %.not37, label %80, label %43

43:                                               ; preds = %39
  %44 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  %46 = load i16, ptr %45, align 4, !tbaa !26
  %47 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %.039)
  %48 = getelementptr inbounds i8, ptr %47, i64 4
  store i16 %46, ptr %48, align 4, !tbaa !27
  %49 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %50 = getelementptr inbounds i8, ptr %49, i64 10
  %51 = load i16, ptr %50, align 2, !tbaa !28
  %52 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %.039)
  %53 = getelementptr inbounds i8, ptr %52, i64 6
  store i16 %51, ptr %53, align 2, !tbaa !29
  %54 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %55 = getelementptr inbounds i8, ptr %54, i64 4
  %56 = load i16, ptr %55, align 4, !tbaa !19
  %57 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %.039)
  %58 = load i16, ptr %57, align 8, !tbaa !14
  %59 = icmp eq i16 %56, %58
  br i1 %59, label %60, label %.critedge

60:                                               ; preds = %43
  %61 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %62 = getelementptr inbounds i8, ptr %61, i64 6
  %63 = load i16, ptr %62, align 2, !tbaa !22
  %64 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %6, i32 noundef %.039)
  %65 = getelementptr inbounds i8, ptr %64, i64 2
  %66 = load i16, ptr %65, align 2, !tbaa !21
  %67 = icmp eq i16 %63, %66
  br i1 %67, label %68, label %.critedge

.critedge:                                        ; preds = %43, %60
  call void @__assert_fail(ptr noundef nonnull @.str.27, ptr noundef nonnull @.str.1, i32 noundef 2635, ptr noundef nonnull @__PRETTY_FUNCTION__._Z31ImFontAtlasBuildPackCustomRectsP11ImFontAtlasPv) #6
  unreachable

68:                                               ; preds = %60
  %69 = load i32, ptr %24, align 4, !tbaa !30
  %70 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %71 = getelementptr inbounds i8, ptr %70, i64 10
  %72 = load i16, ptr %71, align 2, !tbaa !28
  %73 = zext i16 %72 to i32
  %74 = call noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.039)
  %75 = getelementptr inbounds i8, ptr %74, i64 6
  %76 = load i16, ptr %75, align 2, !tbaa !22
  %77 = zext i16 %76 to i32
  %78 = add nuw nsw i32 %77, %73
  %79 = call noundef i32 @_ZL5ImMaxIiET_S0_S0_(i32 noundef %69, i32 noundef %78)
  store i32 %79, ptr %24, align 4, !tbaa !30
  br label %80

80:                                               ; preds = %39, %68
  %81 = add nuw nsw i32 %.039, 1
  %82 = load i32, ptr %3, align 8, !tbaa !13
  %83 = icmp slt i32 %81, %82
  br i1 %83, label %39, label %._crit_edge41, !llvm.loop !35
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI10stbrp_rectEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN8ImVectorI10stbrp_rectE6resizeEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK8ImVectorI10stbrp_rectE13size_in_bytesEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZN8ImVectorI21ImFontAtlasCustomRectEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(16) ptr @_ZN8ImVectorI10stbrp_rectEixEi(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL16stbrp_pack_rectsP13stbrp_contextP10stbrp_recti(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN8ImVectorI10stbrp_rectED2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { noreturn 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 = { 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 #4 = { 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 #5 = { 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 #6 = { noreturn nounwind }
attributes #7 = { 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 = !{!"_ZTS8ImVectorI21ImFontAtlasCustomRectE", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!12, !10, i64 8}
!12 = !{!"_ZTS8ImVectorI10stbrp_rectE", !7, i64 0, !7, i64 4, !10, i64 8}
!13 = !{!12, !7, i64 0}
!14 = !{!15, !16, i64 0}
!15 = !{!"_ZTS21ImFontAtlasCustomRect", !16, i64 0, !16, i64 2, !16, i64 4, !16, i64 6, !7, i64 8, !17, i64 12, !18, i64 16, !10, i64 24}
!16 = !{!"short", !8, i64 0}
!17 = !{!"float", !8, i64 0}
!18 = !{!"_ZTS6ImVec2", !17, i64 0, !17, i64 4}
!19 = !{!20, !16, i64 4}
!20 = !{!"_ZTS10stbrp_rect", !7, i64 0, !16, i64 4, !16, i64 6, !16, i64 8, !16, i64 10, !7, i64 12}
!21 = !{!15, !16, i64 2}
!22 = !{!20, !16, i64 6}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!20, !7, i64 12}
!26 = !{!20, !16, i64 8}
!27 = !{!15, !16, i64 4}
!28 = !{!20, !16, i64 10}
!29 = !{!15, !16, i64 6}
!30 = !{!31, !7, i64 52}
!31 = !{!"_ZTS11ImFontAtlas", !7, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !32, i64 24, !32, i64 25, !32, i64 26, !10, i64 32, !10, i64 40, !7, i64 48, !7, i64 52, !18, i64 56, !18, i64 64, !33, i64 72, !6, i64 88, !34, i64 104, !8, i64 120, !10, i64 1144, !7, i64 1152, !7, i64 1156, !7, i64 1160}
!32 = !{!"bool", !8, i64 0}
!33 = !{!"_ZTS8ImVectorIP6ImFontE", !7, i64 0, !7, i64 4, !10, i64 8}
!34 = !{!"_ZTS8ImVectorI12ImFontConfigE", !7, i64 0, !7, i64 4, !10, i64 8}
!35 = distinct !{!35, !24}


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