; 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_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_string_t = type { ptr, i64, i32 }
%struct.mln_lang_object_s = type { ptr, ptr, i64, ptr, ptr }
%struct.mln_lang_array_s = type { ptr, ptr, i64, i64, ptr, ptr }

; 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
define dso_local i32 @mln_lang_var_value_set_string_ref(ptr noundef nonnull %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca i32, align 4
  %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 %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.mln_lang_var_s, ptr %13, i32 0, i32 2
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  store ptr %15, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.mln_lang_var_s, ptr %16, i32 0, i32 2
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %18, ptr %9, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mln_lang_val_data_free(ptr noundef %19)
  %20 = load ptr, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.mln_lang_val_s, ptr %20, i32 0, i32 3
  %22 = load i32, ptr %21, align 8, !tbaa !13
  switch i32 %22, label %116 [
    i32 0, label %23
    i32 1, label %28
    i32 2, label %36
    i32 3, label %44
    i32 4, label %52
    i32 5, label %75
    i32 6, label %89
    i32 7, label %102
  ]

23:                                               ; preds = %3
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.mln_lang_val_s, ptr %24, i32 0, i32 3
  store i32 0, ptr %25, align 8, !tbaa !13
  %26 = load ptr, ptr %8, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mln_lang_val_s, ptr %26, i32 0, i32 2
  store ptr null, ptr %27, align 8, !tbaa !15
  br label %117

28:                                               ; preds = %3
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.mln_lang_val_s, ptr %29, i32 0, i32 3
  store i32 1, ptr %30, align 8, !tbaa !13
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.mln_lang_val_s, ptr %31, i32 0, i32 2
  %33 = load i64, ptr %32, align 8, !tbaa !15
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.mln_lang_val_s, ptr %34, i32 0, i32 2
  store i64 %33, ptr %35, align 8, !tbaa !15
  br label %117

36:                                               ; preds = %3
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.mln_lang_val_s, ptr %37, i32 0, i32 3
  store i32 2, ptr %38, align 8, !tbaa !13
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.mln_lang_val_s, ptr %39, i32 0, i32 2
  %41 = load i8, ptr %40, align 8, !tbaa !15
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.mln_lang_val_s, ptr %42, i32 0, i32 2
  store i8 %41, ptr %43, align 8, !tbaa !15
  br label %117

44:                                               ; preds = %3
  %45 = load ptr, ptr %8, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mln_lang_val_s, ptr %45, i32 0, i32 3
  store i32 3, ptr %46, align 8, !tbaa !13
  %47 = load ptr, ptr %9, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mln_lang_val_s, ptr %47, i32 0, i32 2
  %49 = load double, ptr %48, align 8, !tbaa !15
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.mln_lang_val_s, ptr %50, i32 0, i32 2
  store double %49, ptr %51, align 8, !tbaa !15
  br label %117

52:                                               ; preds = %3
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mln_lang_val_s, ptr %53, i32 0, i32 3
  store i32 4, ptr %54, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %55 = load ptr, ptr %9, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.mln_lang_val_s, ptr %55, i32 0, i32 2
  %57 = load ptr, ptr %56, align 8, !tbaa !15
  store ptr %57, ptr %10, align 8, !tbaa !5
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.mln_string_t, ptr %58, i32 0, i32 2
  %60 = load i32, ptr %59, align 8
  %61 = lshr i32 %60, 2
  %62 = zext i32 %61 to i64
  %63 = add i64 %62, 1
  %64 = trunc i64 %63 to i32
  %65 = load i32, ptr %59, align 8
  %66 = and i32 %64, 1073741823
  %67 = shl i32 %66, 2
  %68 = and i32 %65, 3
  %69 = or i32 %68, %67
  store i32 %69, ptr %59, align 8
  %70 = zext i32 %66 to i64
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %71, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %72 = load ptr, ptr %11, align 8, !tbaa !5
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.mln_lang_val_s, ptr %73, i32 0, i32 2
  store ptr %72, ptr %74, align 8, !tbaa !15
  br label %117

75:                                               ; preds = %3
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.mln_lang_val_s, ptr %76, i32 0, i32 3
  store i32 5, ptr %77, align 8, !tbaa !13
  %78 = load ptr, ptr %9, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.mln_lang_val_s, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !15
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.mln_lang_val_s, ptr %81, i32 0, i32 2
  store ptr %80, ptr %82, align 8, !tbaa !15
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.mln_lang_val_s, ptr %83, i32 0, i32 2
  %85 = load ptr, ptr %84, align 8, !tbaa !15
  %86 = getelementptr inbounds %struct.mln_lang_object_s, ptr %85, i32 0, i32 2
  %87 = load i64, ptr %86, align 8, !tbaa !16
  %88 = add i64 %87, 1
  store i64 %88, ptr %86, align 8, !tbaa !16
  br label %117

89:                                               ; preds = %3
  %90 = load ptr, ptr %8, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.mln_lang_val_s, ptr %90, i32 0, i32 3
  store i32 6, ptr %91, align 8, !tbaa !13
  %92 = load ptr, ptr %5, align 8, !tbaa !5
  %93 = load ptr, ptr %9, align 8, !tbaa !5
  %94 = getelementptr inbounds %struct.mln_lang_val_s, ptr %93, i32 0, i32 2
  %95 = load ptr, ptr %94, align 8, !tbaa !15
  %96 = call ptr @mln_lang_func_detail_dup(ptr noundef %92, ptr noundef %95)
  %97 = load ptr, ptr %8, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.mln_lang_val_s, ptr %97, i32 0, i32 2
  store ptr %96, ptr %98, align 8, !tbaa !15
  %99 = icmp eq ptr %96, null
  br i1 %99, label %100, label %101

100:                                              ; preds = %89
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %118

101:                                              ; preds = %89
  br label %117

102:                                              ; preds = %3
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.mln_lang_val_s, ptr %103, i32 0, i32 3
  store i32 7, ptr %104, align 8, !tbaa !13
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.mln_lang_val_s, ptr %105, i32 0, i32 2
  %107 = load ptr, ptr %106, align 8, !tbaa !15
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.mln_lang_val_s, ptr %108, i32 0, i32 2
  store ptr %107, ptr %109, align 8, !tbaa !15
  %110 = load ptr, ptr %8, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.mln_lang_val_s, ptr %110, i32 0, i32 2
  %112 = load ptr, ptr %111, align 8, !tbaa !15
  %113 = getelementptr inbounds %struct.mln_lang_array_s, ptr %112, i32 0, i32 3
  %114 = load i64, ptr %113, align 8, !tbaa !18
  %115 = add i64 %114, 1
  store i64 %115, ptr %113, align 8, !tbaa !18
  br label %117

116:                                              ; preds = %3
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %118

117:                                              ; preds = %102, %101, %75, %52, %44, %36, %28, %23
  store i32 0, ptr %4, align 4
  store i32 1, ptr %12, align 4
  br label %118

118:                                              ; preds = %117, %116, %100
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %119 = load i32, ptr %4, align 4
  ret i32 %119
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mln_lang_func_detail_dup(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, !6, i64 16}
!10 = !{!"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}
!11 = !{!"int", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !11, i64 24}
!14 = !{!"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}
!15 = !{!7, !7, i64 0}
!16 = !{!17, !12, i64 16}
!17 = !{!"mln_lang_object_s", !6, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !6, i64 32}
!18 = !{!19, !12, i64 24}
!19 = !{!"mln_lang_array_s", !6, i64 0, !6, i64 8, !12, i64 16, !12, i64 24, !6, i64 32, !6, i64 40}


; 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 range(i32 -1, 1) i32 @mln_lang_var_value_set_string_ref(ptr noundef nonnull %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %1, i64 16
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %2, i64 16
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void @mln_lang_val_data_free(ptr noundef %5)
  %8 = getelementptr inbounds i8, ptr %7, i64 24
  %9 = load i32, ptr %8, align 8, !tbaa !12
  switch i32 %9, label %63 [
    i32 0, label %10
    i32 1, label %13
    i32 2, label %18
    i32 3, label %23
    i32 4, label %28
    i32 5, label %39
    i32 6, label %47
    i32 7, label %54
  ]

10:                                               ; preds = %3
  %11 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 0, ptr %11, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr null, ptr %12, align 8, !tbaa !14
  br label %62

13:                                               ; preds = %3
  %14 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 1, ptr %14, align 8, !tbaa !12
  %15 = getelementptr inbounds i8, ptr %7, i64 16
  %16 = load i64, ptr %15, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %5, i64 16
  store i64 %16, ptr %17, align 8, !tbaa !14
  br label %62

18:                                               ; preds = %3
  %19 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 2, ptr %19, align 8, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %7, i64 16
  %21 = load i8, ptr %20, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %5, i64 16
  store i8 %21, ptr %22, align 8, !tbaa !14
  br label %62

23:                                               ; preds = %3
  %24 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 3, ptr %24, align 8, !tbaa !12
  %25 = getelementptr inbounds i8, ptr %7, i64 16
  %26 = load double, ptr %25, align 8, !tbaa !14
  %27 = getelementptr inbounds i8, ptr %5, i64 16
  store double %26, ptr %27, align 8, !tbaa !14
  br label %62

28:                                               ; preds = %3
  %29 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 4, ptr %29, align 8, !tbaa !12
  %30 = getelementptr inbounds i8, ptr %7, i64 16
  %31 = load ptr, ptr %30, align 8, !tbaa !14
  %32 = getelementptr inbounds i8, ptr %31, i64 16
  %33 = load i32, ptr %32, align 8
  %34 = and i32 %33, -4
  %35 = add i32 %34, 4
  %36 = and i32 %33, 3
  %37 = or disjoint i32 %35, %36
  store i32 %37, ptr %32, align 8
  %38 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %31, ptr %38, align 8, !tbaa !14
  br label %62

39:                                               ; preds = %3
  %40 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 5, ptr %40, align 8, !tbaa !12
  %41 = getelementptr inbounds i8, ptr %7, i64 16
  %42 = load ptr, ptr %41, align 8, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %42, ptr %43, align 8, !tbaa !14
  %44 = getelementptr inbounds i8, ptr %42, i64 16
  %45 = load i64, ptr %44, align 8, !tbaa !15
  %46 = add i64 %45, 1
  store i64 %46, ptr %44, align 8, !tbaa !15
  br label %62

47:                                               ; preds = %3
  %48 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 6, ptr %48, align 8, !tbaa !12
  %49 = getelementptr inbounds i8, ptr %7, i64 16
  %50 = load ptr, ptr %49, align 8, !tbaa !14
  %51 = tail call ptr @mln_lang_func_detail_dup(ptr noundef nonnull %0, ptr noundef %50)
  %52 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %51, ptr %52, align 8, !tbaa !14
  %53 = icmp eq ptr %51, null
  br i1 %53, label %63, label %62

54:                                               ; preds = %3
  %55 = getelementptr inbounds i8, ptr %5, i64 24
  store i32 7, ptr %55, align 8, !tbaa !12
  %56 = getelementptr inbounds i8, ptr %7, i64 16
  %57 = load ptr, ptr %56, align 8, !tbaa !14
  %58 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr %57, ptr %58, align 8, !tbaa !14
  %59 = getelementptr inbounds i8, ptr %57, i64 24
  %60 = load i64, ptr %59, align 8, !tbaa !17
  %61 = add i64 %60, 1
  store i64 %61, ptr %59, align 8, !tbaa !17
  br label %62

62:                                               ; preds = %47, %54, %39, %28, %23, %18, %13, %10
  br label %63

63:                                               ; preds = %3, %47, %62
  %.0 = phi i32 [ 0, %62 ], [ -1, %47 ], [ -1, %3 ]
  ret i32 %.0
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mln_lang_func_detail_dup(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_var_s", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!13, !7, i64 24}
!13 = !{!"mln_lang_val_s", !10, i64 0, !10, i64 8, !8, i64 16, !7, i64 24, !7, i64 28, !10, i64 32, !10, i64 40, !7, i64 48}
!14 = !{!8, !8, i64 0}
!15 = !{!16, !11, i64 16}
!16 = !{!"mln_lang_object_s", !10, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !10, i64 32}
!17 = !{!18, !11, i64 24}
!18 = !{!"mln_lang_array_s", !10, i64 0, !10, i64 8, !11, i64 16, !11, i64 24, !10, i64 32, !10, i64 40}


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