; LLVM IR from uNetworking/uSockets :: examples (udp_benchmark)

; 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.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.sockaddr_in6 = type { i16, i16, i32, %struct.in6_addr, i32 }
%struct.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@send_buf = external dso_local global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @on_wakeup(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @on_pre(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @on_post(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @timer_cb(ptr noundef) #0

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local void @on_server_drain(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @on_server_data(ptr noundef, ptr noundef, i32 noundef) #0

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

declare void @us_udp_buffer_set_packet_payload(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  %13 = alloca %struct.sockaddr_storage, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 1
  br i1 %20, label %21, label %32

21:                                               ; preds = %2
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = load i32, ptr %4, align 4, !tbaa !5
  %24 = sub nsw i32 %23, 1
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds ptr, ptr %22, i64 %25
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = call i32 @strcmp(ptr noundef %27, ptr noundef @.str.2) #7
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %32, label %30

30:                                               ; preds = %21
  store i32 1, ptr %7, align 4, !tbaa !5
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %32

32:                                               ; preds = %30, %21, %2
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = icmp sge i32 %33, 2
  br i1 %34, label %35, label %43

35:                                               ; preds = %32
  %36 = load ptr, ptr %5, align 8, !tbaa !9
  %37 = getelementptr inbounds ptr, ptr %36, i64 1
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = call i32 @strcmp(ptr noundef %38, ptr noundef @.str.4) #7
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %43, label %41

41:                                               ; preds = %35
  store i32 1, ptr %6, align 4, !tbaa !5
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  br label %45

43:                                               ; preds = %35, %32
  %44 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  br label %45

45:                                               ; preds = %43, %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %46 = call ptr (...) @us_create_udp_packet_buffer()
  store ptr %46, ptr %8, align 8, !tbaa !9
  %47 = call ptr (...) @us_create_udp_packet_buffer()
  store ptr %47, ptr @send_buf, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %48 = call ptr @us_create_loop(ptr noundef null, ptr noundef @on_wakeup, ptr noundef @on_pre, ptr noundef @on_post, i32 noundef 0)
  store ptr %48, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = icmp ne i32 %49, 0
  br i1 %50, label %51, label %63

51:                                               ; preds = %45
  %52 = load i32, ptr %7, align 4, !tbaa !5
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %58

54:                                               ; preds = %51
  %55 = load ptr, ptr %9, align 8, !tbaa !9
  %56 = load ptr, ptr %8, align 8, !tbaa !9
  %57 = call ptr @us_create_udp_socket(ptr noundef %55, ptr noundef %56, ptr noundef @on_server_data, ptr noundef @on_server_drain, ptr noundef @.str.7, i16 noundef zeroext 0, ptr noundef null)
  store ptr %57, ptr %11, align 8, !tbaa !9
  br label %62

58:                                               ; preds = %51
  %59 = load ptr, ptr %9, align 8, !tbaa !9
  %60 = load ptr, ptr %8, align 8, !tbaa !9
  %61 = call ptr @us_create_udp_socket(ptr noundef %59, ptr noundef %60, ptr noundef @on_server_data, ptr noundef @on_server_drain, ptr noundef @.str.8, i16 noundef zeroext 0, ptr noundef null)
  store ptr %61, ptr %11, align 8, !tbaa !9
  br label %62

62:                                               ; preds = %58, %54
  br label %75

63:                                               ; preds = %45
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %70

66:                                               ; preds = %63
  %67 = load ptr, ptr %9, align 8, !tbaa !9
  %68 = load ptr, ptr %8, align 8, !tbaa !9
  %69 = call ptr @us_create_udp_socket(ptr noundef %67, ptr noundef %68, ptr noundef @on_server_data, ptr noundef @on_server_drain, ptr noundef @.str.7, i16 noundef zeroext 5678, ptr noundef null)
  store ptr %69, ptr %10, align 8, !tbaa !9
  br label %74

70:                                               ; preds = %63
  %71 = load ptr, ptr %9, align 8, !tbaa !9
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = call ptr @us_create_udp_socket(ptr noundef %71, ptr noundef %72, ptr noundef @on_server_data, ptr noundef @on_server_drain, ptr noundef @.str.8, i16 noundef zeroext 5678, ptr noundef null)
  store ptr %73, ptr %10, align 8, !tbaa !9
  br label %74

74:                                               ; preds = %70, %66
  br label %75

75:                                               ; preds = %74, %62
  %76 = load ptr, ptr %11, align 8, !tbaa !9
  %77 = icmp ne ptr %76, null
  br i1 %77, label %83, label %78

78:                                               ; preds = %75
  %79 = load ptr, ptr %10, align 8, !tbaa !9
  %80 = icmp ne ptr %79, null
  br i1 %80, label %83, label %81

81:                                               ; preds = %78
  %82 = call i32 (ptr, ...) @printf(ptr noundef @.str.9)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %12, align 4
  br label %130

83:                                               ; preds = %78, %75
  call void @llvm.lifetime.start.p0(i64 128, ptr %13) #6
  call void @llvm.memset.p0.i64(ptr align 8 %13, i8 0, i64 128, i1 false)
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = icmp ne i32 %84, 0
  br i1 %85, label %86, label %96

86:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  store ptr %13, ptr %14, align 8, !tbaa !9
  %87 = load ptr, ptr %14, align 8, !tbaa !9
  %88 = getelementptr inbounds %struct.sockaddr_in6, ptr %87, i32 0, i32 3
  %89 = getelementptr inbounds %struct.in6_addr, ptr %88, i32 0, i32 0
  %90 = getelementptr inbounds [16 x i8], ptr %89, i64 0, i64 15
  store i8 1, ptr %90, align 1, !tbaa !11
  %91 = call zeroext i16 @__bswap_16(i16 noundef zeroext 5678)
  %92 = load ptr, ptr %14, align 8, !tbaa !9
  %93 = getelementptr inbounds %struct.sockaddr_in6, ptr %92, i32 0, i32 1
  store i16 %91, ptr %93, align 2, !tbaa !12
  %94 = load ptr, ptr %14, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct.sockaddr_in6, ptr %94, i32 0, i32 0
  store i16 10, ptr %95, align 4, !tbaa !16
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %105

96:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  store ptr %13, ptr %15, align 8, !tbaa !9
  %97 = load ptr, ptr %15, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.sockaddr_in, ptr %97, i32 0, i32 2
  %99 = getelementptr inbounds %struct.in_addr, ptr %98, i32 0, i32 0
  store i32 16777343, ptr %99, align 4, !tbaa !17
  %100 = call zeroext i16 @__bswap_16(i16 noundef zeroext 5678)
  %101 = load ptr, ptr %15, align 8, !tbaa !9
  %102 = getelementptr inbounds %struct.sockaddr_in, ptr %101, i32 0, i32 1
  store i16 %100, ptr %102, align 2, !tbaa !20
  %103 = load ptr, ptr %15, align 8, !tbaa !9
  %104 = getelementptr inbounds %struct.sockaddr_in, ptr %103, i32 0, i32 0
  store i16 2, ptr %104, align 4, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %105

105:                                              ; preds = %96, %86
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = icmp ne i32 %106, 0
  br i1 %107, label %108, label %125

108:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %109

109:                                              ; preds = %116, %108
  %110 = load i32, ptr %16, align 4, !tbaa !5
  %111 = icmp slt i32 %110, 40
  br i1 %111, label %113, label %112

112:                                              ; preds = %109
  store i32 2, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %119

113:                                              ; preds = %109
  %114 = load ptr, ptr @send_buf, align 8, !tbaa !9
  %115 = load i32, ptr %16, align 4, !tbaa !5
  call void @us_udp_buffer_set_packet_payload(ptr noundef %114, i32 noundef %115, i32 noundef 0, ptr noundef @.str.10, i32 noundef 10, ptr noundef %13)
  br label %116

116:                                              ; preds = %113
  %117 = load i32, ptr %16, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  store i32 %118, ptr %16, align 4, !tbaa !5
  br label %109, !llvm.loop !22

119:                                              ; preds = %112
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #6
  %120 = load ptr, ptr %11, align 8, !tbaa !9
  %121 = load ptr, ptr @send_buf, align 8, !tbaa !9
  %122 = call i32 @us_udp_socket_send(ptr noundef %120, ptr noundef %121, i32 noundef 40)
  store i32 %122, ptr %17, align 4, !tbaa !5
  %123 = load i32, ptr %17, align 4, !tbaa !5
  %124 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i32 noundef %123)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #6
  br label %125

125:                                              ; preds = %119, %105
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #6
  %126 = load ptr, ptr %9, align 8, !tbaa !9
  %127 = call ptr @us_create_timer(ptr noundef %126, i32 noundef 0, i32 noundef 0)
  store ptr %127, ptr %18, align 8, !tbaa !9
  %128 = load ptr, ptr %18, align 8, !tbaa !9
  call void @us_timer_set(ptr noundef %128, ptr noundef @timer_cb, i32 noundef 1000, i32 noundef 1000)
  %129 = load ptr, ptr %9, align 8, !tbaa !9
  call void @us_loop_run(ptr noundef %129)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %13) #6
  store i32 0, ptr %12, align 4
  br label %130

130:                                              ; preds = %125, %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  %131 = load i32, ptr %12, align 4
  switch i32 %131, label %134 [
    i32 0, label %132
    i32 1, label %132
  ]

132:                                              ; preds = %130, %130
  %133 = load i32, ptr %3, align 4
  ret i32 %133

134:                                              ; preds = %130
  unreachable
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #3

declare ptr @us_create_udp_packet_buffer(...) #1

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

declare ptr @us_create_udp_socket(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16 noundef zeroext, ptr noundef) #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) #5

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

declare void @us_timer_set(ptr noundef, ptr noundef, i32 noundef, i32 noundef) #1

declare void @us_loop_run(ptr noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { 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 = !{!"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 = !{!7, !7, i64 0}
!12 = !{!13, !14, i64 2}
!13 = !{!"sockaddr_in6", !14, i64 0, !14, i64 2, !6, i64 4, !15, i64 8, !6, i64 24}
!14 = !{!"short", !7, i64 0}
!15 = !{!"in6_addr", !7, i64 0}
!16 = !{!13, !14, i64 0}
!17 = !{!18, !6, i64 4}
!18 = !{!"sockaddr_in", !14, i64 0, !14, i64 2, !19, i64 4, !7, i64 8}
!19 = !{!"in_addr", !6, i64 0}
!20 = !{!18, !14, i64 2}
!21 = !{!18, !14, i64 0}
!22 = distinct !{!22, !23}
!23 = !{!"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"

%struct.sockaddr_storage = type { i16, [118 x i8], i64 }

@send_buf = external dso_local local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @on_wakeup(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @on_pre(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @on_post(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @timer_cb(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @on_server_drain(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @on_server_data(ptr noundef, ptr noundef, i32 noundef) #0

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

declare void @us_udp_buffer_set_packet_payload(ptr noundef, i32 noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

declare i32 @us_udp_socket_send(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local noundef range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.sockaddr_storage, align 8
  %4 = icmp sgt i32 %0, 1
  br i1 %4, label %5, label %17

5:                                                ; preds = %2
  %6 = zext nneg i32 %0 to i64
  %7 = getelementptr ptr, ptr %1, i64 %6
  %8 = getelementptr i8, ptr %7, i64 -8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %9, ptr noundef nonnull dereferenceable(1) @.str.2) #7
  %.not = icmp ne i32 %10, 0
  br i1 %.not, label %13, label %11

11:                                               ; preds = %5
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %13

13:                                               ; preds = %11, %5
  %14 = getelementptr inbounds i8, ptr %1, i64 8
  %15 = load ptr, ptr %14, align 8, !tbaa !5
  %16 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %15, ptr noundef nonnull dereferenceable(1) @.str.4) #7
  %.not41 = icmp ne i32 %16, 0
  %spec.select = select i1 %.not41, ptr @.str.6, ptr @.str.5
  br label %17

17:                                               ; preds = %13, %2
  %.str.6.sink = phi ptr [ @.str.6, %2 ], [ %spec.select, %13 ]
  %.not4347 = phi i1 [ true, %2 ], [ %.not, %13 ]
  %.not42 = phi i1 [ true, %2 ], [ %.not41, %13 ]
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.6.sink)
  %19 = tail call ptr (...) @us_create_udp_packet_buffer() #8
  %20 = tail call ptr (...) @us_create_udp_packet_buffer() #8
  store ptr %20, ptr @send_buf, align 8, !tbaa !5
  %21 = tail call ptr @us_create_loop(ptr noundef null, ptr noundef nonnull @on_wakeup, ptr noundef nonnull @on_pre, ptr noundef nonnull @on_post, i32 noundef 0) #8
  br i1 %.not42, label %27, label %22

22:                                               ; preds = %17
  br i1 %.not4347, label %25, label %23

23:                                               ; preds = %22
  %24 = tail call ptr @us_create_udp_socket(ptr noundef %21, ptr noundef %19, ptr noundef nonnull @on_server_data, ptr noundef nonnull @on_server_drain, ptr noundef nonnull @.str.7, i16 noundef zeroext 0, ptr noundef null) #8
  br label %32

25:                                               ; preds = %22
  %26 = tail call ptr @us_create_udp_socket(ptr noundef %21, ptr noundef %19, ptr noundef nonnull @on_server_data, ptr noundef nonnull @on_server_drain, ptr noundef nonnull @.str.8, i16 noundef zeroext 0, ptr noundef null) #8
  br label %34

27:                                               ; preds = %17
  br i1 %.not4347, label %30, label %28

28:                                               ; preds = %27
  %29 = tail call ptr @us_create_udp_socket(ptr noundef %21, ptr noundef %19, ptr noundef nonnull @on_server_data, ptr noundef nonnull @on_server_drain, ptr noundef nonnull @.str.7, i16 noundef zeroext 5678, ptr noundef null) #8
  br label %32

30:                                               ; preds = %27
  %31 = tail call ptr @us_create_udp_socket(ptr noundef %21, ptr noundef %19, ptr noundef nonnull @on_server_data, ptr noundef nonnull @on_server_drain, ptr noundef nonnull @.str.8, i16 noundef zeroext 5678, ptr noundef null) #8
  br label %34

32:                                               ; preds = %28, %23
  %.039 = phi ptr [ %24, %23 ], [ undef, %28 ]
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %3, i8 0, i64 128, i1 false)
  %33 = getelementptr inbounds i8, ptr %3, i64 23
  store i8 1, ptr %33, align 1, !tbaa !9
  br label %37

34:                                               ; preds = %25, %30
  %.039.ph = phi ptr [ undef, %30 ], [ %26, %25 ]
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #8
  %35 = getelementptr inbounds i8, ptr %3, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %35, i8 0, i64 120, i1 false)
  %36 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 16777343, ptr %36, align 4, !tbaa !10
  br label %37

37:                                               ; preds = %34, %32
  %.03954 = phi ptr [ %.039.ph, %34 ], [ %.039, %32 ]
  %storemerge = phi i16 [ 2, %34 ], [ 10, %32 ]
  %38 = tail call zeroext i16 @__bswap_16(i16 noundef zeroext 5678)
  %39 = getelementptr inbounds i8, ptr %3, i64 2
  store i16 %38, ptr %39, align 2, !tbaa !15
  store i16 %storemerge, ptr %3, align 8, !tbaa !15
  br i1 %.not42, label %46, label %.preheader

40:                                               ; preds = %.preheader
  %41 = load ptr, ptr @send_buf, align 8, !tbaa !5
  %42 = call i32 @us_udp_socket_send(ptr noundef %.03954, ptr noundef %41, i32 noundef 40) #8
  %43 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i32 noundef %42)
  br label %46

.preheader:                                       ; preds = %37, %.preheader
  %.03656 = phi i32 [ %45, %.preheader ], [ 0, %37 ]
  %44 = load ptr, ptr @send_buf, align 8, !tbaa !5
  call void @us_udp_buffer_set_packet_payload(ptr noundef %44, i32 noundef %.03656, i32 noundef 0, ptr noundef nonnull @.str.10, i32 noundef 10, ptr noundef nonnull %3) #8
  %45 = add nuw nsw i32 %.03656, 1
  %exitcond.not = icmp eq i32 %45, 40
  br i1 %exitcond.not, label %40, label %.preheader, !llvm.loop !16

46:                                               ; preds = %37, %40
  %47 = call ptr @us_create_timer(ptr noundef %21, i32 noundef 0, i32 noundef 0) #8
  call void @us_timer_set(ptr noundef %47, ptr noundef nonnull @timer_cb, i32 noundef 1000, i32 noundef 1000) #8
  call void @us_loop_run(ptr noundef %21) #8
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #8
  ret i32 0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #4

declare ptr @us_create_udp_packet_buffer(...) local_unnamed_addr #3

declare ptr @us_create_loop(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

declare ptr @us_create_udp_socket(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i16 noundef zeroext, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i16 @__bswap_16(i16 noundef zeroext) local_unnamed_addr #6

declare ptr @us_create_timer(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @us_timer_set(ptr noundef, ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #3

declare void @us_loop_run(ptr noundef) local_unnamed_addr #3

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #7 = { nounwind willreturn memory(read) }
attributes #8 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !14, i64 4}
!11 = !{!"sockaddr_in", !12, i64 0, !12, i64 2, !13, i64 4, !7, i64 8}
!12 = !{!"short", !7, i64 0}
!13 = !{!"in_addr", !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!12, !12, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass