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

; 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.GumboInternalTokenizerState = type { i32, i8, i8, i32, %struct.GumboStringBuffer, ptr, %struct.GumboStringBuffer, ptr, %struct.GumboSourcePosition, %struct.GumboInternalTagState, %struct.GumboInternalTokenDocType, %struct.GumboInternalUtf8Iterator }
%struct.GumboStringBuffer = type { ptr, i64, i64 }
%struct.GumboSourcePosition = type { i32, i32, i32 }
%struct.GumboInternalTagState = type { %struct.GumboStringBuffer, ptr, i32, %struct.GumboSourcePosition, %struct.GumboVector, i8, i32, i32, i8, i8 }
%struct.GumboVector = type { ptr, i32, i32 }
%struct.GumboInternalTokenDocType = type { ptr, ptr, ptr, i8, i8, i8 }
%struct.GumboInternalUtf8Iterator = type { ptr, ptr, ptr, i32, i32, %struct.GumboSourcePosition, %struct.GumboSourcePosition, ptr }

@.str.1 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [74 x i8], align 1
@__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy = external hidden unnamed_addr constant [50 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1

; 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 void @gumbo_tokenizer_state_destroy(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.GumboInternalParser, ptr %4, i32 0, i32 2
  %6 = load ptr, ptr %5, align 8, !tbaa !9
  store ptr %6, ptr %3, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.GumboInternalTokenizerState, ptr %7, i32 0, i32 10
  %9 = getelementptr inbounds %struct.GumboInternalTokenDocType, ptr %8, i32 0, i32 0
  %10 = load ptr, ptr %9, align 8, !tbaa !11
  %11 = icmp eq ptr %10, null
  br i1 %11, label %12, label %13

12:                                               ; preds = %1
  br label %14

13:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 868, ptr noundef @__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy) #5
  unreachable

14:                                               ; preds = %12
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.GumboInternalTokenizerState, ptr %15, i32 0, i32 10
  %17 = getelementptr inbounds %struct.GumboInternalTokenDocType, ptr %16, i32 0, i32 1
  %18 = load ptr, ptr %17, align 8, !tbaa !22
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %14
  br label %22

21:                                               ; preds = %14
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 869, ptr noundef @__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy) #5
  unreachable

22:                                               ; preds = %20
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.GumboInternalTokenizerState, ptr %23, i32 0, i32 10
  %25 = getelementptr inbounds %struct.GumboInternalTokenDocType, ptr %24, i32 0, i32 2
  %26 = load ptr, ptr %25, align 8, !tbaa !23
  %27 = icmp eq ptr %26, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %22
  br label %30

29:                                               ; preds = %22
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.2, i32 noundef 870, ptr noundef @__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy) #5
  unreachable

30:                                               ; preds = %28
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.GumboInternalTokenizerState, ptr %32, i32 0, i32 4
  call void @gumbo_string_buffer_destroy(ptr noundef %31, ptr noundef %33)
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.GumboInternalTokenizerState, ptr %35, i32 0, i32 6
  call void @gumbo_string_buffer_destroy(ptr noundef %34, ptr noundef %36)
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  call void @gumbo_parser_deallocate(ptr noundef %37, ptr noundef %38)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

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

declare void @gumbo_string_buffer_destroy(ptr noundef, ptr noundef) #3

declare void @gumbo_parser_deallocate(ptr noundef, ptr noundef) #3

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 = { 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 #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, !6, i64 16}
!10 = !{!"GumboInternalParser", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!11 = !{!12, !6, i64 176}
!12 = !{!"GumboInternalTokenizerState", !13, i64 0, !14, i64 4, !14, i64 5, !13, i64 8, !15, i64 16, !6, i64 40, !15, i64 48, !6, i64 72, !17, i64 80, !18, i64 96, !20, i64 176, !21, i64 208}
!13 = !{!"int", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!"", !6, i64 0, !16, i64 8, !16, i64 16}
!16 = !{!"long", !7, i64 0}
!17 = !{!"", !13, i64 0, !13, i64 4, !13, i64 8}
!18 = !{!"GumboInternalTagState", !15, i64 0, !6, i64 24, !13, i64 32, !17, i64 36, !19, i64 48, !14, i64 64, !13, i64 68, !13, i64 72, !14, i64 76, !14, i64 77}
!19 = !{!"", !6, i64 0, !13, i64 8, !13, i64 12}
!20 = !{!"GumboInternalTokenDocType", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !14, i64 25, !14, i64 26}
!21 = !{!"GumboInternalUtf8Iterator", !6, i64 0, !6, i64 8, !6, i64 16, !13, i64 24, !13, i64 28, !17, i64 32, !17, i64 44, !6, i64 56}
!22 = !{!12, !6, i64 184}
!23 = !{!12, !6, i64 192}


; 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.1 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [74 x i8], align 1
@__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy = external hidden unnamed_addr constant [50 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [53 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [53 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @gumbo_tokenizer_state_destroy(ptr noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 16
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %3, i64 176
  %5 = load ptr, ptr %4, align 8, !tbaa !10
  %6 = icmp eq ptr %5, null
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 868, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy) #3
  unreachable

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %3, i64 184
  %10 = load ptr, ptr %9, align 8, !tbaa !21
  %11 = icmp eq ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 869, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy) #3
  unreachable

13:                                               ; preds = %8
  %14 = getelementptr inbounds i8, ptr %3, i64 192
  %15 = load ptr, ptr %14, align 8, !tbaa !22
  %16 = icmp eq ptr %15, null
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.2, i32 noundef 870, ptr noundef nonnull @__PRETTY_FUNCTION__.gumbo_tokenizer_state_destroy) #3
  unreachable

18:                                               ; preds = %13
  %19 = getelementptr inbounds i8, ptr %3, i64 16
  tail call void @gumbo_string_buffer_destroy(ptr noundef nonnull %0, ptr noundef nonnull %19) #4
  %20 = getelementptr inbounds i8, ptr %3, i64 48
  tail call void @gumbo_string_buffer_destroy(ptr noundef nonnull %0, ptr noundef nonnull %20) #4
  tail call void @gumbo_parser_deallocate(ptr noundef nonnull %0, ptr noundef nonnull %3) #4
  ret void
}

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

declare void @gumbo_string_buffer_destroy(ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @gumbo_parser_deallocate(ptr noundef, ptr noundef) local_unnamed_addr #2

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 = { "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 }

!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 16}
!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 = !{!11, !7, i64 176}
!11 = !{!"GumboInternalTokenizerState", !12, i64 0, !13, i64 4, !13, i64 5, !12, i64 8, !14, i64 16, !7, i64 40, !14, i64 48, !7, i64 72, !16, i64 80, !17, i64 96, !19, i64 176, !20, i64 208}
!12 = !{!"int", !8, i64 0}
!13 = !{!"_Bool", !8, i64 0}
!14 = !{!"", !7, i64 0, !15, i64 8, !15, i64 16}
!15 = !{!"long", !8, i64 0}
!16 = !{!"", !12, i64 0, !12, i64 4, !12, i64 8}
!17 = !{!"GumboInternalTagState", !14, i64 0, !7, i64 24, !12, i64 32, !16, i64 36, !18, i64 48, !13, i64 64, !12, i64 68, !12, i64 72, !13, i64 76, !13, i64 77}
!18 = !{!"", !7, i64 0, !12, i64 8, !12, i64 12}
!19 = !{!"GumboInternalTokenDocType", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !13, i64 25, !13, i64 26}
!20 = !{!"GumboInternalUtf8Iterator", !7, i64 0, !7, i64 8, !7, i64 16, !12, i64 24, !12, i64 28, !16, i64 32, !16, i64 44, !7, i64 56}
!21 = !{!11, !7, i64 184}
!22 = !{!11, !7, i64 192}


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