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

; 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.search_t = type { ptr, [20 x i8], [256 x i8], i8, i64, ptr, ptr }
%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.result_t = type { ptr, %struct.sockaddr_storage, i32 }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }

@g_searches = external hidden global ptr, align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@gconf = external global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 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 @searches_debug(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, 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
  store i32 0, ptr %6, align 4, !tbaa !9
  %7 = load ptr, ptr @g_searches, align 8, !tbaa !5
  store ptr %7, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8, !tbaa !5
  %9 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %8, ptr noundef @.str) #4
  br label %10

10:                                               ; preds = %70, %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %13, label %81

13:                                               ; preds = %10
  %14 = load ptr, ptr %2, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.search_t, ptr %15, i32 0, i32 2
  %17 = getelementptr inbounds [256 x i8], ptr %16, i64 0, i64 0
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef @.str.1, ptr noundef %17) #4
  %19 = load ptr, ptr %2, align 8, !tbaa !5
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.search_t, ptr %20, i32 0, i32 1
  %22 = getelementptr inbounds [20 x i8], ptr %21, i64 0, i64 0
  %23 = call ptr @str_id(ptr noundef %22)
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.2, ptr noundef %23) #4
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.search_t, ptr %26, i32 0, i32 6
  %28 = load ptr, ptr %27, align 8, !tbaa !11
  %29 = call ptr @str_callback(ptr noundef %28)
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.search_t, ptr %30, i32 0, i32 3
  %32 = load i8, ptr %31, align 4, !tbaa !15, !range !16, !noundef !17
  %33 = trunc i8 %32 to i1
  %34 = zext i1 %33 to i64
  %35 = select i1 %33, ptr @.str.4, ptr @.str.5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.3, ptr noundef %29, ptr noundef %35) #4
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = load ptr, ptr @gconf, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.gconf_t, ptr %38, i32 0, i32 0
  %40 = load i64, ptr %39, align 8, !tbaa !18
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.search_t, ptr %41, i32 0, i32 4
  %43 = load i64, ptr %42, align 8, !tbaa !20
  %44 = sub nsw i64 %40, %43
  %45 = sdiv i64 %44, 60
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef @.str.6, i64 noundef %45) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.search_t, ptr %47, i32 0, i32 5
  %49 = load ptr, ptr %48, align 8, !tbaa !21
  store ptr %49, ptr %4, align 8, !tbaa !5
  br label %50

50:                                               ; preds = %53, %13
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %70

53:                                               ; preds = %50
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.result_t, ptr %55, i32 0, i32 1
  %57 = call ptr @str_addr(ptr noundef %56)
  %58 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.7, ptr noundef %57) #4
  %59 = load ptr, ptr %2, align 8, !tbaa !5
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.result_t, ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 8, !tbaa !22
  %63 = call ptr @str_state(i32 noundef %62)
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %59, ptr noundef @.str.8, ptr noundef %63) #4
  %65 = load i32, ptr %5, align 4, !tbaa !9
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %5, align 4, !tbaa !9
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.result_t, ptr %67, i32 0, i32 0
  %69 = load ptr, ptr %68, align 8, !tbaa !26
  store ptr %69, ptr %4, align 8, !tbaa !5
  br label %50, !llvm.loop !27

70:                                               ; preds = %50
  %71 = load ptr, ptr %2, align 8, !tbaa !5
  %72 = load i32, ptr %5, align 4, !tbaa !9
  %73 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.9, i32 noundef %72) #4
  %74 = load i32, ptr %5, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %5, align 4, !tbaa !9
  %76 = load i32, ptr %6, align 4, !tbaa !9
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr %6, align 4, !tbaa !9
  %78 = load ptr, ptr %3, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.search_t, ptr %78, i32 0, i32 0
  %80 = load ptr, ptr %79, align 8, !tbaa !29
  store ptr %80, ptr %3, align 8, !tbaa !5
  br label %10, !llvm.loop !30

81:                                               ; preds = %10
  %82 = load ptr, ptr %2, align 8, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !9
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.10, i32 noundef %83) #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
}

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

declare ptr @str_id(ptr noundef) #3

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

declare ptr @str_addr(ptr noundef) #3

; Function Attrs: nounwind uwtable
declare hidden ptr @str_state(i32 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 = { 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 = { "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, !6, i64 304}
!12 = !{!"search_t", !6, i64 0, !7, i64 8, !7, i64 28, !13, i64 284, !14, i64 288, !6, i64 296, !6, i64 304}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !13, i64 284}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!19, !14, i64 0}
!19 = !{!"gconf_t", !14, i64 0, !14, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !13, i64 56, !13, i64 57, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !6, i64 80, !7, i64 88, !7, i64 89, !14, i64 104, !14, i64 112, !14, i64 120, !7, i64 128, !7, i64 160}
!20 = !{!12, !14, i64 288}
!21 = !{!12, !6, i64 296}
!22 = !{!23, !10, i64 136}
!23 = !{!"result_t", !6, i64 0, !24, i64 8, !10, i64 136}
!24 = !{!"sockaddr_storage", !25, i64 0, !7, i64 2, !14, i64 120}
!25 = !{!"short", !7, i64 0}
!26 = !{!23, !6, i64 0}
!27 = distinct !{!27, !28}
!28 = !{!"llvm.loop.mustprogress"}
!29 = !{!12, !6, i64 0}
!30 = distinct !{!30, !28}


; 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_searches = external hidden local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [22 x i8], align 1
@gconf = external local_unnamed_addr global ptr, align 8
@.str.7 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [21 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @searches_debug(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = load ptr, ptr @g_searches, align 8, !tbaa !5
  %3 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str) #3
  %.not33 = icmp eq ptr %2, null
  br i1 %.not33, label %._crit_edge38, label %.lr.ph37

.lr.ph37:                                         ; preds = %1, %._crit_edge
  %.035 = phi i32 [ %34, %._crit_edge ], [ 0, %1 ]
  %.02734 = phi ptr [ %35, %._crit_edge ], [ %2, %1 ]
  %4 = getelementptr inbounds i8, ptr %.02734, i64 28
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef nonnull %4) #3
  %6 = getelementptr inbounds i8, ptr %.02734, i64 8
  %7 = tail call ptr @str_id(ptr noundef nonnull %6) #3
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.2, ptr noundef %7) #3
  %9 = getelementptr inbounds i8, ptr %.02734, i64 304
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = tail call ptr @str_callback(ptr noundef %10)
  %12 = getelementptr inbounds i8, ptr %.02734, i64 284
  %13 = load i8, ptr %12, align 4, !tbaa !13, !range !14, !noundef !15
  %14 = trunc nuw i8 %13 to i1
  %15 = select i1 %14, ptr @.str.4, ptr @.str.5
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.3, ptr noundef %11, ptr noundef nonnull %15) #3
  %17 = load ptr, ptr @gconf, align 8, !tbaa !5
  %18 = load i64, ptr %17, align 8, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %.02734, i64 288
  %20 = load i64, ptr %19, align 8, !tbaa !19
  %21 = sub nsw i64 %18, %20
  %22 = sdiv i64 %21, 60
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.6, i64 noundef %22) #3
  %24 = getelementptr inbounds i8, ptr %.02734, i64 296
  %.02629 = load ptr, ptr %24, align 8, !tbaa !5
  %.not2830 = icmp eq ptr %.02629, null
  br i1 %.not2830, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph37, %.lr.ph
  %.02632 = phi ptr [ %.026, %.lr.ph ], [ %.02629, %.lr.ph37 ]
  %.02531 = phi i32 [ %32, %.lr.ph ], [ 0, %.lr.ph37 ]
  %25 = getelementptr inbounds i8, ptr %.02632, i64 8
  %26 = tail call ptr @str_addr(ptr noundef nonnull %25) #3
  %27 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.7, ptr noundef %26) #3
  %28 = getelementptr inbounds i8, ptr %.02632, i64 136
  %29 = load i32, ptr %28, align 8, !tbaa !20
  %30 = tail call ptr @str_state(i32 noundef %29)
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.8, ptr noundef %30) #3
  %32 = add nuw nsw i32 %.02531, 1
  %.026 = load ptr, ptr %.02632, align 8, !tbaa !5
  %.not28 = icmp eq ptr %.026, null
  br i1 %.not28, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph37
  %.025.lcssa = phi i32 [ 0, %.lr.ph37 ], [ %32, %.lr.ph ]
  %33 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.9, i32 noundef %.025.lcssa) #3
  %34 = add nuw nsw i32 %.035, 1
  %35 = load ptr, ptr %.02734, align 8, !tbaa !26
  %.not = icmp eq ptr %35, null
  br i1 %.not, label %._crit_edge38, label %.lr.ph37, !llvm.loop !27

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

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

declare ptr @str_id(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @str_callback(ptr noundef) local_unnamed_addr #0

declare ptr @str_addr(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden ptr @str_state(i32 noundef) local_unnamed_addr #0

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

!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 304}
!10 = !{!"search_t", !6, i64 0, !7, i64 8, !7, i64 28, !11, i64 284, !12, i64 288, !6, i64 296, !6, i64 304}
!11 = !{!"_Bool", !7, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!10, !11, i64 284}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = !{!17, !12, i64 0}
!17 = !{!"gconf_t", !12, i64 0, !12, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !11, i64 57, !18, i64 60, !18, i64 64, !18, i64 68, !18, i64 72, !6, i64 80, !7, i64 88, !7, i64 89, !12, i64 104, !12, i64 112, !12, i64 120, !7, i64 128, !7, i64 160}
!18 = !{!"int", !7, i64 0}
!19 = !{!10, !12, i64 288}
!20 = !{!21, !18, i64 136}
!21 = !{!"result_t", !6, i64 0, !22, i64 8, !18, i64 136}
!22 = !{!"sockaddr_storage", !23, i64 0, !7, i64 2, !12, i64 120}
!23 = !{!"short", !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!10, !6, i64 0}
!27 = distinct !{!27, !25}


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