; LLVM IR from caryll/otfcc :: lib/table (CPAL)

; 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.cpal_Color = type { i8, i8, i8, i8, i16 }
%struct.table_CPAL = type { i16, %struct.cpal_PaletteSet }
%struct.cpal_PaletteSet = type { i64, i64, ptr }
%struct.cpal_Palette = type { %struct.cpal_ColorSet, i32, i32 }
%struct.cpal_ColorSet = type { i64, i64, ptr }

@white = external dso_local constant %struct.cpal_Color, align 2

; 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: nounwind uwtable
define dso_local ptr @otfcc_buildCPAL(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i16, align 2
  %7 = alloca i16, align 2
  %8 = alloca i16, align 2
  %9 = alloca ptr, align 8
  %10 = alloca i16, align 2
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i16, align 2
  %14 = alloca i16, align 2
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i16, align 2
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %26

20:                                               ; preds = %2
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.table_CPAL, ptr %21, i32 0, i32 1
  %23 = getelementptr inbounds %struct.cpal_PaletteSet, ptr %22, i32 0, i32 0
  %24 = load i64, ptr %23, align 8, !tbaa !9
  %25 = icmp ne i64 %24, 0
  br i1 %25, label %27, label %26

26:                                               ; preds = %20, %2
  store ptr null, ptr %3, align 8
  br label %166

27:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 2, ptr %6) #4
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.table_CPAL, ptr %28, i32 0, i32 1
  %30 = getelementptr inbounds %struct.cpal_PaletteSet, ptr %29, i32 0, i32 0
  %31 = load i64, ptr %30, align 8, !tbaa !9
  %32 = trunc i64 %31 to i16
  store i16 %32, ptr %6, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %7) #4
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.table_CPAL, ptr %33, i32 0, i32 1
  %35 = getelementptr inbounds %struct.cpal_PaletteSet, ptr %34, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !15
  %37 = getelementptr inbounds %struct.cpal_Palette, ptr %36, i64 0
  %38 = getelementptr inbounds %struct.cpal_Palette, ptr %37, i32 0, i32 0
  %39 = getelementptr inbounds %struct.cpal_ColorSet, ptr %38, i32 0, i32 0
  %40 = load i64, ptr %39, align 8, !tbaa !16
  %41 = trunc i64 %40 to i16
  store i16 %41, ptr %7, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %8) #4
  %42 = load i16, ptr %6, align 2, !tbaa !14
  %43 = zext i16 %42 to i32
  %44 = load i16, ptr %7, align 2, !tbaa !14
  %45 = zext i16 %44 to i32
  %46 = mul nsw i32 %43, %45
  %47 = trunc i32 %46 to i16
  store i16 %47, ptr %8, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %48 = call ptr (i32, ...) @bk_new_Block(i32 noundef 0)
  store ptr %48, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %10) #4
  store i16 0, ptr %10, align 2, !tbaa !14
  br label %49

49:                                               ; preds = %114, %27
  %50 = load i16, ptr %10, align 2, !tbaa !14
  %51 = zext i16 %50 to i32
  %52 = load i16, ptr %6, align 2, !tbaa !14
  %53 = zext i16 %52 to i32
  %54 = icmp slt i32 %51, %53
  br i1 %54, label %56, label %55

55:                                               ; preds = %49
  store i32 2, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %10) #4
  br label %117

56:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.table_CPAL, ptr %57, i32 0, i32 1
  %59 = getelementptr inbounds %struct.cpal_PaletteSet, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !15
  %61 = load i16, ptr %10, align 2, !tbaa !14
  %62 = zext i16 %61 to i64
  %63 = getelementptr inbounds %struct.cpal_Palette, ptr %60, i64 %62
  store ptr %63, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %13) #4
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.cpal_Palette, ptr %64, i32 0, i32 0
  %66 = getelementptr inbounds %struct.cpal_ColorSet, ptr %65, i32 0, i32 0
  %67 = load i64, ptr %66, align 8, !tbaa !16
  %68 = trunc i64 %67 to i16
  store i16 %68, ptr %13, align 2, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 2, ptr %14) #4
  store i16 0, ptr %14, align 2, !tbaa !14
  br label %69

69:                                               ; preds = %110, %56
  %70 = load i16, ptr %14, align 2, !tbaa !14
  %71 = zext i16 %70 to i32
  %72 = load i16, ptr %7, align 2, !tbaa !14
  %73 = zext i16 %72 to i32
  %74 = icmp slt i32 %71, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %69
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %14) #4
  br label %113

76:                                               ; preds = %69
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  store ptr null, ptr %15, align 8, !tbaa !5
  %77 = load i16, ptr %14, align 2, !tbaa !14
  %78 = zext i16 %77 to i32
  %79 = load i16, ptr %13, align 2, !tbaa !14
  %80 = zext i16 %79 to i32
  %81 = icmp slt i32 %78, %80
  br i1 %81, label %82, label %90

82:                                               ; preds = %76
  %83 = load ptr, ptr %12, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.cpal_Palette, ptr %83, i32 0, i32 0
  %85 = getelementptr inbounds %struct.cpal_ColorSet, ptr %84, i32 0, i32 2
  %86 = load ptr, ptr %85, align 8, !tbaa !19
  %87 = load i16, ptr %14, align 2, !tbaa !14
  %88 = zext i16 %87 to i64
  %89 = getelementptr inbounds %struct.cpal_Color, ptr %86, i64 %88
  store ptr %89, ptr %15, align 8, !tbaa !5
  br label %91

90:                                               ; preds = %76
  store ptr @white, ptr %15, align 8, !tbaa !5
  br label %91

91:                                               ; preds = %90, %82
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = load ptr, ptr %15, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.cpal_Color, ptr %93, i32 0, i32 2
  %95 = load i8, ptr %94, align 2, !tbaa !20
  %96 = zext i8 %95 to i32
  %97 = load ptr, ptr %15, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.cpal_Color, ptr %97, i32 0, i32 1
  %99 = load i8, ptr %98, align 1, !tbaa !22
  %100 = zext i8 %99 to i32
  %101 = load ptr, ptr %15, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.cpal_Color, ptr %101, i32 0, i32 0
  %103 = load i8, ptr %102, align 2, !tbaa !23
  %104 = zext i8 %103 to i32
  %105 = load ptr, ptr %15, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.cpal_Color, ptr %105, i32 0, i32 3
  %107 = load i8, ptr %106, align 1, !tbaa !24
  %108 = zext i8 %107 to i32
  %109 = call ptr (ptr, i32, ...) @bk_push(ptr noundef %92, i32 noundef 1, i32 noundef %96, i32 noundef 1, i32 noundef %100, i32 noundef 1, i32 noundef %104, i32 noundef 1, i32 noundef %108, i32 noundef 0)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %110

110:                                              ; preds = %91
  %111 = load i16, ptr %14, align 2, !tbaa !14
  %112 = add i16 %111, 1
  store i16 %112, ptr %14, align 2, !tbaa !14
  br label %69, !llvm.loop !25

113:                                              ; preds = %75
  call void @llvm.lifetime.end.p0(i64 2, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %114

114:                                              ; preds = %113
  %115 = load i16, ptr %10, align 2, !tbaa !14
  %116 = add i16 %115, 1
  store i16 %116, ptr %10, align 2, !tbaa !14
  br label %49, !llvm.loop !27

117:                                              ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %118 = load ptr, ptr %4, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.table_CPAL, ptr %118, i32 0, i32 0
  %120 = load i16, ptr %119, align 8, !tbaa !28
  %121 = zext i16 %120 to i32
  %122 = load i16, ptr %7, align 2, !tbaa !14
  %123 = zext i16 %122 to i32
  %124 = load i16, ptr %6, align 2, !tbaa !14
  %125 = zext i16 %124 to i32
  %126 = load i16, ptr %8, align 2, !tbaa !14
  %127 = zext i16 %126 to i32
  %128 = load ptr, ptr %9, align 8, !tbaa !5
  %129 = call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef %121, i32 noundef 2, i32 noundef %123, i32 noundef 2, i32 noundef %125, i32 noundef 2, i32 noundef %127, i32 noundef 17, ptr noundef %128, i32 noundef 0)
  store ptr %129, ptr %16, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %17) #4
  store i16 0, ptr %17, align 2, !tbaa !14
  br label %130

130:                                              ; preds = %145, %117
  %131 = load i16, ptr %17, align 2, !tbaa !14
  %132 = zext i16 %131 to i32
  %133 = load i16, ptr %6, align 2, !tbaa !14
  %134 = zext i16 %133 to i32
  %135 = icmp slt i32 %132, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %130
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 2, ptr %17) #4
  br label %148

137:                                              ; preds = %130
  %138 = load ptr, ptr %16, align 8, !tbaa !5
  %139 = load i16, ptr %7, align 2, !tbaa !14
  %140 = zext i16 %139 to i32
  %141 = load i16, ptr %17, align 2, !tbaa !14
  %142 = zext i16 %141 to i32
  %143 = mul nsw i32 %140, %142
  %144 = call ptr (ptr, i32, ...) @bk_push(ptr noundef %138, i32 noundef 2, i32 noundef %143, i32 noundef 0)
  br label %145

145:                                              ; preds = %137
  %146 = load i16, ptr %17, align 2, !tbaa !14
  %147 = add i16 %146, 1
  store i16 %147, ptr %17, align 2, !tbaa !14
  br label %130, !llvm.loop !29

148:                                              ; preds = %136
  %149 = load ptr, ptr %4, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.table_CPAL, ptr %149, i32 0, i32 0
  %151 = load i16, ptr %150, align 8, !tbaa !28
  %152 = zext i16 %151 to i32
  %153 = icmp sgt i32 %152, 0
  br i1 %153, label %154, label %163

154:                                              ; preds = %148
  %155 = load ptr, ptr %16, align 8, !tbaa !5
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = call ptr @buildPaletteType(ptr noundef %156)
  %158 = load ptr, ptr %4, align 8, !tbaa !5
  %159 = call ptr @buildPaletteLabel(ptr noundef %158)
  %160 = load ptr, ptr %4, align 8, !tbaa !5
  %161 = call ptr @buildPaletteEntryLabel(ptr noundef %160)
  %162 = call ptr (ptr, i32, ...) @bk_push(ptr noundef %155, i32 noundef 17, ptr noundef %157, i32 noundef 17, ptr noundef %159, i32 noundef 17, ptr noundef %161, i32 noundef 0)
  br label %163

163:                                              ; preds = %154, %148
  %164 = load ptr, ptr %16, align 8, !tbaa !5
  %165 = call ptr @bk_build_Block(ptr noundef %164)
  store ptr %165, ptr %3, align 8
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %6) #4
  br label %166

166:                                              ; preds = %163, %26
  %167 = load ptr, ptr %3, align 8
  ret ptr %167
}

declare ptr @bk_new_Block(i32 noundef, ...) #2

declare ptr @bk_push(ptr noundef, i32 noundef, ...) #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @buildPaletteType(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @buildPaletteLabel(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @buildPaletteEntryLabel(ptr noundef) #3

declare ptr @bk_build_Block(ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { "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 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 = { 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, !13, i64 8}
!10 = !{!"", !11, i64 0, !12, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!"", !13, i64 0, !13, i64 8, !6, i64 16}
!13 = !{!"long", !7, i64 0}
!14 = !{!11, !11, i64 0}
!15 = !{!10, !6, i64 24}
!16 = !{!17, !13, i64 0}
!17 = !{!"", !12, i64 0, !18, i64 24, !18, i64 28}
!18 = !{!"int", !7, i64 0}
!19 = !{!17, !6, i64 16}
!20 = !{!21, !7, i64 2}
!21 = !{!"", !7, i64 0, !7, i64 1, !7, i64 2, !7, i64 3, !11, i64 4}
!22 = !{!21, !7, i64 1}
!23 = !{!21, !7, i64 0}
!24 = !{!21, !7, i64 3}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = distinct !{!27, !26}
!28 = !{!10, !11, i64 0}
!29 = distinct !{!29, !26}


; 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.cpal_Color = type { i8, i8, i8, i8, i16 }
%struct.cpal_Palette = type { %struct.cpal_ColorSet, i32, i32 }
%struct.cpal_ColorSet = type { i64, i64, ptr }

@white = external dso_local local_unnamed_addr constant %struct.cpal_Color, align 2

; Function Attrs: nounwind uwtable
define dso_local ptr @otfcc_buildCPAL(ptr noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %64, label %3

3:                                                ; preds = %2
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %.not50 = icmp eq i64 %5, 0
  br i1 %.not50, label %64, label %6

6:                                                ; preds = %3
  %7 = trunc i64 %5 to i32
  %8 = getelementptr inbounds i8, ptr %0, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !13
  %10 = load i64, ptr %9, align 8, !tbaa !14
  %11 = trunc i64 %10 to i32
  %12 = and i32 %7, 65535
  %13 = and i32 %11, 65535
  %14 = mul i32 %11, %7
  %15 = tail call ptr (i32, ...) @bk_new_Block(i32 noundef 0) #3
  %.not58 = icmp eq i32 %12, 0
  br i1 %.not58, label %._crit_edge56.thread, label %.lr.ph55

._crit_edge56.thread:                             ; preds = %6
  %16 = load i16, ptr %0, align 8, !tbaa !17
  %17 = zext i16 %16 to i32
  %18 = tail call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef %17, i32 noundef 2, i32 noundef %13, i32 noundef 2, i32 noundef %12, i32 noundef 2, i32 noundef 0, i32 noundef 17, ptr noundef %15, i32 noundef 0) #3
  br label %._crit_edge

.lr.ph55:                                         ; preds = %6
  %.not59 = icmp eq i32 %13, 0
  br i1 %.not59, label %._crit_edge56.thread74, label %.lr.ph.us.preheader

._crit_edge56.thread74:                           ; preds = %.lr.ph55
  %19 = load i16, ptr %0, align 8, !tbaa !17
  %20 = zext i16 %19 to i32
  %21 = tail call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef %20, i32 noundef 2, i32 noundef %13, i32 noundef 2, i32 noundef %12, i32 noundef 2, i32 noundef 0, i32 noundef 17, ptr noundef %15, i32 noundef 0) #3
  br label %.lr.ph.preheader

.lr.ph.us.preheader:                              ; preds = %.lr.ph55
  %wide.trip.count65 = and i64 %5, 65535
  %wide.trip.count = and i64 %10, 65535
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv62 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next63, %._crit_edge.us ]
  %22 = load ptr, ptr %8, align 8, !tbaa !13
  %23 = getelementptr inbounds %struct.cpal_Palette, ptr %22, i64 %indvars.iv62
  %24 = load i64, ptr %23, align 8, !tbaa !14
  %25 = trunc i64 %24 to i32
  %26 = and i32 %25, 65535
  %27 = getelementptr inbounds i8, ptr %23, i64 16
  br label %28

28:                                               ; preds = %.lr.ph.us, %34
  %indvars.iv = phi i64 [ 0, %.lr.ph.us ], [ %indvars.iv.next, %34 ]
  %29 = phi i32 [ 0, %.lr.ph.us ], [ %47, %34 ]
  %30 = icmp ugt i32 %26, %29
  br i1 %30, label %31, label %34

31:                                               ; preds = %28
  %32 = load ptr, ptr %27, align 8, !tbaa !18
  %33 = getelementptr inbounds %struct.cpal_Color, ptr %32, i64 %indvars.iv
  br label %34

34:                                               ; preds = %31, %28
  %.042.us = phi ptr [ %33, %31 ], [ @white, %28 ]
  %35 = getelementptr inbounds i8, ptr %.042.us, i64 2
  %36 = load i8, ptr %35, align 2, !tbaa !19
  %37 = zext i8 %36 to i32
  %38 = getelementptr inbounds i8, ptr %.042.us, i64 1
  %39 = load i8, ptr %38, align 1, !tbaa !21
  %40 = zext i8 %39 to i32
  %41 = load i8, ptr %.042.us, align 2, !tbaa !22
  %42 = zext i8 %41 to i32
  %43 = getelementptr inbounds i8, ptr %.042.us, i64 3
  %44 = load i8, ptr %43, align 1, !tbaa !23
  %45 = zext i8 %44 to i32
  %46 = tail call ptr (ptr, i32, ...) @bk_push(ptr noundef %15, i32 noundef 1, i32 noundef %37, i32 noundef 1, i32 noundef %40, i32 noundef 1, i32 noundef %42, i32 noundef 1, i32 noundef %45, i32 noundef 0) #3
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %47 = trunc nuw i64 %indvars.iv.next to i32
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge.us, label %28, !llvm.loop !24

._crit_edge.us:                                   ; preds = %34
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count65
  br i1 %exitcond66.not, label %._crit_edge56, label %.lr.ph.us, !llvm.loop !26

._crit_edge56:                                    ; preds = %._crit_edge.us
  %48 = load i16, ptr %0, align 8, !tbaa !17
  %49 = zext i16 %48 to i32
  %50 = and i32 %14, 65535
  %51 = tail call ptr (i32, ...) @bk_new_Block(i32 noundef 2, i32 noundef %49, i32 noundef 2, i32 noundef %13, i32 noundef 2, i32 noundef %12, i32 noundef 2, i32 noundef %50, i32 noundef 17, ptr noundef %15, i32 noundef 0) #3
  br i1 %.not58, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %._crit_edge56.thread74, %._crit_edge56
  %52 = phi ptr [ %21, %._crit_edge56.thread74 ], [ %51, %._crit_edge56 ]
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %._crit_edge56.thread, %._crit_edge56
  %53 = phi ptr [ %18, %._crit_edge56.thread ], [ %51, %._crit_edge56 ], [ %52, %.lr.ph ]
  %54 = load i16, ptr %0, align 8, !tbaa !17
  %.not51 = icmp eq i16 %54, 0
  br i1 %.not51, label %62, label %57

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv70 = phi i32 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next71, %.lr.ph ]
  %55 = mul nuw nsw i32 %indvars.iv70, %13
  %56 = tail call ptr (ptr, i32, ...) @bk_push(ptr noundef %52, i32 noundef 2, i32 noundef %55, i32 noundef 0) #3
  %indvars.iv.next71 = add nuw nsw i32 %indvars.iv70, 1
  %exitcond73.not = icmp eq i32 %indvars.iv.next71, %12
  br i1 %exitcond73.not, label %._crit_edge, label %.lr.ph, !llvm.loop !27

57:                                               ; preds = %._crit_edge
  %58 = tail call ptr @buildPaletteType(ptr noundef nonnull %0)
  %59 = tail call ptr @buildPaletteLabel(ptr noundef nonnull %0)
  %60 = tail call ptr @buildPaletteEntryLabel(ptr noundef nonnull %0)
  %61 = tail call ptr (ptr, i32, ...) @bk_push(ptr noundef %53, i32 noundef 17, ptr noundef %58, i32 noundef 17, ptr noundef %59, i32 noundef 17, ptr noundef %60, i32 noundef 0) #3
  br label %62

62:                                               ; preds = %57, %._crit_edge
  %63 = tail call ptr @bk_build_Block(ptr noundef %53) #3
  br label %64

64:                                               ; preds = %2, %3, %62
  %.041 = phi ptr [ %63, %62 ], [ null, %3 ], [ null, %2 ]
  ret ptr %.041
}

declare ptr @bk_new_Block(i32 noundef, ...) local_unnamed_addr #1

declare ptr @bk_push(ptr noundef, i32 noundef, ...) local_unnamed_addr #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @buildPaletteType(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @buildPaletteLabel(ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @buildPaletteEntryLabel(ptr noundef) local_unnamed_addr #2

declare ptr @bk_build_Block(ptr noundef) local_unnamed_addr #1

attributes #0 = { 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 #1 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !11, i64 8}
!6 = !{!"", !7, i64 0, !10, i64 8}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 8, !12, i64 16}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !12, i64 24}
!14 = !{!15, !11, i64 0}
!15 = !{!"", !10, i64 0, !16, i64 24, !16, i64 28}
!16 = !{!"int", !8, i64 0}
!17 = !{!6, !7, i64 0}
!18 = !{!15, !12, i64 16}
!19 = !{!20, !8, i64 2}
!20 = !{!"", !8, i64 0, !8, i64 1, !8, i64 2, !8, i64 3, !7, i64 4}
!21 = !{!20, !8, i64 1}
!22 = !{!20, !8, i64 0}
!23 = !{!20, !8, i64 3}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = distinct !{!26, !25}
!27 = distinct !{!27, !25}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass