; LLVM IR from Water-Melon/Melon :: src (mln_parser_generator)

; 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.mln_pg_token_s = type { ptr, ptr, ptr, ptr, ptr, i32, i8 }
%struct.mln_string_t = type { ptr, i64, i32 }

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

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

7:                                                ; preds = %1
  br label %117

8:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %9, ptr %3, align 8, !tbaa !5
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.mln_pg_token_s, ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %79

14:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.mln_pg_token_s, ptr %15, i32 0, i32 0
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  store ptr %17, ptr %4, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %78

20:                                               ; preds = %14
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mln_string_t, ptr %21, i32 0, i32 2
  %23 = load i32, ptr %22, align 8
  %24 = lshr i32 %23, 2
  %25 = zext i32 %24 to i64
  %26 = add i64 %25, -1
  %27 = trunc i64 %26 to i32
  %28 = load i32, ptr %22, align 8
  %29 = and i32 %27, 1073741823
  %30 = shl i32 %29, 2
  %31 = and i32 %28, 3
  %32 = or i32 %31, %30
  store i32 %32, ptr %22, align 8
  %33 = zext i32 %29 to i64
  %34 = icmp ule i64 %25, 1
  br i1 %34, label %35, label %77

35:                                               ; preds = %20
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mln_string_t, ptr %36, i32 0, i32 2
  %38 = load i32, ptr %37, align 8
  %39 = and i32 %38, 1
  %40 = zext i32 %39 to i64
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %64, label %42

42:                                               ; preds = %35
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.mln_string_t, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !12
  %46 = icmp ne ptr %45, null
  br i1 %46, label %47, label %64

47:                                               ; preds = %42
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.mln_string_t, ptr %48, i32 0, i32 2
  %50 = load i32, ptr %49, align 8
  %51 = lshr i32 %50, 1
  %52 = and i32 %51, 1
  %53 = zext i32 %52 to i64
  %54 = icmp ne i64 %53, 0
  br i1 %54, label %55, label %59

55:                                               ; preds = %47
  %56 = load ptr, ptr %4, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.mln_string_t, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !12
  call void @mln_alloc_free(ptr noundef %58)
  br label %63

59:                                               ; preds = %47
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mln_string_t, ptr %60, i32 0, i32 0
  %62 = load ptr, ptr %61, align 8, !tbaa !12
  call void @free(ptr noundef %62) #4
  br label %63

63:                                               ; preds = %59, %55
  br label %64

64:                                               ; preds = %63, %42, %35
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.mln_string_t, ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 8
  %68 = lshr i32 %67, 1
  %69 = and i32 %68, 1
  %70 = zext i32 %69 to i64
  %71 = icmp ne i64 %70, 0
  br i1 %71, label %72, label %74

72:                                               ; preds = %64
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  call void @mln_alloc_free(ptr noundef %73)
  br label %76

74:                                               ; preds = %64
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  call void @free(ptr noundef %75) #4
  br label %76

76:                                               ; preds = %74, %72
  br label %77

77:                                               ; preds = %76, %20
  br label %78

78:                                               ; preds = %77, %14
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  br label %79

79:                                               ; preds = %78, %8
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.mln_pg_token_s, ptr %80, i32 0, i32 1
  %82 = load ptr, ptr %81, align 8, !tbaa !15
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %88

84:                                               ; preds = %79
  %85 = load ptr, ptr %3, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.mln_pg_token_s, ptr %85, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8, !tbaa !15
  call void @mln_rbtree_free(ptr noundef %87)
  br label %88

88:                                               ; preds = %84, %79
  %89 = load ptr, ptr %3, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.mln_pg_token_s, ptr %89, i32 0, i32 2
  %91 = load ptr, ptr %90, align 8, !tbaa !16
  %92 = icmp ne ptr %91, null
  br i1 %92, label %93, label %97

93:                                               ; preds = %88
  %94 = load ptr, ptr %3, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.mln_pg_token_s, ptr %94, i32 0, i32 2
  %96 = load ptr, ptr %95, align 8, !tbaa !16
  call void @mln_rbtree_free(ptr noundef %96)
  br label %97

97:                                               ; preds = %93, %88
  %98 = load ptr, ptr %3, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.mln_pg_token_s, ptr %98, i32 0, i32 3
  %100 = load ptr, ptr %99, align 8, !tbaa !17
  %101 = icmp ne ptr %100, null
  br i1 %101, label %102, label %106

102:                                              ; preds = %97
  %103 = load ptr, ptr %3, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mln_pg_token_s, ptr %103, i32 0, i32 3
  %105 = load ptr, ptr %104, align 8, !tbaa !17
  call void @free(ptr noundef %105) #4
  br label %106

106:                                              ; preds = %102, %97
  %107 = load ptr, ptr %3, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.mln_pg_token_s, ptr %107, i32 0, i32 4
  %109 = load ptr, ptr %108, align 8, !tbaa !18
  %110 = icmp ne ptr %109, null
  br i1 %110, label %111, label %115

111:                                              ; preds = %106
  %112 = load ptr, ptr %3, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.mln_pg_token_s, ptr %112, i32 0, i32 4
  %114 = load ptr, ptr %113, align 8, !tbaa !18
  call void @free(ptr noundef %114) #4
  br label %115

115:                                              ; preds = %111, %106
  %116 = load ptr, ptr %3, align 8, !tbaa !5
  call void @free(ptr noundef %116) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %117

117:                                              ; preds = %115, %7
  ret void
}

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

declare void @mln_alloc_free(ptr noundef) #2

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

declare void @mln_rbtree_free(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 "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 }

!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 0}
!10 = !{!"mln_pg_token_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !11, i64 44}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"", !6, i64 0, !14, i64 8, !14, i64 16, !14, i64 16, !14, i64 16}
!14 = !{!"long", !7, i64 0}
!15 = !{!10, !6, i64 8}
!16 = !{!10, !6, i64 16}
!17 = !{!10, !6, i64 24}
!18 = !{!10, !6, i64 32}


; 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 @mln_pg_token_free(ptr noundef %0) local_unnamed_addr #0 {
  %2 = icmp eq ptr %0, null
  br i1 %2, label %43, label %3

3:                                                ; preds = %1
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %26, label %5

5:                                                ; preds = %3
  %6 = getelementptr inbounds i8, ptr %4, i64 16
  %7 = load i32, ptr %6, align 8
  %8 = and i32 %7, -4
  %9 = add i32 %8, -4
  %10 = and i32 %7, 3
  %11 = or disjoint i32 %9, %10
  store i32 %11, ptr %6, align 8
  %12 = icmp ult i32 %7, 8
  br i1 %12, label %13, label %26

13:                                               ; preds = %5
  %14 = and i32 %7, 1
  %.not29 = icmp eq i32 %14, 0
  br i1 %.not29, label %15, label %21

15:                                               ; preds = %13
  %16 = load ptr, ptr %4, align 8, !tbaa !11
  %.not30 = icmp eq ptr %16, null
  br i1 %.not30, label %21, label %17

17:                                               ; preds = %15
  %18 = and i32 %7, 2
  %.not31 = icmp eq i32 %18, 0
  br i1 %.not31, label %20, label %19

19:                                               ; preds = %17
  tail call void @mln_alloc_free(ptr noundef nonnull %16) #3
  br label %21

20:                                               ; preds = %17
  tail call void @free(ptr noundef nonnull %16) #3
  br label %21

21:                                               ; preds = %19, %20, %15, %13
  %22 = load i32, ptr %6, align 8
  %23 = and i32 %22, 2
  %.not32 = icmp eq i32 %23, 0
  br i1 %.not32, label %25, label %24

24:                                               ; preds = %21
  tail call void @mln_alloc_free(ptr noundef nonnull %4) #3
  br label %26

25:                                               ; preds = %21
  tail call void @free(ptr noundef nonnull %4) #3
  br label %26

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

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

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

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

34:                                               ; preds = %33, %30
  %35 = getelementptr inbounds i8, ptr %0, i64 24
  %36 = load ptr, ptr %35, align 8, !tbaa !16
  %.not35 = icmp eq ptr %36, null
  br i1 %.not35, label %38, label %37

37:                                               ; preds = %34
  tail call void @free(ptr noundef nonnull %36) #3
  br label %38

38:                                               ; preds = %37, %34
  %39 = getelementptr inbounds i8, ptr %0, i64 32
  %40 = load ptr, ptr %39, align 8, !tbaa !17
  %.not36 = icmp eq ptr %40, null
  br i1 %.not36, label %42, label %41

41:                                               ; preds = %38
  tail call void @free(ptr noundef nonnull %40) #3
  br label %42

42:                                               ; preds = %41, %38
  tail call void @free(ptr noundef nonnull %0) #3
  br label %43

43:                                               ; preds = %1, %42
  ret void
}

declare void @mln_alloc_free(ptr noundef) local_unnamed_addr #1

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

declare void @mln_rbtree_free(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 = { 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 #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, !7, i64 0}
!6 = !{!"mln_pg_token_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !10, i64 44}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"", !7, i64 0, !13, i64 8, !13, i64 16, !13, i64 16, !13, i64 16}
!13 = !{!"long", !8, i64 0}
!14 = !{!6, !7, i64 8}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 24}
!17 = !{!6, !7, i64 32}


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