; LLVM IR from golems/ach :: src/achd (transport)

; 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.achd_cx = type { %struct.achd_headers, i32, i32, i32, i32, ptr, i32, %struct.ach_channel, ptr }
%struct.achd_headers = type { ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr, ptr, i32, i32, ptr }
%struct.ach_channel = type { %union.anon }
%union.anon = type { [16 x i64] }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.pollfd = type { i32, i16, i16 }
%struct.achd_conn = type { i32, %struct.timespec, %struct.timespec, %struct.achd_headers, %struct.achd_headers, i32, i32, i32, i64, ptr, ptr, ptr }
%struct.timespec = type { i64, i64 }
%struct.ach_pipe_frame_t = type { [8 x i8], [8 x i8], [1 x i8] }

@cx = external global %struct.achd_cx, align 8
@ach_verbosity = external global i32, align 4
@.str.13 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [45 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: nounwind
declare ptr @strerror(i32 noundef) #1

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #2

declare void @ach_log(i32 noundef, ptr noundef, ...) #3

; Function Attrs: nounwind
declare ptr @inet_ntoa(i32) #1

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

; 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
declare hidden void @get_frame(ptr noundef) #5

declare i64 @ach_pipe_get_size(ptr noundef) #3

declare i32 @achd_reconnect(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @achd_push_udp(ptr noundef %0) #5 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.sockaddr_in, align 4
  %6 = alloca [2 x %struct.pollfd], align 16
  %7 = alloca i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #6
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  call void @udp_peer(ptr noundef %11, ptr noundef %5)
  %12 = load i32, ptr @ach_verbosity, align 4, !tbaa !9
  %13 = add nsw i32 5, %12
  %14 = icmp sle i32 6, %13
  br i1 %14, label %15, label %24

15:                                               ; preds = %1
  %16 = getelementptr inbounds %struct.sockaddr_in, ptr %5, i32 0, i32 2
  %17 = getelementptr inbounds %struct.in_addr, ptr %16, i32 0, i32 0
  %18 = load i32, ptr %17, align 4
  %19 = call ptr @inet_ntoa(i32 %18) #6
  %20 = getelementptr inbounds %struct.sockaddr_in, ptr %5, i32 0, i32 1
  %21 = load i16, ptr %20, align 2, !tbaa !11
  %22 = call zeroext i16 @__bswap_16(i16 noundef zeroext %21)
  %23 = zext i16 %22 to i32
  call void (i32, ptr, ...) @ach_log(i32 noundef 6, ptr noundef @.str.13, ptr noundef %19, i32 noundef %23)
  br label %24

24:                                               ; preds = %15, %1
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #6
  %25 = getelementptr inbounds %struct.pollfd, ptr %6, i32 0, i32 0
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.achd_conn, ptr %26, i32 0, i32 7
  %28 = load i32, ptr %27, align 8, !tbaa !15
  store i32 %28, ptr %25, align 8, !tbaa !20
  %29 = getelementptr inbounds %struct.pollfd, ptr %6, i32 0, i32 1
  store i16 4, ptr %29, align 4, !tbaa !22
  %30 = getelementptr inbounds %struct.pollfd, ptr %6, i32 0, i32 2
  store i16 0, ptr %30, align 2, !tbaa !23
  %31 = getelementptr inbounds %struct.pollfd, ptr %6, i64 1
  %32 = getelementptr inbounds %struct.pollfd, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %2, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.achd_conn, ptr %33, i32 0, i32 5
  %35 = load i32, ptr %34, align 8, !tbaa !24
  store i32 %35, ptr %32, align 8, !tbaa !20
  %36 = getelementptr inbounds %struct.pollfd, ptr %31, i32 0, i32 1
  store i16 1, ptr %36, align 4, !tbaa !22
  %37 = getelementptr inbounds %struct.pollfd, ptr %31, i32 0, i32 2
  store i16 0, ptr %37, align 2, !tbaa !23
  br label %38

38:                                               ; preds = %186, %184, %24
  %39 = load i32, ptr getelementptr inbounds (%struct.achd_cx, ptr @cx, i32 0, i32 6), align 8, !tbaa !25
  %40 = icmp ne i32 %39, 0
  %41 = xor i1 %40, true
  br i1 %41, label %42, label %187

42:                                               ; preds = %38
  %43 = load ptr, ptr %2, align 8, !tbaa !5
  call void @get_frame(ptr noundef %43)
  %44 = load i32, ptr getelementptr inbounds (%struct.achd_cx, ptr @cx, i32 0, i32 6), align 8, !tbaa !25
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %47

46:                                               ; preds = %42
  br label %187

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %48 = load ptr, ptr %2, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.achd_conn, ptr %48, i32 0, i32 9
  %50 = load ptr, ptr %49, align 8, !tbaa !28
  %51 = call i64 @ach_pipe_get_size(ptr noundef %50)
  store i64 %51, ptr %7, align 8, !tbaa !29
  %52 = load i64, ptr %7, align 8, !tbaa !29
  %53 = icmp ugt i64 %52, 65535
  br i1 %53, label %54, label %65

54:                                               ; preds = %47
  %55 = load i32, ptr %4, align 4, !tbaa !9
  %56 = icmp ne i32 %55, 0
  br i1 %56, label %64, label %57

57:                                               ; preds = %54
  %58 = load i32, ptr @ach_verbosity, align 4, !tbaa !9
  %59 = add nsw i32 5, %58
  %60 = icmp sle i32 3, %59
  br i1 %60, label %61, label %63

61:                                               ; preds = %57
  %62 = load i64, ptr %7, align 8, !tbaa !29
  call void (i32, ptr, ...) @ach_log(i32 noundef 3, ptr noundef @.str.14, i64 noundef %62)
  br label %63

63:                                               ; preds = %61, %57
  store i32 1, ptr %4, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %63, %54
  store i32 2, ptr %8, align 4
  br label %184, !llvm.loop !30

65:                                               ; preds = %47
  %66 = load i64, ptr %7, align 8, !tbaa !29
  %67 = add i64 %66, 8
  %68 = add i64 %67, 20
  %69 = icmp ugt i64 %68, 1500
  br i1 %69, label %70, label %82

70:                                               ; preds = %65
  %71 = load i32, ptr %3, align 4, !tbaa !9
  %72 = icmp ne i32 %71, 0
  br i1 %72, label %82, label %73

73:                                               ; preds = %70
  %74 = load i32, ptr @ach_verbosity, align 4, !tbaa !9
  %75 = add nsw i32 5, %74
  %76 = icmp sle i32 4, %75
  br i1 %76, label %77, label %81

77:                                               ; preds = %73
  %78 = load i64, ptr %7, align 8, !tbaa !29
  %79 = add i64 %78, 8
  %80 = add i64 %79, 20
  call void (i32, ptr, ...) @ach_log(i32 noundef 4, ptr noundef @.str.15, i64 noundef %80)
  br label %81

81:                                               ; preds = %77, %73
  store i32 1, ptr %3, align 4, !tbaa !9
  br label %82

82:                                               ; preds = %81, %70, %65
  br label %83

83:                                               ; preds = %82
  %84 = getelementptr inbounds [2 x %struct.pollfd], ptr %6, i64 0, i64 0
  %85 = getelementptr inbounds %struct.pollfd, ptr %84, i32 0, i32 2
  store i16 0, ptr %85, align 2, !tbaa !23
  br label %86

86:                                               ; preds = %130, %83
  %87 = getelementptr inbounds [2 x %struct.pollfd], ptr %6, i64 0, i64 0
  %88 = getelementptr inbounds %struct.pollfd, ptr %87, i32 0, i32 2
  %89 = load i16, ptr %88, align 2, !tbaa !23
  %90 = sext i16 %89 to i32
  %91 = and i32 %90, 4
  %92 = icmp ne i32 %91, 0
  %93 = xor i1 %92, true
  br i1 %93, label %94, label %131

94:                                               ; preds = %86
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %95 = getelementptr inbounds [2 x %struct.pollfd], ptr %6, i64 0, i64 0
  %96 = call i32 @udp_poll(ptr noundef %95)
  store i32 %96, ptr %9, align 4, !tbaa !9
  %97 = load i32, ptr %9, align 4, !tbaa !9
  %98 = icmp slt i32 %97, 0
  br i1 %98, label %99, label %108

99:                                               ; preds = %94
  %100 = load i32, ptr getelementptr inbounds (%struct.achd_cx, ptr @cx, i32 0, i32 3), align 8, !tbaa !32
  %101 = icmp ne i32 %100, 0
  br i1 %101, label %102, label %106

102:                                              ; preds = %99
  %103 = load ptr, ptr %2, align 8, !tbaa !5
  %104 = call i32 @achd_reconnect(ptr noundef %103)
  %105 = load ptr, ptr %2, align 8, !tbaa !5
  call void @udp_peer(ptr noundef %105, ptr noundef %5)
  br label %107

106:                                              ; preds = %99
  store i32 1, ptr %8, align 4
  br label %128

107:                                              ; preds = %102
  br label %127

108:                                              ; preds = %94
  %109 = load i32, ptr getelementptr inbounds (%struct.achd_cx, ptr @cx, i32 0, i32 6), align 8, !tbaa !25
  %110 = icmp ne i32 %109, 0
  br i1 %110, label %111, label %112

111:                                              ; preds = %108
  store i32 1, ptr %8, align 4
  br label %128

112:                                              ; preds = %108
  %113 = getelementptr inbounds [2 x %struct.pollfd], ptr %6, i64 0, i64 0
  %114 = getelementptr inbounds %struct.pollfd, ptr %113, i32 0, i32 2
  %115 = load i16, ptr %114, align 2, !tbaa !23
  %116 = sext i16 %115 to i32
  %117 = and i32 %116, 4
  %118 = icmp ne i32 %117, 0
  br i1 %118, label %125, label %119

119:                                              ; preds = %112
  %120 = load i32, ptr @ach_verbosity, align 4, !tbaa !9
  %121 = add nsw i32 5, %120
  %122 = icmp sle i32 3, %121
  br i1 %122, label %123, label %124

123:                                              ; preds = %119
  call void (i32, ptr, ...) @ach_log(i32 noundef 3, ptr noundef @.str.16)
  br label %124

124:                                              ; preds = %123, %119
  br label %125

125:                                              ; preds = %124, %112
  br label %126

126:                                              ; preds = %125
  br label %127

127:                                              ; preds = %126, %107
  store i32 0, ptr %8, align 4
  br label %128

128:                                              ; preds = %127, %111, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  %129 = load i32, ptr %8, align 4
  switch i32 %129, label %184 [
    i32 0, label %130
  ]

130:                                              ; preds = %128
  br label %86, !llvm.loop !33

131:                                              ; preds = %86
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 -1, ptr %10, align 8, !tbaa !29
  %132 = load i32, ptr @ach_verbosity, align 4, !tbaa !9
  %133 = add nsw i32 5, %132
  %134 = icmp sle i32 7, %133
  br i1 %134, label %135, label %137

135:                                              ; preds = %131
  %136 = load i64, ptr %7, align 8, !tbaa !29
  call void (i32, ptr, ...) @ach_log(i32 noundef 7, ptr noundef @.str.17, i64 noundef %136)
  br label %137

137:                                              ; preds = %135, %131
  br label %138

138:                                              ; preds = %159, %137
  %139 = load ptr, ptr %2, align 8, !tbaa !5
  %140 = getelementptr inbounds %struct.achd_conn, ptr %139, i32 0, i32 7
  %141 = load i32, ptr %140, align 8, !tbaa !15
  %142 = load ptr, ptr %2, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.achd_conn, ptr %142, i32 0, i32 9
  %144 = load ptr, ptr %143, align 8, !tbaa !28
  %145 = getelementptr inbounds %struct.ach_pipe_frame_t, ptr %144, i32 0, i32 2
  %146 = getelementptr inbounds [1 x i8], ptr %145, i64 0, i64 0
  %147 = load i64, ptr %7, align 8, !tbaa !29
  %148 = call i64 @sendto(i32 noundef %141, ptr noundef %146, i64 noundef %147, i32 noundef 0, ptr noundef %5, i32 noundef 16)
  store i64 %148, ptr %10, align 8, !tbaa !29
  br label %149

149:                                              ; preds = %138
  %150 = load i64, ptr %10, align 8, !tbaa !29
  %151 = icmp slt i64 %150, 0
  br i1 %151, label %152, label %159

152:                                              ; preds = %149
  %153 = load i32, ptr getelementptr inbounds (%struct.achd_cx, ptr @cx, i32 0, i32 6), align 8, !tbaa !25
  %154 = icmp ne i32 %153, 0
  br i1 %154, label %159, label %155

155:                                              ; preds = %152
  %156 = call ptr @__errno_location() #7
  %157 = load i32, ptr %156, align 4, !tbaa !9
  %158 = icmp eq i32 4, %157
  br label %159

159:                                              ; preds = %155, %152, %149
  %160 = phi i1 [ false, %152 ], [ false, %149 ], [ %158, %155 ]
  br i1 %160, label %138, label %161, !llvm.loop !34

161:                                              ; preds = %159
  %162 = load i64, ptr %10, align 8, !tbaa !29
  %163 = icmp slt i64 %162, 0
  br i1 %163, label %168, label %164

164:                                              ; preds = %161
  %165 = load i64, ptr %10, align 8, !tbaa !29
  %166 = load i64, ptr %7, align 8, !tbaa !29
  %167 = icmp ne i64 %165, %166
  br i1 %167, label %168, label %183

168:                                              ; preds = %164, %161
  %169 = load ptr, ptr getelementptr inbounds (%struct.achd_cx, ptr @cx, i32 0, i32 8), align 8, !tbaa !35
  %170 = getelementptr inbounds %struct.sockaddr_in, ptr %5, i32 0, i32 2
  %171 = getelementptr inbounds %struct.in_addr, ptr %170, i32 0, i32 0
  %172 = load i32, ptr %171, align 4
  %173 = call ptr @inet_ntoa(i32 %172) #6
  %174 = getelementptr inbounds %struct.sockaddr_in, ptr %5, i32 0, i32 1
  %175 = load i16, ptr %174, align 2, !tbaa !11
  %176 = call zeroext i16 @__bswap_16(i16 noundef zeroext %175)
  %177 = zext i16 %176 to i32
  %178 = call ptr @__errno_location() #7
  %179 = load i32, ptr %178, align 4, !tbaa !9
  %180 = call ptr @strerror(i32 noundef %179) #6
  %181 = call ptr @__errno_location() #7
  %182 = load i32, ptr %181, align 4, !tbaa !9
  call void (i32, ptr, ...) %169(i32 noundef 4, ptr noundef @.str.18, ptr noundef %173, i32 noundef %177, ptr noundef %180, i32 noundef %182)
  br label %183

183:                                              ; preds = %168, %164
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  store i32 0, ptr %8, align 4
  br label %184

184:                                              ; preds = %183, %128, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  %185 = load i32, ptr %8, align 4
  switch i32 %185, label %188 [
    i32 0, label %186
    i32 2, label %38
  ]

186:                                              ; preds = %184
  br label %38, !llvm.loop !30

187:                                              ; preds = %46, %38
  store i32 0, ptr %8, align 4
  br label %188

188:                                              ; preds = %187, %184
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  %189 = load i32, ptr %8, align 4
  switch i32 %189, label %191 [
    i32 0, label %190
    i32 1, label %190
  ]

190:                                              ; preds = %188, %188
  ret void

191:                                              ; preds = %188
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden void @udp_peer(ptr noundef, ptr noundef) #5

; Function Attrs: nounwind uwtable
declare hidden i32 @udp_poll(ptr noundef) #5

declare i64 @sendto(i32 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { nounwind willreturn memory(none) "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 = { 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 #5 = { 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(none) }

!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, !13, i64 2}
!12 = !{!"sockaddr_in", !13, i64 0, !13, i64 2, !14, i64 4, !7, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!"in_addr", !10, i64 0}
!15 = !{!16, !10, i64 224}
!16 = !{!"achd_conn", !10, i64 0, !17, i64 8, !17, i64 24, !19, i64 40, !19, i64 128, !10, i64 216, !10, i64 220, !10, i64 224, !18, i64 232, !6, i64 240, !6, i64 248, !6, i64 256}
!17 = !{!"timespec", !18, i64 0, !18, i64 8}
!18 = !{!"long", !7, i64 0}
!19 = !{!"achd_headers", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !18, i64 48, !6, i64 56, !6, i64 64, !10, i64 72, !10, i64 76, !6, i64 80}
!20 = !{!21, !10, i64 0}
!21 = !{!"pollfd", !10, i64 0, !13, i64 4, !13, i64 6}
!22 = !{!21, !13, i64 4}
!23 = !{!21, !13, i64 6}
!24 = !{!16, !10, i64 216}
!25 = !{!26, !10, i64 112}
!26 = !{!"achd_cx", !19, i64 0, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !6, i64 104, !10, i64 112, !27, i64 120, !6, i64 248}
!27 = !{!"ach_channel", !7, i64 0}
!28 = !{!16, !6, i64 240}
!29 = !{!18, !18, i64 0}
!30 = distinct !{!30, !31}
!31 = !{!"llvm.loop.mustprogress"}
!32 = !{!26, !10, i64 96}
!33 = distinct !{!33, !31}
!34 = distinct !{!34, !31}
!35 = !{!26, !6, i64 248}


; 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.achd_cx = type { %struct.achd_headers, i32, i32, i32, i32, ptr, i32, %struct.ach_channel, ptr }
%struct.achd_headers = type { ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i64, ptr, ptr, i32, i32, ptr }
%struct.ach_channel = type { %union.anon }
%union.anon = type { [16 x i64] }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.pollfd = type { i32, i16, i16 }

@cx = external local_unnamed_addr global %struct.achd_cx, align 8
@ach_verbosity = external local_unnamed_addr global i32, align 4
@.str.13 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.18 = external hidden unnamed_addr constant [45 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

; Function Attrs: nounwind
declare ptr @strerror(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

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

; Function Attrs: nounwind
declare ptr @inet_ntoa(i32) local_unnamed_addr #1

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

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

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

declare i64 @ach_pipe_get_size(ptr noundef) local_unnamed_addr #3

declare i32 @achd_reconnect(ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @achd_push_udp(ptr noundef %0) local_unnamed_addr #5 {
  %2 = alloca %struct.sockaddr_in, align 4
  %3 = alloca [2 x %struct.pollfd], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #6
  call void @udp_peer(ptr noundef %0, ptr noundef nonnull %2)
  %4 = load i32, ptr @ach_verbosity, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %6, label %14

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %2, i64 4
  %8 = load i32, ptr %7, align 4
  %9 = call ptr @inet_ntoa(i32 %8) #6
  %10 = getelementptr inbounds i8, ptr %2, i64 2
  %11 = load i16, ptr %10, align 2, !tbaa !9
  %12 = call zeroext i16 @__bswap_16(i16 noundef zeroext %11)
  %13 = zext i16 %12 to i32
  call void (i32, ptr, ...) @ach_log(i32 noundef 6, ptr noundef nonnull @.str.13, ptr noundef %9, i32 noundef %13) #6
  br label %14

14:                                               ; preds = %6, %1
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %15 = getelementptr inbounds i8, ptr %0, i64 224
  %16 = load i32, ptr %15, align 8, !tbaa !13
  store i32 %16, ptr %3, align 16, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %3, i64 4
  store i16 4, ptr %17, align 4, !tbaa !21
  %18 = getelementptr inbounds i8, ptr %3, i64 6
  store i16 0, ptr %18, align 2, !tbaa !22
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  %20 = getelementptr inbounds i8, ptr %0, i64 216
  %21 = load i32, ptr %20, align 8, !tbaa !23
  store i32 %21, ptr %19, align 8, !tbaa !19
  %22 = getelementptr inbounds i8, ptr %3, i64 12
  store i16 1, ptr %22, align 4, !tbaa !21
  %23 = getelementptr inbounds i8, ptr %3, i64 14
  store i16 0, ptr %23, align 2, !tbaa !22
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @cx, i64 112), align 8, !tbaa !24
  %.not57 = icmp eq i32 %24, 0
  br i1 %.not57, label %.lr.ph61, label %.critedge45.thread

.lr.ph61:                                         ; preds = %14
  %25 = getelementptr inbounds i8, ptr %0, i64 240
  %26 = getelementptr inbounds i8, ptr %2, i64 4
  %27 = getelementptr inbounds i8, ptr %2, i64 2
  br label %28

28:                                               ; preds = %.lr.ph61, %.critedge45
  %.059 = phi i32 [ 0, %.lr.ph61 ], [ %.2, %.critedge45 ]
  %.02858 = phi i32 [ 0, %.lr.ph61 ], [ %.230, %.critedge45 ]
  call void @get_frame(ptr noundef nonnull %0)
  %29 = load i32, ptr getelementptr inbounds (i8, ptr @cx, i64 112), align 8, !tbaa !24
  %.not35 = icmp eq i32 %29, 0
  br i1 %.not35, label %30, label %.critedge45.thread

30:                                               ; preds = %28
  %31 = load ptr, ptr %25, align 8, !tbaa !27
  %32 = call i64 @ach_pipe_get_size(ptr noundef %31) #6
  %33 = icmp ugt i64 %32, 65535
  br i1 %33, label %34, label %38

34:                                               ; preds = %30
  %.not41 = icmp eq i32 %.02858, 0
  %35 = load i32, ptr @ach_verbosity, align 4
  %36 = icmp sgt i32 %35, -3
  %or.cond48 = select i1 %.not41, i1 %36, i1 false
  br i1 %or.cond48, label %37, label %.critedge45, !llvm.loop !28

37:                                               ; preds = %34
  call void (i32, ptr, ...) @ach_log(i32 noundef 3, ptr noundef nonnull @.str.14, i64 noundef %32) #6
  br label %.critedge45, !llvm.loop !28

38:                                               ; preds = %30
  %39 = add nuw nsw i64 %32, 28
  %40 = icmp ult i64 %32, 1473
  %41 = icmp ne i32 %.059, 0
  %or.cond = select i1 %40, i1 true, i1 %41
  br i1 %or.cond, label %.lr.ph.preheader, label %42

42:                                               ; preds = %38
  %43 = load i32, ptr @ach_verbosity, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, -2
  br i1 %44, label %45, label %.lr.ph.preheader

45:                                               ; preds = %42
  call void (i32, ptr, ...) @ach_log(i32 noundef 4, ptr noundef nonnull @.str.15, i64 noundef %39) #6
  br label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %38, %45, %42
  %.1 = phi i32 [ %.059, %38 ], [ 1, %45 ], [ 1, %42 ]
  store i16 0, ptr %18, align 2, !tbaa !22
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %60
  %46 = call i32 @udp_poll(ptr noundef nonnull %3)
  %47 = icmp slt i32 %46, 0
  br i1 %47, label %48, label %52

48:                                               ; preds = %.lr.ph
  %49 = load i32, ptr getelementptr inbounds (i8, ptr @cx, i64 96), align 8, !tbaa !30
  %.not40 = icmp eq i32 %49, 0
  br i1 %.not40, label %.critedge45.thread, label %50

50:                                               ; preds = %48
  %51 = call i32 @achd_reconnect(ptr noundef %0) #6
  call void @udp_peer(ptr noundef %0, ptr noundef nonnull %2)
  br label %60

52:                                               ; preds = %.lr.ph
  %53 = load i32, ptr getelementptr inbounds (i8, ptr @cx, i64 112), align 8, !tbaa !24
  %.not38 = icmp eq i32 %53, 0
  br i1 %.not38, label %54, label %.critedge45.thread

54:                                               ; preds = %52
  %55 = load i16, ptr %18, align 2, !tbaa !22
  %56 = and i16 %55, 4
  %.not39 = icmp eq i16 %56, 0
  %57 = load i32, ptr @ach_verbosity, align 4
  %58 = icmp sgt i32 %57, -3
  %or.cond43 = select i1 %.not39, i1 %58, i1 false
  br i1 %or.cond43, label %59, label %60

59:                                               ; preds = %54
  call void (i32, ptr, ...) @ach_log(i32 noundef 3, ptr noundef nonnull @.str.16) #6
  br label %60

60:                                               ; preds = %50, %54, %59
  %61 = load i16, ptr %18, align 2, !tbaa !22
  %62 = and i16 %61, 4
  %.not36 = icmp eq i16 %62, 0
  br i1 %.not36, label %.lr.ph, label %._crit_edge, !llvm.loop !31

._crit_edge:                                      ; preds = %60
  %63 = load i32, ptr @ach_verbosity, align 4, !tbaa !5
  %64 = icmp sgt i32 %63, 1
  br i1 %64, label %65, label %.preheader

65:                                               ; preds = %._crit_edge
  call void (i32, ptr, ...) @ach_log(i32 noundef 7, ptr noundef nonnull @.str.17, i64 noundef %32) #6
  br label %.preheader

.preheader:                                       ; preds = %65, %._crit_edge
  br label %66

66:                                               ; preds = %.preheader, %74
  %67 = load i32, ptr %15, align 8, !tbaa !13
  %68 = load ptr, ptr %25, align 8, !tbaa !27
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  %70 = call i64 @sendto(i32 noundef %67, ptr noundef nonnull %69, i64 noundef %32, i32 noundef 0, ptr noundef nonnull %2, i32 noundef 16) #6
  %71 = icmp sgt i64 %70, -1
  %72 = load i32, ptr getelementptr inbounds (i8, ptr @cx, i64 112), align 8
  %73 = icmp ne i32 %72, 0
  %or.cond3 = select i1 %71, i1 true, i1 %73
  br i1 %or.cond3, label %.critedge, label %74

74:                                               ; preds = %66
  %75 = tail call ptr @__errno_location() #7
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp eq i32 %76, 4
  br i1 %77, label %66, label %.critedge.thread, !llvm.loop !32

.critedge:                                        ; preds = %66
  %.not37 = icmp eq i64 %70, %32
  %or.cond46 = and i1 %71, %.not37
  br i1 %or.cond46, label %.critedge45, label %.critedge.thread

.critedge.thread:                                 ; preds = %74, %.critedge
  %78 = load ptr, ptr getelementptr inbounds (i8, ptr @cx, i64 248), align 8, !tbaa !33
  %79 = load i32, ptr %26, align 4
  %80 = call ptr @inet_ntoa(i32 %79) #6
  %81 = load i16, ptr %27, align 2, !tbaa !9
  %82 = call zeroext i16 @__bswap_16(i16 noundef zeroext %81)
  %83 = zext i16 %82 to i32
  %84 = tail call ptr @__errno_location() #7
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = call ptr @strerror(i32 noundef %85) #6
  %87 = load i32, ptr %84, align 4, !tbaa !5
  call void (i32, ptr, ...) %78(i32 noundef 4, ptr noundef nonnull @.str.18, ptr noundef %80, i32 noundef %83, ptr noundef %86, i32 noundef %87) #6
  br label %.critedge45

.critedge45:                                      ; preds = %.critedge.thread, %.critedge, %34, %37
  %.230 = phi i32 [ 1, %37 ], [ 1, %34 ], [ %.02858, %.critedge ], [ %.02858, %.critedge.thread ]
  %.2 = phi i32 [ %.059, %37 ], [ %.059, %34 ], [ %.1, %.critedge ], [ %.1, %.critedge.thread ]
  %88 = load i32, ptr getelementptr inbounds (i8, ptr @cx, i64 112), align 8, !tbaa !24
  %.not = icmp eq i32 %88, 0
  br i1 %.not, label %28, label %.critedge45.thread

.critedge45.thread:                               ; preds = %28, %.critedge45, %48, %52, %14
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #6
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @udp_peer(ptr noundef, ptr noundef) local_unnamed_addr #5

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

declare i64 @sendto(i32 noundef, ptr noundef, i64 noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 nofree nosync nounwind willreturn memory(none) "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 = { 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 #5 = { 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(none) }

!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, !11, i64 2}
!10 = !{!"sockaddr_in", !11, i64 0, !11, i64 2, !12, i64 4, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!"in_addr", !6, i64 0}
!13 = !{!14, !6, i64 224}
!14 = !{!"achd_conn", !6, i64 0, !15, i64 8, !15, i64 24, !17, i64 40, !17, i64 128, !6, i64 216, !6, i64 220, !6, i64 224, !16, i64 232, !18, i64 240, !18, i64 248, !18, i64 256}
!15 = !{!"timespec", !16, i64 0, !16, i64 8}
!16 = !{!"long", !7, i64 0}
!17 = !{!"achd_headers", !18, i64 0, !18, i64 8, !6, i64 16, !6, i64 20, !6, i64 24, !6, i64 28, !6, i64 32, !6, i64 36, !6, i64 40, !6, i64 44, !16, i64 48, !18, i64 56, !18, i64 64, !6, i64 72, !6, i64 76, !18, i64 80}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!20, !6, i64 0}
!20 = !{!"pollfd", !6, i64 0, !11, i64 4, !11, i64 6}
!21 = !{!20, !11, i64 4}
!22 = !{!20, !11, i64 6}
!23 = !{!14, !6, i64 216}
!24 = !{!25, !6, i64 112}
!25 = !{!"achd_cx", !17, i64 0, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !18, i64 104, !6, i64 112, !26, i64 120, !18, i64 248}
!26 = !{!"ach_channel", !7, i64 0}
!27 = !{!14, !18, i64 240}
!28 = distinct !{!28, !29}
!29 = !{!"llvm.loop.mustprogress"}
!30 = !{!25, !6, i64 96}
!31 = distinct !{!31, !29}
!32 = distinct !{!32, !29}
!33 = !{!25, !18, i64 248}


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