; 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_lang_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

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

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

; Function Attrs: nounwind uwtable
define dso_local void @mln_lang_ctx_continue(ptr noundef nonnull %0) #1 {
  %2 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %3, i32 0, i32 9
  %5 = load i64, ptr %4, align 8, !tbaa !9
  %6 = icmp ne i64 %5, 0
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  br label %57

8:                                                ; preds = %1
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %9, i32 0, i32 9
  %11 = load i64, ptr %10, align 8, !tbaa !9
  %12 = add i64 %11, -1
  store i64 %12, ptr %10, align 8, !tbaa !9
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !13
  %16 = getelementptr inbounds %struct.mln_lang_s, ptr %15, i32 0, i32 4
  %17 = load ptr, ptr %2, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !13
  %20 = getelementptr inbounds %struct.mln_lang_s, ptr %19, i32 0, i32 5
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  call void @mln_lang_ctx_chain_del(ptr noundef %16, ptr noundef %20, ptr noundef %21)
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = getelementptr inbounds %struct.mln_lang_s, ptr %24, i32 0, i32 2
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !13
  %29 = getelementptr inbounds %struct.mln_lang_s, ptr %28, i32 0, i32 3
  %30 = load ptr, ptr %2, align 8, !tbaa !5
  call void @mln_lang_ctx_chain_add(ptr noundef %25, ptr noundef %29, ptr noundef %30)
  %31 = load ptr, ptr %2, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = getelementptr inbounds %struct.mln_lang_s, ptr %33, i32 0, i32 2
  %35 = load ptr, ptr %34, align 8, !tbaa !14
  %36 = icmp ne ptr %35, null
  br i1 %36, label %37, label %47

37:                                               ; preds = %8
  %38 = load ptr, ptr %2, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %38, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !13
  %41 = getelementptr inbounds %struct.mln_lang_s, ptr %40, i32 0, i32 11
  %42 = load ptr, ptr %41, align 8, !tbaa !16
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !13
  %46 = call i32 %42(ptr noundef %45)
  br label %57

47:                                               ; preds = %8
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %48, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !13
  %51 = getelementptr inbounds %struct.mln_lang_s, ptr %50, i32 0, i32 12
  %52 = load ptr, ptr %51, align 8, !tbaa !17
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mln_lang_ctx_s, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = call i32 %52(ptr noundef %55)
  br label %57

57:                                               ; preds = %47, %37, %7
  ret void
}

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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 114856}
!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 = !{!10, !6, i64 0}
!14 = !{!15, !6, i64 16}
!15 = !{!"mln_lang_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 63, !11, i64 63, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !7, i64 120}
!16 = !{!15, !6, i64 88}
!17 = !{!15, !6, i64 96}


; 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_ctx_chain_del(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @mln_lang_ctx_continue(ptr noundef nonnull %0) local_unnamed_addr #1 {
  %2 = getelementptr inbounds i8, ptr %0, i64 114856
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %.not = icmp eq i64 %3, 0
  br i1 %.not, label %17, label %.sink.split

.sink.split:                                      ; preds = %1
  %4 = add i64 %3, -1
  store i64 %4, ptr %2, align 8, !tbaa !5
  %5 = load ptr, ptr %0, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %5, i64 32
  %7 = getelementptr inbounds i8, ptr %5, i64 40
  tail call void @mln_lang_ctx_chain_del(ptr noundef nonnull %6, ptr noundef nonnull %7, ptr noundef nonnull %0)
  %8 = load ptr, ptr %0, align 8, !tbaa !12
  %9 = getelementptr inbounds i8, ptr %8, i64 16
  %10 = getelementptr inbounds i8, ptr %8, i64 24
  tail call void @mln_lang_ctx_chain_add(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %0)
  %11 = load ptr, ptr %0, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %11, i64 16
  %13 = load ptr, ptr %12, align 8, !tbaa !13
  %.not13 = icmp eq ptr %13, null
  %. = select i1 %.not13, i64 96, i64 88
  %14 = getelementptr inbounds i8, ptr %11, i64 %.
  %15 = load ptr, ptr %14, align 8, !tbaa !15
  %16 = tail call i32 %15(ptr noundef nonnull %11) #2
  br label %17

17:                                               ; preds = %.sink.split, %1
  ret void
}

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 = { 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 }

!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 114856}
!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 = !{!6, !7, i64 0}
!13 = !{!14, !7, i64 16}
!14 = !{!"mln_lang_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56, !10, i64 63, !10, i64 63, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !8, i64 120}
!15 = !{!7, !7, i64 0}


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