; LLVM IR from pandax381/microps :: udp (udp_sendto)

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

%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 }
%struct.ip_endpoint = type { i32, i16 }
%struct.udp_pcb = type { i32, %struct.ip_endpoint, %struct.queue_head, %struct.sched_ctx }
%struct.queue_head = type { ptr, ptr, i32 }
%struct.sched_ctx = type { %union.pthread_cond_t, i32, i32 }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.ip_iface = type { %struct.net_iface, ptr, i32, i32, i32 }
%struct.net_iface = type { ptr, ptr, i32 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [57 x i8], align 1
@mutex = external hidden global %union.pthread_mutex_t, align 8
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@__func__.udp_sendto = external hidden unnamed_addr constant [11 x i8], align 1
@IP_ADDR_ANY = external constant i32, align 4
@.str.10 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @udp_output(ptr noundef, ptr noundef, ptr noundef, i64 noundef) #0

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

declare i32 @lprintf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) #2

declare zeroext i16 @hton16(i16 noundef zeroext) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @mutex_lock(ptr noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @mutex_unlock(ptr noundef) #3

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

; Function Attrs: nounwind uwtable
declare hidden ptr @udp_pcb_select(i32 noundef, i16 noundef zeroext) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @udp_sendto(i32 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca %struct.ip_endpoint, align 4
  %12 = alloca ptr, align 8
  %13 = alloca [16 x i8], align 16
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  store i32 %0, ptr %6, align 4, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !9
  store i64 %2, ptr %8, align 8, !tbaa !11
  store ptr %3, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  %16 = call i32 @mutex_lock(ptr noundef @mutex)
  %17 = load i32, ptr %6, align 4, !tbaa !5
  %18 = call ptr @udp_pcb_get(i32 noundef %17)
  store ptr %18, ptr %10, align 8, !tbaa !9
  %19 = load ptr, ptr %10, align 8, !tbaa !9
  %20 = icmp ne ptr %19, null
  br i1 %20, label %26, label %21

21:                                               ; preds = %4
  %22 = load ptr, ptr @stderr, align 8, !tbaa !9
  %23 = load i32, ptr %6, align 4, !tbaa !5
  %24 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %22, i32 noundef 69, ptr noundef @.str, i32 noundef 351, ptr noundef @__func__.udp_sendto, ptr noundef @.str.7, i32 noundef %23)
  %25 = call i32 @mutex_unlock(ptr noundef @mutex)
  store i64 -1, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %121

26:                                               ; preds = %4
  %27 = load ptr, ptr %10, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct.udp_pcb, ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds %struct.ip_endpoint, ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 4, !tbaa !13
  %31 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 0
  store i32 %30, ptr %31, align 4, !tbaa !19
  %32 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 0
  %33 = load i32, ptr %32, align 4, !tbaa !19
  %34 = load i32, ptr @IP_ADDR_ANY, align 4, !tbaa !5
  %35 = icmp eq i32 %33, %34
  br i1 %35, label %36, label %63

36:                                               ; preds = %26
  %37 = load ptr, ptr %9, align 8, !tbaa !9
  %38 = getelementptr inbounds %struct.ip_endpoint, ptr %37, i32 0, i32 0
  %39 = load i32, ptr %38, align 4, !tbaa !19
  %40 = call ptr @ip_route_get_iface(i32 noundef %39)
  store ptr %40, ptr %12, align 8, !tbaa !9
  %41 = load ptr, ptr %12, align 8, !tbaa !9
  %42 = icmp ne ptr %41, null
  br i1 %42, label %52, label %43

43:                                               ; preds = %36
  %44 = load ptr, ptr @stderr, align 8, !tbaa !9
  %45 = load ptr, ptr %9, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.ip_endpoint, ptr %45, i32 0, i32 0
  %47 = load i32, ptr %46, align 4, !tbaa !19
  %48 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %49 = call ptr @ip_addr_ntop(i32 noundef %47, ptr noundef %48, i64 noundef 16)
  %50 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %44, i32 noundef 69, ptr noundef @.str, i32 noundef 360, ptr noundef @__func__.udp_sendto, ptr noundef @.str.10, ptr noundef %49)
  %51 = call i32 @mutex_unlock(ptr noundef @mutex)
  store i64 -1, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %121

52:                                               ; preds = %36
  %53 = load ptr, ptr %12, align 8, !tbaa !9
  %54 = getelementptr inbounds %struct.ip_iface, ptr %53, i32 0, i32 2
  %55 = load i32, ptr %54, align 8, !tbaa !20
  %56 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 0
  store i32 %55, ptr %56, align 4, !tbaa !19
  %57 = load ptr, ptr @stderr, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !19
  %60 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %61 = call ptr @ip_addr_ntop(i32 noundef %59, ptr noundef %60, i64 noundef 16)
  %62 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %57, i32 noundef 68, ptr noundef @.str, i32 noundef 365, ptr noundef @__func__.udp_sendto, ptr noundef @.str.11, ptr noundef %61)
  br label %63

63:                                               ; preds = %52, %26
  %64 = load ptr, ptr %10, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct.udp_pcb, ptr %64, i32 0, i32 1
  %66 = getelementptr inbounds %struct.ip_endpoint, ptr %65, i32 0, i32 1
  %67 = load i16, ptr %66, align 4, !tbaa !23
  %68 = icmp ne i16 %67, 0
  br i1 %68, label %110, label %69

69:                                               ; preds = %63
  store i32 49152, ptr %14, align 4, !tbaa !5
  br label %70

70:                                               ; preds = %92, %69
  %71 = load i32, ptr %14, align 4, !tbaa !5
  %72 = icmp ule i32 %71, 65535
  br i1 %72, label %73, label %95

73:                                               ; preds = %70
  %74 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 0
  %75 = load i32, ptr %74, align 4, !tbaa !19
  %76 = load i32, ptr %14, align 4, !tbaa !5
  %77 = trunc i32 %76 to i16
  %78 = call zeroext i16 @hton16(i16 noundef zeroext %77)
  %79 = call ptr @udp_pcb_select(i32 noundef %75, i16 noundef zeroext %78)
  %80 = icmp ne ptr %79, null
  br i1 %80, label %91, label %81

81:                                               ; preds = %73
  %82 = load i32, ptr %14, align 4, !tbaa !5
  %83 = trunc i32 %82 to i16
  %84 = call zeroext i16 @hton16(i16 noundef zeroext %83)
  %85 = load ptr, ptr %10, align 8, !tbaa !9
  %86 = getelementptr inbounds %struct.udp_pcb, ptr %85, i32 0, i32 1
  %87 = getelementptr inbounds %struct.ip_endpoint, ptr %86, i32 0, i32 1
  store i16 %84, ptr %87, align 4, !tbaa !23
  %88 = load ptr, ptr @stderr, align 8, !tbaa !9
  %89 = load i32, ptr %14, align 4, !tbaa !5
  %90 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %88, i32 noundef 68, ptr noundef @.str, i32 noundef 371, ptr noundef @__func__.udp_sendto, ptr noundef @.str.12, i32 noundef %89)
  br label %95

91:                                               ; preds = %73
  br label %92

92:                                               ; preds = %91
  %93 = load i32, ptr %14, align 4, !tbaa !5
  %94 = add i32 %93, 1
  store i32 %94, ptr %14, align 4, !tbaa !5
  br label %70, !llvm.loop !24

95:                                               ; preds = %81, %70
  %96 = load ptr, ptr %10, align 8, !tbaa !9
  %97 = getelementptr inbounds %struct.udp_pcb, ptr %96, i32 0, i32 1
  %98 = getelementptr inbounds %struct.ip_endpoint, ptr %97, i32 0, i32 1
  %99 = load i16, ptr %98, align 4, !tbaa !23
  %100 = icmp ne i16 %99, 0
  br i1 %100, label %109, label %101

101:                                              ; preds = %95
  %102 = load ptr, ptr @stderr, align 8, !tbaa !9
  %103 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 0
  %104 = load i32, ptr %103, align 4, !tbaa !19
  %105 = getelementptr inbounds [16 x i8], ptr %13, i64 0, i64 0
  %106 = call ptr @ip_addr_ntop(i32 noundef %104, ptr noundef %105, i64 noundef 16)
  %107 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %102, i32 noundef 68, ptr noundef @.str, i32 noundef 376, ptr noundef @__func__.udp_sendto, ptr noundef @.str.13, ptr noundef %106)
  %108 = call i32 @mutex_unlock(ptr noundef @mutex)
  store i64 -1, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %121

109:                                              ; preds = %95
  br label %110

110:                                              ; preds = %109, %63
  %111 = load ptr, ptr %10, align 8, !tbaa !9
  %112 = getelementptr inbounds %struct.udp_pcb, ptr %111, i32 0, i32 1
  %113 = getelementptr inbounds %struct.ip_endpoint, ptr %112, i32 0, i32 1
  %114 = load i16, ptr %113, align 4, !tbaa !23
  %115 = getelementptr inbounds %struct.ip_endpoint, ptr %11, i32 0, i32 1
  store i16 %114, ptr %115, align 4, !tbaa !26
  %116 = call i32 @mutex_unlock(ptr noundef @mutex)
  %117 = load ptr, ptr %9, align 8, !tbaa !9
  %118 = load ptr, ptr %7, align 8, !tbaa !9
  %119 = load i64, ptr %8, align 8, !tbaa !11
  %120 = call i64 @udp_output(ptr noundef %11, ptr noundef %117, ptr noundef %118, i64 noundef %119)
  store i64 %120, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %121

121:                                              ; preds = %110, %101, %43, %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  %122 = load i64, ptr %5, align 8
  ret i64 %122
}

declare ptr @ip_route_get_iface(i32 noundef) #2

declare ptr @ip_addr_ntop(i32 noundef, ptr noundef, i64 noundef) #2

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"udp_pcb", !6, i64 0, !15, i64 4, !17, i64 16, !18, i64 40}
!15 = !{!"ip_endpoint", !6, i64 0, !16, i64 4}
!16 = !{!"short", !7, i64 0}
!17 = !{!"queue_head", !10, i64 0, !10, i64 8, !6, i64 16}
!18 = !{!"sched_ctx", !7, i64 0, !6, i64 48, !6, i64 52}
!19 = !{!15, !6, i64 0}
!20 = !{!21, !6, i64 32}
!21 = !{!"ip_iface", !22, i64 0, !10, i64 24, !6, i64 32, !6, i64 36, !6, i64 40}
!22 = !{!"net_iface", !10, i64 0, !10, i64 8, !6, i64 16}
!23 = !{!14, !16, i64 8}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!15, !16, i64 4}


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

%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 }
%struct.ip_endpoint = type { i32, i16 }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [57 x i8], align 1
@mutex = external hidden global %union.pthread_mutex_t, align 8
@.str.7 = external hidden unnamed_addr constant [21 x i8], align 1
@__func__.udp_sendto = external hidden unnamed_addr constant [11 x i8], align 1
@IP_ADDR_ANY = external local_unnamed_addr constant i32, align 4
@.str.10 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local i64 @udp_output(ptr noundef, ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #0

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

declare i32 @lprintf(ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #2

declare zeroext i16 @hton16(i16 noundef zeroext) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @mutex_lock(ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden i32 @mutex_unlock(ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nounwind uwtable
declare hidden ptr @udp_pcb_select(i32 noundef, i16 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i64 @udp_sendto(i32 noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca %struct.ip_endpoint, align 4
  %6 = alloca [16 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #4
  %7 = tail call i32 @mutex_lock(ptr noundef nonnull @mutex)
  %8 = tail call ptr @udp_pcb_get(i32 noundef %0)
  %.not = icmp eq ptr %8, null
  br i1 %.not, label %9, label %13

9:                                                ; preds = %4
  %10 = load ptr, ptr @stderr, align 8, !tbaa !5
  %11 = tail call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %10, i32 noundef 69, ptr noundef nonnull @.str, i32 noundef 351, ptr noundef nonnull @__func__.udp_sendto, ptr noundef nonnull @.str.7, i32 noundef %0) #4
  %12 = tail call i32 @mutex_unlock(ptr noundef nonnull @mutex)
  br label %57

13:                                               ; preds = %4
  %14 = getelementptr inbounds i8, ptr %8, i64 4
  %15 = load i32, ptr %14, align 4, !tbaa !9
  store i32 %15, ptr %5, align 4, !tbaa !16
  %16 = load i32, ptr @IP_ADDR_ANY, align 4, !tbaa !17
  %17 = icmp eq i32 %15, %16
  br i1 %17, label %18, label %33

18:                                               ; preds = %13
  %19 = load i32, ptr %3, align 4, !tbaa !16
  %20 = tail call ptr @ip_route_get_iface(i32 noundef %19) #4
  %.not23 = icmp eq ptr %20, null
  br i1 %.not23, label %21, label %27

21:                                               ; preds = %18
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = load i32, ptr %3, align 4, !tbaa !16
  %24 = call ptr @ip_addr_ntop(i32 noundef %23, ptr noundef nonnull %6, i64 noundef 16) #4
  %25 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %22, i32 noundef 69, ptr noundef nonnull @.str, i32 noundef 360, ptr noundef nonnull @__func__.udp_sendto, ptr noundef nonnull @.str.10, ptr noundef %24) #4
  %26 = call i32 @mutex_unlock(ptr noundef nonnull @mutex)
  br label %57

27:                                               ; preds = %18
  %28 = getelementptr inbounds i8, ptr %20, i64 32
  %29 = load i32, ptr %28, align 8, !tbaa !18
  store i32 %29, ptr %5, align 4, !tbaa !16
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call ptr @ip_addr_ntop(i32 noundef %29, ptr noundef nonnull %6, i64 noundef 16) #4
  %32 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %30, i32 noundef 68, ptr noundef nonnull @.str, i32 noundef 365, ptr noundef nonnull @__func__.udp_sendto, ptr noundef nonnull @.str.11, ptr noundef %31) #4
  br label %33

33:                                               ; preds = %27, %13
  %34 = phi i32 [ %29, %27 ], [ %15, %13 ]
  %35 = getelementptr inbounds i8, ptr %8, i64 8
  %36 = load i16, ptr %35, align 4, !tbaa !21
  %.not24 = icmp eq i16 %36, 0
  br i1 %.not24, label %.preheader, label %52

.preheader:                                       ; preds = %33, %44
  %.028 = phi i32 [ %45, %44 ], [ 49152, %33 ]
  %37 = trunc nuw i32 %.028 to i16
  %38 = call zeroext i16 @hton16(i16 noundef zeroext %37) #4
  %39 = call ptr @udp_pcb_select(i32 noundef %34, i16 noundef zeroext %38)
  %.not25 = icmp eq ptr %39, null
  br i1 %.not25, label %40, label %44

40:                                               ; preds = %.preheader
  %41 = call zeroext i16 @hton16(i16 noundef zeroext %37) #4
  store i16 %41, ptr %35, align 4, !tbaa !21
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %42, i32 noundef 68, ptr noundef nonnull @.str, i32 noundef 371, ptr noundef nonnull @__func__.udp_sendto, ptr noundef nonnull @.str.12, i32 noundef %.028) #4
  br label %.loopexit

44:                                               ; preds = %.preheader
  %45 = add nuw nsw i32 %.028, 1
  %exitcond.not = icmp eq i32 %45, 65536
  br i1 %exitcond.not, label %.loopexit, label %.preheader, !llvm.loop !22

.loopexit:                                        ; preds = %44, %40
  %46 = load i16, ptr %35, align 4, !tbaa !21
  %.not26 = icmp eq i16 %46, 0
  br i1 %.not26, label %47, label %52

47:                                               ; preds = %.loopexit
  %48 = load ptr, ptr @stderr, align 8, !tbaa !5
  %49 = call ptr @ip_addr_ntop(i32 noundef %34, ptr noundef nonnull %6, i64 noundef 16) #4
  %50 = call i32 (ptr, i32, ptr, i32, ptr, ptr, ...) @lprintf(ptr noundef %48, i32 noundef 68, ptr noundef nonnull @.str, i32 noundef 376, ptr noundef nonnull @__func__.udp_sendto, ptr noundef nonnull @.str.13, ptr noundef %49) #4
  %51 = call i32 @mutex_unlock(ptr noundef nonnull @mutex)
  br label %57

52:                                               ; preds = %.loopexit, %33
  %53 = phi i16 [ %46, %.loopexit ], [ %36, %33 ]
  %54 = getelementptr inbounds i8, ptr %5, i64 4
  store i16 %53, ptr %54, align 4, !tbaa !24
  %55 = call i32 @mutex_unlock(ptr noundef nonnull @mutex)
  %56 = call i64 @udp_output(ptr noundef nonnull %5, ptr noundef %3, ptr noundef %1, i64 noundef %2)
  br label %57

57:                                               ; preds = %52, %47, %21, %9
  %.020 = phi i64 [ %56, %52 ], [ -1, %47 ], [ -1, %21 ], [ -1, %9 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #4
  ret i64 %.020
}

declare ptr @ip_route_get_iface(i32 noundef) local_unnamed_addr #2

declare ptr @ip_addr_ntop(i32 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 4}
!10 = !{!"udp_pcb", !11, i64 0, !12, i64 4, !14, i64 16, !15, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!"ip_endpoint", !11, i64 0, !13, i64 4}
!13 = !{!"short", !7, i64 0}
!14 = !{!"queue_head", !6, i64 0, !6, i64 8, !11, i64 16}
!15 = !{!"sched_ctx", !7, i64 0, !11, i64 48, !11, i64 52}
!16 = !{!12, !11, i64 0}
!17 = !{!11, !11, i64 0}
!18 = !{!19, !11, i64 32}
!19 = !{!"ip_iface", !20, i64 0, !6, i64 24, !11, i64 32, !11, i64 36, !11, i64 40}
!20 = !{!"net_iface", !6, i64 0, !6, i64 8, !11, i64 16}
!21 = !{!10, !13, i64 8}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!12, !13, i64 4}


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