; 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_symbol_node_s = type { ptr, ptr, i32, %union.anon.0, i64, ptr, ptr, ptr, ptr, ptr }
%union.anon.0 = type { 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.mln_lang_funccall_val_s = type { ptr, ptr, ptr, %struct.mln_array_t }
%struct.mln_array_t = type { ptr, i64, i64, i64, ptr, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [11 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
declare hidden void @__mln_lang_errmsg(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @mln_lang_var_create_call(ptr noundef, ptr noundef) #1

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare dso_local i32 @mln_lang_funccall_val_add_arg(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @mln_lang_funccall_val_operator(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef %4) #1 {
  %6 = alloca i32, align 4
  %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 ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store ptr %1, ptr %8, align 8, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !5
  store ptr %3, ptr %10, align 8, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = call i32 @mln_lang_funccall_val_operator_overload_test(ptr noundef %15, ptr noundef %16)
  %18 = icmp ne i32 %17, 0
  br i1 %18, label %19, label %20

19:                                               ; preds = %5
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %90

20:                                               ; preds = %5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = call ptr @__mln_lang_symbol_node_search(ptr noundef %21, ptr noundef %22, i32 noundef 0)
  store ptr %23, ptr %12, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %89

25:                                               ; preds = %20
  %26 = load ptr, ptr %12, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mln_lang_symbol_node_s, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 8, !tbaa !9
  %29 = icmp eq i32 %28, 0
  br i1 %29, label %30, label %89

30:                                               ; preds = %25
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.mln_lang_symbol_node_s, ptr %31, i32 0, i32 3
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = getelementptr inbounds %struct.mln_lang_var_s, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = getelementptr inbounds %struct.mln_lang_val_s, ptr %35, i32 0, i32 3
  %37 = load i32, ptr %36, align 8, !tbaa !16
  %38 = icmp eq i32 %37, 6
  br i1 %38, label %39, label %89

39:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %40 = load ptr, ptr %7, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %40, i32 0, i32 1
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = call ptr @__mln_lang_funccall_val_new(ptr noundef %42, ptr noundef %43)
  store ptr %44, ptr %14, align 8, !tbaa !5
  %45 = load ptr, ptr %14, align 8, !tbaa !5
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %39
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  call void @__mln_lang_errmsg(ptr noundef %48, ptr noundef @.str)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %88

49:                                               ; preds = %39
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = load ptr, ptr %14, align 8, !tbaa !5
  %52 = call ptr @mln_lang_var_create_call(ptr noundef %50, ptr noundef %51)
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %52, ptr %53, align 8, !tbaa !5
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = icmp eq ptr %55, null
  br i1 %56, label %57, label %60

57:                                               ; preds = %49
  %58 = load ptr, ptr %7, align 8, !tbaa !5
  call void @__mln_lang_errmsg(ptr noundef %58, ptr noundef @.str)
  %59 = load ptr, ptr %14, align 8, !tbaa !5
  call void @__mln_lang_funccall_val_free(ptr noundef %59)
  store i32 -1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %88

60:                                               ; preds = %49
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.mln_lang_var_s, ptr %62, i32 0, i32 6
  %64 = load i64, ptr %63, align 8, !tbaa !20
  %65 = add i64 %64, 1
  store i64 %65, ptr %63, align 8, !tbaa !20
  %66 = load ptr, ptr %10, align 8, !tbaa !5
  %67 = call i32 @mln_lang_funccall_val_add_arg(ptr noundef %61, ptr noundef %66)
  %68 = load ptr, ptr %11, align 8, !tbaa !5
  %69 = icmp ne ptr %68, null
  br i1 %69, label %70, label %78

70:                                               ; preds = %60
  %71 = load ptr, ptr %14, align 8, !tbaa !5
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.mln_lang_var_s, ptr %72, i32 0, i32 6
  %74 = load i64, ptr %73, align 8, !tbaa !20
  %75 = add i64 %74, 1
  store i64 %75, ptr %73, align 8, !tbaa !20
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = call i32 @mln_lang_funccall_val_add_arg(ptr noundef %71, ptr noundef %76)
  br label %78

78:                                               ; preds = %70, %60
  %79 = load ptr, ptr %12, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.mln_lang_symbol_node_s, ptr %79, i32 0, i32 3
  %81 = load ptr, ptr %80, align 8, !tbaa !13
  %82 = getelementptr inbounds %struct.mln_lang_var_s, ptr %81, i32 0, i32 2
  %83 = load ptr, ptr %82, align 8, !tbaa !14
  %84 = getelementptr inbounds %struct.mln_lang_val_s, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !13
  %86 = load ptr, ptr %14, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.mln_lang_funccall_val_s, ptr %86, i32 0, i32 1
  store ptr %85, ptr %87, align 8, !tbaa !21
  store i32 1, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %88

88:                                               ; preds = %78, %57, %47
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %90

89:                                               ; preds = %30, %25, %20
  store i32 0, ptr %6, align 4
  store i32 1, ptr %13, align 4
  br label %90

90:                                               ; preds = %89, %88, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %91 = load i32, ptr %6, align 4
  ret i32 %91
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @mln_lang_funccall_val_operator_overload_test(ptr noundef, 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 = { 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 #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, !11, i64 16}
!10 = !{!"mln_lang_symbol_node_s", !6, i64 0, !6, i64 8, !11, i64 16, !7, i64 24, !12, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"mln_lang_var_s", !11, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48}
!16 = !{!17, !11, i64 24}
!17 = !{!"mln_lang_val_s", !6, i64 0, !6, i64 8, !7, i64 16, !11, i64 24, !11, i64 28, !6, i64 32, !6, i64 40, !11, i64 48}
!18 = !{!19, !6, i64 8}
!19 = !{!"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, !12, 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, !12, i64 114952, !6, i64 114960, !11, i64 114968, !11, i64 114970, !11, i64 114970, !11, i64 114970, !11, i64 114970, !11, i64 114970, !11, i64 114970, !11, i64 114970, !11, i64 114970, !11, i64 114971, !11, i64 114971, !11, i64 114971}
!20 = !{!15, !12, i64 48}
!21 = !{!22, !6, i64 8}
!22 = !{!"mln_lang_funccall_val_s", !6, i64 0, !6, i64 8, !6, i64 16, !23, i64 24}
!23 = !{!"", !6, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56}


; 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 [11 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @mln_lang_var_create_call(ptr noundef, ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: inlinehint nounwind uwtable
declare dso_local i32 @mln_lang_funccall_val_add_arg(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 2) i32 @mln_lang_funccall_val_operator(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr nocapture noundef nonnull writeonly %2, ptr noundef nonnull %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = tail call i32 @mln_lang_funccall_val_operator_overload_test(ptr noundef nonnull %0, ptr noundef nonnull %1)
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %7, label %48

7:                                                ; preds = %5
  %8 = tail call ptr @__mln_lang_symbol_node_search(ptr noundef nonnull %0, ptr noundef nonnull %1, i32 noundef 0)
  %.not28 = icmp eq ptr %8, null
  br i1 %.not28, label %48, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %8, i64 16
  %11 = load i32, ptr %10, align 8, !tbaa !5
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %48

13:                                               ; preds = %9
  %14 = getelementptr inbounds i8, ptr %8, i64 24
  %15 = load ptr, ptr %14, align 8, !tbaa !12
  %16 = getelementptr inbounds i8, ptr %15, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %17, i64 24
  %19 = load i32, ptr %18, align 8, !tbaa !15
  %20 = icmp eq i32 %19, 6
  br i1 %20, label %21, label %48

21:                                               ; preds = %13
  %22 = getelementptr inbounds i8, ptr %0, i64 8
  %23 = load ptr, ptr %22, align 8, !tbaa !17
  %24 = tail call ptr @__mln_lang_funccall_val_new(ptr noundef %23, ptr noundef nonnull %1)
  %25 = icmp eq ptr %24, null
  br i1 %25, label %26, label %27

26:                                               ; preds = %21
  tail call void @__mln_lang_errmsg(ptr noundef nonnull %0, ptr noundef nonnull @.str)
  br label %48

27:                                               ; preds = %21
  %28 = tail call ptr @mln_lang_var_create_call(ptr noundef nonnull %0, ptr noundef nonnull %24)
  store ptr %28, ptr %2, align 8, !tbaa !19
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %27
  tail call void @__mln_lang_errmsg(ptr noundef nonnull %0, ptr noundef nonnull @.str)
  tail call void @__mln_lang_funccall_val_free(ptr noundef nonnull %24)
  br label %48

31:                                               ; preds = %27
  %32 = getelementptr inbounds i8, ptr %3, i64 48
  %33 = load i64, ptr %32, align 8, !tbaa !20
  %34 = add i64 %33, 1
  store i64 %34, ptr %32, align 8, !tbaa !20
  %35 = tail call i32 @mln_lang_funccall_val_add_arg(ptr noundef nonnull %24, ptr noundef nonnull %3)
  %.not29 = icmp eq ptr %4, null
  br i1 %.not29, label %41, label %36

36:                                               ; preds = %31
  %37 = getelementptr inbounds i8, ptr %4, i64 48
  %38 = load i64, ptr %37, align 8, !tbaa !20
  %39 = add i64 %38, 1
  store i64 %39, ptr %37, align 8, !tbaa !20
  %40 = tail call i32 @mln_lang_funccall_val_add_arg(ptr noundef nonnull %24, ptr noundef nonnull %4)
  br label %41

41:                                               ; preds = %36, %31
  %42 = load ptr, ptr %14, align 8, !tbaa !12
  %43 = getelementptr inbounds i8, ptr %42, i64 16
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = getelementptr inbounds i8, ptr %44, i64 16
  %46 = load ptr, ptr %45, align 8, !tbaa !12
  %47 = getelementptr inbounds i8, ptr %24, i64 8
  store ptr %46, ptr %47, align 8, !tbaa !21
  br label %48

48:                                               ; preds = %7, %9, %13, %26, %30, %41, %5
  %.1 = phi i32 [ 0, %5 ], [ -1, %26 ], [ -1, %30 ], [ 1, %41 ], [ 0, %13 ], [ 0, %9 ], [ 0, %7 ]
  ret i32 %.1
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @mln_lang_funccall_val_operator_overload_test(ptr noundef, 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 = { 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" }

!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, !10, i64 16}
!6 = !{!"mln_lang_symbol_node_s", !7, i64 0, !7, i64 8, !10, i64 16, !8, i64 24, !11, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!8, !8, i64 0}
!13 = !{!14, !7, i64 16}
!14 = !{!"mln_lang_var_s", !10, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !11, i64 48}
!15 = !{!16, !10, i64 24}
!16 = !{!"mln_lang_val_s", !7, i64 0, !7, i64 8, !8, i64 16, !10, i64 24, !10, i64 28, !7, i64 32, !7, i64 40, !10, i64 48}
!17 = !{!18, !7, i64 8}
!18 = !{!"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, !11, 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, !11, i64 114952, !7, i64 114960, !10, i64 114968, !10, i64 114970, !10, i64 114970, !10, i64 114970, !10, i64 114970, !10, i64 114970, !10, i64 114970, !10, i64 114970, !10, i64 114970, !10, i64 114971, !10, i64 114971, !10, i64 114971}
!19 = !{!7, !7, i64 0}
!20 = !{!14, !11, i64 48}
!21 = !{!22, !7, i64 8}
!22 = !{!"mln_lang_funccall_val_s", !7, i64 0, !7, i64 8, !7, i64 16, !23, i64 24}
!23 = !{!"", !7, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56}


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