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

declare void @mln_alloc_free(ptr noundef) #1

; 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 ptr @__mln_lang_val_new(ptr noundef, i32 noundef, ptr noundef) #2

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

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

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

19:                                               ; preds = %3
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %98

20:                                               ; preds = %3
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = call ptr @__mln_lang_val_new(ptr noundef %21, i32 noundef 4, ptr noundef %22)
  store ptr %23, ptr %8, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %88

25:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %26 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %26, ptr %12, align 8, !tbaa !5
  %27 = load ptr, ptr %12, align 8, !tbaa !5
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %87

29:                                               ; preds = %25
  %30 = load ptr, ptr %12, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mln_string_t, ptr %30, i32 0, i32 2
  %32 = load i32, ptr %31, align 8
  %33 = lshr i32 %32, 2
  %34 = zext i32 %33 to i64
  %35 = add i64 %34, -1
  %36 = trunc i64 %35 to i32
  %37 = load i32, ptr %31, align 8
  %38 = and i32 %36, 1073741823
  %39 = shl i32 %38, 2
  %40 = and i32 %37, 3
  %41 = or i32 %40, %39
  store i32 %41, ptr %31, align 8
  %42 = zext i32 %38 to i64
  %43 = icmp ule i64 %34, 1
  br i1 %43, label %44, label %86

44:                                               ; preds = %29
  %45 = load ptr, ptr %12, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.mln_string_t, ptr %45, i32 0, i32 2
  %47 = load i32, ptr %46, align 8
  %48 = and i32 %47, 1
  %49 = zext i32 %48 to i64
  %50 = icmp ne i64 %49, 0
  br i1 %50, label %73, label %51

51:                                               ; preds = %44
  %52 = load ptr, ptr %12, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.mln_string_t, ptr %52, i32 0, i32 0
  %54 = load ptr, ptr %53, align 8, !tbaa !13
  %55 = icmp ne ptr %54, null
  br i1 %55, label %56, label %73

56:                                               ; preds = %51
  %57 = load ptr, ptr %12, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.mln_string_t, ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 8
  %60 = lshr i32 %59, 1
  %61 = and i32 %60, 1
  %62 = zext i32 %61 to i64
  %63 = icmp ne i64 %62, 0
  br i1 %63, label %64, label %68

64:                                               ; preds = %56
  %65 = load ptr, ptr %12, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.mln_string_t, ptr %65, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !13
  call void @mln_alloc_free(ptr noundef %67)
  br label %72

68:                                               ; preds = %56
  %69 = load ptr, ptr %12, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.mln_string_t, ptr %69, i32 0, i32 0
  %71 = load ptr, ptr %70, align 8, !tbaa !13
  call void @free(ptr noundef %71) #5
  br label %72

72:                                               ; preds = %68, %64
  br label %73

73:                                               ; preds = %72, %51, %44
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mln_string_t, ptr %74, i32 0, i32 2
  %76 = load i32, ptr %75, align 8
  %77 = lshr i32 %76, 1
  %78 = and i32 %77, 1
  %79 = zext i32 %78 to i64
  %80 = icmp ne i64 %79, 0
  br i1 %80, label %81, label %83

81:                                               ; preds = %73
  %82 = load ptr, ptr %12, align 8, !tbaa !5
  call void @mln_alloc_free(ptr noundef %82)
  br label %85

83:                                               ; preds = %73
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %84) #5
  br label %85

85:                                               ; preds = %83, %81
  br label %86

86:                                               ; preds = %85, %29
  br label %87

87:                                               ; preds = %86, %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %98

88:                                               ; preds = %20
  %89 = load ptr, ptr %5, align 8, !tbaa !5
  %90 = load ptr, ptr %7, align 8, !tbaa !5
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = call ptr @__mln_lang_var_new_ref_string(ptr noundef %89, ptr noundef %90, i32 noundef 0, ptr noundef %91, ptr noundef null)
  store ptr %92, ptr %9, align 8, !tbaa !5
  %93 = icmp eq ptr %92, null
  br i1 %93, label %94, label %96

94:                                               ; preds = %88
  %95 = load ptr, ptr %8, align 8, !tbaa !5
  call void @__mln_lang_val_free(ptr noundef %95)
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %98

96:                                               ; preds = %88
  %97 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %97, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %98

98:                                               ; preds = %96, %94, %87, %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %99 = load ptr, ptr %4, align 8
  ret ptr %99
}

declare ptr @mln_string_pool_dup(ptr noundef, ptr noundef) #1

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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 "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 #5 = { 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 = !{!"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, !12, i64 114968, !12, i64 114970, !12, i64 114970, !12, i64 114970, !12, i64 114970, !12, i64 114970, !12, i64 114970, !12, i64 114970, !12, i64 114970, !12, i64 114971, !12, i64 114971, !12, i64 114971}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 16, !11, i64 16}


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

declare void @mln_alloc_free(ptr noundef) local_unnamed_addr #0

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @mln_lang_var_create_string(ptr noundef nonnull %0, ptr noundef nonnull %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 8
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = tail call ptr @mln_string_pool_dup(ptr noundef %5, ptr noundef nonnull %1) #4
  %7 = icmp eq ptr %6, null
  br i1 %7, label %36, label %8

8:                                                ; preds = %3
  %9 = tail call ptr @__mln_lang_val_new(ptr noundef nonnull %0, i32 noundef 4, ptr noundef nonnull %6)
  %10 = icmp eq ptr %9, null
  br i1 %10, label %11, label %32

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %6, i64 16
  %13 = load i32, ptr %12, align 8
  %14 = and i32 %13, -4
  %15 = add i32 %14, -4
  %16 = and i32 %13, 3
  %17 = or disjoint i32 %15, %16
  store i32 %17, ptr %12, align 8
  %18 = icmp ult i32 %13, 8
  br i1 %18, label %19, label %36

19:                                               ; preds = %11
  %20 = and i32 %13, 1
  %.not = icmp eq i32 %20, 0
  br i1 %.not, label %21, label %27

21:                                               ; preds = %19
  %22 = load ptr, ptr %6, align 8, !tbaa !12
  %.not25 = icmp eq ptr %22, null
  br i1 %.not25, label %27, label %23

23:                                               ; preds = %21
  %24 = and i32 %13, 2
  %.not26 = icmp eq i32 %24, 0
  br i1 %.not26, label %26, label %25

25:                                               ; preds = %23
  tail call void @mln_alloc_free(ptr noundef nonnull %22) #4
  br label %27

26:                                               ; preds = %23
  tail call void @free(ptr noundef nonnull %22) #4
  br label %27

27:                                               ; preds = %25, %26, %21, %19
  %28 = load i32, ptr %12, align 8
  %29 = and i32 %28, 2
  %.not27 = icmp eq i32 %29, 0
  br i1 %.not27, label %31, label %30

30:                                               ; preds = %27
  tail call void @mln_alloc_free(ptr noundef nonnull %6) #4
  br label %36

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

32:                                               ; preds = %8
  %33 = tail call ptr @__mln_lang_var_new_ref_string(ptr noundef nonnull %0, ptr noundef %2, i32 noundef 0, ptr noundef nonnull %9, ptr noundef null)
  %34 = icmp eq ptr %33, null
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  tail call void @__mln_lang_val_free(ptr noundef nonnull %9)
  br label %36

36:                                               ; preds = %32, %30, %31, %11, %3, %35
  %.0 = phi ptr [ null, %35 ], [ null, %3 ], [ null, %11 ], [ null, %31 ], [ null, %30 ], [ %33, %32 ]
  ret ptr %.0
}

declare ptr @mln_string_pool_dup(ptr noundef, ptr noundef) local_unnamed_addr #0

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

attributes #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" }
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 = { 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 #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, !7, i64 8}
!6 = !{!"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, !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}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"", !7, i64 0, !10, i64 8, !10, i64 16, !10, i64 16, !10, i64 16}


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