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

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

@kSvgTagReplacements = external hidden constant [36 x %struct._ReplacementEntry], align 16

; 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 @gumbo_normalize_svg_tagname(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %7

7:                                                ; preds = %29, %1
  %8 = load i32, ptr %4, align 4, !tbaa !9
  %9 = sext i32 %8 to i64
  %10 = icmp ult i64 %9, 36
  br i1 %10, label %12, label %11

11:                                               ; preds = %7
  store i32 2, ptr %5, align 4
  br label %32

12:                                               ; preds = %7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %13 = load i32, ptr %4, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [36 x %struct._ReplacementEntry], ptr @kSvgTagReplacements, i64 0, i64 %14
  store ptr %15, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._ReplacementEntry, ptr %17, i32 0, i32 0
  %19 = call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %16, ptr noundef %18)
  br i1 %19, label %20, label %25

20:                                               ; preds = %12
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct._ReplacementEntry, ptr %21, i32 0, i32 1
  %23 = getelementptr inbounds %struct.GumboStringPiece, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !11
  store ptr %24, ptr %2, align 8
  store i32 1, ptr %5, align 4
  br label %26

25:                                               ; preds = %12
  store i32 0, ptr %5, align 4
  br label %26

26:                                               ; preds = %25, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %27 = load i32, ptr %5, align 4
  switch i32 %27, label %32 [
    i32 0, label %28
  ]

28:                                               ; preds = %26
  br label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %4, align 4, !tbaa !9
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !9
  br label %7, !llvm.loop !15

32:                                               ; preds = %26, %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %33 = load i32, ptr %5, align 4
  switch i32 %33, label %37 [
    i32 2, label %34
    i32 1, label %35
  ]

34:                                               ; preds = %32
  store ptr null, ptr %2, align 8
  br label %35

35:                                               ; preds = %34, %32
  %36 = load ptr, ptr %2, align 8
  ret ptr %36

37:                                               ; preds = %32
  unreachable
}

declare zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef, 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 = { 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 = !{!12, !6, i64 16}
!12 = !{!"_ReplacementEntry", !13, i64 0, !13, i64 16}
!13 = !{!"", !6, i64 0, !14, i64 8}
!14 = !{!"long", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

%struct._ReplacementEntry = type { %struct.GumboStringPiece, %struct.GumboStringPiece }
%struct.GumboStringPiece = type { ptr, i64 }

@kSvgTagReplacements = external hidden constant [36 x %struct._ReplacementEntry], align 16

; Function Attrs: nounwind uwtable
define dso_local ptr @gumbo_normalize_svg_tagname(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull @kSvgTagReplacements) #2
  br i1 %2, label %.thread, label %3

3:                                                ; preds = %1
  %4 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 32)) #2
  br i1 %4, label %.thread, label %5

5:                                                ; preds = %3
  %6 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 64)) #2
  br i1 %6, label %.thread, label %7

7:                                                ; preds = %5
  %8 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 96)) #2
  br i1 %8, label %.thread, label %9

9:                                                ; preds = %7
  %10 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 128)) #2
  br i1 %10, label %.thread, label %11

11:                                               ; preds = %9
  %12 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 160)) #2
  br i1 %12, label %.thread, label %13

13:                                               ; preds = %11
  %14 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 192)) #2
  br i1 %14, label %.thread, label %15

15:                                               ; preds = %13
  %16 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 224)) #2
  br i1 %16, label %.thread, label %17

17:                                               ; preds = %15
  %18 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 256)) #2
  br i1 %18, label %.thread, label %19

19:                                               ; preds = %17
  %20 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 288)) #2
  br i1 %20, label %.thread, label %21

21:                                               ; preds = %19
  %22 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 320)) #2
  br i1 %22, label %.thread, label %23

23:                                               ; preds = %21
  %24 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 352)) #2
  br i1 %24, label %.thread, label %25

25:                                               ; preds = %23
  %26 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 384)) #2
  br i1 %26, label %.thread, label %27

27:                                               ; preds = %25
  %28 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 416)) #2
  br i1 %28, label %.thread, label %29

29:                                               ; preds = %27
  %30 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 448)) #2
  br i1 %30, label %.thread, label %31

31:                                               ; preds = %29
  %32 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 480)) #2
  br i1 %32, label %.thread, label %33

33:                                               ; preds = %31
  %34 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 512)) #2
  br i1 %34, label %.thread, label %35

35:                                               ; preds = %33
  %36 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 544)) #2
  br i1 %36, label %.thread, label %37

37:                                               ; preds = %35
  %38 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 576)) #2
  br i1 %38, label %.thread, label %39

39:                                               ; preds = %37
  %40 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 608)) #2
  br i1 %40, label %.thread, label %41

41:                                               ; preds = %39
  %42 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 640)) #2
  br i1 %42, label %.thread, label %43

43:                                               ; preds = %41
  %44 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 672)) #2
  br i1 %44, label %.thread, label %45

45:                                               ; preds = %43
  %46 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 704)) #2
  br i1 %46, label %.thread, label %47

47:                                               ; preds = %45
  %48 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 736)) #2
  br i1 %48, label %.thread, label %49

49:                                               ; preds = %47
  %50 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 768)) #2
  br i1 %50, label %.thread, label %51

51:                                               ; preds = %49
  %52 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 800)) #2
  br i1 %52, label %.thread, label %53

53:                                               ; preds = %51
  %54 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 832)) #2
  br i1 %54, label %.thread, label %55

55:                                               ; preds = %53
  %56 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 864)) #2
  br i1 %56, label %.thread, label %57

57:                                               ; preds = %55
  %58 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 896)) #2
  br i1 %58, label %.thread, label %59

59:                                               ; preds = %57
  %60 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 928)) #2
  br i1 %60, label %.thread, label %61

61:                                               ; preds = %59
  %62 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 960)) #2
  br i1 %62, label %.thread, label %63

63:                                               ; preds = %61
  %64 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 992)) #2
  br i1 %64, label %.thread, label %65

65:                                               ; preds = %63
  %66 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1024)) #2
  br i1 %66, label %.thread, label %67

67:                                               ; preds = %65
  %68 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1056)) #2
  br i1 %68, label %.thread, label %69

69:                                               ; preds = %67
  %70 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1088)) #2
  br i1 %70, label %.thread, label %71

71:                                               ; preds = %69
  %72 = tail call zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef %0, ptr noundef nonnull getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1120)) #2
  br i1 %72, label %.thread, label %.loopexit

.thread:                                          ; preds = %71, %69, %67, %65, %63, %61, %59, %57, %55, %53, %51, %49, %47, %45, %43, %41, %39, %37, %35, %33, %31, %29, %27, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3, %1
  %.lcssa = phi ptr [ @kSvgTagReplacements, %1 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 32), %3 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 64), %5 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 96), %7 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 128), %9 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 160), %11 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 192), %13 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 224), %15 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 256), %17 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 288), %19 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 320), %21 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 352), %23 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 384), %25 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 416), %27 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 448), %29 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 480), %31 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 512), %33 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 544), %35 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 576), %37 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 608), %39 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 640), %41 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 672), %43 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 704), %45 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 736), %47 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 768), %49 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 800), %51 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 832), %53 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 864), %55 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 896), %57 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 928), %59 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 960), %61 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 992), %63 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1024), %65 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1056), %67 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1088), %69 ], [ getelementptr inbounds (i8, ptr @kSvgTagReplacements, i64 1120), %71 ]
  %73 = getelementptr inbounds i8, ptr %.lcssa, i64 16
  %74 = load ptr, ptr %73, align 8, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %71, %.thread
  %spec.select = phi ptr [ %74, %.thread ], [ null, %71 ]
  ret ptr %spec.select
}

declare zeroext i1 @gumbo_string_equals_ignore_case(ptr noundef, 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 = { 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, !8, i64 16}
!6 = !{!"_ReplacementEntry", !7, i64 0, !7, i64 16}
!7 = !{!"", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"long", !9, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,SROAPass,SimplifyCFGPass,TailCallElimPass