; LLVM IR from mldbai/mldb :: ext/hoedown/src (html_blocks)

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: inlinehint nounwind uwtable
define dso_local ptr @hoedown_find_block_tag(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = icmp ule i32 %9, 10
  br i1 %10, label %11, label %85

11:                                               ; preds = %2
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = icmp uge i32 %12, 1
  br i1 %13, label %14, label %85

14:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load i32, ptr %5, align 4, !tbaa !9
  %17 = call i32 @hash(ptr noundef %15, i32 noundef %16)
  store i32 %17, ptr %6, align 4, !tbaa !9
  %18 = load i32, ptr %6, align 4, !tbaa !9
  %19 = icmp sle i32 %18, 24
  br i1 %19, label %20, label %81

20:                                               ; preds = %14
  %21 = load i32, ptr %6, align 4, !tbaa !9
  %22 = icmp sge i32 %21, 1
  br i1 %22, label %23, label %81

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %24 = load i32, ptr %6, align 4, !tbaa !9
  %25 = sub nsw i32 %24, 1
  switch i32 %25, label %50 [
    i32 0, label %26
    i32 1, label %27
    i32 2, label %28
    i32 3, label %29
    i32 4, label %30
    i32 5, label %31
    i32 6, label %32
    i32 7, label %33
    i32 8, label %34
    i32 9, label %35
    i32 10, label %36
    i32 11, label %37
    i32 12, label %38
    i32 13, label %39
    i32 14, label %40
    i32 15, label %41
    i32 16, label %42
    i32 17, label %43
    i32 18, label %44
    i32 19, label %45
    i32 20, label %46
    i32 21, label %47
    i32 22, label %48
    i32 23, label %49
  ]

26:                                               ; preds = %23
  store ptr @.str, ptr %7, align 8, !tbaa !5
  br label %51

27:                                               ; preds = %23
  store ptr @.str.1, ptr %7, align 8, !tbaa !5
  br label %51

28:                                               ; preds = %23
  store ptr @.str.2, ptr %7, align 8, !tbaa !5
  br label %51

29:                                               ; preds = %23
  store ptr @.str.3, ptr %7, align 8, !tbaa !5
  br label %51

30:                                               ; preds = %23
  store ptr @.str.4, ptr %7, align 8, !tbaa !5
  br label %51

31:                                               ; preds = %23
  store ptr @.str.5, ptr %7, align 8, !tbaa !5
  br label %51

32:                                               ; preds = %23
  store ptr @.str.6, ptr %7, align 8, !tbaa !5
  br label %51

33:                                               ; preds = %23
  store ptr @.str.7, ptr %7, align 8, !tbaa !5
  br label %51

34:                                               ; preds = %23
  store ptr @.str.8, ptr %7, align 8, !tbaa !5
  br label %51

35:                                               ; preds = %23
  store ptr @.str.9, ptr %7, align 8, !tbaa !5
  br label %51

36:                                               ; preds = %23
  store ptr @.str.10, ptr %7, align 8, !tbaa !5
  br label %51

37:                                               ; preds = %23
  store ptr @.str.11, ptr %7, align 8, !tbaa !5
  br label %51

38:                                               ; preds = %23
  store ptr @.str.12, ptr %7, align 8, !tbaa !5
  br label %51

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

40:                                               ; preds = %23
  store ptr @.str.14, ptr %7, align 8, !tbaa !5
  br label %51

41:                                               ; preds = %23
  store ptr @.str.15, ptr %7, align 8, !tbaa !5
  br label %51

42:                                               ; preds = %23
  store ptr @.str.16, ptr %7, align 8, !tbaa !5
  br label %51

43:                                               ; preds = %23
  store ptr @.str.17, ptr %7, align 8, !tbaa !5
  br label %51

44:                                               ; preds = %23
  store ptr @.str.18, ptr %7, align 8, !tbaa !5
  br label %51

45:                                               ; preds = %23
  store ptr @.str.19, ptr %7, align 8, !tbaa !5
  br label %51

46:                                               ; preds = %23
  store ptr @.str.20, ptr %7, align 8, !tbaa !5
  br label %51

47:                                               ; preds = %23
  store ptr @.str.21, ptr %7, align 8, !tbaa !5
  br label %51

48:                                               ; preds = %23
  store ptr @.str.22, ptr %7, align 8, !tbaa !5
  br label %51

49:                                               ; preds = %23
  store ptr @.str.23, ptr %7, align 8, !tbaa !5
  br label %51

50:                                               ; preds = %23
  store ptr null, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %78

51:                                               ; preds = %49, %48, %47, %46, %45, %44, %43, %42, %41, %40, %39, %38, %37, %36, %35, %34, %33, %32, %31, %30, %29, %28, %27, %26
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load i8, ptr %52, align 1, !tbaa !11
  %54 = zext i8 %53 to i32
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i8, ptr %55, align 1, !tbaa !11
  %57 = zext i8 %56 to i32
  %58 = xor i32 %54, %57
  %59 = and i32 %58, -33
  %60 = icmp eq i32 %59, 0
  br i1 %60, label %61, label %77

61:                                               ; preds = %51
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = load i32, ptr %5, align 4, !tbaa !9
  %65 = call i32 @gperf_case_strncmp(ptr noundef %62, ptr noundef %63, i32 noundef %64)
  %66 = icmp ne i32 %65, 0
  br i1 %66, label %77, label %67

67:                                               ; preds = %61
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = load i32, ptr %5, align 4, !tbaa !9
  %70 = zext i32 %69 to i64
  %71 = getelementptr inbounds i8, ptr %68, i64 %70
  %72 = load i8, ptr %71, align 1, !tbaa !11
  %73 = sext i8 %72 to i32
  %74 = icmp eq i32 %73, 0
  br i1 %74, label %75, label %77

75:                                               ; preds = %67
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %76, ptr %3, align 8
  store i32 1, ptr %8, align 4
  br label %78

77:                                               ; preds = %67, %61, %51
  store i32 0, ptr %8, align 4
  br label %78

78:                                               ; preds = %77, %75, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  %79 = load i32, ptr %8, align 4
  switch i32 %79, label %82 [
    i32 0, label %80
  ]

80:                                               ; preds = %78
  br label %81

81:                                               ; preds = %80, %20, %14
  store i32 0, ptr %8, align 4
  br label %82

82:                                               ; preds = %81, %78
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  %83 = load i32, ptr %8, align 4
  switch i32 %83, label %88 [
    i32 0, label %84
    i32 1, label %86
  ]

84:                                               ; preds = %82
  br label %85

85:                                               ; preds = %84, %11, %2
  store ptr null, ptr %3, align 8
  br label %86

86:                                               ; preds = %85, %82
  %87 = load ptr, ptr %3, align 8
  ret ptr %87

88:                                               ; preds = %82
  unreachable
}

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

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

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

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

attributes #0 = { inlinehint 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = !{!7, !7, i64 0}


; 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 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.19 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [3 x i8], align 1
@switch.table.hoedown_find_block_tag = private unnamed_addr constant [24 x ptr] [ptr @.str, ptr @.str.1, ptr @.str.2, ptr @.str.3, ptr @.str.4, ptr @.str.5, ptr @.str.6, ptr @.str.7, ptr @.str.8, ptr @.str.9, ptr @.str.10, ptr @.str.11, ptr @.str.12, ptr @.str.13, ptr @.str.14, ptr @.str.15, ptr @.str.16, ptr @.str.17, ptr @.str.18, ptr @.str.19, ptr @.str.20, ptr @.str.21, ptr @.str.22, ptr @.str.23], align 8

; Function Attrs: inlinehint nounwind uwtable
define dso_local noundef ptr @hoedown_find_block_tag(ptr noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = add i32 %1, -1
  %or.cond = icmp ult i32 %3, 10
  br i1 %or.cond, label %4, label %20

4:                                                ; preds = %2
  %5 = tail call i32 @hash(ptr noundef %0, i32 noundef %1)
  %6 = add i32 %5, -1
  %or.cond3 = icmp ult i32 %6, 24
  br i1 %or.cond3, label %switch.lookup, label %.thread

switch.lookup:                                    ; preds = %4
  %switch.tableidx = add nsw i32 %5, -1
  %7 = sext i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [24 x ptr], ptr @switch.table.hoedown_find_block_tag, i64 0, i64 %7
  %switch.load = load ptr, ptr %switch.gep, align 8
  %8 = load i8, ptr %0, align 1, !tbaa !5
  %9 = load i8, ptr %switch.load, align 1, !tbaa !5
  %10 = xor i8 %9, %8
  %11 = and i8 %10, -33
  %12 = icmp eq i8 %11, 0
  br i1 %12, label %13, label %.thread

13:                                               ; preds = %switch.lookup
  %14 = tail call i32 @gperf_case_strncmp(ptr noundef nonnull %0, ptr noundef nonnull %switch.load, i32 noundef %1)
  %.not = icmp eq i32 %14, 0
  br i1 %.not, label %15, label %.thread

15:                                               ; preds = %13
  %16 = zext nneg i32 %1 to i64
  %17 = getelementptr inbounds i8, ptr %switch.load, i64 %16
  %18 = load i8, ptr %17, align 1, !tbaa !5
  %19 = icmp eq i8 %18, 0
  br i1 %19, label %20, label %.thread

.thread:                                          ; preds = %4, %15, %13, %switch.lookup
  br label %20

20:                                               ; preds = %2, %.thread, %15
  %.3 = phi ptr [ %switch.load, %15 ], [ null, %.thread ], [ null, %2 ]
  ret ptr %.3
}

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

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

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

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}


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