; 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 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [20 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 void @announces_print(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %7 = load ptr, ptr @gconf, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.gconf_t, ptr %7, i32 0, i32 0
  %9 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %9, ptr %4, align 8, !tbaa !14
  store i32 0, ptr %6, align 4, !tbaa !15
  %10 = call i32 @kad_count_nodes(i1 noundef zeroext false)
  store i32 %10, ptr %5, align 4, !tbaa !15
  %11 = load ptr, ptr @g_values, align 8, !tbaa !5
  store ptr %11, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %12, ptr noundef @.str) #4
  br label %14

14:                                               ; preds = %78, %1
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %90

17:                                               ; preds = %14
  %18 = load ptr, ptr %2, align 8, !tbaa !5
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.announcement_t, ptr %19, i32 0, i32 2
  %21 = getelementptr inbounds [256 x i8], ptr %20, i64 0, i64 0
  %22 = load ptr, ptr @gconf, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.gconf_t, ptr %22, i32 0, i32 3
  %24 = load ptr, ptr %23, align 8, !tbaa !16
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.1, ptr noundef %21, ptr noundef %24) #4
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.announcement_t, ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds [20 x i8], ptr %28, i64 0, i64 0
  %30 = call ptr @str_id(ptr noundef %29)
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.2, ptr noundef %30) #4
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.announcement_t, ptr %33, i32 0, i32 3
  %35 = load i32, ptr %34, align 4, !tbaa !17
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef @.str.3, i32 noundef %35) #4
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.announcement_t, ptr %37, i32 0, i32 6
  %39 = load i64, ptr %38, align 8, !tbaa !19
  %40 = load i64, ptr %4, align 8, !tbaa !14
  %41 = icmp slt i64 %39, %40
  br i1 %41, label %42, label %52

42:                                               ; preds = %17
  %43 = load i32, ptr %5, align 4, !tbaa !15
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %45, label %48

45:                                               ; preds = %42
  %46 = load ptr, ptr %2, align 8, !tbaa !5
  %47 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.4) #4
  br label %51

48:                                               ; preds = %42
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef @.str.5) #4
  br label %51

51:                                               ; preds = %48, %45
  br label %61

52:                                               ; preds = %17
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.announcement_t, ptr %54, i32 0, i32 6
  %56 = load i64, ptr %55, align 8, !tbaa !19
  %57 = load i64, ptr %4, align 8, !tbaa !14
  %58 = sub nsw i64 %56, %57
  %59 = sdiv i64 %58, 60
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.6, i64 noundef %59) #4
  br label %61

61:                                               ; preds = %52, %51
  %62 = load ptr, ptr %3, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.announcement_t, ptr %62, i32 0, i32 5
  %64 = load i64, ptr %63, align 8, !tbaa !20
  %65 = icmp eq i64 %64, 9223372036854775807
  br i1 %65, label %66, label %69

66:                                               ; preds = %61
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %67, ptr noundef @.str.7) #4
  br label %78

69:                                               ; preds = %61
  %70 = load ptr, ptr %2, align 8, !tbaa !5
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.announcement_t, ptr %71, i32 0, i32 5
  %73 = load i64, ptr %72, align 8, !tbaa !20
  %74 = load i64, ptr %4, align 8, !tbaa !14
  %75 = sub nsw i64 %73, %74
  %76 = sdiv i64 %75, 60
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %70, ptr noundef @.str.8, i64 noundef %76) #4
  br label %78

78:                                               ; preds = %69, %66
  %79 = load ptr, ptr %2, align 8, !tbaa !5
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.announcement_t, ptr %80, i32 0, i32 4
  %82 = load i32, ptr %81, align 8, !tbaa !21
  %83 = call ptr @get_auth_type_str(i32 noundef %82)
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %79, ptr noundef @.str.9, ptr noundef %83) #4
  %85 = load i32, ptr %6, align 4, !tbaa !15
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %6, align 4, !tbaa !15
  %87 = load ptr, ptr %3, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.announcement_t, ptr %87, i32 0, i32 0
  %89 = load ptr, ptr %88, align 8, !tbaa !22
  store ptr %89, ptr %3, align 8, !tbaa !5
  br label %14, !llvm.loop !23

90:                                               ; preds = %14
  %91 = load ptr, ptr %2, align 8, !tbaa !5
  %92 = load i32, ptr %6, align 4, !tbaa !15
  %93 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.10, i32 noundef %92) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret void
}

declare i32 @kad_count_nodes(i1 noundef zeroext) #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

declare ptr @str_id(ptr noundef) #2

declare ptr @get_auth_type_str(i32 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 = { "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 "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, !11, i64 0}
!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 = !{!11, !11, i64 0}
!15 = !{!13, !13, i64 0}
!16 = !{!10, !6, i64 24}
!17 = !{!18, !13, i64 284}
!18 = !{!"announcement_t", !6, i64 0, !7, i64 8, !7, i64 28, !13, i64 284, !13, i64 288, !11, i64 296, !11, i64 304}
!19 = !{!18, !11, i64 304}
!20 = !{!18, !11, i64 296}
!21 = !{!18, !13, i64 288}
!22 = !{!18, !6, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"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 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [28 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @announces_print(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @gconf, align 8, !tbaa !5
  %3 = load i64, ptr %2, align 8, !tbaa !9
  %4 = tail call i32 @kad_count_nodes(i1 noundef zeroext false) #3
  %5 = load ptr, ptr @g_values, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str) #3
  %.not30 = icmp eq ptr %5, null
  br i1 %.not30, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %7 = icmp sgt i32 %4, 0
  br label %8

8:                                                ; preds = %.lr.ph, %42
  %.032 = phi i32 [ 0, %.lr.ph ], [ %47, %42 ]
  %.02631 = phi ptr [ %5, %.lr.ph ], [ %48, %42 ]
  %9 = getelementptr inbounds i8, ptr %.02631, i64 28
  %10 = load ptr, ptr @gconf, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %10, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef nonnull %9, ptr noundef %12) #3
  %14 = getelementptr inbounds i8, ptr %.02631, i64 8
  %15 = tail call ptr @str_id(ptr noundef nonnull %14) #3
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef %15) #3
  %17 = getelementptr inbounds i8, ptr %.02631, i64 284
  %18 = load i32, ptr %17, align 4, !tbaa !15
  %19 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.3, i32 noundef %18) #3
  %20 = getelementptr inbounds i8, ptr %.02631, i64 304
  %21 = load i64, ptr %20, align 8, !tbaa !17
  %22 = icmp slt i64 %21, %3
  br i1 %22, label %23, label %28

23:                                               ; preds = %8
  br i1 %7, label %24, label %26

24:                                               ; preds = %23
  %25 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.4) #3
  br label %32

26:                                               ; preds = %23
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.5) #3
  br label %32

28:                                               ; preds = %8
  %29 = sub nsw i64 %21, %3
  %30 = sdiv i64 %29, 60
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.6, i64 noundef %30) #3
  br label %32

32:                                               ; preds = %24, %26, %28
  %33 = getelementptr inbounds i8, ptr %.02631, i64 296
  %34 = load i64, ptr %33, align 8, !tbaa !18
  %35 = icmp eq i64 %34, 9223372036854775807
  br i1 %35, label %36, label %38

36:                                               ; preds = %32
  %37 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.7) #3
  br label %42

38:                                               ; preds = %32
  %39 = sub nsw i64 %34, %3
  %40 = sdiv i64 %39, 60
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.8, i64 noundef %40) #3
  br label %42

42:                                               ; preds = %38, %36
  %43 = getelementptr inbounds i8, ptr %.02631, i64 288
  %44 = load i32, ptr %43, align 8, !tbaa !19
  %45 = tail call ptr @get_auth_type_str(i32 noundef %44) #3
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.9, ptr noundef %45) #3
  %47 = add nuw nsw i32 %.032, 1
  %48 = load ptr, ptr %.02631, align 8, !tbaa !20
  %.not = icmp eq ptr %48, null
  br i1 %.not, label %._crit_edge, label %8, !llvm.loop !21

._crit_edge:                                      ; preds = %42, %1
  %.0.lcssa = phi i32 [ 0, %1 ], [ %47, %42 ]
  %49 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.10, i32 noundef %.0.lcssa) #3
  ret void
}

declare i32 @kad_count_nodes(i1 noundef zeroext) local_unnamed_addr #1

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

declare ptr @str_id(ptr noundef) local_unnamed_addr #1

declare ptr @get_auth_type_str(i32 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 = { "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 }

!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 0}
!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 = !{!10, !6, i64 24}
!15 = !{!16, !13, i64 284}
!16 = !{!"announcement_t", !6, i64 0, !7, i64 8, !7, i64 28, !13, i64 284, !13, i64 288, !11, i64 296, !11, i64 304}
!17 = !{!16, !11, i64 304}
!18 = !{!16, !11, i64 296}
!19 = !{!16, !13, i64 288}
!20 = !{!16, !6, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}


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