; 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.GumboInternalParser = type { ptr, ptr, ptr, ptr }
%struct.GumboInternalToken = type { i32, %struct.GumboSourcePosition, %struct.GumboStringPiece, %union.anon.0 }
%struct.GumboSourcePosition = type { i32, i32, i32 }
%struct.GumboStringPiece = type { ptr, i64 }
%union.anon.0 = type { %struct.GumboInternalTokenDocType }
%struct.GumboInternalTokenDocType = type { ptr, ptr, ptr, i8, i8, i8 }
%struct.GumboInternalParserState = type { i32, i32, %struct.GumboVector, %struct.GumboVector, %struct.GumboVector, ptr, ptr, i8, i8, i8, i8, i8, %struct._TextNodeBufferState, ptr, i8, i8 }
%struct.GumboVector = type { ptr, i32, i32 }
%struct._TextNodeBufferState = type { %struct.GumboStringBuffer, ptr, %struct.GumboSourcePosition, i32 }
%struct.GumboStringBuffer = type { ptr, i64, i64 }
%struct.GumboInternalNode = type { i32, ptr, i64, i32, %union.anon }
%union.anon = type { %struct.GumboElement }
%struct.GumboElement = type { %struct.GumboVector, i32, i32, %struct.GumboStringPiece, %struct.GumboStringPiece, %struct.GumboSourcePosition, %struct.GumboSourcePosition, %struct.GumboVector }
%struct.GumboInternalTokenStartTag = type { i32, %struct.GumboVector, i8 }
%struct.GumboInternalError = type { i32, %struct.GumboSourcePosition, ptr, %union.anon.1 }
%union.anon.1 = type { %struct.GumboInternalParserError }
%struct.GumboInternalParserError = type { i32, i32, i32, %struct.GumboVector }
%struct.GumboInternalOptions = type { ptr, ptr, ptr, i32, i8, i32 }
%struct.GumboInternalOutput = type { ptr, ptr, %struct.GumboVector }
%struct.GumboDocument = type { %struct.GumboVector, i8, ptr, ptr, ptr, i32 }

@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [116 x i8], align 1
@__PRETTY_FUNCTION__.gumbo_parse_with_options = external hidden unnamed_addr constant [82 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: nounwind uwtable
declare hidden ptr @get_current_node(ptr noundef) #0

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

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

declare ptr @gumbo_copy_stringz(ptr noundef, ptr noundef) #3

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

; Function Attrs: nounwind uwtable
define dso_local ptr @gumbo_parse_with_options(ptr noundef %0, ptr noundef %1, i64 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca %struct.GumboInternalParser, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.GumboInternalToken, align 8
  %11 = alloca i8, align 1
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %7) #4
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.GumboInternalParser, ptr %7, i32 0, i32 0
  store ptr %16, ptr %17, align 8, !tbaa !11
  call void @output_init(ptr noundef %7)
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = load i64, ptr %6, align 8, !tbaa !9
  call void @gumbo_tokenizer_state_init(ptr noundef %7, ptr noundef %18, i64 noundef %19)
  call void @parser_state_init(ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %20 = getelementptr inbounds %struct.GumboInternalParser, ptr %7, i32 0, i32 3
  %21 = load ptr, ptr %20, align 8, !tbaa !13
  store ptr %21, ptr %8, align 8, !tbaa !5
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ...) @gumbo_debug(ptr noundef @.str.2, i64 noundef %22, ptr noundef %23)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 64, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #4
  store i8 0, ptr %11, align 1, !tbaa !16
  br label %24

24:                                               ; preds = %157, %3
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.GumboInternalParserState, ptr %25, i32 0, i32 7
  %27 = load i8, ptr %26, align 8, !tbaa !18, !range !24, !noundef !25
  %28 = trunc i8 %27 to i1
  br i1 %28, label %29, label %32

29:                                               ; preds = %24
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.GumboInternalParserState, ptr %30, i32 0, i32 7
  store i8 0, ptr %31, align 8, !tbaa !18
  br label %51

32:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %33 = call ptr @get_current_node(ptr noundef %7)
  store ptr %33, ptr %12, align 8, !tbaa !5
  %34 = load ptr, ptr %12, align 8, !tbaa !5
  %35 = icmp ne ptr %34, null
  br i1 %35, label %36, label %42

36:                                               ; preds = %32
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.GumboInternalNode, ptr %37, i32 0, i32 4
  %39 = getelementptr inbounds %struct.GumboElement, ptr %38, i32 0, i32 2
  %40 = load i32, ptr %39, align 4, !tbaa !26
  %41 = icmp ne i32 %40, 0
  br label %42

42:                                               ; preds = %36, %32
  %43 = phi i1 [ false, %32 ], [ %41, %36 ]
  call void @gumbo_tokenizer_set_is_current_node_foreign(ptr noundef %7, i1 noundef zeroext %43)
  %44 = call zeroext i1 @gumbo_lex(ptr noundef %7, ptr noundef %10)
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = load i8, ptr %11, align 1, !tbaa !16, !range !24, !noundef !25
  %47 = trunc i8 %46 to i1
  br label %48

48:                                               ; preds = %45, %42
  %49 = phi i1 [ true, %42 ], [ %47, %45 ]
  %50 = zext i1 %49 to i8
  store i8 %50, ptr %11, align 1, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %51

51:                                               ; preds = %48, %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store ptr @.str.3, ptr %13, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 0
  %53 = load i32, ptr %52, align 8, !tbaa !27
  switch i32 %53, label %65 [
    i32 0, label %54
    i32 1, label %55
    i32 2, label %60
    i32 3, label %64
  ]

54:                                               ; preds = %51
  store ptr @.str.4, ptr %13, align 8, !tbaa !5
  br label %66

55:                                               ; preds = %51
  %56 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 3
  %57 = getelementptr inbounds %struct.GumboInternalTokenStartTag, ptr %56, i32 0, i32 0
  %58 = load i32, ptr %57, align 8, !tbaa !26
  %59 = call ptr @gumbo_normalized_tagname(i32 noundef %58)
  store ptr %59, ptr %13, align 8, !tbaa !5
  br label %66

60:                                               ; preds = %51
  %61 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 3
  %62 = load i32, ptr %61, align 8, !tbaa !26
  %63 = call ptr @gumbo_normalized_tagname(i32 noundef %62)
  store ptr %63, ptr %13, align 8, !tbaa !5
  br label %66

64:                                               ; preds = %51
  store ptr @.str.5, ptr %13, align 8, !tbaa !5
  br label %66

65:                                               ; preds = %51
  br label %66

66:                                               ; preds = %65, %64, %60, %55, %54
  %67 = load ptr, ptr %13, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 1
  %69 = getelementptr inbounds %struct.GumboSourcePosition, ptr %68, i32 0, i32 0
  %70 = load i32, ptr %69, align 4, !tbaa !30
  %71 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 1
  %72 = getelementptr inbounds %struct.GumboSourcePosition, ptr %71, i32 0, i32 1
  %73 = load i32, ptr %72, align 4, !tbaa !31
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.GumboInternalParserState, ptr %74, i32 0, i32 0
  %76 = load i32, ptr %75, align 8, !tbaa !32
  call void (ptr, ...) @gumbo_debug(ptr noundef @.str.6, ptr noundef %67, i32 noundef %70, i32 noundef %73, i32 noundef %76)
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.GumboInternalParserState, ptr %77, i32 0, i32 13
  store ptr %10, ptr %78, align 8, !tbaa !33
  %79 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 0
  %80 = load i32, ptr %79, align 8, !tbaa !27
  %81 = icmp eq i32 %80, 1
  br i1 %81, label %82, label %87

82:                                               ; preds = %66
  %83 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 3
  %84 = getelementptr inbounds %struct.GumboInternalTokenStartTag, ptr %83, i32 0, i32 2
  %85 = load i8, ptr %84, align 8, !tbaa !26, !range !24, !noundef !25
  %86 = trunc i8 %85 to i1
  br label %87

87:                                               ; preds = %82, %66
  %88 = phi i1 [ false, %66 ], [ %86, %82 ]
  %89 = xor i1 %88, true
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.GumboInternalParserState, ptr %90, i32 0, i32 8
  %92 = zext i1 %89 to i8
  store i8 %92, ptr %91, align 1, !tbaa !34
  %93 = call zeroext i1 @handle_token(ptr noundef %7, ptr noundef %10)
  br i1 %93, label %94, label %97

94:                                               ; preds = %87
  %95 = load i8, ptr %11, align 1, !tbaa !16, !range !24, !noundef !25
  %96 = trunc i8 %95 to i1
  br label %97

97:                                               ; preds = %94, %87
  %98 = phi i1 [ true, %87 ], [ %96, %94 ]
  %99 = zext i1 %98 to i8
  store i8 %99, ptr %11, align 1, !tbaa !16
  %100 = load ptr, ptr %8, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.GumboInternalParserState, ptr %100, i32 0, i32 7
  %102 = load i8, ptr %101, align 8, !tbaa !18, !range !24, !noundef !25
  %103 = trunc i8 %102 to i1
  br i1 %103, label %114, label %104

104:                                              ; preds = %97
  %105 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 0
  %106 = load i32, ptr %105, align 8, !tbaa !27
  %107 = icmp ne i32 %106, 1
  br i1 %107, label %114, label %108

108:                                              ; preds = %104
  %109 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 3
  %110 = getelementptr inbounds %struct.GumboInternalTokenStartTag, ptr %109, i32 0, i32 1
  %111 = getelementptr inbounds %struct.GumboVector, ptr %110, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !26
  %113 = icmp eq ptr %112, null
  br i1 %113, label %114, label %115

114:                                              ; preds = %108, %104, %97
  br label %116

115:                                              ; preds = %108
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 3872, ptr noundef @__PRETTY_FUNCTION__.gumbo_parse_with_options) #5
  unreachable

116:                                              ; preds = %114
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct.GumboInternalParserState, ptr %117, i32 0, i32 8
  %119 = load i8, ptr %118, align 1, !tbaa !34, !range !24, !noundef !25
  %120 = trunc i8 %119 to i1
  br i1 %120, label %129, label %121

121:                                              ; preds = %116
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %122 = call ptr @add_parse_error(ptr noundef %7, ptr noundef %10)
  store ptr %122, ptr %14, align 8, !tbaa !5
  %123 = load ptr, ptr %14, align 8, !tbaa !5
  %124 = icmp ne ptr %123, null
  br i1 %124, label %125, label %128

125:                                              ; preds = %121
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct.GumboInternalError, ptr %126, i32 0, i32 0
  store i32 41, ptr %127, align 8, !tbaa !35
  br label %128

128:                                              ; preds = %125, %121
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %129

129:                                              ; preds = %128, %116
  %130 = load i32, ptr %9, align 4, !tbaa !14
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %9, align 4, !tbaa !14
  %132 = load i32, ptr %9, align 4, !tbaa !14
  %133 = icmp slt i32 %132, 1000000000
  br i1 %133, label %134, label %135

134:                                              ; preds = %129
  br label %136

135:                                              ; preds = %129
  call void @__assert_fail(ptr noundef @.str.8, ptr noundef @.str.1, i32 noundef 3882, ptr noundef @__PRETTY_FUNCTION__.gumbo_parse_with_options) #5
  unreachable

136:                                              ; preds = %134
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  br label %137

137:                                              ; preds = %136
  %138 = getelementptr inbounds %struct.GumboInternalToken, ptr %10, i32 0, i32 0
  %139 = load i32, ptr %138, align 8, !tbaa !27
  %140 = icmp ne i32 %139, 7
  br i1 %140, label %146, label %141

141:                                              ; preds = %137
  %142 = load ptr, ptr %8, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.GumboInternalParserState, ptr %142, i32 0, i32 7
  %144 = load i8, ptr %143, align 8, !tbaa !18, !range !24, !noundef !25
  %145 = trunc i8 %144 to i1
  br i1 %145, label %146, label %157

146:                                              ; preds = %141, %137
  %147 = load ptr, ptr %4, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.GumboInternalOptions, ptr %147, i32 0, i32 4
  %149 = load i8, ptr %148, align 4, !tbaa !37, !range !24, !noundef !25
  %150 = trunc i8 %149 to i1
  br i1 %150, label %151, label %154

151:                                              ; preds = %146
  %152 = load i8, ptr %11, align 1, !tbaa !16, !range !24, !noundef !25
  %153 = trunc i8 %152 to i1
  br label %154

154:                                              ; preds = %151, %146
  %155 = phi i1 [ false, %146 ], [ %153, %151 ]
  %156 = xor i1 %155, true
  br label %157

157:                                              ; preds = %154, %141
  %158 = phi i1 [ false, %141 ], [ %156, %154 ]
  br i1 %158, label %24, label %159, !llvm.loop !39

159:                                              ; preds = %157
  call void @finish_parsing(ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %160 = getelementptr inbounds %struct.GumboInternalParser, ptr %7, i32 0, i32 1
  %161 = load ptr, ptr %160, align 8, !tbaa !41
  %162 = getelementptr inbounds %struct.GumboInternalOutput, ptr %161, i32 0, i32 0
  %163 = load ptr, ptr %162, align 8, !tbaa !42
  %164 = getelementptr inbounds %struct.GumboInternalNode, ptr %163, i32 0, i32 4
  store ptr %164, ptr %15, align 8, !tbaa !5
  %165 = load ptr, ptr %15, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.GumboDocument, ptr %165, i32 0, i32 2
  %167 = load ptr, ptr %166, align 8, !tbaa !44
  %168 = icmp eq ptr %167, null
  br i1 %168, label %169, label %173

169:                                              ; preds = %159
  %170 = call ptr @gumbo_copy_stringz(ptr noundef %7, ptr noundef @.str.9)
  %171 = load ptr, ptr %15, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.GumboDocument, ptr %171, i32 0, i32 2
  store ptr %170, ptr %172, align 8, !tbaa !44
  br label %173

173:                                              ; preds = %169, %159
  %174 = load ptr, ptr %15, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.GumboDocument, ptr %174, i32 0, i32 3
  %176 = load ptr, ptr %175, align 8, !tbaa !46
  %177 = icmp eq ptr %176, null
  br i1 %177, label %178, label %182

178:                                              ; preds = %173
  %179 = call ptr @gumbo_copy_stringz(ptr noundef %7, ptr noundef @.str.9)
  %180 = load ptr, ptr %15, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.GumboDocument, ptr %180, i32 0, i32 3
  store ptr %179, ptr %181, align 8, !tbaa !46
  br label %182

182:                                              ; preds = %178, %173
  %183 = load ptr, ptr %15, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.GumboDocument, ptr %183, i32 0, i32 4
  %185 = load ptr, ptr %184, align 8, !tbaa !47
  %186 = icmp eq ptr %185, null
  br i1 %186, label %187, label %191

187:                                              ; preds = %182
  %188 = call ptr @gumbo_copy_stringz(ptr noundef %7, ptr noundef @.str.9)
  %189 = load ptr, ptr %15, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.GumboDocument, ptr %189, i32 0, i32 4
  store ptr %188, ptr %190, align 8, !tbaa !47
  br label %191

191:                                              ; preds = %187, %182
  call void @parser_state_destroy(ptr noundef %7)
  call void @gumbo_tokenizer_state_destroy(ptr noundef %7)
  %192 = getelementptr inbounds %struct.GumboInternalParser, ptr %7, i32 0, i32 1
  %193 = load ptr, ptr %192, align 8, !tbaa !41
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 64, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %7) #4
  ret ptr %193
}

; Function Attrs: nounwind uwtable
declare hidden void @output_init(ptr noundef) #0

declare void @gumbo_tokenizer_state_init(ptr noundef, ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden void @parser_state_init(ptr noundef) #0

declare void @gumbo_debug(ptr noundef, ...) #3

declare void @gumbo_tokenizer_set_is_current_node_foreign(ptr noundef, i1 noundef zeroext) #3

declare zeroext i1 @gumbo_lex(ptr noundef, ptr noundef) #3

declare ptr @gumbo_normalized_tagname(i32 noundef) #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @handle_token(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden ptr @add_parse_error(ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @finish_parsing(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @parser_state_destroy(ptr noundef) #0

declare void @gumbo_tokenizer_state_destroy(ptr noundef) #3

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 = { 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #5 = { noreturn 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 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"GumboInternalParser", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!13 = !{!12, !6, i64 24}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!19, !17, i64 72}
!19 = !{!"GumboInternalParserState", !15, i64 0, !15, i64 4, !20, i64 8, !20, i64 24, !20, i64 40, !6, i64 56, !6, i64 64, !17, i64 72, !17, i64 73, !17, i64 74, !17, i64 75, !17, i64 76, !21, i64 80, !6, i64 128, !17, i64 136, !17, i64 137}
!20 = !{!"", !6, i64 0, !15, i64 8, !15, i64 12}
!21 = !{!"_TextNodeBufferState", !22, i64 0, !6, i64 24, !23, i64 32, !15, i64 44}
!22 = !{!"", !6, i64 0, !10, i64 8, !10, i64 16}
!23 = !{!"", !15, i64 0, !15, i64 4, !15, i64 8}
!24 = !{i8 0, i8 2}
!25 = !{}
!26 = !{!7, !7, i64 0}
!27 = !{!28, !15, i64 0}
!28 = !{!"GumboInternalToken", !15, i64 0, !23, i64 4, !29, i64 16, !7, i64 32}
!29 = !{!"", !6, i64 0, !10, i64 8}
!30 = !{!28, !15, i64 4}
!31 = !{!28, !15, i64 8}
!32 = !{!19, !15, i64 0}
!33 = !{!19, !6, i64 128}
!34 = !{!19, !17, i64 73}
!35 = !{!36, !15, i64 0}
!36 = !{!"GumboInternalError", !15, i64 0, !23, i64 4, !6, i64 16, !7, i64 24}
!37 = !{!38, !17, i64 28}
!38 = !{!"GumboInternalOptions", !6, i64 0, !6, i64 8, !6, i64 16, !15, i64 24, !17, i64 28, !15, i64 32}
!39 = distinct !{!39, !40}
!40 = !{!"llvm.loop.mustprogress"}
!41 = !{!12, !6, i64 8}
!42 = !{!43, !6, i64 0}
!43 = !{!"GumboInternalOutput", !6, i64 0, !6, i64 8, !20, i64 16}
!44 = !{!45, !6, i64 24}
!45 = !{!"", !20, i64 0, !17, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !15, i64 48}
!46 = !{!45, !6, i64 32}
!47 = !{!45, !6, i64 40}


; 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.GumboInternalParser = type { ptr, ptr, ptr, ptr }
%struct.GumboInternalToken = type { i32, %struct.GumboSourcePosition, %struct.GumboStringPiece, %union.anon.0 }
%struct.GumboSourcePosition = type { i32, i32, i32 }
%struct.GumboStringPiece = type { ptr, i64 }
%union.anon.0 = type { %struct.GumboInternalTokenDocType }
%struct.GumboInternalTokenDocType = type { ptr, ptr, ptr, i8, i8, i8 }

@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [116 x i8], align 1
@__PRETTY_FUNCTION__.gumbo_parse_with_options = external hidden unnamed_addr constant [82 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [1 x i8], align 1

; Function Attrs: nounwind uwtable
declare hidden ptr @get_current_node(ptr noundef) local_unnamed_addr #0

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

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

declare ptr @gumbo_copy_stringz(ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
define dso_local ptr @gumbo_parse_with_options(ptr noundef %0, ptr noundef %1, i64 noundef %2) local_unnamed_addr #0 {
  %4 = alloca %struct.GumboInternalParser, align 8
  %5 = alloca %struct.GumboInternalToken, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #4
  store ptr %0, ptr %4, align 8, !tbaa !5
  call void @output_init(ptr noundef nonnull %4)
  call void @gumbo_tokenizer_state_init(ptr noundef nonnull %4, ptr noundef %1, i64 noundef %2) #4
  call void @parser_state_init(ptr noundef nonnull %4)
  %6 = getelementptr inbounds i8, ptr %4, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !10
  call void (ptr, ...) @gumbo_debug(ptr noundef nonnull @.str.2, i64 noundef %2, ptr noundef %1) #4
  call void @llvm.lifetime.start.p0(i64 64, ptr nonnull %5) #4
  %8 = getelementptr inbounds i8, ptr %7, i64 72
  %9 = getelementptr inbounds i8, ptr %5, i64 32
  %10 = getelementptr inbounds i8, ptr %5, i64 4
  %11 = getelementptr inbounds i8, ptr %5, i64 8
  %12 = getelementptr inbounds i8, ptr %7, i64 128
  %13 = getelementptr inbounds i8, ptr %5, i64 56
  %14 = getelementptr inbounds i8, ptr %7, i64 73
  %15 = getelementptr inbounds i8, ptr %5, i64 40
  %16 = getelementptr inbounds i8, ptr %0, i64 28
  br label %17

17:                                               ; preds = %74, %3
  %18 = phi i32 [ undef, %3 ], [ %70, %74 ]
  %.036 = phi i1 [ false, %3 ], [ %52, %74 ]
  %.0 = phi i32 [ 0, %3 ], [ %67, %74 ]
  %19 = load i8, ptr %8, align 8, !tbaa !11, !range !20, !noundef !21
  %20 = trunc nuw i8 %19 to i1
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store i8 0, ptr %8, align 8, !tbaa !11
  br label %32

22:                                               ; preds = %17
  %23 = call ptr @get_current_node(ptr noundef nonnull %4)
  %.not = icmp eq ptr %23, null
  br i1 %.not, label %28, label %24

24:                                               ; preds = %22
  %25 = getelementptr inbounds i8, ptr %23, i64 52
  %26 = load i32, ptr %25, align 4, !tbaa !22
  %27 = icmp ne i32 %26, 0
  br label %28

28:                                               ; preds = %24, %22
  %29 = phi i1 [ false, %22 ], [ %27, %24 ]
  call void @gumbo_tokenizer_set_is_current_node_foreign(ptr noundef nonnull %4, i1 noundef zeroext %29) #4
  %30 = call zeroext i1 @gumbo_lex(ptr noundef nonnull %4, ptr noundef nonnull %5) #4
  %not.43 = xor i1 %30, true
  %31 = select i1 %not.43, i1 true, i1 %.036
  %.pre = load i32, ptr %5, align 8, !tbaa !23
  br label %32

32:                                               ; preds = %28, %21
  %33 = phi i32 [ %18, %21 ], [ %.pre, %28 ]
  %.1 = phi i1 [ %.036, %21 ], [ %31, %28 ]
  switch i32 %33, label %42 [
    i32 0, label %34
    i32 1, label %35
    i32 2, label %38
    i32 3, label %41
  ]

34:                                               ; preds = %32
  br label %42

35:                                               ; preds = %32
  %36 = load i32, ptr %9, align 8, !tbaa !22
  %37 = call ptr @gumbo_normalized_tagname(i32 noundef %36) #4
  br label %42

38:                                               ; preds = %32
  %39 = load i32, ptr %9, align 8, !tbaa !22
  %40 = call ptr @gumbo_normalized_tagname(i32 noundef %39) #4
  br label %42

41:                                               ; preds = %32
  br label %42

42:                                               ; preds = %32, %41, %38, %35, %34
  %.037 = phi ptr [ @.str.3, %32 ], [ @.str.5, %41 ], [ %40, %38 ], [ %37, %35 ], [ @.str.4, %34 ]
  %43 = load i32, ptr %10, align 4, !tbaa !26
  %44 = load i32, ptr %11, align 8, !tbaa !27
  %45 = load i32, ptr %7, align 8, !tbaa !28
  call void (ptr, ...) @gumbo_debug(ptr noundef nonnull @.str.6, ptr noundef %.037, i32 noundef %43, i32 noundef %44, i32 noundef %45) #4
  store ptr %5, ptr %12, align 8, !tbaa !29
  %46 = load i32, ptr %5, align 8, !tbaa !23
  %47 = icmp eq i32 %46, 1
  %48 = load i8, ptr %13, align 8, !range !20
  %49 = xor i8 %48, 1
  %50 = select i1 %47, i8 %49, i8 1
  store i8 %50, ptr %14, align 1, !tbaa !30
  %51 = call zeroext i1 @handle_token(ptr noundef nonnull %4, ptr noundef nonnull %5)
  %not. = xor i1 %51, true
  %52 = select i1 %not., i1 true, i1 %.1
  %53 = load i8, ptr %8, align 8, !tbaa !11, !range !20, !noundef !21
  %54 = trunc nuw i8 %53 to i1
  %55 = load i32, ptr %5, align 8
  %56 = icmp ne i32 %55, 1
  %or.cond = select i1 %54, i1 true, i1 %56
  %57 = load ptr, ptr %15, align 8
  %58 = icmp eq ptr %57, null
  %or.cond7 = select i1 %or.cond, i1 true, i1 %58
  br i1 %or.cond7, label %60, label %59

59:                                               ; preds = %42
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 3872, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_parse_with_options) #5
  unreachable

60:                                               ; preds = %42
  %61 = load i8, ptr %14, align 1, !tbaa !30, !range !20, !noundef !21
  %62 = trunc nuw i8 %61 to i1
  br i1 %62, label %66, label %63

63:                                               ; preds = %60
  %64 = call ptr @add_parse_error(ptr noundef nonnull %4, ptr noundef nonnull %5)
  %.not41 = icmp eq ptr %64, null
  br i1 %.not41, label %66, label %65

65:                                               ; preds = %63
  store i32 41, ptr %64, align 8, !tbaa !31
  br label %66

66:                                               ; preds = %63, %65, %60
  %67 = add nuw nsw i32 %.0, 1
  %exitcond.not = icmp eq i32 %.0, 999999999
  br i1 %exitcond.not, label %68, label %69

68:                                               ; preds = %66
  call void @__assert_fail(ptr noundef nonnull @.str.8, ptr noundef nonnull @.str.1, i32 noundef 3882, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_parse_with_options) #5
  unreachable

69:                                               ; preds = %66
  %70 = load i32, ptr %5, align 8, !tbaa !23
  %.not42 = icmp eq i32 %70, 7
  br i1 %.not42, label %71, label %74

71:                                               ; preds = %69
  %72 = load i8, ptr %8, align 8, !tbaa !11, !range !20, !noundef !21
  %73 = trunc nuw i8 %72 to i1
  br i1 %73, label %74, label %.critedge

74:                                               ; preds = %71, %69
  %75 = load i8, ptr %16, align 4, !tbaa !33, !range !20, !noundef !21
  %76 = trunc nuw i8 %75 to i1
  %77 = select i1 %76, i1 %52, i1 false
  br i1 %77, label %.critedge, label %17, !llvm.loop !35

.critedge:                                        ; preds = %71, %74
  call void @finish_parsing(ptr noundef nonnull %4)
  %78 = getelementptr inbounds i8, ptr %4, i64 8
  %79 = load ptr, ptr %78, align 8, !tbaa !37
  %80 = load ptr, ptr %79, align 8, !tbaa !38
  %81 = getelementptr inbounds i8, ptr %80, i64 56
  %82 = load ptr, ptr %81, align 8, !tbaa !40
  %83 = icmp eq ptr %82, null
  br i1 %83, label %84, label %86

84:                                               ; preds = %.critedge
  %85 = call ptr @gumbo_copy_stringz(ptr noundef nonnull %4, ptr noundef nonnull @.str.9) #4
  store ptr %85, ptr %81, align 8, !tbaa !40
  br label %86

86:                                               ; preds = %84, %.critedge
  %87 = getelementptr inbounds i8, ptr %80, i64 64
  %88 = load ptr, ptr %87, align 8, !tbaa !42
  %89 = icmp eq ptr %88, null
  br i1 %89, label %90, label %92

90:                                               ; preds = %86
  %91 = call ptr @gumbo_copy_stringz(ptr noundef nonnull %4, ptr noundef nonnull @.str.9) #4
  store ptr %91, ptr %87, align 8, !tbaa !42
  br label %92

92:                                               ; preds = %90, %86
  %93 = getelementptr inbounds i8, ptr %80, i64 72
  %94 = load ptr, ptr %93, align 8, !tbaa !43
  %95 = icmp eq ptr %94, null
  br i1 %95, label %96, label %98

96:                                               ; preds = %92
  %97 = call ptr @gumbo_copy_stringz(ptr noundef nonnull %4, ptr noundef nonnull @.str.9) #4
  store ptr %97, ptr %93, align 8, !tbaa !43
  br label %98

98:                                               ; preds = %96, %92
  call void @parser_state_destroy(ptr noundef nonnull %4)
  call void @gumbo_tokenizer_state_destroy(ptr noundef nonnull %4) #4
  %99 = load ptr, ptr %78, align 8, !tbaa !37
  call void @llvm.lifetime.end.p0(i64 64, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #4
  ret ptr %99
}

; Function Attrs: nounwind uwtable
declare hidden void @output_init(ptr noundef) local_unnamed_addr #0

declare void @gumbo_tokenizer_state_init(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden void @parser_state_init(ptr noundef) local_unnamed_addr #0

declare void @gumbo_debug(ptr noundef, ...) local_unnamed_addr #3

declare void @gumbo_tokenizer_set_is_current_node_foreign(ptr noundef, i1 noundef zeroext) local_unnamed_addr #3

declare zeroext i1 @gumbo_lex(ptr noundef, ptr noundef) local_unnamed_addr #3

declare ptr @gumbo_normalized_tagname(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @handle_token(ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare hidden void @finish_parsing(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @parser_state_destroy(ptr noundef) local_unnamed_addr #0

declare void @gumbo_tokenizer_state_destroy(ptr noundef) local_unnamed_addr #3

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 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nounwind }
attributes #5 = { noreturn 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, !7, i64 0}
!6 = !{!"GumboInternalParser", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 24}
!11 = !{!12, !15, i64 72}
!12 = !{!"GumboInternalParserState", !13, i64 0, !13, i64 4, !14, i64 8, !14, i64 24, !14, i64 40, !7, i64 56, !7, i64 64, !15, i64 72, !15, i64 73, !15, i64 74, !15, i64 75, !15, i64 76, !16, i64 80, !7, i64 128, !15, i64 136, !15, i64 137}
!13 = !{!"int", !8, i64 0}
!14 = !{!"", !7, i64 0, !13, i64 8, !13, i64 12}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{!"_TextNodeBufferState", !17, i64 0, !7, i64 24, !19, i64 32, !13, i64 44}
!17 = !{!"", !7, i64 0, !18, i64 8, !18, i64 16}
!18 = !{!"long", !8, i64 0}
!19 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!8, !8, i64 0}
!23 = !{!24, !13, i64 0}
!24 = !{!"GumboInternalToken", !13, i64 0, !19, i64 4, !25, i64 16, !8, i64 32}
!25 = !{!"", !7, i64 0, !18, i64 8}
!26 = !{!24, !13, i64 4}
!27 = !{!24, !13, i64 8}
!28 = !{!12, !13, i64 0}
!29 = !{!12, !7, i64 128}
!30 = !{!12, !15, i64 73}
!31 = !{!32, !13, i64 0}
!32 = !{!"GumboInternalError", !13, i64 0, !19, i64 4, !7, i64 16, !8, i64 24}
!33 = !{!34, !15, i64 28}
!34 = !{!"GumboInternalOptions", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !15, i64 28, !13, i64 32}
!35 = distinct !{!35, !36}
!36 = !{!"llvm.loop.mustprogress"}
!37 = !{!6, !7, i64 8}
!38 = !{!39, !7, i64 0}
!39 = !{!"GumboInternalOutput", !7, i64 0, !7, i64 8, !14, i64 16}
!40 = !{!41, !7, i64 24}
!41 = !{!"", !14, i64 0, !15, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !13, i64 48}
!42 = !{!41, !7, i64 32}
!43 = !{!41, !7, i64 40}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,SROAPass,SimplifyCFGPass