; LLVM IR from 2404589803/LowMemoryLLM :: src/huggingface (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.Tokenizer = type { %struct.TokenizerConfig, ptr, ptr, i64, i32 }
%struct.TokenizerConfig = type { i32, ptr, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local void @tokenizer_free(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = icmp ne ptr %3, null
  br i1 %4, label %6, label %5

5:                                                ; preds = %1
  br label %100

6:                                                ; preds = %1
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.Tokenizer, ptr %7, i32 0, i32 0
  %9 = getelementptr inbounds %struct.TokenizerConfig, ptr %8, i32 0, i32 1
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = icmp ne ptr %10, null
  br i1 %11, label %12, label %17

12:                                               ; preds = %6
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.Tokenizer, ptr %13, i32 0, i32 0
  %15 = getelementptr inbounds %struct.TokenizerConfig, ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  call void @free(ptr noundef %16) #2
  br label %17

17:                                               ; preds = %12, %6
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Tokenizer, ptr %18, i32 0, i32 0
  %20 = getelementptr inbounds %struct.TokenizerConfig, ptr %19, i32 0, i32 2
  %21 = load ptr, ptr %20, align 8, !tbaa !14
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %28

23:                                               ; preds = %17
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.Tokenizer, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %struct.TokenizerConfig, ptr %25, i32 0, i32 2
  %27 = load ptr, ptr %26, align 8, !tbaa !14
  call void @free(ptr noundef %27) #2
  br label %28

28:                                               ; preds = %23, %17
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.Tokenizer, ptr %29, i32 0, i32 0
  %31 = getelementptr inbounds %struct.TokenizerConfig, ptr %30, i32 0, i32 5
  %32 = load ptr, ptr %31, align 8, !tbaa !15
  %33 = icmp ne ptr %32, null
  br i1 %33, label %34, label %39

34:                                               ; preds = %28
  %35 = load ptr, ptr %2, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.Tokenizer, ptr %35, i32 0, i32 0
  %37 = getelementptr inbounds %struct.TokenizerConfig, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !15
  call void @free(ptr noundef %38) #2
  br label %39

39:                                               ; preds = %34, %28
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.Tokenizer, ptr %40, i32 0, i32 0
  %42 = getelementptr inbounds %struct.TokenizerConfig, ptr %41, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !16
  %44 = icmp ne ptr %43, null
  br i1 %44, label %45, label %50

45:                                               ; preds = %39
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.Tokenizer, ptr %46, i32 0, i32 0
  %48 = getelementptr inbounds %struct.TokenizerConfig, ptr %47, i32 0, i32 6
  %49 = load ptr, ptr %48, align 8, !tbaa !16
  call void @free(ptr noundef %49) #2
  br label %50

50:                                               ; preds = %45, %39
  %51 = load ptr, ptr %2, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.Tokenizer, ptr %51, i32 0, i32 0
  %53 = getelementptr inbounds %struct.TokenizerConfig, ptr %52, i32 0, i32 7
  %54 = load ptr, ptr %53, align 8, !tbaa !17
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %61

56:                                               ; preds = %50
  %57 = load ptr, ptr %2, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.Tokenizer, ptr %57, i32 0, i32 0
  %59 = getelementptr inbounds %struct.TokenizerConfig, ptr %58, i32 0, i32 7
  %60 = load ptr, ptr %59, align 8, !tbaa !17
  call void @free(ptr noundef %60) #2
  br label %61

61:                                               ; preds = %56, %50
  %62 = load ptr, ptr %2, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.Tokenizer, ptr %62, i32 0, i32 0
  %64 = getelementptr inbounds %struct.TokenizerConfig, ptr %63, i32 0, i32 8
  %65 = load ptr, ptr %64, align 8, !tbaa !18
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %72

67:                                               ; preds = %61
  %68 = load ptr, ptr %2, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Tokenizer, ptr %68, i32 0, i32 0
  %70 = getelementptr inbounds %struct.TokenizerConfig, ptr %69, i32 0, i32 8
  %71 = load ptr, ptr %70, align 8, !tbaa !18
  call void @free(ptr noundef %71) #2
  br label %72

72:                                               ; preds = %67, %61
  %73 = load ptr, ptr %2, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.Tokenizer, ptr %73, i32 0, i32 0
  %75 = getelementptr inbounds %struct.TokenizerConfig, ptr %74, i32 0, i32 9
  %76 = load ptr, ptr %75, align 8, !tbaa !19
  %77 = icmp ne ptr %76, null
  br i1 %77, label %78, label %83

78:                                               ; preds = %72
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.Tokenizer, ptr %79, i32 0, i32 0
  %81 = getelementptr inbounds %struct.TokenizerConfig, ptr %80, i32 0, i32 9
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  call void @free(ptr noundef %82) #2
  br label %83

83:                                               ; preds = %78, %72
  %84 = load ptr, ptr %2, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.Tokenizer, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !20
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %92

88:                                               ; preds = %83
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.Tokenizer, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !20
  call void @free_vocab_table(ptr noundef %91)
  br label %92

92:                                               ; preds = %88, %83
  %93 = load ptr, ptr %2, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.Tokenizer, ptr %93, i32 0, i32 2
  %95 = load ptr, ptr %94, align 8, !tbaa !21
  %96 = icmp ne ptr %95, null
  br i1 %96, label %97, label %98

97:                                               ; preds = %92
  br label %98

98:                                               ; preds = %97, %92
  %99 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %99) #2
  br label %100

100:                                              ; preds = %98, %5
  ret void
}

; Function Attrs: nounwind
declare void @free(ptr noundef) #1

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

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 = { 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 = { 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 8}
!10 = !{!"", !11, i64 0, !6, i64 72, !6, i64 80, !13, i64 88, !12, i64 96}
!11 = !{!"", !12, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !12, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !6, i64 16}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !6, i64 40}
!17 = !{!10, !6, i64 48}
!18 = !{!10, !6, i64 56}
!19 = !{!10, !6, i64 64}
!20 = !{!10, !6, i64 72}
!21 = !{!10, !6, i64 80}


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

; Function Attrs: nounwind uwtable
define dso_local void @tokenizer_free(ptr noundef %0) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %35, label %2

2:                                                ; preds = %1
  %3 = getelementptr inbounds i8, ptr %0, i64 8
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %.not27 = icmp eq ptr %4, null
  br i1 %.not27, label %6, label %5

5:                                                ; preds = %2
  tail call void @free(ptr noundef nonnull %4) #2
  br label %6

6:                                                ; preds = %5, %2
  %7 = getelementptr inbounds i8, ptr %0, i64 16
  %8 = load ptr, ptr %7, align 8, !tbaa !13
  %.not28 = icmp eq ptr %8, null
  br i1 %.not28, label %10, label %9

9:                                                ; preds = %6
  tail call void @free(ptr noundef nonnull %8) #2
  br label %10

10:                                               ; preds = %9, %6
  %11 = getelementptr inbounds i8, ptr %0, i64 32
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %.not29 = icmp eq ptr %12, null
  br i1 %.not29, label %14, label %13

13:                                               ; preds = %10
  tail call void @free(ptr noundef nonnull %12) #2
  br label %14

14:                                               ; preds = %13, %10
  %15 = getelementptr inbounds i8, ptr %0, i64 40
  %16 = load ptr, ptr %15, align 8, !tbaa !15
  %.not30 = icmp eq ptr %16, null
  br i1 %.not30, label %18, label %17

17:                                               ; preds = %14
  tail call void @free(ptr noundef nonnull %16) #2
  br label %18

18:                                               ; preds = %17, %14
  %19 = getelementptr inbounds i8, ptr %0, i64 48
  %20 = load ptr, ptr %19, align 8, !tbaa !16
  %.not31 = icmp eq ptr %20, null
  br i1 %.not31, label %22, label %21

21:                                               ; preds = %18
  tail call void @free(ptr noundef nonnull %20) #2
  br label %22

22:                                               ; preds = %21, %18
  %23 = getelementptr inbounds i8, ptr %0, i64 56
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %.not32 = icmp eq ptr %24, null
  br i1 %.not32, label %26, label %25

25:                                               ; preds = %22
  tail call void @free(ptr noundef nonnull %24) #2
  br label %26

26:                                               ; preds = %25, %22
  %27 = getelementptr inbounds i8, ptr %0, i64 64
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  %.not33 = icmp eq ptr %28, null
  br i1 %.not33, label %30, label %29

29:                                               ; preds = %26
  tail call void @free(ptr noundef nonnull %28) #2
  br label %30

30:                                               ; preds = %29, %26
  %31 = getelementptr inbounds i8, ptr %0, i64 72
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %.not34 = icmp eq ptr %32, null
  br i1 %.not34, label %34, label %33

33:                                               ; preds = %30
  tail call void @free_vocab_table(ptr noundef nonnull %32)
  br label %34

34:                                               ; preds = %33, %30
  tail call void @free(ptr noundef nonnull %0) #2
  br label %35

35:                                               ; preds = %1, %34
  ret void
}

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #1

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

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 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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, !11, i64 8}
!6 = !{!"", !7, i64 0, !11, i64 72, !11, i64 80, !12, i64 88, !8, i64 96}
!7 = !{!"", !8, i64 0, !11, i64 8, !11, i64 16, !8, i64 24, !8, i64 28, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!6, !11, i64 16}
!14 = !{!6, !11, i64 32}
!15 = !{!6, !11, i64 40}
!16 = !{!6, !11, i64 48}
!17 = !{!6, !11, i64 56}
!18 = !{!6, !11, i64 64}
!19 = !{!6, !11, i64 72}


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