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

; 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_string_t = type { ptr, i64, i32 }
%struct.mln_conf_domain_s = type { ptr, ptr, ptr, ptr, ptr }
%struct.mln_conf_s = type { ptr, ptr, ptr, ptr, ptr, ptr }
%struct.mln_rbtree_node_s = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }

@g_conf = external hidden global ptr, align 8
@default_domain = external hidden global [5 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
define dso_local i32 @mln_conf_load() #1 {
  %1 = alloca i32, align 4
  %2 = alloca %struct.mln_string_t, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %struct.mln_conf_domain_s, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr %5) #5
  %9 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %10 = icmp ne ptr %9, null
  br i1 %10, label %11, label %12

11:                                               ; preds = %0
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %67

12:                                               ; preds = %0
  %13 = call ptr @mln_conf_init()
  store ptr %13, ptr @g_conf, align 8, !tbaa !5
  %14 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  br i1 %15, label %16, label %17

16:                                               ; preds = %12
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %67

17:                                               ; preds = %12
  %18 = getelementptr inbounds %struct.mln_string_t, ptr %2, i32 0, i32 0
  store ptr @default_domain, ptr %18, align 8, !tbaa !9
  %19 = call i64 @strlen(ptr noundef @default_domain) #6
  %20 = getelementptr inbounds %struct.mln_string_t, ptr %2, i32 0, i32 1
  store i64 %19, ptr %20, align 8, !tbaa !12
  %21 = getelementptr inbounds %struct.mln_string_t, ptr %2, i32 0, i32 2
  %22 = load i32, ptr %21, align 8
  %23 = and i32 %22, -2
  %24 = or i32 %23, 1
  store i32 %24, ptr %21, align 8
  %25 = getelementptr inbounds %struct.mln_string_t, ptr %2, i32 0, i32 2
  %26 = load i32, ptr %25, align 8
  %27 = and i32 %26, -3
  %28 = or i32 %27, 0
  store i32 %28, ptr %25, align 8
  %29 = getelementptr inbounds %struct.mln_string_t, ptr %2, i32 0, i32 2
  %30 = load i32, ptr %29, align 8
  %31 = and i32 %30, 3
  %32 = or i32 %31, 4
  store i32 %32, ptr %29, align 8
  store ptr %2, ptr %7, align 8, !tbaa !5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mln_conf_domain_s, ptr %5, i32 0, i32 3
  store ptr %2, ptr %34, align 8, !tbaa !13
  %35 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.mln_conf_s, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !15
  %38 = call ptr @mln_rbtree_search(ptr noundef %37, ptr noundef %5)
  store ptr %38, ptr %3, align 8, !tbaa !5
  %39 = load ptr, ptr %3, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.mln_rbtree_node_s, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  store ptr %41, ptr %4, align 8, !tbaa !5
  %42 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.mln_conf_s, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !20
  %45 = icmp ne ptr %44, null
  br i1 %45, label %46, label %59

46:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %47 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = call i32 @_mln_conf_load(ptr noundef %47, ptr noundef %48)
  store i32 %49, ptr %8, align 4, !tbaa !21
  %50 = load ptr, ptr @g_conf, align 8, !tbaa !5
  call void @mln_conf_destroy_lex(ptr noundef %50)
  %51 = load i32, ptr %8, align 4, !tbaa !21
  %52 = icmp slt i32 %51, 0
  br i1 %52, label %53, label %55

53:                                               ; preds = %46
  %54 = load ptr, ptr @g_conf, align 8, !tbaa !5
  call void @mln_conf_destroy(ptr noundef %54)
  store ptr null, ptr @g_conf, align 8, !tbaa !5
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %56

55:                                               ; preds = %46
  store i32 0, ptr %6, align 4
  br label %56

56:                                               ; preds = %55, %53
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %57 = load i32, ptr %6, align 4
  switch i32 %57, label %67 [
    i32 0, label %58
  ]

58:                                               ; preds = %56
  br label %59

59:                                               ; preds = %58, %17
  %60 = call ptr @mln_ipc_handler_register(i32 noundef 1, ptr noundef @mln_conf_reload_master_handler, ptr noundef @mln_conf_reload_worker_handler, ptr noundef null, ptr noundef null)
  %61 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.mln_conf_s, ptr %61, i32 0, i32 5
  store ptr %60, ptr %62, align 8, !tbaa !22
  %63 = icmp eq ptr %60, null
  br i1 %63, label %64, label %66

64:                                               ; preds = %59
  %65 = load ptr, ptr @g_conf, align 8, !tbaa !5
  call void @mln_conf_destroy(ptr noundef %65)
  store ptr null, ptr @g_conf, align 8, !tbaa !5
  store i32 -1, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %67

66:                                               ; preds = %59
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %67

67:                                               ; preds = %66, %64, %56, %16, %11
  call void @llvm.lifetime.end.p0(i64 40, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #5
  %68 = load i32, ptr %1, align 4
  ret i32 %68
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mln_conf_init() #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden i32 @_mln_conf_load(ptr noundef nonnull, ptr noundef nonnull) #1

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

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

declare ptr @mln_ipc_handler_register(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
declare hidden void @mln_conf_reload_master_handler(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @mln_conf_reload_worker_handler(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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 willreturn memory(read) "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 = { "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 }
attributes #6 = { nounwind willreturn memory(read) }

!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 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 16, !11, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!14, !6, i64 24}
!14 = !{!"mln_conf_domain_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!16, !6, i64 8}
!16 = !{!"mln_conf_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!18, !6, i64 0}
!18 = !{!"mln_rbtree_node_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !19, i64 48, !19, i64 48}
!19 = !{!"int", !7, i64 0}
!20 = !{!16, !6, i64 0}
!21 = !{!19, !19, i64 0}
!22 = !{!16, !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"

%struct.mln_string_t = type { ptr, i64, i32 }
%struct.mln_conf_domain_s = type { ptr, ptr, ptr, ptr, ptr }

@g_conf = external hidden local_unnamed_addr global ptr, align 8
@default_domain = external hidden global [5 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: mustprogress 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 range(i32 -1, 1) i32 @mln_conf_load() local_unnamed_addr #1 {
  %1 = alloca %struct.mln_string_t, align 8
  %2 = alloca %struct.mln_conf_domain_s, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %2) #5
  %3 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %29

4:                                                ; preds = %0
  %5 = tail call ptr @mln_conf_init()
  store ptr %5, ptr @g_conf, align 8, !tbaa !5
  %6 = icmp eq ptr %5, null
  br i1 %6, label %29, label %7

7:                                                ; preds = %4
  store ptr @default_domain, ptr %1, align 8, !tbaa !9
  %8 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @default_domain) #6
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  store i64 %8, ptr %9, align 8, !tbaa !12
  %10 = getelementptr inbounds i8, ptr %1, i64 16
  store i32 5, ptr %10, align 8
  %11 = getelementptr inbounds i8, ptr %2, i64 24
  store ptr %1, ptr %11, align 8, !tbaa !13
  %12 = getelementptr inbounds i8, ptr %5, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !15
  %14 = call ptr @mln_rbtree_search(ptr noundef %13, ptr noundef nonnull %2) #5
  %15 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  %.not6 = icmp eq ptr %16, null
  br i1 %.not6, label %.critedge, label %17

17:                                               ; preds = %7
  %18 = load ptr, ptr %14, align 8, !tbaa !18
  %19 = call i32 @_mln_conf_load(ptr noundef %15, ptr noundef %18)
  %20 = load ptr, ptr @g_conf, align 8, !tbaa !5
  call void @mln_conf_destroy_lex(ptr noundef %20)
  %21 = icmp sgt i32 %19, -1
  br i1 %21, label %.critedge, label %22

22:                                               ; preds = %17
  %23 = load ptr, ptr @g_conf, align 8, !tbaa !5
  call void @mln_conf_destroy(ptr noundef %23)
  br label %.sink.split

.critedge:                                        ; preds = %17, %7
  %24 = call ptr @mln_ipc_handler_register(i32 noundef 1, ptr noundef nonnull @mln_conf_reload_master_handler, ptr noundef nonnull @mln_conf_reload_worker_handler, ptr noundef null, ptr noundef null) #5
  %25 = load ptr, ptr @g_conf, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 40
  store ptr %24, ptr %26, align 8, !tbaa !21
  %27 = icmp eq ptr %24, null
  br i1 %27, label %28, label %29

28:                                               ; preds = %.critedge
  call void @mln_conf_destroy(ptr noundef nonnull %25)
  br label %.sink.split

.sink.split:                                      ; preds = %28, %22
  store ptr null, ptr @g_conf, align 8, !tbaa !5
  br label %29

29:                                               ; preds = %.sink.split, %.critedge, %4, %0
  %.1 = phi i32 [ 0, %0 ], [ -1, %4 ], [ 0, %.critedge ], [ -1, %.sink.split ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #5
  ret i32 %.1
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden ptr @mln_conf_init() local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

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

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

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

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

declare ptr @mln_ipc_handler_register(i32 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare hidden void @mln_conf_reload_master_handler(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden void @mln_conf_reload_worker_handler(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

attributes #0 = { mustprogress 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { "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 }
attributes #6 = { nounwind willreturn memory(read) }

!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 0}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 16, !11, i64 16, !11, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!10, !11, i64 8}
!13 = !{!14, !6, i64 24}
!14 = !{!"mln_conf_domain_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!16, !6, i64 8}
!16 = !{!"mln_conf_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!17 = !{!16, !6, i64 0}
!18 = !{!19, !6, i64 0}
!19 = !{!"mln_rbtree_node_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !20, i64 48, !20, i64 48}
!20 = !{!"int", !7, i64 0}
!21 = !{!16, !6, i64 40}


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