; LLVM IR from DroneBridge/DroneBridge :: video (video_main_air)

; 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.db_socket_t = type { i32, %struct.sockaddr_ll }
%struct.sockaddr_ll = type { i16, i16, i32, i16, i8, i8, [8 x i8] }
%struct.input_t = type { i32, i32, i32, ptr }
%struct.db_uav_status_t = type <{ i32, i8, i8, i32, i32, i32, i32, i32, i16, i16, i8, i8, i32, [8 x %struct.db_adapter_status] }>
%struct.db_adapter_status = type <{ i32, i32, i8, [4 x i8], i8, i8, i8, i8, [16 x i8] }>
%struct.db_unix_tcp_socket = type { i32, %struct.sockaddr_un }
%struct.sockaddr_un = type { i16, [108 x i8] }
%struct.db_unix_tcp_client = type { i32, %struct.sockaddr_un }
%struct.packet_buffer_t = type { i32, i32, i32, ptr }
%struct.video_packet_data_t = type <{ i32, ptr }>

@keeprunning = external dso_local global i8, align 1
@num_interfaces = external dso_local global i32, align 4
@num_data_per_block = external dso_local global i32, align 4
@num_fec_per_block = external dso_local global i32, align 4
@pack_size = external dso_local global i32, align 4
@bitrate_op = external dso_local global i32, align 4
@db_uav_status = external dso_local global ptr, align 8
@raw_sockets = external dso_local global [4 x %struct.db_socket_t], align 16
@comm_id = external dso_local global i8, align 1
@frame_type = external dso_local global i8, align 1
@adapters = external dso_local global [4 x [16 x i8]], align 16
@stderr = external global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [121 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [27 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @write_to_unix(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

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

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

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

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

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

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

; Function Attrs: nounwind
declare ptr @strncpy(ptr noundef, ptr noundef, i64 noundef) #4

; Function Attrs: noreturn nounwind
declare void @abort() #6

; 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 %struct.input_t, align 8
  %7 = alloca %struct.db_uav_status_t, align 1
  %8 = alloca i32, align 4
  %9 = alloca [1 x i8], align 1
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.db_socket_t, align 4
  %13 = alloca %struct.db_unix_tcp_socket, align 4
  %14 = alloca [5 x %struct.db_unix_tcp_client], align 16
  %15 = alloca %struct.sockaddr_un, align 2
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca ptr, align 8
  %22 = alloca i64, align 8
  %23 = alloca ptr, align 8
  %24 = alloca i32, align 4
  %25 = alloca i64, align 8
  %26 = alloca i32, align 4
  %27 = alloca i32, align 4
  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
  %28 = call ptr @signal(i32 noundef 2, ptr noundef @int_handler) #8
  %29 = call i32 @setpriority(i32 noundef 0, i32 noundef 0, i32 noundef -10) #8
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !9
  call void @process_command_line_args(i32 noundef %30, ptr noundef %31)
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #8
  call void @llvm.memset.p0.i64(ptr align 1 %7, i8 0, i64 300, i1 false)
  %32 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 0
  %33 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 1
  %34 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 2
  %35 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 3
  %36 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 4
  %37 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 5
  %38 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 6
  %39 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 7
  %40 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 8
  %41 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 9
  %42 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 10
  %43 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 11
  %44 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 12
  %45 = getelementptr inbounds %struct.db_uav_status_t, ptr %7, i32 0, i32 13
  store ptr %7, ptr @db_uav_status, align 8, !tbaa !9
  %46 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %47 = getelementptr inbounds %struct.db_uav_status_t, ptr %46, i32 0, i32 5
  store i32 0, ptr %47, align 1, !tbaa !11
  %48 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %49 = getelementptr inbounds %struct.db_uav_status_t, ptr %48, i32 0, i32 4
  store i32 0, ptr %49, align 1, !tbaa !14
  %50 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %51 = getelementptr inbounds %struct.db_uav_status_t, ptr %50, i32 0, i32 3
  store i32 0, ptr %51, align 1, !tbaa !15
  %52 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.db_uav_status_t, ptr %52, i32 0, i32 6
  store i32 0, ptr %53, align 1, !tbaa !16
  %54 = load i32, ptr @num_interfaces, align 4, !tbaa !5
  %55 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %56 = getelementptr inbounds %struct.db_uav_status_t, ptr %55, i32 0, i32 12
  store i32 %54, ptr %56, align 1, !tbaa !17
  %57 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %58 = getelementptr inbounds %struct.db_uav_status_t, ptr %57, i32 0, i32 7
  store i32 0, ptr %58, align 1, !tbaa !18
  %59 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.db_uav_status_t, ptr %59, i32 0, i32 0
  store i32 0, ptr %60, align 1, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 24, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #8
  %61 = load i32, ptr @num_interfaces, align 4, !tbaa !5
  %62 = icmp eq i32 %61, 0
  br i1 %62, label %63, label %69

63:                                               ; preds = %2
  br label %64

64:                                               ; preds = %63
  %65 = load ptr, ptr @stderr, align 8, !tbaa !9
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef @.str.5) #8
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.5)
  br label %67

67:                                               ; preds = %64
  br label %68

68:                                               ; preds = %67
  call void @abort() #9
  unreachable

69:                                               ; preds = %2
  %70 = load i32, ptr @pack_size, align 4, !tbaa !5
  %71 = icmp ugt i32 %70, 2048
  br i1 %71, label %72, label %80

72:                                               ; preds = %69
  br label %73

73:                                               ; preds = %72
  %74 = load ptr, ptr @stderr, align 8, !tbaa !9
  %75 = load i32, ptr @pack_size, align 4, !tbaa !5
  %76 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %74, ptr noundef @.str.6, i32 noundef 2048, i32 noundef %75) #8
  %77 = load i32, ptr @pack_size, align 4, !tbaa !5
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.6, i32 noundef 2048, i32 noundef %77)
  br label %78

78:                                               ; preds = %73
  br label %79

79:                                               ; preds = %78
  call void @abort() #9
  unreachable

80:                                               ; preds = %69
  %81 = load i32, ptr %8, align 4, !tbaa !5
  %82 = load i32, ptr @pack_size, align 4, !tbaa !5
  %83 = icmp ugt i32 %81, %82
  br i1 %83, label %84, label %94

84:                                               ; preds = %80
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr @stderr, align 8, !tbaa !9
  %87 = load i32, ptr %8, align 4, !tbaa !5
  %88 = load i32, ptr @pack_size, align 4, !tbaa !5
  %89 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %86, ptr noundef @.str.7, i32 noundef %87, i32 noundef %88) #8
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = load i32, ptr @pack_size, align 4, !tbaa !5
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.7, i32 noundef %90, i32 noundef %91)
  br label %92

92:                                               ; preds = %85
  br label %93

93:                                               ; preds = %92
  call void @abort() #9
  unreachable

94:                                               ; preds = %80
  %95 = load i32, ptr @num_data_per_block, align 4, !tbaa !5
  %96 = icmp ugt i32 %95, 32
  br i1 %96, label %100, label %97

97:                                               ; preds = %94
  %98 = load i32, ptr @num_fec_per_block, align 4, !tbaa !5
  %99 = icmp ugt i32 %98, 32
  br i1 %99, label %100, label %110

100:                                              ; preds = %97, %94
  br label %101

101:                                              ; preds = %100
  %102 = load ptr, ptr @stderr, align 8, !tbaa !9
  %103 = load i32, ptr @num_data_per_block, align 4, !tbaa !5
  %104 = load i32, ptr @num_fec_per_block, align 4, !tbaa !5
  %105 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %102, ptr noundef @.str.8, i32 noundef 32, i32 noundef %103, i32 noundef %104) #8
  %106 = load i32, ptr @num_data_per_block, align 4, !tbaa !5
  %107 = load i32, ptr @num_fec_per_block, align 4, !tbaa !5
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.8, i32 noundef 32, i32 noundef %106, i32 noundef %107)
  br label %108

108:                                              ; preds = %101
  br label %109

109:                                              ; preds = %108
  call void @abort() #9
  unreachable

110:                                              ; preds = %97
  %111 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 1
  store i32 0, ptr %111, align 4, !tbaa !20
  %112 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 0
  store i32 0, ptr %112, align 8, !tbaa !22
  %113 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 2
  store i32 0, ptr %113, align 8, !tbaa !23
  %114 = load i32, ptr @num_data_per_block, align 4, !tbaa !5
  %115 = zext i32 %114 to i64
  %116 = call ptr @lib_alloc_packet_buffer_list(i64 noundef %115, i64 noundef 2071)
  %117 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 3
  store ptr %116, ptr %117, align 8, !tbaa !24
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %129, %110
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = load i32, ptr @num_data_per_block, align 4, !tbaa !5
  %121 = icmp ult i32 %119, %120
  br i1 %121, label %122, label %132

122:                                              ; preds = %118
  %123 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 3
  %124 = load ptr, ptr %123, align 8, !tbaa !24
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds %struct.packet_buffer_t, ptr %124, i64 %126
  %128 = getelementptr inbounds %struct.packet_buffer_t, ptr %127, i32 0, i32 2
  store i32 0, ptr %128, align 8, !tbaa !23
  br label %129

129:                                              ; preds = %122
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %10, align 4, !tbaa !5
  br label %118, !llvm.loop !25

132:                                              ; preds = %118
  call void @fec_init()
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #8
  store i32 0, ptr %11, align 4, !tbaa !5
  br label %133

133:                                              ; preds = %161, %132
  %134 = load i32, ptr %11, align 4, !tbaa !5
  %135 = load i32, ptr @num_interfaces, align 4, !tbaa !5
  %136 = icmp ult i32 %134, %135
  br i1 %136, label %138, label %137

137:                                              ; preds = %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #8
  br label %164

138:                                              ; preds = %133
  %139 = load i32, ptr %11, align 4, !tbaa !5
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [4 x %struct.db_socket_t], ptr @raw_sockets, i64 0, i64 %140
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #8
  %142 = load i32, ptr %11, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [4 x [16 x i8]], ptr @adapters, i64 0, i64 %143
  %145 = getelementptr inbounds [16 x i8], ptr %144, i64 0, i64 0
  %146 = load i8, ptr @comm_id, align 1, !tbaa !27
  %147 = load i32, ptr @bitrate_op, align 4, !tbaa !5
  %148 = load i8, ptr @frame_type, align 1, !tbaa !27
  call void @open_db_socket(ptr dead_on_unwind writable sret(%struct.db_socket_t) align 4 %12, ptr noundef %145, i8 noundef zeroext %146, i8 noundef signext 109, i32 noundef %147, i8 noundef zeroext 3, i8 noundef zeroext 3, i8 noundef zeroext %148)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %141, ptr align 4 %12, i64 24, i1 false), !tbaa.struct !28
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #8
  %149 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %150 = getelementptr inbounds %struct.db_uav_status_t, ptr %149, i32 0, i32 13
  %151 = load i32, ptr %11, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [8 x %struct.db_adapter_status], ptr %150, i64 0, i64 %152
  %154 = getelementptr inbounds %struct.db_adapter_status, ptr %153, i32 0, i32 8
  %155 = getelementptr inbounds [16 x i8], ptr %154, i64 0, i64 0
  %156 = load i32, ptr %11, align 4, !tbaa !5
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [4 x [16 x i8]], ptr @adapters, i64 0, i64 %157
  %159 = getelementptr inbounds [16 x i8], ptr %158, i64 0, i64 0
  %160 = call ptr @strncpy(ptr noundef %155, ptr noundef %159, i64 noundef 16) #8
  br label %161

161:                                              ; preds = %138
  %162 = load i32, ptr %11, align 4, !tbaa !5
  %163 = add nsw i32 %162, 1
  store i32 %163, ptr %11, align 4, !tbaa !5
  br label %133, !llvm.loop !30

164:                                              ; preds = %137
  call void @llvm.lifetime.start.p0(i64 116, ptr %13) #8
  call void @db_create_unix_tcpserver_sock(ptr dead_on_unwind writable sret(%struct.db_unix_tcp_socket) align 4 %13, ptr noundef @.str.9)
  %165 = getelementptr inbounds %struct.db_unix_tcp_socket, ptr %13, i32 0, i32 0
  call void @set_socket_nonblocking(ptr noundef %165)
  call void @llvm.lifetime.start.p0(i64 580, ptr %14) #8
  call void @llvm.lifetime.start.p0(i64 110, ptr %15) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 110, ptr %16, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !5
  br label %166

166:                                              ; preds = %175, %164
  %167 = load i32, ptr %17, align 4, !tbaa !5
  %168 = icmp slt i32 %167, 5
  br i1 %168, label %170, label %169

169:                                              ; preds = %166
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %178

170:                                              ; preds = %166
  %171 = load i32, ptr %17, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %172
  %174 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %173, i32 0, i32 0
  store i32 -1, ptr %174, align 4, !tbaa !31
  br label %175

175:                                              ; preds = %170
  %176 = load i32, ptr %17, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %17, align 4, !tbaa !5
  br label %166, !llvm.loop !34

178:                                              ; preds = %169
  br label %179

179:                                              ; preds = %178
  %180 = call i32 (ptr, ...) @printf(ptr noundef @.str.10)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.10)
  br label %181

181:                                              ; preds = %179
  br label %182

182:                                              ; preds = %181
  br label %183

183:                                              ; preds = %440, %438, %182
  %184 = load i8, ptr @keeprunning, align 1, !tbaa !35, !range !37, !noundef !38
  %185 = trunc i8 %184 to i1
  br i1 %185, label %186, label %441

186:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #8
  %187 = getelementptr inbounds %struct.db_unix_tcp_socket, ptr %13, i32 0, i32 0
  %188 = load i32, ptr %187, align 4, !tbaa !31
  %189 = getelementptr inbounds %struct.db_unix_tcp_socket, ptr %13, i32 0, i32 1
  %190 = call i32 @accept(i32 noundef %188, ptr noundef %189, ptr noundef %16)
  store i32 %190, ptr %18, align 4, !tbaa !5
  %191 = load i32, ptr %18, align 4, !tbaa !5
  %192 = icmp sgt i32 %191, 0
  br i1 %192, label %193, label %233

193:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %194

194:                                              ; preds = %228, %193
  %195 = load i32, ptr %19, align 4, !tbaa !5
  %196 = icmp slt i32 %195, 5
  br i1 %196, label %198, label %197

197:                                              ; preds = %194
  store i32 23, ptr %20, align 4
  br label %231

198:                                              ; preds = %194
  %199 = load i32, ptr %19, align 4, !tbaa !5
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %200
  %202 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %201, i32 0, i32 0
  %203 = load i32, ptr %202, align 4, !tbaa !31
  %204 = icmp slt i32 %203, 0
  br i1 %204, label %208, label %205

205:                                              ; preds = %198
  %206 = load i32, ptr %19, align 4, !tbaa !5
  %207 = icmp eq i32 %206, 4
  br i1 %207, label %208, label %227

208:                                              ; preds = %205, %198
  %209 = load i32, ptr %18, align 4, !tbaa !5
  %210 = load i32, ptr %19, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %211
  %213 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %212, i32 0, i32 0
  store i32 %209, ptr %213, align 4, !tbaa !31
  %214 = load i32, ptr %19, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %215
  %217 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %216, i32 0, i32 0
  call void @set_socket_nonblocking(ptr noundef %217)
  %218 = load i32, ptr %19, align 4, !tbaa !5
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %219
  %221 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %220, i32 0, i32 1
  %222 = getelementptr inbounds %struct.db_unix_tcp_socket, ptr %13, i32 0, i32 1
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %221, ptr align 4 %222, i64 110, i1 false), !tbaa.struct !39
  br label %223

223:                                              ; preds = %208
  %224 = call i32 (ptr, ...) @printf(ptr noundef @.str.11)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.11)
  br label %225

225:                                              ; preds = %223
  br label %226

226:                                              ; preds = %225
  store i32 23, ptr %20, align 4
  br label %231

227:                                              ; preds = %205
  br label %228

228:                                              ; preds = %227
  %229 = load i32, ptr %19, align 4, !tbaa !5
  %230 = add nsw i32 %229, 1
  store i32 %230, ptr %19, align 4, !tbaa !5
  br label %194, !llvm.loop !40

231:                                              ; preds = %226, %197
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %232

232:                                              ; preds = %231
  br label %254

233:                                              ; preds = %186
  %234 = call ptr @__errno_location() #10
  %235 = load i32, ptr %234, align 4, !tbaa !5
  %236 = icmp ne i32 %235, 11
  br i1 %236, label %241, label %237

237:                                              ; preds = %233
  %238 = call ptr @__errno_location() #10
  %239 = load i32, ptr %238, align 4, !tbaa !5
  %240 = icmp ne i32 %239, 11
  br i1 %240, label %241, label %253

241:                                              ; preds = %237, %233
  br label %242

242:                                              ; preds = %241
  %243 = load ptr, ptr @stderr, align 8, !tbaa !9
  %244 = call ptr @__errno_location() #10
  %245 = load i32, ptr %244, align 4, !tbaa !5
  %246 = call ptr @strerror(i32 noundef %245) #8
  %247 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %243, ptr noundef @.str.12, ptr noundef %246, ptr noundef @.str.9) #8
  %248 = call ptr @__errno_location() #10
  %249 = load i32, ptr %248, align 4, !tbaa !5
  %250 = call ptr @strerror(i32 noundef %249) #8
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.12, ptr noundef %250, ptr noundef @.str.9)
  br label %251

251:                                              ; preds = %242
  br label %252

252:                                              ; preds = %251
  br label %253

253:                                              ; preds = %252, %237
  br label %254

254:                                              ; preds = %253, %232
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %255 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 3
  %256 = load ptr, ptr %255, align 8, !tbaa !24
  %257 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 2
  %258 = load i32, ptr %257, align 8, !tbaa !23
  %259 = sext i32 %258 to i64
  %260 = getelementptr inbounds %struct.packet_buffer_t, ptr %256, i64 %259
  store ptr %260, ptr %21, align 8, !tbaa !9
  %261 = load ptr, ptr %21, align 8, !tbaa !9
  %262 = getelementptr inbounds %struct.packet_buffer_t, ptr %261, i32 0, i32 2
  %263 = load i32, ptr %262, align 8, !tbaa !23
  %264 = icmp eq i32 %263, 0
  br i1 %264, label %265, label %272

265:                                              ; preds = %254
  %266 = load ptr, ptr %21, align 8, !tbaa !9
  %267 = getelementptr inbounds %struct.packet_buffer_t, ptr %266, i32 0, i32 2
  %268 = load i32, ptr %267, align 8, !tbaa !23
  %269 = zext i32 %268 to i64
  %270 = add i64 %269, 4
  %271 = trunc i64 %270 to i32
  store i32 %271, ptr %267, align 8, !tbaa !23
  br label %272

272:                                              ; preds = %265, %254
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #8
  %273 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 1
  %274 = load i32, ptr %273, align 4, !tbaa !20
  %275 = load ptr, ptr %21, align 8, !tbaa !9
  %276 = getelementptr inbounds %struct.packet_buffer_t, ptr %275, i32 0, i32 3
  %277 = load ptr, ptr %276, align 8, !tbaa !24
  %278 = load ptr, ptr %21, align 8, !tbaa !9
  %279 = getelementptr inbounds %struct.packet_buffer_t, ptr %278, i32 0, i32 2
  %280 = load i32, ptr %279, align 8, !tbaa !23
  %281 = zext i32 %280 to i64
  %282 = getelementptr inbounds i8, ptr %277, i64 %281
  %283 = load i32, ptr @pack_size, align 4, !tbaa !5
  %284 = load ptr, ptr %21, align 8, !tbaa !9
  %285 = getelementptr inbounds %struct.packet_buffer_t, ptr %284, i32 0, i32 2
  %286 = load i32, ptr %285, align 8, !tbaa !23
  %287 = sub i32 %283, %286
  %288 = zext i32 %287 to i64
  %289 = call i64 @read(i32 noundef %274, ptr noundef %282, i64 noundef %288)
  store i64 %289, ptr %22, align 8, !tbaa !41
  %290 = load i64, ptr %22, align 8, !tbaa !41
  %291 = icmp slt i64 %290, 0
  br i1 %291, label %301, label %292

292:                                              ; preds = %272
  %293 = load i64, ptr %22, align 8, !tbaa !41
  %294 = load i32, ptr @pack_size, align 4, !tbaa !5
  %295 = load ptr, ptr %21, align 8, !tbaa !9
  %296 = getelementptr inbounds %struct.packet_buffer_t, ptr %295, i32 0, i32 2
  %297 = load i32, ptr %296, align 8, !tbaa !23
  %298 = sub i32 %294, %297
  %299 = zext i32 %298 to i64
  %300 = icmp sgt i64 %293, %299
  br i1 %300, label %301, label %302

301:                                              ; preds = %292, %272
  call void @perror(ptr noundef @.str.13)
  call void @abort() #9
  unreachable

302:                                              ; preds = %292
  %303 = load i64, ptr %22, align 8, !tbaa !41
  %304 = icmp eq i64 %303, 0
  br i1 %304, label %305, label %312

305:                                              ; preds = %302
  br label %306

306:                                              ; preds = %305
  %307 = load ptr, ptr @stderr, align 8, !tbaa !9
  %308 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %307, ptr noundef @.str.14) #8
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef @.str.14)
  br label %309

309:                                              ; preds = %306
  br label %310

310:                                              ; preds = %309
  %311 = call i32 @usleep(i32 noundef 500000)
  store i32 21, ptr %20, align 4
  br label %438, !llvm.loop !43

312:                                              ; preds = %302
  %313 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 0
  %314 = load ptr, ptr %21, align 8, !tbaa !9
  %315 = getelementptr inbounds %struct.packet_buffer_t, ptr %314, i32 0, i32 3
  %316 = load ptr, ptr %315, align 8, !tbaa !24
  %317 = load ptr, ptr %21, align 8, !tbaa !9
  %318 = getelementptr inbounds %struct.packet_buffer_t, ptr %317, i32 0, i32 2
  %319 = load i32, ptr %318, align 8, !tbaa !23
  %320 = zext i32 %319 to i64
  %321 = getelementptr inbounds i8, ptr %316, i64 %320
  %322 = load i64, ptr %22, align 8, !tbaa !41
  call void @write_to_unix(ptr noundef %313, ptr noundef %321, i64 noundef %322)
  %323 = load i64, ptr %22, align 8, !tbaa !41
  %324 = load ptr, ptr %21, align 8, !tbaa !9
  %325 = getelementptr inbounds %struct.packet_buffer_t, ptr %324, i32 0, i32 2
  %326 = load i32, ptr %325, align 8, !tbaa !23
  %327 = zext i32 %326 to i64
  %328 = add nsw i64 %327, %323
  %329 = trunc i64 %328 to i32
  store i32 %329, ptr %325, align 8, !tbaa !23
  %330 = load ptr, ptr %21, align 8, !tbaa !9
  %331 = getelementptr inbounds %struct.packet_buffer_t, ptr %330, i32 0, i32 2
  %332 = load i32, ptr %331, align 8, !tbaa !23
  %333 = load i32, ptr %8, align 4, !tbaa !5
  %334 = icmp uge i32 %332, %333
  br i1 %334, label %335, label %437

335:                                              ; preds = %312
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #8
  %336 = load ptr, ptr %21, align 8, !tbaa !9
  %337 = getelementptr inbounds %struct.packet_buffer_t, ptr %336, i32 0, i32 3
  %338 = load ptr, ptr %337, align 8, !tbaa !24
  store ptr %338, ptr %23, align 8, !tbaa !9
  %339 = load ptr, ptr %21, align 8, !tbaa !9
  %340 = getelementptr inbounds %struct.packet_buffer_t, ptr %339, i32 0, i32 2
  %341 = load i32, ptr %340, align 8, !tbaa !23
  %342 = load ptr, ptr %23, align 8, !tbaa !9
  %343 = getelementptr inbounds %struct.video_packet_data_t, ptr %342, i32 0, i32 0
  store i32 %341, ptr %343, align 1, !tbaa !44
  %344 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 2
  %345 = load i32, ptr %344, align 8, !tbaa !23
  %346 = load i32, ptr @num_data_per_block, align 4, !tbaa !5
  %347 = sub i32 %346, 1
  %348 = icmp eq i32 %345, %347
  br i1 %348, label %349, label %390

349:                                              ; preds = %335
  %350 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 3
  %351 = load ptr, ptr %350, align 8, !tbaa !24
  %352 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 0
  %353 = load i32, ptr @pack_size, align 4, !tbaa !5
  call void @transmit_block(ptr noundef %351, ptr noundef %352, i32 noundef %353)
  %354 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %355 = getelementptr inbounds %struct.db_uav_status_t, ptr %354, i32 0, i32 3
  %356 = load i32, ptr %355, align 1, !tbaa !15
  %357 = urem i32 %356, 500
  %358 = icmp eq i32 %357, 1
  br i1 %358, label %359, label %388

359:                                              ; preds = %349
  br label %360

360:                                              ; preds = %359
  %361 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %362 = getelementptr inbounds %struct.db_uav_status_t, ptr %361, i32 0, i32 7
  %363 = load i32, ptr %362, align 1, !tbaa !18
  %364 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %365 = getelementptr inbounds %struct.db_uav_status_t, ptr %364, i32 0, i32 5
  %366 = load i32, ptr %365, align 1, !tbaa !11
  %367 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %368 = getelementptr inbounds %struct.db_uav_status_t, ptr %367, i32 0, i32 6
  %369 = load i32, ptr %368, align 1, !tbaa !16
  %370 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %371 = getelementptr inbounds %struct.db_uav_status_t, ptr %370, i32 0, i32 0
  %372 = load i32, ptr %371, align 1, !tbaa !19
  %373 = call i32 (ptr, ...) @printf(ptr noundef @.str.15, i32 noundef %363, i32 noundef %366, i32 noundef %369, i32 noundef %372)
  %374 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %375 = getelementptr inbounds %struct.db_uav_status_t, ptr %374, i32 0, i32 7
  %376 = load i32, ptr %375, align 1, !tbaa !18
  %377 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %378 = getelementptr inbounds %struct.db_uav_status_t, ptr %377, i32 0, i32 5
  %379 = load i32, ptr %378, align 1, !tbaa !11
  %380 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %381 = getelementptr inbounds %struct.db_uav_status_t, ptr %380, i32 0, i32 6
  %382 = load i32, ptr %381, align 1, !tbaa !16
  %383 = load ptr, ptr @db_uav_status, align 8, !tbaa !9
  %384 = getelementptr inbounds %struct.db_uav_status_t, ptr %383, i32 0, i32 0
  %385 = load i32, ptr %384, align 1, !tbaa !19
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.15, i32 noundef %376, i32 noundef %379, i32 noundef %382, i32 noundef %385)
  br label %386

386:                                              ; preds = %360
  br label %387

387:                                              ; preds = %386
  br label %388

388:                                              ; preds = %387, %349
  %389 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 2
  store i32 0, ptr %389, align 8, !tbaa !23
  br label %394

390:                                              ; preds = %335
  %391 = getelementptr inbounds %struct.input_t, ptr %6, i32 0, i32 2
  %392 = load i32, ptr %391, align 8, !tbaa !23
  %393 = add nsw i32 %392, 1
  store i32 %393, ptr %391, align 8, !tbaa !23
  br label %394

394:                                              ; preds = %390, %388
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #8
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %395

395:                                              ; preds = %433, %394
  %396 = load i32, ptr %24, align 4, !tbaa !5
  %397 = icmp slt i32 %396, 5
  br i1 %397, label %399, label %398

398:                                              ; preds = %395
  store i32 34, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #8
  br label %436

399:                                              ; preds = %395
  %400 = load i32, ptr %24, align 4, !tbaa !5
  %401 = sext i32 %400 to i64
  %402 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %401
  %403 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %402, i32 0, i32 0
  %404 = load i32, ptr %403, align 4, !tbaa !31
  %405 = icmp sgt i32 %404, 0
  br i1 %405, label %406, label %432

406:                                              ; preds = %399
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #8
  %407 = load i32, ptr %24, align 4, !tbaa !5
  %408 = sext i32 %407 to i64
  %409 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %408
  %410 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %409, i32 0, i32 0
  %411 = load i32, ptr %410, align 4, !tbaa !31
  %412 = getelementptr inbounds [1 x i8], ptr %9, i64 0, i64 0
  %413 = call i64 @recv(i32 noundef %411, ptr noundef %412, i64 noundef 1, i32 noundef 0)
  store i64 %413, ptr %25, align 8, !tbaa !41
  %414 = load i64, ptr %25, align 8, !tbaa !41
  %415 = icmp eq i64 %414, 0
  br i1 %415, label %416, label %431

416:                                              ; preds = %406
  br label %417

417:                                              ; preds = %416
  %418 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.16)
  br label %419

419:                                              ; preds = %417
  br label %420

420:                                              ; preds = %419
  %421 = load i32, ptr %24, align 4, !tbaa !5
  %422 = sext i32 %421 to i64
  %423 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %422
  %424 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %423, i32 0, i32 0
  %425 = load i32, ptr %424, align 4, !tbaa !31
  %426 = call i32 @close(i32 noundef %425)
  %427 = load i32, ptr %24, align 4, !tbaa !5
  %428 = sext i32 %427 to i64
  %429 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %428
  %430 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %429, i32 0, i32 0
  store i32 -1, ptr %430, align 4, !tbaa !31
  br label %431

431:                                              ; preds = %420, %406
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #8
  br label %432

432:                                              ; preds = %431, %399
  br label %433

433:                                              ; preds = %432
  %434 = load i32, ptr %24, align 4, !tbaa !5
  %435 = add nsw i32 %434, 1
  store i32 %435, ptr %24, align 4, !tbaa !5
  br label %395, !llvm.loop !46

436:                                              ; preds = %398
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #8
  br label %437

437:                                              ; preds = %436, %312
  store i32 0, ptr %20, align 4
  br label %438

438:                                              ; preds = %437, %310
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #8
  %439 = load i32, ptr %20, align 4
  switch i32 %439, label %496 [
    i32 0, label %440
    i32 21, label %183
  ]

440:                                              ; preds = %438
  br label %183, !llvm.loop !43

441:                                              ; preds = %183
  call void @llvm.lifetime.start.p0(i64 4, ptr %26) #8
  store i32 0, ptr %26, align 4, !tbaa !5
  br label %442

442:                                              ; preds = %461, %441
  %443 = load i32, ptr %26, align 4, !tbaa !5
  %444 = icmp slt i32 %443, 4
  br i1 %444, label %446, label %445

445:                                              ; preds = %442
  store i32 39, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %26) #8
  br label %464

446:                                              ; preds = %442
  %447 = load i32, ptr %26, align 4, !tbaa !5
  %448 = sext i32 %447 to i64
  %449 = getelementptr inbounds [4 x %struct.db_socket_t], ptr @raw_sockets, i64 0, i64 %448
  %450 = getelementptr inbounds %struct.db_socket_t, ptr %449, i32 0, i32 0
  %451 = load i32, ptr %450, align 8, !tbaa !47
  %452 = icmp sgt i32 %451, 0
  br i1 %452, label %453, label %460

453:                                              ; preds = %446
  %454 = load i32, ptr %26, align 4, !tbaa !5
  %455 = sext i32 %454 to i64
  %456 = getelementptr inbounds [4 x %struct.db_socket_t], ptr @raw_sockets, i64 0, i64 %455
  %457 = getelementptr inbounds %struct.db_socket_t, ptr %456, i32 0, i32 0
  %458 = load i32, ptr %457, align 8, !tbaa !47
  %459 = call i32 @close(i32 noundef %458)
  br label %460

460:                                              ; preds = %453, %446
  br label %461

461:                                              ; preds = %460
  %462 = load i32, ptr %26, align 4, !tbaa !5
  %463 = add nsw i32 %462, 1
  store i32 %463, ptr %26, align 4, !tbaa !5
  br label %442, !llvm.loop !50

464:                                              ; preds = %445
  call void @llvm.lifetime.start.p0(i64 4, ptr %27) #8
  store i32 0, ptr %27, align 4, !tbaa !5
  br label %465

465:                                              ; preds = %484, %464
  %466 = load i32, ptr %27, align 4, !tbaa !5
  %467 = icmp slt i32 %466, 5
  br i1 %467, label %469, label %468

468:                                              ; preds = %465
  store i32 42, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %27) #8
  br label %487

469:                                              ; preds = %465
  %470 = load i32, ptr %27, align 4, !tbaa !5
  %471 = sext i32 %470 to i64
  %472 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %471
  %473 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %472, i32 0, i32 0
  %474 = load i32, ptr %473, align 4, !tbaa !31
  %475 = icmp sgt i32 %474, 0
  br i1 %475, label %476, label %483

476:                                              ; preds = %469
  %477 = load i32, ptr %27, align 4, !tbaa !5
  %478 = sext i32 %477 to i64
  %479 = getelementptr inbounds [5 x %struct.db_unix_tcp_client], ptr %14, i64 0, i64 %478
  %480 = getelementptr inbounds %struct.db_unix_tcp_client, ptr %479, i32 0, i32 0
  %481 = load i32, ptr %480, align 4, !tbaa !31
  %482 = call i32 @close(i32 noundef %481)
  br label %483

483:                                              ; preds = %476, %469
  br label %484

484:                                              ; preds = %483
  %485 = load i32, ptr %27, align 4, !tbaa !5
  %486 = add nsw i32 %485, 1
  store i32 %486, ptr %27, align 4, !tbaa !5
  br label %465, !llvm.loop !51

487:                                              ; preds = %468
  %488 = getelementptr inbounds %struct.db_unix_tcp_socket, ptr %13, i32 0, i32 0
  %489 = load i32, ptr %488, align 4, !tbaa !31
  %490 = call i32 @close(i32 noundef %489)
  br label %491

491:                                              ; preds = %487
  %492 = call i32 (ptr, ...) @printf(ptr noundef @.str.17)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef @.str.17)
  br label %493

493:                                              ; preds = %491
  br label %494

494:                                              ; preds = %493
  store i32 0, ptr %3, align 4
  store i32 1, ptr %20, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  call void @llvm.lifetime.end.p0(i64 110, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 580, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 116, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #8
  %495 = load i32, ptr %3, align 4
  ret i32 %495

496:                                              ; preds = %438
  unreachable
}

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) #4

; Function Attrs: nounwind
declare i32 @setpriority(i32 noundef, i32 noundef, i32 noundef) #4

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

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

declare ptr @lib_alloc_packet_buffer_list(i64 noundef, i64 noundef) #3

declare void @fec_init() #3

declare void @open_db_socket(ptr dead_on_unwind writable sret(%struct.db_socket_t) align 4, ptr noundef, i8 noundef zeroext, i8 noundef signext, i32 noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) #3

declare void @db_create_unix_tcpserver_sock(ptr dead_on_unwind writable sret(%struct.db_unix_tcp_socket) align 4, ptr noundef) #3

declare void @set_socket_nonblocking(ptr noundef) #3

declare i32 @accept(i32 noundef, ptr noundef, ptr noundef) #3

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

declare void @perror(ptr noundef) #3

declare i32 @usleep(i32 noundef) #3

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

declare i32 @close(i32 noundef) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { noreturn 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { 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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 14}
!12 = !{!"", !6, i64 0, !7, i64 4, !7, i64 5, !6, i64 6, !6, i64 10, !6, i64 14, !6, i64 18, !6, i64 22, !13, i64 26, !13, i64 28, !7, i64 30, !7, i64 31, !6, i64 32, !7, i64 36}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !6, i64 10}
!15 = !{!12, !6, i64 6}
!16 = !{!12, !6, i64 18}
!17 = !{!12, !6, i64 32}
!18 = !{!12, !6, i64 22}
!19 = !{!12, !6, i64 0}
!20 = !{!21, !6, i64 4}
!21 = !{!"", !6, i64 0, !6, i64 4, !6, i64 8, !10, i64 16}
!22 = !{!21, !6, i64 0}
!23 = !{!21, !6, i64 8}
!24 = !{!21, !10, i64 16}
!25 = distinct !{!25, !26}
!26 = !{!"llvm.loop.mustprogress"}
!27 = !{!7, !7, i64 0}
!28 = !{i64 0, i64 4, !5, i64 4, i64 2, !29, i64 6, i64 2, !29, i64 8, i64 4, !5, i64 12, i64 2, !29, i64 14, i64 1, !27, i64 15, i64 1, !27, i64 16, i64 8, !27}
!29 = !{!13, !13, i64 0}
!30 = distinct !{!30, !26}
!31 = !{!32, !6, i64 0}
!32 = !{!"", !6, i64 0, !33, i64 4}
!33 = !{!"sockaddr_un", !13, i64 0, !7, i64 2}
!34 = distinct !{!34, !26}
!35 = !{!36, !36, i64 0}
!36 = !{!"_Bool", !7, i64 0}
!37 = !{i8 0, i8 2}
!38 = !{}
!39 = !{i64 0, i64 2, !29, i64 2, i64 108, !27}
!40 = distinct !{!40, !26}
!41 = !{!42, !42, i64 0}
!42 = !{!"long", !7, i64 0}
!43 = distinct !{!43, !26}
!44 = !{!45, !6, i64 0}
!45 = !{!"", !6, i64 0, !10, i64 4}
!46 = distinct !{!46, !26}
!47 = !{!48, !6, i64 0}
!48 = !{!"", !6, i64 0, !49, i64 4}
!49 = !{!"sockaddr_ll", !13, i64 0, !13, i64 2, !6, i64 4, !13, i64 8, !7, i64 10, !7, i64 11, !7, i64 12}
!50 = distinct !{!50, !26}
!51 = distinct !{!51, !26}


; 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.db_socket_t = type { i32, %struct.sockaddr_ll }
%struct.sockaddr_ll = type { i16, i16, i32, i16, i8, i8, [8 x i8] }
%struct.input_t = type { i32, i32, i32, ptr }
%struct.db_uav_status_t = type <{ i32, i8, i8, i32, i32, i32, i32, i32, i16, i16, i8, i8, i32, [8 x %struct.db_adapter_status] }>
%struct.db_adapter_status = type <{ i32, i32, i8, [4 x i8], i8, i8, i8, i8, [16 x i8] }>
%struct.db_unix_tcp_socket = type { i32, %struct.sockaddr_un }
%struct.sockaddr_un = type { i16, [108 x i8] }
%struct.db_unix_tcp_client = type { i32, %struct.sockaddr_un }
%struct.packet_buffer_t = type { i32, i32, i32, ptr }

@keeprunning = external dso_local local_unnamed_addr global i8, align 1
@num_interfaces = external dso_local local_unnamed_addr global i32, align 4
@num_data_per_block = external dso_local local_unnamed_addr global i32, align 4
@num_fec_per_block = external dso_local local_unnamed_addr global i32, align 4
@pack_size = external dso_local local_unnamed_addr global i32, align 4
@bitrate_op = external dso_local local_unnamed_addr global i32, align 4
@db_uav_status = external dso_local local_unnamed_addr global ptr, align 8
@raw_sockets = external dso_local local_unnamed_addr global [4 x %struct.db_socket_t], align 16
@comm_id = external dso_local local_unnamed_addr global i8, align 1
@frame_type = external dso_local local_unnamed_addr global i8, align 1
@adapters = external dso_local global [4 x [16 x i8]], align 16
@stderr = external local_unnamed_addr global ptr, align 8
@.str.5 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [84 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [96 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [59 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [99 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [121 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.17 = external hidden unnamed_addr constant [27 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare dso_local void @write_to_unix(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

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

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

declare void @syslog(i32 noundef, ptr noundef, ...) local_unnamed_addr #4

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite)
declare ptr @strncpy(ptr noalias noundef returned writeonly, ptr noalias nocapture noundef readonly, i64 noundef) local_unnamed_addr #7

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #8

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.input_t, align 8
  %4 = alloca %struct.db_uav_status_t, align 4
  %5 = alloca [1 x i8], align 1
  %6 = alloca %struct.db_socket_t, align 4
  %7 = alloca %struct.db_unix_tcp_socket, align 4
  %8 = alloca [5 x %struct.db_unix_tcp_client], align 16
  %9 = alloca i32, align 4
  %10 = tail call ptr @signal(i32 noundef 2, ptr noundef nonnull @int_handler) #11
  %11 = tail call i32 @setpriority(i32 noundef 0, i32 noundef 0, i32 noundef -10) #11
  tail call void @process_command_line_args(i32 noundef %0, ptr noundef %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #11
  %12 = getelementptr inbounds i8, ptr %4, i64 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(300) %12, i8 0, i64 296, i1 false)
  store ptr %4, ptr @db_uav_status, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %4, i64 6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 2 dereferenceable(16) %13, i8 0, i64 16, i1 false)
  %14 = load i32, ptr @num_interfaces, align 4, !tbaa !9
  %15 = getelementptr inbounds i8, ptr %4, i64 32
  store i32 %14, ptr %15, align 4, !tbaa !11
  store i32 0, ptr %4, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #11
  %16 = icmp eq i32 %14, 0
  br i1 %16, label %17, label %20

17:                                               ; preds = %2
  %18 = load ptr, ptr @stderr, align 8, !tbaa !5
  %19 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef nonnull @.str.5) #12
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.5) #11
  call void @abort() #13
  unreachable

20:                                               ; preds = %2
  %21 = load i32, ptr @pack_size, align 4, !tbaa !9
  %22 = icmp ugt i32 %21, 2048
  br i1 %22, label %23, label %27

23:                                               ; preds = %20
  %24 = load ptr, ptr @stderr, align 8, !tbaa !5
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %24, ptr noundef nonnull @.str.6, i32 noundef 2048, i32 noundef %21) #12
  %26 = load i32, ptr @pack_size, align 4, !tbaa !9
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.6, i32 noundef 2048, i32 noundef %26) #11
  call void @abort() #13
  unreachable

27:                                               ; preds = %20
  %28 = icmp ult i32 %21, 24
  br i1 %28, label %29, label %33

29:                                               ; preds = %27
  %30 = load ptr, ptr @stderr, align 8, !tbaa !5
  %31 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %30, ptr noundef nonnull @.str.7, i32 noundef 24, i32 noundef %21) #12
  %32 = load i32, ptr @pack_size, align 4, !tbaa !9
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.7, i32 noundef 24, i32 noundef %32) #11
  call void @abort() #13
  unreachable

33:                                               ; preds = %27
  %34 = load i32, ptr @num_data_per_block, align 4, !tbaa !9
  %35 = icmp ugt i32 %34, 32
  %36 = load i32, ptr @num_fec_per_block, align 4
  %37 = icmp ugt i32 %36, 32
  %or.cond = select i1 %35, i1 true, i1 %37
  br i1 %or.cond, label %38, label %43

38:                                               ; preds = %33
  %39 = load ptr, ptr @stderr, align 8, !tbaa !5
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str.8, i32 noundef 32, i32 noundef %34, i32 noundef %36) #12
  %41 = load i32, ptr @num_data_per_block, align 4, !tbaa !9
  %42 = load i32, ptr @num_fec_per_block, align 4, !tbaa !9
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.8, i32 noundef 32, i32 noundef %41, i32 noundef %42) #11
  call void @abort() #13
  unreachable

43:                                               ; preds = %33
  %44 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 0, ptr %44, align 4, !tbaa !15
  store i32 0, ptr %3, align 8, !tbaa !17
  %45 = getelementptr inbounds i8, ptr %3, i64 8
  store i32 0, ptr %45, align 8, !tbaa !18
  %46 = zext nneg i32 %34 to i64
  %47 = call ptr @lib_alloc_packet_buffer_list(i64 noundef %46, i64 noundef 2071) #11
  %48 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr %47, ptr %48, align 8, !tbaa !19
  %49 = load i32, ptr @num_data_per_block, align 4, !tbaa !9
  %.not91 = icmp eq i32 %49, 0
  br i1 %.not91, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %43, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %43 ]
  %50 = getelementptr inbounds %struct.packet_buffer_t, ptr %47, i64 %indvars.iv, i32 2
  store i32 0, ptr %50, align 8, !tbaa !18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %51 = load i32, ptr @num_data_per_block, align 4, !tbaa !9
  %52 = zext i32 %51 to i64
  %53 = icmp ult i64 %indvars.iv.next, %52
  br i1 %53, label %.lr.ph, label %._crit_edge, !llvm.loop !20

._crit_edge:                                      ; preds = %.lr.ph, %43
  call void @fec_init() #11
  %54 = load i32, ptr @num_interfaces, align 4, !tbaa !9
  %.not92 = icmp eq i32 %54, 0
  br i1 %.not92, label %._crit_edge84, label %.lr.ph83

._crit_edge84:                                    ; preds = %.lr.ph83, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 116, ptr nonnull %7) #11
  call void @db_create_unix_tcpserver_sock(ptr dead_on_unwind nonnull writable sret(%struct.db_unix_tcp_socket) align 4 %7, ptr noundef nonnull @.str.9) #11
  call void @set_socket_nonblocking(ptr noundef nonnull %7) #11
  call void @llvm.lifetime.start.p0(i64 580, ptr nonnull %8) #11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #11
  store i32 110, ptr %9, align 4, !tbaa !9
  store i32 -1, ptr %8, align 16, !tbaa !22
  %55 = getelementptr inbounds i8, ptr %8, i64 116
  store i32 -1, ptr %55, align 4, !tbaa !22
  %56 = getelementptr inbounds i8, ptr %8, i64 232
  store i32 -1, ptr %56, align 8, !tbaa !22
  %57 = getelementptr inbounds i8, ptr %8, i64 348
  store i32 -1, ptr %57, align 4, !tbaa !22
  %58 = getelementptr inbounds i8, ptr %8, i64 464
  store i32 -1, ptr %58, align 16, !tbaa !22
  %59 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.10) #11
  %60 = load i8, ptr @keeprunning, align 1, !tbaa !25, !range !27, !noundef !28
  %61 = trunc nuw i8 %60 to i1
  br i1 %61, label %.lr.ph88, label %.preheader78

.lr.ph83:                                         ; preds = %._crit_edge, %.lr.ph83
  %indvars.iv94 = phi i64 [ %indvars.iv.next95, %.lr.ph83 ], [ 0, %._crit_edge ]
  %62 = getelementptr inbounds [4 x %struct.db_socket_t], ptr @raw_sockets, i64 0, i64 %indvars.iv94
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #11
  %63 = getelementptr inbounds [4 x [16 x i8]], ptr @adapters, i64 0, i64 %indvars.iv94
  %64 = load i8, ptr @comm_id, align 1, !tbaa !29
  %65 = load i32, ptr @bitrate_op, align 4, !tbaa !9
  %66 = load i8, ptr @frame_type, align 1, !tbaa !29
  call void @open_db_socket(ptr dead_on_unwind nonnull writable sret(%struct.db_socket_t) align 4 %6, ptr noundef nonnull %63, i8 noundef zeroext %64, i8 noundef signext 109, i32 noundef %65, i8 noundef zeroext 3, i8 noundef zeroext 3, i8 noundef zeroext %66) #11
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %62, ptr noundef nonnull align 4 dereferenceable(24) %6, i64 24, i1 false), !tbaa.struct !30
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #11
  %67 = load ptr, ptr @db_uav_status, align 8, !tbaa !5
  %68 = getelementptr inbounds i8, ptr %67, i64 36
  %69 = getelementptr inbounds [8 x %struct.db_adapter_status], ptr %68, i64 0, i64 %indvars.iv94, i32 8
  %70 = call ptr @strncpy(ptr noundef nonnull dereferenceable(1) %69, ptr noundef nonnull dereferenceable(1) %63, i64 noundef 16) #11
  %indvars.iv.next95 = add nuw nsw i64 %indvars.iv94, 1
  %71 = load i32, ptr @num_interfaces, align 4, !tbaa !9
  %72 = zext i32 %71 to i64
  %73 = icmp ult i64 %indvars.iv.next95, %72
  br i1 %73, label %.lr.ph83, label %._crit_edge84, !llvm.loop !32

.lr.ph88:                                         ; preds = %._crit_edge84
  %74 = getelementptr inbounds i8, ptr %7, i64 4
  %75 = getelementptr inbounds i8, ptr %8, i64 116
  %76 = getelementptr inbounds i8, ptr %8, i64 232
  %77 = getelementptr inbounds i8, ptr %8, i64 348
  %78 = getelementptr inbounds i8, ptr %8, i64 464
  br label %81

.preheader78:                                     ; preds = %.loopexit, %._crit_edge84
  %79 = load i32, ptr @raw_sockets, align 16, !tbaa !33
  %80 = icmp sgt i32 %79, 0
  br i1 %80, label %231, label %233

81:                                               ; preds = %.lr.ph88, %.loopexit
  %82 = load i32, ptr %7, align 4, !tbaa !22
  %83 = call i32 @accept(i32 noundef %82, ptr noundef nonnull %74, ptr noundef nonnull %9) #11
  %84 = icmp sgt i32 %83, 0
  br i1 %84, label %.preheader79, label %95

.preheader79:                                     ; preds = %81
  %85 = load i32, ptr %8, align 16, !tbaa !22
  %86 = icmp slt i32 %85, 0
  br i1 %86, label %.preheader79.4, label %.preheader79.1, !llvm.loop !36

.preheader79.1:                                   ; preds = %.preheader79
  %87 = load i32, ptr %75, align 4, !tbaa !22
  %88 = icmp slt i32 %87, 0
  br i1 %88, label %.preheader79.4, label %.preheader79.2, !llvm.loop !36

.preheader79.2:                                   ; preds = %.preheader79.1
  %89 = load i32, ptr %76, align 8, !tbaa !22
  %90 = icmp slt i32 %89, 0
  br i1 %90, label %.preheader79.4, label %.preheader79.3, !llvm.loop !36

.preheader79.3:                                   ; preds = %.preheader79.2
  %91 = load i32, ptr %77, align 4, !tbaa !22
  %92 = icmp slt i32 %91, 0
  %spec.select = select i1 %92, ptr %77, ptr %78
  br label %.preheader79.4, !llvm.loop !36

.preheader79.4:                                   ; preds = %.preheader79.3, %.preheader79.2, %.preheader79.1, %.preheader79
  %.lcssa = phi ptr [ %8, %.preheader79 ], [ %75, %.preheader79.1 ], [ %76, %.preheader79.2 ], [ %spec.select, %.preheader79.3 ]
  store i32 %83, ptr %.lcssa, align 4, !tbaa !22
  call void @set_socket_nonblocking(ptr noundef nonnull %.lcssa) #11
  %93 = getelementptr inbounds i8, ptr %.lcssa, i64 4
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(110) %93, ptr noundef nonnull align 4 dereferenceable(110) %74, i64 110, i1 false), !tbaa.struct !37
  %94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.11) #11
  br label %104

95:                                               ; preds = %81
  %96 = tail call ptr @__errno_location() #14
  %97 = load i32, ptr %96, align 4, !tbaa !9
  %.not = icmp eq i32 %97, 11
  br i1 %.not, label %104, label %98

98:                                               ; preds = %95
  %99 = load ptr, ptr @stderr, align 8, !tbaa !5
  %100 = call ptr @strerror(i32 noundef %97) #11
  %101 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %99, ptr noundef nonnull @.str.12, ptr noundef %100, ptr noundef nonnull @.str.9) #12
  %102 = load i32, ptr %96, align 4, !tbaa !9
  %103 = call ptr @strerror(i32 noundef %102) #11
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.12, ptr noundef %103, ptr noundef nonnull @.str.9) #11
  br label %104

104:                                              ; preds = %95, %.preheader79.4, %98
  %105 = load ptr, ptr %48, align 8, !tbaa !19
  %106 = load i32, ptr %45, align 8, !tbaa !18
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds %struct.packet_buffer_t, ptr %105, i64 %107
  %109 = getelementptr inbounds i8, ptr %108, i64 8
  %110 = load i32, ptr %109, align 8, !tbaa !18
  %111 = icmp eq i32 %110, 0
  br i1 %111, label %112, label %113

112:                                              ; preds = %104
  store i32 4, ptr %109, align 8, !tbaa !18
  br label %113

113:                                              ; preds = %112, %104
  %114 = phi i32 [ 4, %112 ], [ %110, %104 ]
  %115 = load i32, ptr %44, align 4, !tbaa !15
  %116 = getelementptr inbounds i8, ptr %108, i64 16
  %117 = load ptr, ptr %116, align 8, !tbaa !19
  %118 = zext i32 %114 to i64
  %119 = getelementptr inbounds i8, ptr %117, i64 %118
  %120 = load i32, ptr @pack_size, align 4, !tbaa !9
  %121 = sub i32 %120, %114
  %122 = zext i32 %121 to i64
  %123 = call i64 @read(i32 noundef %115, ptr noundef nonnull %119, i64 noundef %122) #11
  %124 = icmp slt i64 %123, 0
  br i1 %124, label %131, label %125

125:                                              ; preds = %113
  %126 = load i32, ptr @pack_size, align 4, !tbaa !9
  %127 = load i32, ptr %109, align 8, !tbaa !18
  %128 = sub i32 %126, %127
  %129 = zext i32 %128 to i64
  %130 = icmp ugt i64 %123, %129
  br i1 %130, label %131, label %132

131:                                              ; preds = %125, %113
  call void @perror(ptr noundef nonnull @.str.13) #15
  call void @abort() #13
  unreachable

132:                                              ; preds = %125
  %133 = icmp eq i64 %123, 0
  br i1 %133, label %134, label %138

134:                                              ; preds = %132
  %135 = load ptr, ptr @stderr, align 8, !tbaa !5
  %136 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %135, ptr noundef nonnull @.str.14) #12
  call void (i32, ptr, ...) @syslog(i32 noundef 3, ptr noundef nonnull @.str.14) #11
  %137 = call i32 @usleep(i32 noundef 500000) #11
  br label %.loopexit, !llvm.loop !38

138:                                              ; preds = %132
  %139 = load ptr, ptr %116, align 8, !tbaa !19
  %140 = zext i32 %127 to i64
  %141 = getelementptr inbounds i8, ptr %139, i64 %140
  call void @write_to_unix(ptr noundef nonnull %8, ptr noundef %141, i64 noundef %123)
  %142 = load i32, ptr %109, align 8, !tbaa !18
  %143 = trunc i64 %123 to i32
  %144 = add i32 %142, %143
  store i32 %144, ptr %109, align 8, !tbaa !18
  %145 = icmp ugt i32 %144, 23
  br i1 %145, label %146, label %.loopexit

146:                                              ; preds = %138
  %147 = load ptr, ptr %116, align 8, !tbaa !19
  store i32 %144, ptr %147, align 1, !tbaa !39
  %148 = load i32, ptr %45, align 8, !tbaa !18
  %149 = load i32, ptr @num_data_per_block, align 4, !tbaa !9
  %150 = add i32 %149, -1
  %151 = icmp eq i32 %148, %150
  br i1 %151, label %152, label %177

152:                                              ; preds = %146
  %153 = load ptr, ptr %48, align 8, !tbaa !19
  %154 = load i32, ptr @pack_size, align 4, !tbaa !9
  call void @transmit_block(ptr noundef %153, ptr noundef nonnull %3, i32 noundef %154)
  %155 = load ptr, ptr @db_uav_status, align 8, !tbaa !5
  %156 = getelementptr inbounds i8, ptr %155, i64 6
  %157 = load i32, ptr %156, align 1, !tbaa !41
  %158 = urem i32 %157, 500
  %159 = icmp eq i32 %158, 1
  br i1 %159, label %160, label %179

160:                                              ; preds = %152
  %161 = getelementptr inbounds i8, ptr %155, i64 22
  %162 = load i32, ptr %161, align 1, !tbaa !42
  %163 = getelementptr inbounds i8, ptr %155, i64 14
  %164 = load i32, ptr %163, align 1, !tbaa !43
  %165 = getelementptr inbounds i8, ptr %155, i64 18
  %166 = load i32, ptr %165, align 1, !tbaa !44
  %167 = load i32, ptr %155, align 1, !tbaa !14
  %168 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15, i32 noundef %162, i32 noundef %164, i32 noundef %166, i32 noundef %167)
  %169 = load ptr, ptr @db_uav_status, align 8, !tbaa !5
  %170 = getelementptr inbounds i8, ptr %169, i64 22
  %171 = load i32, ptr %170, align 1, !tbaa !42
  %172 = getelementptr inbounds i8, ptr %169, i64 14
  %173 = load i32, ptr %172, align 1, !tbaa !43
  %174 = getelementptr inbounds i8, ptr %169, i64 18
  %175 = load i32, ptr %174, align 1, !tbaa !44
  %176 = load i32, ptr %169, align 1, !tbaa !14
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.15, i32 noundef %171, i32 noundef %173, i32 noundef %175, i32 noundef %176) #11
  br label %179

177:                                              ; preds = %146
  %178 = add nsw i32 %148, 1
  br label %179

179:                                              ; preds = %152, %160, %177
  %storemerge = phi i32 [ %178, %177 ], [ 0, %160 ], [ 0, %152 ]
  store i32 %storemerge, ptr %45, align 8, !tbaa !18
  %180 = load i32, ptr %8, align 16, !tbaa !22
  %181 = icmp sgt i32 %180, 0
  br i1 %181, label %182, label %189

182:                                              ; preds = %179
  %183 = call i64 @recv(i32 noundef %180, ptr noundef nonnull %5, i64 noundef 1, i32 noundef 0) #11
  %184 = icmp eq i64 %183, 0
  br i1 %184, label %185, label %189

185:                                              ; preds = %182
  %186 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.16) #11
  %187 = load i32, ptr %8, align 16, !tbaa !22
  %188 = call i32 @close(i32 noundef %187) #11
  store i32 -1, ptr %8, align 16, !tbaa !22
  br label %189

189:                                              ; preds = %182, %185, %179
  %190 = load i32, ptr %55, align 4, !tbaa !22
  %191 = icmp sgt i32 %190, 0
  br i1 %191, label %192, label %199

192:                                              ; preds = %189
  %193 = call i64 @recv(i32 noundef %190, ptr noundef nonnull %5, i64 noundef 1, i32 noundef 0) #11
  %194 = icmp eq i64 %193, 0
  br i1 %194, label %195, label %199

195:                                              ; preds = %192
  %196 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.16) #11
  %197 = load i32, ptr %55, align 4, !tbaa !22
  %198 = call i32 @close(i32 noundef %197) #11
  store i32 -1, ptr %55, align 4, !tbaa !22
  br label %199

199:                                              ; preds = %195, %192, %189
  %200 = load i32, ptr %56, align 8, !tbaa !22
  %201 = icmp sgt i32 %200, 0
  br i1 %201, label %202, label %209

202:                                              ; preds = %199
  %203 = call i64 @recv(i32 noundef %200, ptr noundef nonnull %5, i64 noundef 1, i32 noundef 0) #11
  %204 = icmp eq i64 %203, 0
  br i1 %204, label %205, label %209

205:                                              ; preds = %202
  %206 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.16) #11
  %207 = load i32, ptr %56, align 8, !tbaa !22
  %208 = call i32 @close(i32 noundef %207) #11
  store i32 -1, ptr %56, align 8, !tbaa !22
  br label %209

209:                                              ; preds = %205, %202, %199
  %210 = load i32, ptr %57, align 4, !tbaa !22
  %211 = icmp sgt i32 %210, 0
  br i1 %211, label %212, label %219

212:                                              ; preds = %209
  %213 = call i64 @recv(i32 noundef %210, ptr noundef nonnull %5, i64 noundef 1, i32 noundef 0) #11
  %214 = icmp eq i64 %213, 0
  br i1 %214, label %215, label %219

215:                                              ; preds = %212
  %216 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.16) #11
  %217 = load i32, ptr %57, align 4, !tbaa !22
  %218 = call i32 @close(i32 noundef %217) #11
  store i32 -1, ptr %57, align 4, !tbaa !22
  br label %219

219:                                              ; preds = %215, %212, %209
  %220 = load i32, ptr %58, align 16, !tbaa !22
  %221 = icmp sgt i32 %220, 0
  br i1 %221, label %222, label %.loopexit

222:                                              ; preds = %219
  %223 = call i64 @recv(i32 noundef %220, ptr noundef nonnull %5, i64 noundef 1, i32 noundef 0) #11
  %224 = icmp eq i64 %223, 0
  br i1 %224, label %225, label %.loopexit

225:                                              ; preds = %222
  %226 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.16) #11
  %227 = load i32, ptr %58, align 16, !tbaa !22
  %228 = call i32 @close(i32 noundef %227) #11
  store i32 -1, ptr %58, align 16, !tbaa !22
  br label %.loopexit

.loopexit:                                        ; preds = %219, %222, %225, %138, %134
  %229 = load i8, ptr @keeprunning, align 1, !tbaa !25, !range !27, !noundef !28
  %230 = trunc nuw i8 %229 to i1
  br i1 %230, label %81, label %.preheader78

231:                                              ; preds = %.preheader78
  %232 = call i32 @close(i32 noundef %79) #11
  br label %233

233:                                              ; preds = %.preheader78, %231
  %234 = load i32, ptr getelementptr inbounds (i8, ptr @raw_sockets, i64 24), align 8, !tbaa !33
  %235 = icmp sgt i32 %234, 0
  br i1 %235, label %236, label %238

236:                                              ; preds = %233
  %237 = call i32 @close(i32 noundef %234) #11
  br label %238

238:                                              ; preds = %236, %233
  %239 = load i32, ptr getelementptr inbounds (i8, ptr @raw_sockets, i64 48), align 16, !tbaa !33
  %240 = icmp sgt i32 %239, 0
  br i1 %240, label %241, label %243

241:                                              ; preds = %238
  %242 = call i32 @close(i32 noundef %239) #11
  br label %243

243:                                              ; preds = %241, %238
  %244 = load i32, ptr getelementptr inbounds (i8, ptr @raw_sockets, i64 72), align 8, !tbaa !33
  %245 = icmp sgt i32 %244, 0
  br i1 %245, label %246, label %.preheader.preheader

246:                                              ; preds = %243
  %247 = call i32 @close(i32 noundef %244) #11
  br label %.preheader.preheader

.preheader.preheader:                             ; preds = %246, %243
  %248 = load i32, ptr %8, align 16, !tbaa !22
  %249 = icmp sgt i32 %248, 0
  br i1 %249, label %250, label %.preheader.1

250:                                              ; preds = %.preheader.preheader
  %251 = call i32 @close(i32 noundef %248) #11
  br label %.preheader.1

.preheader.1:                                     ; preds = %.preheader.preheader, %250
  %252 = load i32, ptr %55, align 4, !tbaa !22
  %253 = icmp sgt i32 %252, 0
  br i1 %253, label %254, label %.preheader.2

254:                                              ; preds = %.preheader.1
  %255 = call i32 @close(i32 noundef %252) #11
  br label %.preheader.2

.preheader.2:                                     ; preds = %254, %.preheader.1
  %256 = load i32, ptr %56, align 8, !tbaa !22
  %257 = icmp sgt i32 %256, 0
  br i1 %257, label %258, label %.preheader.3

258:                                              ; preds = %.preheader.2
  %259 = call i32 @close(i32 noundef %256) #11
  br label %.preheader.3

.preheader.3:                                     ; preds = %258, %.preheader.2
  %260 = load i32, ptr %57, align 4, !tbaa !22
  %261 = icmp sgt i32 %260, 0
  br i1 %261, label %262, label %.preheader.4

262:                                              ; preds = %.preheader.3
  %263 = call i32 @close(i32 noundef %260) #11
  br label %.preheader.4

.preheader.4:                                     ; preds = %262, %.preheader.3
  %264 = load i32, ptr %58, align 16, !tbaa !22
  %265 = icmp sgt i32 %264, 0
  br i1 %265, label %266, label %268

266:                                              ; preds = %.preheader.4
  %267 = call i32 @close(i32 noundef %264) #11
  br label %268

268:                                              ; preds = %266, %.preheader.4
  %269 = load i32, ptr %7, align 4, !tbaa !22
  %270 = call i32 @close(i32 noundef %269) #11
  %271 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.17)
  call void (i32, ptr, ...) @syslog(i32 noundef 6, ptr noundef nonnull @.str.17) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #11
  call void @llvm.lifetime.end.p0(i64 580, ptr nonnull %8) #11
  call void @llvm.lifetime.end.p0(i64 116, ptr nonnull %7) #11
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #11
  ret i32 0
}

; Function Attrs: nounwind
declare ptr @signal(i32 noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: nounwind
declare i32 @setpriority(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #5

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

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

declare ptr @lib_alloc_packet_buffer_list(i64 noundef, i64 noundef) local_unnamed_addr #4

declare void @fec_init() local_unnamed_addr #4

declare void @open_db_socket(ptr dead_on_unwind writable sret(%struct.db_socket_t) align 4, ptr noundef, i8 noundef zeroext, i8 noundef signext, i32 noundef, i8 noundef zeroext, i8 noundef zeroext, i8 noundef zeroext) local_unnamed_addr #4

declare void @db_create_unix_tcpserver_sock(ptr dead_on_unwind writable sret(%struct.db_unix_tcp_socket) align 4, ptr noundef) local_unnamed_addr #4

declare void @set_socket_nonblocking(ptr noundef) local_unnamed_addr #4

declare i32 @accept(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nofree
declare noundef i64 @read(i32 noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #10

; Function Attrs: nofree nounwind
declare void @perror(ptr nocapture noundef readonly) local_unnamed_addr #3

declare i32 @usleep(i32 noundef) local_unnamed_addr #4

declare i64 @recv(i32 noundef, ptr noundef, i64 noundef, i32 noundef) local_unnamed_addr #4

declare i32 @close(i32 noundef) local_unnamed_addr #4

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 = { 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 = { 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 #4 = { "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 "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #7 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite) "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 #8 = { noreturn 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 #9 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nofree "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 #11 = { nounwind }
attributes #12 = { cold nounwind }
attributes #13 = { noreturn nounwind }
attributes #14 = { nounwind willreturn memory(none) }
attributes #15 = { cold }

!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, !10, i64 32}
!12 = !{!"", !10, i64 0, !7, i64 4, !7, i64 5, !10, i64 6, !10, i64 10, !10, i64 14, !10, i64 18, !10, i64 22, !13, i64 26, !13, i64 28, !7, i64 30, !7, i64 31, !10, i64 32, !7, i64 36}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !10, i64 0}
!15 = !{!16, !10, i64 4}
!16 = !{!"", !10, i64 0, !10, i64 4, !10, i64 8, !6, i64 16}
!17 = !{!16, !10, i64 0}
!18 = !{!16, !10, i64 8}
!19 = !{!16, !6, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!23, !10, i64 0}
!23 = !{!"", !10, i64 0, !24, i64 4}
!24 = !{!"sockaddr_un", !13, i64 0, !7, i64 2}
!25 = !{!26, !26, i64 0}
!26 = !{!"_Bool", !7, i64 0}
!27 = !{i8 0, i8 2}
!28 = !{}
!29 = !{!7, !7, i64 0}
!30 = !{i64 0, i64 4, !9, i64 4, i64 2, !31, i64 6, i64 2, !31, i64 8, i64 4, !9, i64 12, i64 2, !31, i64 14, i64 1, !29, i64 15, i64 1, !29, i64 16, i64 8, !29}
!31 = !{!13, !13, i64 0}
!32 = distinct !{!32, !21}
!33 = !{!34, !10, i64 0}
!34 = !{!"", !10, i64 0, !35, i64 4}
!35 = !{!"sockaddr_ll", !13, i64 0, !13, i64 2, !10, i64 4, !13, i64 8, !7, i64 10, !7, i64 11, !7, i64 12}
!36 = distinct !{!36, !21}
!37 = !{i64 0, i64 2, !31, i64 2, i64 108, !29}
!38 = distinct !{!38, !21}
!39 = !{!40, !10, i64 0}
!40 = !{!"", !10, i64 0, !6, i64 4}
!41 = !{!12, !10, i64 6}
!42 = !{!12, !10, i64 22}
!43 = !{!12, !10, i64 14}
!44 = !{!12, !10, i64 18}


; Effective O3 passes: CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass