; LLVM IR from clibs/clib :: deps/gumbo-parser (tag)

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

@.str.151 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__.gumbo_tag_from_original_text = external hidden unnamed_addr constant [54 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.154 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.155 = external hidden unnamed_addr constant [18 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @gumbo_tag_from_original_text(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.GumboStringPiece, ptr %5, i32 0, i32 0
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  %8 = icmp eq ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  br label %121

10:                                               ; preds = %1
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.GumboStringPiece, ptr %11, i32 0, i32 1
  %13 = load i64, ptr %12, align 8, !tbaa !12
  %14 = icmp uge i64 %13, 2
  br i1 %14, label %15, label %16

15:                                               ; preds = %10
  br label %17

16:                                               ; preds = %10
  call void @__assert_fail(ptr noundef @.str.152, ptr noundef @.str.151, i32 noundef 192, ptr noundef @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #4
  unreachable

17:                                               ; preds = %15
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.GumboStringPiece, ptr %18, i32 0, i32 0
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %20, i64 0
  %22 = load i8, ptr %21, align 1, !tbaa !13
  %23 = sext i8 %22 to i32
  %24 = icmp eq i32 %23, 60
  br i1 %24, label %25, label %26

25:                                               ; preds = %17
  br label %27

26:                                               ; preds = %17
  call void @__assert_fail(ptr noundef @.str.153, ptr noundef @.str.151, i32 noundef 193, ptr noundef @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #4
  unreachable

27:                                               ; preds = %25
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.GumboStringPiece, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.GumboStringPiece, ptr %31, i32 0, i32 1
  %33 = load i64, ptr %32, align 8, !tbaa !12
  %34 = sub i64 %33, 1
  %35 = getelementptr inbounds i8, ptr %30, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !13
  %37 = sext i8 %36 to i32
  %38 = icmp eq i32 %37, 62
  br i1 %38, label %39, label %40

39:                                               ; preds = %27
  br label %41

40:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.154, ptr noundef @.str.151, i32 noundef 194, ptr noundef @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #4
  unreachable

41:                                               ; preds = %39
  %42 = load ptr, ptr %2, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.GumboStringPiece, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds i8, ptr %44, i64 1
  %46 = load i8, ptr %45, align 1, !tbaa !13
  %47 = sext i8 %46 to i32
  %48 = icmp eq i32 %47, 47
  br i1 %48, label %49, label %65

49:                                               ; preds = %41
  %50 = load ptr, ptr %2, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.GumboStringPiece, ptr %50, i32 0, i32 1
  %52 = load i64, ptr %51, align 8, !tbaa !12
  %53 = icmp uge i64 %52, 3
  br i1 %53, label %54, label %55

54:                                               ; preds = %49
  br label %56

55:                                               ; preds = %49
  call void @__assert_fail(ptr noundef @.str.155, ptr noundef @.str.151, i32 noundef 197, ptr noundef @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #4
  unreachable

56:                                               ; preds = %54
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.GumboStringPiece, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = getelementptr inbounds i8, ptr %59, i64 2
  store ptr %60, ptr %58, align 8, !tbaa !9
  %61 = load ptr, ptr %2, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.GumboStringPiece, ptr %61, i32 0, i32 1
  %63 = load i64, ptr %62, align 8, !tbaa !12
  %64 = sub i64 %63, 3
  store i64 %64, ptr %62, align 8, !tbaa !12
  br label %121

65:                                               ; preds = %41
  %66 = load ptr, ptr %2, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.GumboStringPiece, ptr %66, i32 0, i32 0
  %68 = load ptr, ptr %67, align 8, !tbaa !9
  %69 = getelementptr inbounds i8, ptr %68, i64 1
  store ptr %69, ptr %67, align 8, !tbaa !9
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.GumboStringPiece, ptr %70, i32 0, i32 1
  %72 = load i64, ptr %71, align 8, !tbaa !12
  %73 = sub i64 %72, 2
  store i64 %73, ptr %71, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %74 = load ptr, ptr %2, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.GumboStringPiece, ptr %74, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  store ptr %76, ptr %3, align 8, !tbaa !5
  br label %77

77:                                               ; preds = %116, %65
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.GumboStringPiece, ptr %79, i32 0, i32 0
  %81 = load ptr, ptr %80, align 8, !tbaa !9
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.GumboStringPiece, ptr %82, i32 0, i32 1
  %84 = load i64, ptr %83, align 8, !tbaa !12
  %85 = getelementptr inbounds i8, ptr %81, i64 %84
  %86 = icmp ne ptr %78, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %77
  store i32 2, ptr %4, align 4
  br label %119

88:                                               ; preds = %77
  %89 = call ptr @__ctype_b_loc() #6
  %90 = load ptr, ptr %89, align 8, !tbaa !5
  %91 = load ptr, ptr %3, align 8, !tbaa !5
  %92 = load i8, ptr %91, align 1, !tbaa !13
  %93 = sext i8 %92 to i32
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i16, ptr %90, i64 %94
  %96 = load i16, ptr %95, align 2, !tbaa !14
  %97 = zext i16 %96 to i32
  %98 = and i32 %97, 8192
  %99 = icmp ne i32 %98, 0
  br i1 %99, label %105, label %100

100:                                              ; preds = %88
  %101 = load ptr, ptr %3, align 8, !tbaa !5
  %102 = load i8, ptr %101, align 1, !tbaa !13
  %103 = sext i8 %102 to i32
  %104 = icmp eq i32 %103, 47
  br i1 %104, label %105, label %115

105:                                              ; preds = %100, %88
  %106 = load ptr, ptr %3, align 8, !tbaa !5
  %107 = load ptr, ptr %2, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.GumboStringPiece, ptr %107, i32 0, i32 0
  %109 = load ptr, ptr %108, align 8, !tbaa !9
  %110 = ptrtoint ptr %106 to i64
  %111 = ptrtoint ptr %109 to i64
  %112 = sub i64 %110, %111
  %113 = load ptr, ptr %2, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.GumboStringPiece, ptr %113, i32 0, i32 1
  store i64 %112, ptr %114, align 8, !tbaa !12
  store i32 2, ptr %4, align 4
  br label %119

115:                                              ; preds = %100
  br label %116

116:                                              ; preds = %115
  %117 = load ptr, ptr %3, align 8, !tbaa !5
  %118 = getelementptr inbounds i8, ptr %117, i32 1
  store ptr %118, ptr %3, align 8, !tbaa !5
  br label %77, !llvm.loop !16

119:                                              ; preds = %105, %87
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120, %56, %9
  ret void
}

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

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() #3

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

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(none) "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 = { noreturn nounwind }
attributes #5 = { nounwind }
attributes #6 = { nounwind willreturn memory(none) }

!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, !6, i64 0}
!10 = !{!"", !6, i64 0, !11, i64 8}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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

@.str.151 = external hidden unnamed_addr constant [68 x i8], align 1
@.str.152 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__.gumbo_tag_from_original_text = external hidden unnamed_addr constant [54 x i8], align 1
@.str.153 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.154 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.155 = external hidden unnamed_addr constant [18 x i8], align 1

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

; Function Attrs: nounwind uwtable
define dso_local void @gumbo_tag_from_original_text(ptr nocapture noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr %0, align 8, !tbaa !5
  %3 = icmp eq ptr %2, null
  br i1 %3, label %.loopexit, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 8
  %6 = load i64, ptr %5, align 8, !tbaa !11
  %7 = icmp ugt i64 %6, 1
  br i1 %7, label %9, label %8

8:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str.152, ptr noundef nonnull @.str.151, i32 noundef 192, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #3
  unreachable

9:                                                ; preds = %4
  %10 = load i8, ptr %2, align 1, !tbaa !12
  %11 = icmp eq i8 %10, 60
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void @__assert_fail(ptr noundef nonnull @.str.153, ptr noundef nonnull @.str.151, i32 noundef 193, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #3
  unreachable

13:                                               ; preds = %9
  %14 = getelementptr i8, ptr %2, i64 %6
  %15 = getelementptr i8, ptr %14, i64 -1
  %16 = load i8, ptr %15, align 1, !tbaa !12
  %17 = icmp eq i8 %16, 62
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.154, ptr noundef nonnull @.str.151, i32 noundef 194, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #3
  unreachable

19:                                               ; preds = %13
  %.ptr = getelementptr inbounds i8, ptr %2, i64 1
  %20 = load i8, ptr %.ptr, align 1, !tbaa !12
  %21 = icmp eq i8 %20, 47
  br i1 %21, label %22, label %27

22:                                               ; preds = %19
  %.not24 = icmp eq i64 %6, 2
  br i1 %.not24, label %23, label %24

23:                                               ; preds = %22
  tail call void @__assert_fail(ptr noundef nonnull @.str.155, ptr noundef nonnull @.str.151, i32 noundef 197, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tag_from_original_text) #3
  unreachable

24:                                               ; preds = %22
  %25 = getelementptr inbounds i8, ptr %2, i64 2
  store ptr %25, ptr %0, align 8, !tbaa !5
  %26 = add i64 %6, -3
  br label %.loopexit.sink.split

27:                                               ; preds = %19
  store ptr %.ptr, ptr %0, align 8, !tbaa !5
  %28 = add i64 %6, -2
  store i64 %28, ptr %5, align 8, !tbaa !11
  %.not26 = icmp eq i64 %28, 0
  br i1 %.not26, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %27
  %29 = tail call ptr @__ctype_b_loc() #4
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  br label %31

31:                                               ; preds = %.lr.ph, %42
  %.027 = phi ptr [ %.ptr, %.lr.ph ], [ %43, %42 ]
  %32 = load i8, ptr %.027, align 1, !tbaa !12
  %33 = sext i8 %32 to i64
  %34 = getelementptr inbounds i16, ptr %30, i64 %33
  %35 = load i16, ptr %34, align 2, !tbaa !14
  %36 = and i16 %35, 8192
  %.not23 = icmp ne i16 %36, 0
  %37 = icmp eq i8 %32, 47
  %or.cond = or i1 %37, %.not23
  br i1 %or.cond, label %38, label %42

38:                                               ; preds = %31
  %39 = ptrtoint ptr %.027 to i64
  %40 = ptrtoint ptr %.ptr to i64
  %41 = sub i64 %39, %40
  br label %.loopexit.sink.split

42:                                               ; preds = %31
  %43 = getelementptr inbounds i8, ptr %.027, i64 1
  %.not = icmp eq ptr %43, %15
  br i1 %.not, label %.loopexit, label %31, !llvm.loop !16

.loopexit.sink.split:                             ; preds = %24, %38
  %.sink = phi i64 [ %41, %38 ], [ %26, %24 ]
  store i64 %.sink, ptr %5, align 8, !tbaa !11
  br label %.loopexit

.loopexit:                                        ; preds = %42, %.loopexit.sink.split, %27, %1
  ret void
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__ctype_b_loc() local_unnamed_addr #2

attributes #0 = { 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 #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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { noreturn nounwind }
attributes #4 = { nounwind willreturn memory(none) }

!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 = !{!"", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!6, !10, i64 8}
!12 = !{!8, !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"short", !8, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


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