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

; 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_lang_array_s = type { ptr, ptr, i64, i64, ptr, ptr }
%struct.mln_lang_var_s = type { i32, ptr, ptr, ptr, ptr, ptr, i64 }
%struct.mln_lang_val_s = type { ptr, ptr, %union.anon.1, i32, i32, ptr, ptr, i8 }
%union.anon.1 = type { i64 }
%struct.mln_lang_ctx_s = type { ptr, ptr, ptr, ptr, ptr, [1025 x %struct.mln_lang_stack_node_s], ptr, [1025 x %struct.mln_lang_scope_s], ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, i32 }
%struct.mln_lang_stack_node_s = type { ptr, i32, i32, %union.anon, ptr, ptr, ptr }
%union.anon = type { ptr }
%struct.mln_lang_scope_s = type { i32, ptr, ptr, ptr, ptr, i64, ptr, ptr }
%struct.rbtree_s = type { ptr, ptr, ptr, ptr, ptr, %struct.mln_rbtree_node_s, ptr, ptr, ptr, ptr, ptr, i64, i8 }
%struct.mln_rbtree_node_s = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }

; 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: inlinehint nounwind uwtable
declare hidden void @__mln_lang_var_free(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @__mln_lang_var_create_nil(ptr noundef, ptr noundef) #1

declare ptr @mln_rbtree_search(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @mln_lang_array_elem_exist(ptr noundef nonnull %0, ptr noundef nonnull %1) #3 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.mln_lang_array_s, ptr %13, i32 0, i32 5
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %11, align 8, !tbaa !5
  %16 = load ptr, ptr %11, align 8, !tbaa !5
  %17 = call ptr @__mln_lang_var_create_nil(ptr noundef %16, ptr noundef null)
  store ptr %17, ptr %8, align 8, !tbaa !5
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %2
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

20:                                               ; preds = %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.mln_lang_var_s, ptr %21, i32 0, i32 2
  %23 = load ptr, ptr %22, align 8, !tbaa !12
  %24 = getelementptr inbounds %struct.mln_lang_val_s, ptr %23, i32 0, i32 3
  %25 = load i32, ptr %24, align 8, !tbaa !15
  %26 = icmp eq i32 %25, 1
  br i1 %26, label %27, label %55

27:                                               ; preds = %20
  %28 = load ptr, ptr %11, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !17
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.mln_lang_var_s, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !12
  %35 = getelementptr inbounds %struct.mln_lang_val_s, ptr %34, i32 0, i32 2
  %36 = load i64, ptr %35, align 8, !tbaa !19
  %37 = call ptr @mln_lang_array_elem_new(ptr noundef %30, ptr noundef null, ptr noundef %31, i64 noundef %36)
  store ptr %37, ptr %10, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  br i1 %38, label %39, label %41

39:                                               ; preds = %27
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  call void @__mln_lang_var_free(ptr noundef %40)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

41:                                               ; preds = %27
  %42 = load ptr, ptr %4, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.mln_lang_array_s, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  store ptr %44, ptr %6, align 8, !tbaa !5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = load ptr, ptr %10, align 8, !tbaa !5
  %47 = call ptr @mln_rbtree_search(ptr noundef %45, ptr noundef %46)
  store ptr %47, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %10, align 8, !tbaa !5
  call void @mln_lang_array_elem_free(ptr noundef %48)
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.rbtree_s, ptr %50, i32 0, i32 5
  %52 = icmp eq ptr %49, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %41
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

54:                                               ; preds = %41
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

55:                                               ; preds = %20
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  %58 = call ptr @mln_lang_var_dup_with_val(ptr noundef %56, ptr noundef %57)
  store ptr %58, ptr %9, align 8, !tbaa !5
  %59 = icmp eq ptr %58, null
  br i1 %59, label %60, label %62

60:                                               ; preds = %55
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  call void @__mln_lang_var_free(ptr noundef %61)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

62:                                               ; preds = %55
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %63, i32 0, i32 1
  %65 = load ptr, ptr %64, align 8, !tbaa !17
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.mln_lang_array_s, ptr %68, i32 0, i32 2
  %70 = load i64, ptr %69, align 8, !tbaa !21
  %71 = call ptr @mln_lang_array_elem_new(ptr noundef %65, ptr noundef %66, ptr noundef %67, i64 noundef %70)
  store ptr %71, ptr %10, align 8, !tbaa !5
  %72 = icmp eq ptr %71, null
  br i1 %72, label %73, label %76

73:                                               ; preds = %62
  %74 = load ptr, ptr %9, align 8, !tbaa !5
  call void @__mln_lang_var_free(ptr noundef %74)
  %75 = load ptr, ptr %8, align 8, !tbaa !5
  call void @__mln_lang_var_free(ptr noundef %75)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

76:                                               ; preds = %62
  %77 = load ptr, ptr %4, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.mln_lang_array_s, ptr %77, i32 0, i32 1
  %79 = load ptr, ptr %78, align 8, !tbaa !22
  store ptr %79, ptr %6, align 8, !tbaa !5
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = call ptr @mln_rbtree_search(ptr noundef %80, ptr noundef %81)
  store ptr %82, ptr %7, align 8, !tbaa !5
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  call void @mln_lang_array_elem_free(ptr noundef %83)
  %84 = load ptr, ptr %7, align 8, !tbaa !5
  %85 = load ptr, ptr %6, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.rbtree_s, ptr %85, i32 0, i32 5
  %87 = icmp eq ptr %84, %86
  br i1 %87, label %88, label %89

88:                                               ; preds = %76
  store i32 0, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

89:                                               ; preds = %76
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %90

90:                                               ; preds = %89, %88, %73, %60, %54, %53, %39, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %91 = load i32, ptr %3, align 4
  ret i32 %91
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mln_lang_array_elem_new(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @mln_lang_array_elem_free(ptr noundef) #1

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mln_lang_var_dup_with_val(ptr noundef, ptr noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 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 #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 40}
!10 = !{!"mln_lang_array_s", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !6, i64 16}
!13 = !{!"mln_lang_var_s", !14, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !14, i64 24}
!16 = !{!"mln_lang_val_s", !6, i64 0, !6, i64 8, !7, i64 16, !14, i64 24, !14, i64 28, !6, i64 32, !6, i64 40, !14, i64 48}
!17 = !{!18, !6, i64 8}
!18 = !{!"mln_lang_ctx_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !6, i64 49240, !7, i64 49248, !6, i64 114848, !11, i64 114856, !6, i64 114864, !6, i64 114872, !6, i64 114880, !6, i64 114888, !6, i64 114896, !6, i64 114904, !6, i64 114912, !6, i64 114920, !6, i64 114928, !6, i64 114936, !6, i64 114944, !11, i64 114952, !6, i64 114960, !14, i64 114968, !14, i64 114970, !14, i64 114970, !14, i64 114970, !14, i64 114970, !14, i64 114970, !14, i64 114970, !14, i64 114970, !14, i64 114970, !14, i64 114971, !14, i64 114971, !14, i64 114971}
!19 = !{!7, !7, i64 0}
!20 = !{!10, !6, i64 0}
!21 = !{!10, !11, i64 16}
!22 = !{!10, !6, i64 8}


; 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: inlinehint nounwind uwtable
declare hidden void @__mln_lang_var_free(ptr noundef) local_unnamed_addr #0

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

declare ptr @mln_rbtree_search(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @mln_lang_array_elem_exist(ptr nocapture noundef nonnull readonly %0, ptr noundef nonnull %1) local_unnamed_addr #2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 40
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = tail call ptr @__mln_lang_var_create_nil(ptr noundef %4, ptr noundef null)
  %6 = icmp eq ptr %5, null
  br i1 %6, label %44, label %7

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %9, i64 24
  %11 = load i32, ptr %10, align 8, !tbaa !14
  %12 = icmp eq i32 %11, 1
  br i1 %12, label %13, label %26

13:                                               ; preds = %7
  %14 = getelementptr inbounds i8, ptr %4, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %9, i64 16
  %17 = load i64, ptr %16, align 8, !tbaa !18
  %18 = tail call ptr @mln_lang_array_elem_new(ptr noundef %15, ptr noundef null, ptr noundef nonnull %5, i64 noundef %17)
  %19 = icmp eq ptr %18, null
  br i1 %19, label %20, label %21

20:                                               ; preds = %13
  tail call void @__mln_lang_var_free(ptr noundef nonnull %5)
  br label %44

21:                                               ; preds = %13
  %22 = load ptr, ptr %0, align 8, !tbaa !19
  %23 = tail call ptr @mln_rbtree_search(ptr noundef %22, ptr noundef nonnull %18) #3
  tail call void @mln_lang_array_elem_free(ptr noundef nonnull %18)
  %24 = getelementptr inbounds i8, ptr %22, i64 40
  %25 = icmp ne ptr %23, %24
  br label %44

26:                                               ; preds = %7
  %27 = tail call ptr @mln_lang_var_dup_with_val(ptr noundef %4, ptr noundef nonnull %1)
  %28 = icmp eq ptr %27, null
  br i1 %28, label %29, label %30

29:                                               ; preds = %26
  tail call void @__mln_lang_var_free(ptr noundef nonnull %5)
  br label %44

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %4, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !16
  %33 = getelementptr inbounds i8, ptr %0, i64 16
  %34 = load i64, ptr %33, align 8, !tbaa !20
  %35 = tail call ptr @mln_lang_array_elem_new(ptr noundef %32, ptr noundef nonnull %27, ptr noundef nonnull %5, i64 noundef %34)
  %36 = icmp eq ptr %35, null
  br i1 %36, label %37, label %38

37:                                               ; preds = %30
  tail call void @__mln_lang_var_free(ptr noundef nonnull %27)
  tail call void @__mln_lang_var_free(ptr noundef nonnull %5)
  br label %44

38:                                               ; preds = %30
  %39 = getelementptr inbounds i8, ptr %0, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !21
  %41 = tail call ptr @mln_rbtree_search(ptr noundef %40, ptr noundef nonnull %35) #3
  tail call void @mln_lang_array_elem_free(ptr noundef nonnull %35)
  %42 = getelementptr inbounds i8, ptr %40, i64 40
  %43 = icmp ne ptr %41, %42
  br label %44

44:                                               ; preds = %38, %21, %2, %37, %29, %20
  %.0.shrunk = phi i1 [ false, %20 ], [ false, %29 ], [ false, %37 ], [ false, %2 ], [ %25, %21 ], [ %43, %38 ]
  %.0 = zext i1 %.0.shrunk to i32
  ret i32 %.0
}

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

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

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

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 = { "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 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, !7, i64 40}
!6 = !{!"mln_lang_array_s", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !7, i64 32, !7, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!12, !7, i64 16}
!12 = !{!"mln_lang_var_s", !13, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48}
!13 = !{!"int", !8, i64 0}
!14 = !{!15, !13, i64 24}
!15 = !{!"mln_lang_val_s", !7, i64 0, !7, i64 8, !8, i64 16, !13, i64 24, !13, i64 28, !7, i64 32, !7, i64 40, !13, i64 48}
!16 = !{!17, !7, i64 8}
!17 = !{!"mln_lang_ctx_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !8, i64 40, !7, i64 49240, !8, i64 49248, !7, i64 114848, !10, i64 114856, !7, i64 114864, !7, i64 114872, !7, i64 114880, !7, i64 114888, !7, i64 114896, !7, i64 114904, !7, i64 114912, !7, i64 114920, !7, i64 114928, !7, i64 114936, !7, i64 114944, !10, i64 114952, !7, i64 114960, !13, i64 114968, !13, i64 114970, !13, i64 114970, !13, i64 114970, !13, i64 114970, !13, i64 114970, !13, i64 114970, !13, i64 114970, !13, i64 114970, !13, i64 114971, !13, i64 114971, !13, i64 114971}
!18 = !{!8, !8, i64 0}
!19 = !{!6, !7, i64 0}
!20 = !{!6, !10, i64 16}
!21 = !{!6, !7, i64 8}


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