; LLVM IR from mwarning/KadNode :: src (announces)

; 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.gconf_t = type { i64, i64, ptr, ptr, ptr, ptr, ptr, i8, i8, i32, i32, i32, i32, ptr, i8, [8 x i8], i64, i64, i64, [8 x i32], [8 x i32] }
%struct.announcement_t = type { ptr, [20 x i8], [256 x i8], i32, i32, i64, i64 }

@g_values = external hidden global ptr, align 8
@gconf = external global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [26 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

declare zeroext i1 @id_equal(ptr noundef, 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: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

declare i32 @parse_query(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #1

declare void @log_print(i32 noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @announces_remove(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [256 x i8], align 16
  %6 = alloca [20 x i8], align 16
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 256, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %11 = getelementptr inbounds [20 x i8], ptr %6, i64 0, i64 0
  %12 = getelementptr inbounds [256 x i8], ptr %5, i64 0, i64 0
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call i32 @parse_query(ptr noundef %11, ptr noundef %12, ptr noundef null, ptr noundef %13)
  store i32 %14, ptr %9, align 4, !tbaa !9
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = icmp eq i32 %15, 0
  br i1 %16, label %17, label %36

17:                                               ; preds = %2
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %20, label %24

20:                                               ; preds = %17
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef @.str.11, ptr noundef %22) #4
  br label %35

24:                                               ; preds = %17
  br label %25

25:                                               ; preds = %24
  %26 = load ptr, ptr @gconf, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.gconf_t, ptr %26, i32 0, i32 9
  %28 = load i32, ptr %27, align 4, !tbaa !11
  %29 = icmp ne i32 %28, 2
  br i1 %29, label %30, label %32

30:                                               ; preds = %25
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  call void (i32, ptr, ...) @log_print(i32 noundef 4, ptr noundef @.str.12, ptr noundef %31)
  br label %32

32:                                               ; preds = %30, %25
  br label %33

33:                                               ; preds = %32
  br label %34

34:                                               ; preds = %33
  br label %35

35:                                               ; preds = %34, %20
  store i32 1, ptr %10, align 4
  br label %75

36:                                               ; preds = %2
  store ptr null, ptr %7, align 8, !tbaa !5
  %37 = load ptr, ptr @g_values, align 8, !tbaa !5
  store ptr %37, ptr %8, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %69, %36
  %39 = load ptr, ptr %8, align 8, !tbaa !5
  %40 = icmp ne ptr %39, null
  br i1 %40, label %41, label %74

41:                                               ; preds = %38
  %42 = getelementptr inbounds [20 x i8], ptr %6, i64 0, i64 0
  %43 = load ptr, ptr %8, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.announcement_t, ptr %43, i32 0, i32 1
  %45 = getelementptr inbounds [20 x i8], ptr %44, i64 0, i64 0
  %46 = call zeroext i1 @id_equal(ptr noundef %42, ptr noundef %45)
  br i1 %46, label %47, label %69

47:                                               ; preds = %41
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %56

50:                                               ; preds = %47
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.announcement_t, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !15
  %54 = load ptr, ptr %7, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.announcement_t, ptr %54, i32 0, i32 0
  store ptr %53, ptr %55, align 8, !tbaa !15
  br label %60

56:                                               ; preds = %47
  %57 = load ptr, ptr %8, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.announcement_t, ptr %57, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !15
  store ptr %59, ptr @g_values, align 8, !tbaa !5
  br label %60

60:                                               ; preds = %56, %50
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  call void @announcement_free(ptr noundef %61)
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %68

64:                                               ; preds = %60
  %65 = load ptr, ptr %3, align 8, !tbaa !5
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef @.str.16, ptr noundef %66) #4
  br label %68

68:                                               ; preds = %64, %60
  store i32 1, ptr %10, align 4
  br label %75

69:                                               ; preds = %41
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %70, ptr %7, align 8, !tbaa !5
  %71 = load ptr, ptr %8, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.announcement_t, ptr %71, i32 0, i32 0
  %73 = load ptr, ptr %72, align 8, !tbaa !15
  store ptr %73, ptr %8, align 8, !tbaa !5
  br label %38, !llvm.loop !17

74:                                               ; preds = %38
  store i32 0, ptr %10, align 4
  br label %75

75:                                               ; preds = %74, %68, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 20, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr %5) #4
  %76 = load i32, ptr %10, align 4
  switch i32 %76, label %78 [
    i32 0, label %77
    i32 1, label %77
  ]

77:                                               ; preds = %75, %75
  ret void

78:                                               ; preds = %75
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden void @announcement_free(ptr noundef) #3

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

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 60}
!12 = !{!"gconf_t", !13, i64 0, !13, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !14, i64 56, !14, i64 57, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !6, i64 80, !7, i64 88, !7, i64 89, !13, i64 104, !13, i64 112, !13, i64 120, !7, i64 128, !7, i64 160}
!13 = !{!"long", !7, i64 0}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"announcement_t", !6, i64 0, !7, i64 8, !7, i64 28, !10, i64 284, !10, i64 288, !13, i64 296, !13, i64 304}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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

@g_values = external hidden local_unnamed_addr global ptr, align 8
@gconf = external local_unnamed_addr global ptr, align 8
@.str.11 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [26 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

declare zeroext i1 @id_equal(ptr noundef, ptr noundef) local_unnamed_addr #1

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #2

declare i32 @parse_query(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @log_print(i32 noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @announces_remove(ptr noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = alloca [256 x i8], align 16
  %4 = alloca [20 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %3) #4
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #4
  %5 = call i32 @parse_query(ptr noundef nonnull %4, ptr noundef nonnull %3, ptr noundef null, ptr noundef %1) #4
  %6 = icmp eq i32 %5, 0
  br i1 %6, label %7, label %.preheader

7:                                                ; preds = %2
  %.not21 = icmp eq ptr %0, null
  br i1 %.not21, label %10, label %8

8:                                                ; preds = %7
  %9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %0, ptr noundef nonnull @.str.11, ptr noundef %1) #4
  br label %.loopexit

10:                                               ; preds = %7
  %11 = load ptr, ptr @gconf, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 60
  %13 = load i32, ptr %12, align 4, !tbaa !9
  %.not22 = icmp eq i32 %13, 2
  br i1 %.not22, label %.loopexit, label %14

14:                                               ; preds = %10
  call void (i32, ptr, ...) @log_print(i32 noundef 4, ptr noundef nonnull @.str.12, ptr noundef %1) #4
  br label %.loopexit

.preheader:                                       ; preds = %2, %15
  %.017.in = phi ptr [ %.017, %15 ], [ @g_values, %2 ]
  %.0 = phi ptr [ %.017, %15 ], [ null, %2 ]
  %.017 = load ptr, ptr %.017.in, align 8, !tbaa !5
  %.not = icmp eq ptr %.017, null
  br i1 %.not, label %.loopexit, label %15

15:                                               ; preds = %.preheader
  %16 = getelementptr inbounds i8, ptr %.017, i64 8
  %17 = call zeroext i1 @id_equal(ptr noundef nonnull %4, ptr noundef nonnull %16) #4
  br i1 %17, label %18, label %.preheader, !llvm.loop !14

18:                                               ; preds = %15
  %.not19 = icmp eq ptr %.0, null
  %19 = load ptr, ptr %.017, align 8, !tbaa !16
  %g_values..0.lcssa28 = select i1 %.not19, ptr @g_values, ptr %.0
  store ptr %19, ptr %g_values..0.lcssa28, align 8, !tbaa !5
  call void @announcement_free(ptr noundef nonnull %.017)
  %.not20 = icmp eq ptr %0, null
  br i1 %.not20, label %.loopexit, label %20

20:                                               ; preds = %18
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %0, ptr noundef nonnull @.str.16, ptr noundef %1) #4
  br label %.loopexit

.loopexit:                                        ; preds = %.preheader, %18, %20, %8, %14, %10
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %3) #4
  ret void
}

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

attributes #0 = { mustprogress 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 = { nofree 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 #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 }

!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, !13, i64 60}
!10 = !{!"gconf_t", !11, i64 0, !11, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !12, i64 56, !12, i64 57, !13, i64 60, !13, i64 64, !13, i64 68, !13, i64 72, !6, i64 80, !7, i64 88, !7, i64 89, !11, i64 104, !11, i64 112, !11, i64 120, !7, i64 128, !7, i64 160}
!11 = !{!"long", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !6, i64 0}
!17 = !{!"announcement_t", !6, i64 0, !7, i64 8, !7, i64 28, !13, i64 284, !13, i64 288, !11, i64 296, !11, i64 304}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass