; LLVM IR from ashishzero/karma :: src/modules/core (stb)

; 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.stbtt_fontinfo = type { ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, %struct.stbtt__buf, %struct.stbtt__buf, %struct.stbtt__buf, %struct.stbtt__buf, %struct.stbtt__buf, %struct.stbtt__buf }
%struct.stbtt__buf = type { ptr, i32, i32 }

; 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: mustprogress nounwind uwtable
declare hidden noundef signext i16 @_ZL7ttSHORTPh(ptr noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local i32 @stbtt_GetGlyphBox(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) #2 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store i32 %1, ptr %9, align 4, !tbaa !9
  store ptr %2, ptr %10, align 8, !tbaa !5
  store ptr %3, ptr %11, align 8, !tbaa !5
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.stbtt_fontinfo, ptr %16, i32 0, i32 18
  %18 = getelementptr inbounds %struct.stbtt__buf, ptr %17, i32 0, i32 2
  %19 = load i32, ptr %18, align 4, !tbaa !11
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %29

21:                                               ; preds = %6
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = load ptr, ptr %10, align 8, !tbaa !5
  %25 = load ptr, ptr %11, align 8, !tbaa !5
  %26 = load ptr, ptr %12, align 8, !tbaa !5
  %27 = load ptr, ptr %13, align 8, !tbaa !5
  %28 = call noundef i32 @_ZL21stbtt__GetGlyphInfoT2PK14stbtt_fontinfoiPiS2_S2_S2_(ptr noundef %22, i32 noundef %23, ptr noundef %24, ptr noundef %25, ptr noundef %26, ptr noundef %27)
  br label %96

29:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = load i32, ptr %9, align 4, !tbaa !9
  %32 = call noundef i32 @_ZL20stbtt__GetGlyfOffsetPK14stbtt_fontinfoi(ptr noundef %30, i32 noundef %31)
  store i32 %32, ptr %14, align 4, !tbaa !9
  %33 = load i32, ptr %14, align 4, !tbaa !9
  %34 = icmp slt i32 %33, 0
  br i1 %34, label %35, label %36

35:                                               ; preds = %29
  store i32 0, ptr %7, align 4
  store i32 1, ptr %15, align 4
  br label %93

36:                                               ; preds = %29
  %37 = load ptr, ptr %10, align 8, !tbaa !5
  %38 = icmp ne ptr %37, null
  br i1 %38, label %39, label %50

39:                                               ; preds = %36
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.stbtt_fontinfo, ptr %40, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  %43 = load i32, ptr %14, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i8, ptr %42, i64 %44
  %46 = getelementptr inbounds i8, ptr %45, i64 2
  %47 = call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef %46)
  %48 = sext i16 %47 to i32
  %49 = load ptr, ptr %10, align 8, !tbaa !5
  store i32 %48, ptr %49, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %39, %36
  %51 = load ptr, ptr %11, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %64

53:                                               ; preds = %50
  %54 = load ptr, ptr %8, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.stbtt_fontinfo, ptr %54, i32 0, i32 1
  %56 = load ptr, ptr %55, align 8, !tbaa !14
  %57 = load i32, ptr %14, align 4, !tbaa !9
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds i8, ptr %56, i64 %58
  %60 = getelementptr inbounds i8, ptr %59, i64 4
  %61 = call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef %60)
  %62 = sext i16 %61 to i32
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  store i32 %62, ptr %63, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %53, %50
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %78

67:                                               ; preds = %64
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.stbtt_fontinfo, ptr %68, i32 0, i32 1
  %70 = load ptr, ptr %69, align 8, !tbaa !14
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i8, ptr %70, i64 %72
  %74 = getelementptr inbounds i8, ptr %73, i64 6
  %75 = call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef %74)
  %76 = sext i16 %75 to i32
  %77 = load ptr, ptr %12, align 8, !tbaa !5
  store i32 %76, ptr %77, align 4, !tbaa !9
  br label %78

78:                                               ; preds = %67, %64
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  %80 = icmp ne ptr %79, null
  br i1 %80, label %81, label %92

81:                                               ; preds = %78
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.stbtt_fontinfo, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !14
  %85 = load i32, ptr %14, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds i8, ptr %84, i64 %86
  %88 = getelementptr inbounds i8, ptr %87, i64 8
  %89 = call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef %88)
  %90 = sext i16 %89 to i32
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  store i32 %90, ptr %91, align 4, !tbaa !9
  br label %92

92:                                               ; preds = %81, %78
  store i32 0, ptr %15, align 4
  br label %93

93:                                               ; preds = %92, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  %94 = load i32, ptr %15, align 4
  switch i32 %94, label %99 [
    i32 0, label %95
    i32 1, label %97
  ]

95:                                               ; preds = %93
  br label %96

96:                                               ; preds = %95, %21
  store i32 1, ptr %7, align 4
  br label %97

97:                                               ; preds = %96, %93
  %98 = load i32, ptr %7, align 4
  ret i32 %98

99:                                               ; preds = %93
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL20stbtt__GetGlyfOffsetPK14stbtt_fontinfoi(ptr noundef, i32 noundef) #1

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 92}
!12 = !{!"_ZTS14stbtt_fontinfo", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !13, i64 80, !13, i64 96, !13, i64 112, !13, i64 128, !13, i64 144, !13, i64 160}
!13 = !{!"_ZTS10stbtt__buf", !6, i64 0, !10, i64 8, !10, i64 12}
!14 = !{!12, !6, i64 8}


; 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"

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef signext i16 @_ZL7ttSHORTPh(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local range(i32 0, 2) i32 @stbtt_GetGlyphBox(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #1 {
  %7 = getelementptr inbounds i8, ptr %0, i64 92
  %8 = load i32, ptr %7, align 4, !tbaa !5
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %11, label %9

9:                                                ; preds = %6
  %10 = tail call noundef i32 @_ZL21stbtt__GetGlyphInfoT2PK14stbtt_fontinfoiPiS2_S2_S2_(ptr noundef nonnull %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5)
  br label %.thread

11:                                               ; preds = %6
  %12 = tail call noundef i32 @_ZL20stbtt__GetGlyfOffsetPK14stbtt_fontinfoi(ptr noundef nonnull %0, i32 noundef %1)
  %13 = icmp slt i32 %12, 0
  br i1 %13, label %.thread, label %14

14:                                               ; preds = %11
  %.not33 = icmp eq ptr %2, null
  br i1 %.not33, label %23, label %15

15:                                               ; preds = %14
  %16 = getelementptr inbounds i8, ptr %0, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !12
  %18 = zext nneg i32 %12 to i64
  %19 = getelementptr inbounds i8, ptr %17, i64 %18
  %20 = getelementptr inbounds i8, ptr %19, i64 2
  %21 = tail call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef nonnull %20)
  %22 = sext i16 %21 to i32
  store i32 %22, ptr %2, align 4, !tbaa !13
  br label %23

23:                                               ; preds = %15, %14
  %.not34 = icmp eq ptr %3, null
  br i1 %.not34, label %32, label %24

24:                                               ; preds = %23
  %25 = getelementptr inbounds i8, ptr %0, i64 8
  %26 = load ptr, ptr %25, align 8, !tbaa !12
  %27 = zext nneg i32 %12 to i64
  %28 = getelementptr inbounds i8, ptr %26, i64 %27
  %29 = getelementptr inbounds i8, ptr %28, i64 4
  %30 = tail call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef nonnull %29)
  %31 = sext i16 %30 to i32
  store i32 %31, ptr %3, align 4, !tbaa !13
  br label %32

32:                                               ; preds = %24, %23
  %.not35 = icmp eq ptr %4, null
  br i1 %.not35, label %41, label %33

33:                                               ; preds = %32
  %34 = getelementptr inbounds i8, ptr %0, i64 8
  %35 = load ptr, ptr %34, align 8, !tbaa !12
  %36 = zext nneg i32 %12 to i64
  %37 = getelementptr inbounds i8, ptr %35, i64 %36
  %38 = getelementptr inbounds i8, ptr %37, i64 6
  %39 = tail call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef nonnull %38)
  %40 = sext i16 %39 to i32
  store i32 %40, ptr %4, align 4, !tbaa !13
  br label %41

41:                                               ; preds = %33, %32
  %.not36 = icmp eq ptr %5, null
  br i1 %.not36, label %.thread, label %42

42:                                               ; preds = %41
  %43 = getelementptr inbounds i8, ptr %0, i64 8
  %44 = load ptr, ptr %43, align 8, !tbaa !12
  %45 = zext nneg i32 %12 to i64
  %46 = getelementptr inbounds i8, ptr %44, i64 %45
  %47 = getelementptr inbounds i8, ptr %46, i64 8
  %48 = tail call noundef signext i16 @_ZL7ttSHORTPh(ptr noundef nonnull %47)
  %49 = sext i16 %48 to i32
  store i32 %49, ptr %5, align 4, !tbaa !13
  br label %.thread

.thread:                                          ; preds = %42, %41, %9, %11
  %.1 = phi i32 [ 0, %11 ], [ 1, %9 ], [ 1, %41 ], [ 1, %42 ]
  ret i32 %.1
}

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL20stbtt__GetGlyfOffsetPK14stbtt_fontinfoi(ptr noundef, i32 noundef) local_unnamed_addr #0

attributes #0 = { 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 #1 = { 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" }

!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, !10, i64 92}
!6 = !{!"_ZTS14stbtt_fontinfo", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !11, i64 80, !11, i64 96, !11, i64 112, !11, i64 128, !11, i64 144, !11, i64 160}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_ZTS10stbtt__buf", !7, i64 0, !10, i64 8, !10, i64 12}
!12 = !{!6, !7, i64 8}
!13 = !{!10, !10, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass