; LLVM IR from cashapp/zipline :: zipline/native/quickjs (libunicode)

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

; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @unicode_normalize(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca %struct.DynBuf, align 8
  %24 = alloca ptr, align 8
  %25 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.start.p0(i64 48, ptr %23) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #5
  store ptr %23, ptr %24, align 8, !tbaa !5
  %26 = load i32, ptr %11, align 4, !tbaa !9
  %27 = lshr i32 %26, 1
  store i32 %27, ptr %22, align 4, !tbaa !9
  %28 = load ptr, ptr %24, align 8, !tbaa !5
  %29 = load ptr, ptr %12, align 8, !tbaa !5
  %30 = load ptr, ptr %13, align 8, !tbaa !5
  call void @dbuf_init2(ptr noundef %28, ptr noundef %29, ptr noundef %30)
  %31 = load ptr, ptr %24, align 8, !tbaa !5
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = mul i64 4, %33
  %35 = call i32 @dbuf_realloc(ptr noundef %31, i64 noundef %34)
  %36 = icmp ne i32 %35, 0
  br i1 %36, label %37, label %38

37:                                               ; preds = %6
  br label %80

38:                                               ; preds = %6
  %39 = load i32, ptr %11, align 4, !tbaa !9
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %41, label %71

41:                                               ; preds = %38
  store i32 0, ptr %16, align 4, !tbaa !9
  br label %42

42:                                               ; preds = %55, %41
  %43 = load i32, ptr %16, align 4, !tbaa !9
  %44 = load i32, ptr %10, align 4, !tbaa !9
  %45 = icmp slt i32 %43, %44
  br i1 %45, label %46, label %58

46:                                               ; preds = %42
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = load i32, ptr %16, align 4, !tbaa !9
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds i32, ptr %47, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = icmp uge i32 %51, 256
  br i1 %52, label %53, label %54

53:                                               ; preds = %46
  br label %70

54:                                               ; preds = %46
  br label %55

55:                                               ; preds = %54
  %56 = load i32, ptr %16, align 4, !tbaa !9
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %16, align 4, !tbaa !9
  br label %42, !llvm.loop !11

58:                                               ; preds = %42
  %59 = load ptr, ptr %24, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.DynBuf, ptr %59, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8, !tbaa !13
  store ptr %61, ptr %14, align 8, !tbaa !5
  %62 = load ptr, ptr %14, align 8, !tbaa !5
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load i32, ptr %10, align 4, !tbaa !9
  %65 = sext i32 %64 to i64
  %66 = mul i64 %65, 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %62, ptr align 4 %63, i64 %66, i1 false)
  %67 = load ptr, ptr %14, align 8, !tbaa !5
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %67, ptr %68, align 8, !tbaa !5
  %69 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %69, ptr %7, align 4
  store i32 1, ptr %25, align 4
  br label %180

70:                                               ; preds = %53
  br label %71

71:                                               ; preds = %70, %38
  %72 = load ptr, ptr %24, align 8, !tbaa !5
  %73 = load ptr, ptr %9, align 8, !tbaa !5
  %74 = load i32, ptr %10, align 4, !tbaa !9
  %75 = load i32, ptr %22, align 4, !tbaa !9
  call void @to_nfd_rec(ptr noundef %72, ptr noundef %73, i32 noundef %74, i32 noundef %75)
  %76 = load ptr, ptr %24, align 8, !tbaa !5
  %77 = call i32 @dbuf_error(ptr noundef %76)
  %78 = icmp ne i32 %77, 0
  br i1 %78, label %79, label %82

79:                                               ; preds = %71
  br label %80

80:                                               ; preds = %79, %37
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr null, ptr %81, align 8, !tbaa !5
  store i32 -1, ptr %7, align 4
  store i32 1, ptr %25, align 4
  br label %180

82:                                               ; preds = %71
  %83 = load ptr, ptr %24, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.DynBuf, ptr %83, i32 0, i32 0
  %85 = load ptr, ptr %84, align 8, !tbaa !13
  store ptr %85, ptr %14, align 8, !tbaa !5
  %86 = load ptr, ptr %24, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.DynBuf, ptr %86, i32 0, i32 1
  %88 = load i64, ptr %87, align 8, !tbaa !16
  %89 = udiv i64 %88, 4
  %90 = trunc i64 %89 to i32
  store i32 %90, ptr %15, align 4, !tbaa !9
  %91 = load ptr, ptr %14, align 8, !tbaa !5
  %92 = load i32, ptr %15, align 4, !tbaa !9
  call void @sort_cc(ptr noundef %91, i32 noundef %92)
  %93 = load i32, ptr %15, align 4, !tbaa !9
  %94 = icmp sle i32 %93, 1
  br i1 %94, label %99, label %95

95:                                               ; preds = %82
  %96 = load i32, ptr %11, align 4, !tbaa !9
  %97 = and i32 %96, 1
  %98 = icmp ne i32 %97, 0
  br i1 %98, label %99, label %103

99:                                               ; preds = %95, %82
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %100, ptr %101, align 8, !tbaa !5
  %102 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %102, ptr %7, align 4
  store i32 1, ptr %25, align 4
  br label %180

103:                                              ; preds = %95
  store i32 1, ptr %16, align 4, !tbaa !9
  store i32 1, ptr %21, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %175, %103
  %105 = load i32, ptr %16, align 4, !tbaa !9
  %106 = load i32, ptr %15, align 4, !tbaa !9
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %108, label %176

108:                                              ; preds = %104
  %109 = load ptr, ptr %14, align 8, !tbaa !5
  %110 = load i32, ptr %16, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds i32, ptr %109, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !9
  %114 = call i32 @unicode_get_cc(i32 noundef %113)
  store i32 %114, ptr %20, align 4, !tbaa !9
  %115 = load i32, ptr %21, align 4, !tbaa !9
  %116 = sub nsw i32 %115, 1
  store i32 %116, ptr %18, align 4, !tbaa !9
  br label %117

117:                                              ; preds = %135, %108
  %118 = load i32, ptr %18, align 4, !tbaa !9
  %119 = icmp sge i32 %118, 0
  br i1 %119, label %120, label %138

120:                                              ; preds = %117
  %121 = load ptr, ptr %14, align 8, !tbaa !5
  %122 = load i32, ptr %18, align 4, !tbaa !9
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds i32, ptr %121, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !9
  %126 = call i32 @unicode_get_cc(i32 noundef %125)
  store i32 %126, ptr %19, align 4, !tbaa !9
  %127 = load i32, ptr %19, align 4, !tbaa !9
  %128 = icmp eq i32 %127, 0
  br i1 %128, label %129, label %130

129:                                              ; preds = %120
  br label %138

130:                                              ; preds = %120
  %131 = load i32, ptr %19, align 4, !tbaa !9
  %132 = load i32, ptr %20, align 4, !tbaa !9
  %133 = icmp sge i32 %131, %132
  br i1 %133, label %134, label %135

134:                                              ; preds = %130
  br label %163

135:                                              ; preds = %130
  store i32 256, ptr %20, align 4, !tbaa !9
  %136 = load i32, ptr %18, align 4, !tbaa !9
  %137 = add nsw i32 %136, -1
  store i32 %137, ptr %18, align 4, !tbaa !9
  br label %117, !llvm.loop !17

138:                                              ; preds = %129, %117
  %139 = load i32, ptr %18, align 4, !tbaa !9
  %140 = icmp sge i32 %139, 0
  br i1 %140, label %141, label %162

141:                                              ; preds = %138
  %142 = load ptr, ptr %14, align 8, !tbaa !5
  %143 = load i32, ptr %18, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds i32, ptr %142, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !9
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = load i32, ptr %16, align 4, !tbaa !9
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds i32, ptr %147, i64 %149
  %151 = load i32, ptr %150, align 4, !tbaa !9
  %152 = call i32 @compose_pair(i32 noundef %146, i32 noundef %151)
  store i32 %152, ptr %17, align 4, !tbaa !9
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %162

154:                                              ; preds = %141
  %155 = load i32, ptr %17, align 4, !tbaa !9
  %156 = load ptr, ptr %14, align 8, !tbaa !5
  %157 = load i32, ptr %18, align 4, !tbaa !9
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds i32, ptr %156, i64 %158
  store i32 %155, ptr %159, align 4, !tbaa !9
  %160 = load i32, ptr %16, align 4, !tbaa !9
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr %16, align 4, !tbaa !9
  br label %175

162:                                              ; preds = %141, %138
  br label %163

163:                                              ; preds = %162, %134
  %164 = load ptr, ptr %14, align 8, !tbaa !5
  %165 = load i32, ptr %16, align 4, !tbaa !9
  %166 = add nsw i32 %165, 1
  store i32 %166, ptr %16, align 4, !tbaa !9
  %167 = sext i32 %165 to i64
  %168 = getelementptr inbounds i32, ptr %164, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !9
  %170 = load ptr, ptr %14, align 8, !tbaa !5
  %171 = load i32, ptr %21, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %21, align 4, !tbaa !9
  %173 = sext i32 %171 to i64
  %174 = getelementptr inbounds i32, ptr %170, i64 %173
  store i32 %169, ptr %174, align 4, !tbaa !9
  br label %175

175:                                              ; preds = %163, %154
  br label %104, !llvm.loop !18

176:                                              ; preds = %104
  %177 = load ptr, ptr %14, align 8, !tbaa !5
  %178 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %177, ptr %178, align 8, !tbaa !5
  %179 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %179, ptr %7, align 4
  store i32 1, ptr %25, align 4
  br label %180

180:                                              ; preds = %176, %99, %80, %58
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #5
  call void @llvm.lifetime.end.p0(i64 48, ptr %23) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  %181 = load i32, ptr %7, align 4
  ret i32 %181
}

declare void @dbuf_init2(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @dbuf_realloc(ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @to_nfd_rec(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @dbuf_error(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden void @sort_cc(ptr noundef, i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @unicode_get_cc(i32 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @compose_pair(i32 noundef, i32 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "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 = { inlinehint 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 #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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 0}
!14 = !{!"DynBuf", !6, i64 0, !15, i64 8, !15, i64 16, !10, i64 24, !6, i64 32, !6, i64 40}
!15 = !{!"long", !7, i64 0}
!16 = !{!14, !15, i64 8}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

; 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: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
define dso_local i32 @unicode_normalize(ptr nocapture noundef writeonly %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #2 {
  %7 = alloca %struct.DynBuf, align 8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #5
  %8 = lshr i32 %3, 1
  call void @dbuf_init2(ptr noundef nonnull %7, ptr noundef %4, ptr noundef %5) #5
  %9 = sext i32 %2 to i64
  %10 = shl nsw i64 %9, 2
  %11 = call i32 @dbuf_realloc(ptr noundef nonnull %7, i64 noundef %10) #5
  %.not = icmp eq i32 %11, 0
  br i1 %.not, label %12, label %.loopexit94

12:                                               ; preds = %6
  %13 = icmp eq i32 %3, 0
  br i1 %13, label %.preheader75, label %.loopexit

.preheader75:                                     ; preds = %12
  %14 = icmp sgt i32 %2, 0
  br i1 %14, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %.preheader75
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph

15:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !5

.lr.ph:                                           ; preds = %.lr.ph.preheader, %15
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %15 ]
  %16 = getelementptr inbounds i32, ptr %1, i64 %indvars.iv
  %17 = load i32, ptr %16, align 4, !tbaa !7
  %18 = icmp ugt i32 %17, 255
  br i1 %18, label %.loopexit, label %15

._crit_edge:                                      ; preds = %15, %.preheader75
  %19 = load ptr, ptr %7, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %1, i64 %10, i1 false)
  br label %.loopexit94

.loopexit:                                        ; preds = %.lr.ph, %12
  call void @to_nfd_rec(ptr noundef nonnull %7, ptr noundef %1, i32 noundef %2, i32 noundef %8)
  %20 = call i32 @dbuf_error(ptr noundef nonnull %7)
  %.not71 = icmp eq i32 %20, 0
  br i1 %.not71, label %21, label %.loopexit94

21:                                               ; preds = %.loopexit
  %22 = load ptr, ptr %7, align 8, !tbaa !11
  %23 = getelementptr inbounds i8, ptr %7, i64 8
  %24 = load i64, ptr %23, align 8, !tbaa !15
  %25 = lshr i64 %24, 2
  %26 = trunc i64 %25 to i32
  call void @sort_cc(ptr noundef %22, i32 noundef %26)
  %27 = icmp sgt i32 %26, 1
  %28 = and i32 %3, 1
  %.not72 = icmp eq i32 %28, 0
  %or.cond = and i1 %.not72, %27
  br i1 %or.cond, label %.preheader.preheader, label %.loopexit94

.preheader.preheader:                             ; preds = %21
  %wide.trip.count90 = and i64 %25, 2147483647
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %59
  %indvars.iv87 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next88, %59 ]
  %.06279 = phi i32 [ 1, %.preheader.preheader ], [ %.1, %59 ]
  %29 = getelementptr inbounds i32, ptr %22, i64 %indvars.iv87
  %30 = load i32, ptr %29, align 4, !tbaa !7
  %31 = call i32 @unicode_get_cc(i32 noundef %30)
  %32 = zext i32 %.06279 to i64
  %33 = add nsw i64 %32, -1
  %34 = icmp sgt i32 %.06279, 0
  br i1 %34, label %35, label %.critedge

35:                                               ; preds = %.preheader
  %36 = getelementptr inbounds i32, ptr %22, i64 %33
  %37 = load i32, ptr %36, align 4, !tbaa !7
  %38 = call i32 @unicode_get_cc(i32 noundef %37)
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %.loopexit86, label %40

40:                                               ; preds = %35
  %.not73.peel = icmp slt i32 %38, %31
  br i1 %.not73.peel, label %.peel.next, label %.critedge

.peel.next:                                       ; preds = %40, %49
  %indvars.iv81 = phi i64 [ %41, %49 ], [ %33, %40 ]
  %41 = add nsw i64 %indvars.iv81, -1
  %42 = trunc nuw i64 %indvars.iv81 to i32
  %43 = icmp sgt i32 %42, 0
  br i1 %43, label %44, label %.critedge

44:                                               ; preds = %.peel.next
  %45 = getelementptr inbounds i32, ptr %22, i64 %41
  %46 = load i32, ptr %45, align 4, !tbaa !7
  %47 = call i32 @unicode_get_cc(i32 noundef %46)
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %.loopexit86, label %49

49:                                               ; preds = %44
  %.not73 = icmp slt i32 %47, 256
  br i1 %.not73, label %.peel.next, label %.critedge, !llvm.loop !16

.loopexit86:                                      ; preds = %44, %35
  %.lcssa = phi i64 [ %33, %35 ], [ %41, %44 ]
  %50 = getelementptr inbounds i32, ptr %22, i64 %.lcssa
  %51 = load i32, ptr %50, align 4, !tbaa !7
  %52 = load i32, ptr %29, align 4, !tbaa !7
  %53 = call i32 @compose_pair(i32 noundef %51, i32 noundef %52)
  %.not74 = icmp eq i32 %53, 0
  br i1 %.not74, label %.critedge, label %54

54:                                               ; preds = %.loopexit86
  store i32 %53, ptr %50, align 4, !tbaa !7
  br label %59

.critedge:                                        ; preds = %.peel.next, %49, %.preheader, %40, %.loopexit86
  %55 = load i32, ptr %29, align 4, !tbaa !7
  %56 = add nsw i32 %.06279, 1
  %57 = sext i32 %.06279 to i64
  %58 = getelementptr inbounds i32, ptr %22, i64 %57
  store i32 %55, ptr %58, align 4, !tbaa !7
  br label %59

59:                                               ; preds = %.critedge, %54
  %.1 = phi i32 [ %.06279, %54 ], [ %56, %.critedge ]
  %indvars.iv.next88 = add nuw nsw i64 %indvars.iv87, 1
  %exitcond91.not = icmp eq i64 %indvars.iv.next88, %wide.trip.count90
  br i1 %exitcond91.not, label %.loopexit94, label %.preheader, !llvm.loop !18

.loopexit94:                                      ; preds = %59, %21, %6, %.loopexit, %._crit_edge
  %.sink = phi ptr [ %19, %._crit_edge ], [ null, %.loopexit ], [ null, %6 ], [ %22, %21 ], [ %22, %59 ]
  %.0 = phi i32 [ %2, %._crit_edge ], [ -1, %.loopexit ], [ -1, %6 ], [ %26, %21 ], [ %.1, %59 ]
  store ptr %.sink, ptr %0, align 8, !tbaa !19
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #5
  ret i32 %.0
}

declare void @dbuf_init2(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @dbuf_realloc(ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @to_nfd_rec(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @dbuf_error(ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @sort_cc(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @unicode_get_cc(i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @compose_pair(i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 = { "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 = { inlinehint 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 #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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!12, !13, i64 0}
!12 = !{!"DynBuf", !13, i64 0, !14, i64 8, !14, i64 16, !8, i64 24, !13, i64 32, !13, i64 40}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!"long", !9, i64 0}
!15 = !{!12, !14, i64 8}
!16 = distinct !{!16, !6, !17}
!17 = !{!"llvm.loop.peeled.count", i32 1}
!18 = distinct !{!18, !6}
!19 = !{!13, !13, i64 0}


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