; LLVM IR from rigtorp/ipc-bench :: src (tcp_remote_lat)

; 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.timeval = type { i64, i64 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [73 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@stderr = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca %struct.timeval, align 8
  %12 = alloca %struct.timeval, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i32, align 4
  %16 = alloca %struct.addrinfo, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = 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
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 48, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #7
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = icmp ne i32 %20, 6
  br i1 %21, label %22, label %24

22:                                               ; preds = %2
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

24:                                               ; preds = %2
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 4
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = call i32 @atoi(ptr noundef %27) #8
  store i32 %28, ptr %6, align 4, !tbaa !5
  %29 = load ptr, ptr %5, align 8, !tbaa !9
  %30 = getelementptr inbounds ptr, ptr %29, i64 5
  %31 = load ptr, ptr %30, align 8, !tbaa !9
  %32 = call i64 @atol(ptr noundef %31) #8
  store i64 %32, ptr %8, align 8, !tbaa !11
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = call noalias ptr @malloc(i64 noundef %34) #9
  store ptr %35, ptr %7, align 8, !tbaa !9
  %36 = load ptr, ptr %7, align 8, !tbaa !9
  %37 = icmp eq ptr %36, null
  br i1 %37, label %38, label %39

38:                                               ; preds = %24
  call void @perror(ptr noundef @.str.1)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

39:                                               ; preds = %24
  %40 = load i32, ptr %6, align 4, !tbaa !5
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %40)
  %42 = load i64, ptr %8, align 8, !tbaa !11
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i64 noundef %42)
  call void @llvm.memset.p0.i64(ptr align 8 %16, i8 0, i64 48, i1 false)
  %44 = getelementptr inbounds %struct.addrinfo, ptr %16, i32 0, i32 1
  store i32 0, ptr %44, align 4, !tbaa !13
  %45 = getelementptr inbounds %struct.addrinfo, ptr %16, i32 0, i32 2
  store i32 1, ptr %45, align 8, !tbaa !15
  %46 = getelementptr inbounds %struct.addrinfo, ptr %16, i32 0, i32 0
  store i32 1, ptr %46, align 8, !tbaa !16
  %47 = load ptr, ptr %5, align 8, !tbaa !9
  %48 = getelementptr inbounds ptr, ptr %47, i64 1
  %49 = load ptr, ptr %48, align 8, !tbaa !9
  %50 = call i32 @getaddrinfo(ptr noundef %49, ptr noundef null, ptr noundef %16, ptr noundef %17)
  store i32 %50, ptr %15, align 4, !tbaa !5
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %52, label %57

52:                                               ; preds = %39
  %53 = load ptr, ptr @stderr, align 8, !tbaa !9
  %54 = load i32, ptr %15, align 4, !tbaa !5
  %55 = call ptr @gai_strerror(i32 noundef %54) #7
  %56 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str.4, ptr noundef %55) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

57:                                               ; preds = %39
  %58 = load ptr, ptr %17, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.addrinfo, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = load ptr, ptr %17, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.addrinfo, ptr %61, i32 0, i32 2
  %63 = load i32, ptr %62, align 8, !tbaa !15
  %64 = load ptr, ptr %17, align 8, !tbaa !9
  %65 = getelementptr inbounds %struct.addrinfo, ptr %64, i32 0, i32 3
  %66 = load i32, ptr %65, align 4, !tbaa !17
  %67 = call i32 @socket(i32 noundef %60, i32 noundef %63, i32 noundef %66) #7
  store i32 %67, ptr %18, align 4, !tbaa !5
  %68 = icmp eq i32 %67, -1
  br i1 %68, label %69, label %70

69:                                               ; preds = %57
  call void @perror(ptr noundef @.str.5)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

70:                                               ; preds = %57
  %71 = load i32, ptr %18, align 4, !tbaa !5
  %72 = load ptr, ptr %17, align 8, !tbaa !9
  %73 = getelementptr inbounds %struct.addrinfo, ptr %72, i32 0, i32 5
  %74 = load ptr, ptr %73, align 8, !tbaa !18
  %75 = load ptr, ptr %17, align 8, !tbaa !9
  %76 = getelementptr inbounds %struct.addrinfo, ptr %75, i32 0, i32 4
  %77 = load i32, ptr %76, align 8, !tbaa !19
  %78 = call i32 @bind(i32 noundef %71, ptr noundef %74, i32 noundef %77) #7
  %79 = icmp eq i32 %78, -1
  br i1 %79, label %80, label %81

80:                                               ; preds = %70
  call void @perror(ptr noundef @.str.6)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

81:                                               ; preds = %70
  %82 = load ptr, ptr %5, align 8, !tbaa !9
  %83 = getelementptr inbounds ptr, ptr %82, i64 2
  %84 = load ptr, ptr %83, align 8, !tbaa !9
  %85 = load ptr, ptr %5, align 8, !tbaa !9
  %86 = getelementptr inbounds ptr, ptr %85, i64 3
  %87 = load ptr, ptr %86, align 8, !tbaa !9
  %88 = call i32 @getaddrinfo(ptr noundef %84, ptr noundef %87, ptr noundef %16, ptr noundef %17)
  store i32 %88, ptr %15, align 4, !tbaa !5
  %89 = icmp ne i32 %88, 0
  br i1 %89, label %90, label %95

90:                                               ; preds = %81
  %91 = load ptr, ptr @stderr, align 8, !tbaa !9
  %92 = load i32, ptr %15, align 4, !tbaa !5
  %93 = call ptr @gai_strerror(i32 noundef %92) #7
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %91, ptr noundef @.str.4, ptr noundef %93) #7
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

95:                                               ; preds = %81
  %96 = load i32, ptr %18, align 4, !tbaa !5
  %97 = load ptr, ptr %17, align 8, !tbaa !9
  %98 = getelementptr inbounds %struct.addrinfo, ptr %97, i32 0, i32 5
  %99 = load ptr, ptr %98, align 8, !tbaa !18
  %100 = load ptr, ptr %17, align 8, !tbaa !9
  %101 = getelementptr inbounds %struct.addrinfo, ptr %100, i32 0, i32 4
  %102 = load i32, ptr %101, align 8, !tbaa !19
  %103 = call i32 @connect(i32 noundef %96, ptr noundef %99, i32 noundef %102)
  %104 = icmp eq i32 %103, -1
  br i1 %104, label %105, label %106

105:                                              ; preds = %95
  call void @perror(ptr noundef @.str.7)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

106:                                              ; preds = %95
  %107 = call i32 @gettimeofday(ptr noundef %11, ptr noundef null) #7
  store i64 0, ptr %9, align 8, !tbaa !11
  br label %108

108:                                              ; preds = %144, %106
  %109 = load i64, ptr %9, align 8, !tbaa !11
  %110 = load i64, ptr %8, align 8, !tbaa !11
  %111 = icmp slt i64 %109, %110
  br i1 %111, label %112, label %147

112:                                              ; preds = %108
  %113 = load i32, ptr %18, align 4, !tbaa !5
  %114 = load ptr, ptr %7, align 8, !tbaa !9
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = call i64 @write(i32 noundef %113, ptr noundef %114, i64 noundef %116)
  %118 = load i32, ptr %6, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = icmp ne i64 %117, %119
  br i1 %120, label %121, label %122

121:                                              ; preds = %112
  call void @perror(ptr noundef @.str.8)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

122:                                              ; preds = %112
  store i64 0, ptr %14, align 8, !tbaa !11
  br label %123

123:                                              ; preds = %139, %122
  %124 = load i64, ptr %14, align 8, !tbaa !11
  %125 = load i32, ptr %6, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = icmp ult i64 %124, %126
  br i1 %127, label %128, label %143

128:                                              ; preds = %123
  %129 = load i32, ptr %18, align 4, !tbaa !5
  %130 = load ptr, ptr %7, align 8, !tbaa !9
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = sext i32 %131 to i64
  %133 = load i64, ptr %14, align 8, !tbaa !11
  %134 = sub i64 %132, %133
  %135 = call i64 @read(i32 noundef %129, ptr noundef %130, i64 noundef %134)
  store i64 %135, ptr %13, align 8, !tbaa !11
  %136 = load i64, ptr %13, align 8, !tbaa !11
  %137 = icmp eq i64 %136, -1
  br i1 %137, label %138, label %139

138:                                              ; preds = %128
  call void @perror(ptr noundef @.str.9)
  store i32 1, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

139:                                              ; preds = %128
  %140 = load i64, ptr %13, align 8, !tbaa !11
  %141 = load i64, ptr %14, align 8, !tbaa !11
  %142 = add i64 %141, %140
  store i64 %142, ptr %14, align 8, !tbaa !11
  br label %123, !llvm.loop !20

143:                                              ; preds = %123
  br label %144

144:                                              ; preds = %143
  %145 = load i64, ptr %9, align 8, !tbaa !11
  %146 = add nsw i64 %145, 1
  store i64 %146, ptr %9, align 8, !tbaa !11
  br label %108, !llvm.loop !22

147:                                              ; preds = %108
  %148 = call i32 @gettimeofday(ptr noundef %12, ptr noundef null) #7
  %149 = getelementptr inbounds %struct.timeval, ptr %12, i32 0, i32 0
  %150 = load i64, ptr %149, align 8, !tbaa !23
  %151 = getelementptr inbounds %struct.timeval, ptr %11, i32 0, i32 0
  %152 = load i64, ptr %151, align 8, !tbaa !23
  %153 = sub nsw i64 %150, %152
  %154 = mul nsw i64 %153, 1000000000
  %155 = getelementptr inbounds %struct.timeval, ptr %12, i32 0, i32 1
  %156 = load i64, ptr %155, align 8, !tbaa !25
  %157 = getelementptr inbounds %struct.timeval, ptr %11, i32 0, i32 1
  %158 = load i64, ptr %157, align 8, !tbaa !25
  %159 = sub nsw i64 %156, %158
  %160 = mul nsw i64 %159, 1000
  %161 = add nsw i64 %154, %160
  store i64 %161, ptr %10, align 8, !tbaa !11
  %162 = load i64, ptr %10, align 8, !tbaa !11
  %163 = load i64, ptr %8, align 8, !tbaa !11
  %164 = mul nsw i64 %163, 2
  %165 = sdiv i64 %162, %164
  %166 = call i32 (ptr, ...) @printf(ptr noundef @.str.10, i64 noundef %165)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %19, align 4
  br label %167

167:                                              ; preds = %147, %138, %121, %105, %90, %80, %69, %52, %38, %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 48, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  %168 = load i32, ptr %3, align 4
  ret i32 %168
}

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

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

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr noundef nonnull) #3

; Function Attrs: inlinehint nounwind willreturn memory(read) uwtable
declare i64 @atol(ptr noundef nonnull) #3

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #4

declare void @perror(ptr noundef) #2

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

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind
declare ptr @gai_strerror(i32 noundef) #6

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) #6

; Function Attrs: nounwind
declare i32 @bind(i32 noundef, ptr noundef, i32 noundef) #6

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) #2

; Function Attrs: nounwind
declare i32 @gettimeofday(ptr noundef, ptr noundef) #6

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

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { inlinehint nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind allocsize(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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0) }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"addrinfo", !6, i64 0, !6, i64 4, !6, i64 8, !6, i64 12, !6, i64 16, !10, i64 24, !10, i64 32, !10, i64 40}
!15 = !{!14, !6, i64 8}
!16 = !{!14, !6, i64 0}
!17 = !{!14, !6, i64 12}
!18 = !{!14, !10, i64 24}
!19 = !{!14, !6, i64 16}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = distinct !{!22, !21}
!23 = !{!24, !12, i64 0}
!24 = !{!"timeval", !12, i64 0, !12, i64 8}
!25 = !{!24, !12, i64 8}


; 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.timeval = type { i64, i64 }
%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [73 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [6 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = alloca %struct.timeval, align 8
  %4 = alloca %struct.timeval, align 8
  %5 = alloca %struct.addrinfo, align 8
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #9
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %5) #9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %.not = icmp eq i32 %0, 6
  br i1 %.not, label %9, label %7

7:                                                ; preds = %2
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %98

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %1, i64 32
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %12 = tail call i32 @atoi(ptr nocapture noundef %11) #10
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = tail call i64 @atol(ptr nocapture noundef %14) #10
  %16 = sext i32 %12 to i64
  %17 = tail call noalias ptr @malloc(i64 noundef %16) #11
  %18 = icmp eq ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %9
  tail call void @perror(ptr noundef nonnull @.str.1) #12
  br label %98

20:                                               ; preds = %9
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %12)
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i64 noundef %15)
  %23 = getelementptr inbounds i8, ptr %5, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %5, i8 0, i64 48, i1 false)
  store i32 1, ptr %23, align 8, !tbaa !9
  store i32 1, ptr %5, align 8, !tbaa !12
  %24 = getelementptr inbounds i8, ptr %1, i64 8
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = call i32 @getaddrinfo(ptr noundef %25, ptr noundef null, ptr noundef nonnull %5, ptr noundef nonnull %6) #9
  %.not41 = icmp eq i32 %26, 0
  br i1 %.not41, label %31, label %27

27:                                               ; preds = %20
  %28 = load ptr, ptr @stderr, align 8, !tbaa !5
  %29 = call ptr @gai_strerror(i32 noundef %26) #9
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %28, ptr noundef nonnull @.str.4, ptr noundef %29) #13
  br label %98

31:                                               ; preds = %20
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !13
  %35 = getelementptr inbounds i8, ptr %32, i64 8
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = getelementptr inbounds i8, ptr %32, i64 12
  %38 = load i32, ptr %37, align 4, !tbaa !14
  %39 = call i32 @socket(i32 noundef %34, i32 noundef %36, i32 noundef %38) #9
  %40 = icmp eq i32 %39, -1
  br i1 %40, label %41, label %42

41:                                               ; preds = %31
  call void @perror(ptr noundef nonnull @.str.5) #12
  br label %98

42:                                               ; preds = %31
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 24
  %45 = load ptr, ptr %44, align 8, !tbaa !15
  %46 = getelementptr inbounds i8, ptr %43, i64 16
  %47 = load i32, ptr %46, align 8, !tbaa !16
  %48 = call i32 @bind(i32 noundef %39, ptr noundef %45, i32 noundef %47) #9
  %49 = icmp eq i32 %48, -1
  br i1 %49, label %50, label %51

50:                                               ; preds = %42
  call void @perror(ptr noundef nonnull @.str.6) #12
  br label %98

51:                                               ; preds = %42
  %52 = getelementptr inbounds i8, ptr %1, i64 16
  %53 = load ptr, ptr %52, align 8, !tbaa !5
  %54 = getelementptr inbounds i8, ptr %1, i64 24
  %55 = load ptr, ptr %54, align 8, !tbaa !5
  %56 = call i32 @getaddrinfo(ptr noundef %53, ptr noundef %55, ptr noundef nonnull %5, ptr noundef nonnull %6) #9
  %.not42 = icmp eq i32 %56, 0
  br i1 %.not42, label %61, label %57

57:                                               ; preds = %51
  %58 = load ptr, ptr @stderr, align 8, !tbaa !5
  %59 = call ptr @gai_strerror(i32 noundef %56) #9
  %60 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %58, ptr noundef nonnull @.str.4, ptr noundef %59) #13
  br label %98

61:                                               ; preds = %51
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds i8, ptr %62, i64 24
  %64 = load ptr, ptr %63, align 8, !tbaa !15
  %65 = getelementptr inbounds i8, ptr %62, i64 16
  %66 = load i32, ptr %65, align 8, !tbaa !16
  %67 = call i32 @connect(i32 noundef %39, ptr noundef %64, i32 noundef %66) #9
  %68 = icmp eq i32 %67, -1
  br i1 %68, label %69, label %70

69:                                               ; preds = %61
  call void @perror(ptr noundef nonnull @.str.7) #12
  br label %98

70:                                               ; preds = %61
  %71 = call i32 @gettimeofday(ptr noundef nonnull %3, ptr noundef null) #9
  %72 = icmp sgt i64 %15, 0
  br i1 %72, label %.lr.ph47, label %._crit_edge48

.lr.ph47:                                         ; preds = %70
  %.not51 = icmp eq i32 %12, 0
  br i1 %.not51, label %.lr.ph47.split, label %.lr.ph47.split.us

.lr.ph47.split.us:                                ; preds = %.lr.ph47, %._crit_edge.us
  %.03345.us = phi i64 [ %80, %._crit_edge.us ], [ 0, %.lr.ph47 ]
  %73 = call i64 @write(i32 noundef %39, ptr noundef nonnull %17, i64 noundef %16) #9
  %.not43.us = icmp eq i64 %73, %16
  br i1 %.not43.us, label %.preheader.us, label %.split.us

74:                                               ; preds = %.preheader.us
  %75 = add i64 %78, %.03244.us
  %76 = icmp ult i64 %75, %16
  br i1 %76, label %.preheader.us, label %._crit_edge.us, !llvm.loop !17

.preheader.us:                                    ; preds = %.lr.ph47.split.us, %74
  %.03244.us = phi i64 [ %75, %74 ], [ 0, %.lr.ph47.split.us ]
  %77 = sub i64 %16, %.03244.us
  %78 = call i64 @read(i32 noundef %39, ptr noundef nonnull %17, i64 noundef %77) #9
  %79 = icmp eq i64 %78, -1
  br i1 %79, label %.split50.us, label %74

._crit_edge.us:                                   ; preds = %74
  %80 = add nuw nsw i64 %.03345.us, 1
  %exitcond.not = icmp eq i64 %80, %15
  br i1 %exitcond.not, label %._crit_edge48, label %.lr.ph47.split.us, !llvm.loop !19

.lr.ph47.split:                                   ; preds = %.lr.ph47, %.preheader
  %.03345 = phi i64 [ %82, %.preheader ], [ 0, %.lr.ph47 ]
  %81 = call i64 @write(i32 noundef %39, ptr noundef nonnull %17, i64 noundef %16) #9
  %.not43 = icmp eq i64 %81, %16
  br i1 %.not43, label %.preheader, label %.split.us

.preheader:                                       ; preds = %.lr.ph47.split
  %82 = add nuw nsw i64 %.03345, 1
  %exitcond54.not = icmp eq i64 %82, %15
  br i1 %exitcond54.not, label %._crit_edge48, label %.lr.ph47.split, !llvm.loop !19

.split.us:                                        ; preds = %.lr.ph47.split.us, %.lr.ph47.split
  call void @perror(ptr noundef nonnull @.str.8) #12
  br label %98

.split50.us:                                      ; preds = %.preheader.us
  call void @perror(ptr noundef nonnull @.str.9) #12
  br label %98

._crit_edge48:                                    ; preds = %._crit_edge.us, %.preheader, %70
  %83 = call i32 @gettimeofday(ptr noundef nonnull %4, ptr noundef null) #9
  %84 = load i64, ptr %4, align 8, !tbaa !20
  %85 = load i64, ptr %3, align 8, !tbaa !20
  %86 = sub nsw i64 %84, %85
  %87 = mul nsw i64 %86, 1000000000
  %88 = getelementptr inbounds i8, ptr %4, i64 8
  %89 = load i64, ptr %88, align 8, !tbaa !23
  %90 = getelementptr inbounds i8, ptr %3, i64 8
  %91 = load i64, ptr %90, align 8, !tbaa !23
  %92 = sub nsw i64 %89, %91
  %93 = mul nsw i64 %92, 1000
  %94 = add nsw i64 %93, %87
  %95 = shl nsw i64 %15, 1
  %96 = sdiv i64 %94, %95
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i64 noundef %96)
  br label %98

98:                                               ; preds = %._crit_edge48, %.split50.us, %.split.us, %69, %57, %50, %41, %27, %19, %7
  %.0 = phi i32 [ 1, %7 ], [ 1, %19 ], [ 1, %27 ], [ 1, %41 ], [ 1, %50 ], [ 1, %57 ], [ 1, %69 ], [ 1, %.split.us ], [ 1, %.split50.us ], [ 0, %._crit_edge48 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %5) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #9
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #9
  ret i32 %.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: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i32 @atoi(ptr nocapture noundef nonnull) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable
declare i64 @atol(ptr nocapture noundef nonnull) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #4

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

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

declare i32 @getaddrinfo(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

; Function Attrs: nounwind
declare ptr @gai_strerror(i32 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @socket(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @bind(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #7

declare i32 @connect(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i32 @gettimeofday(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree
declare noundef i64 @write(i32 noundef, ptr nocapture noundef readonly, i64 noundef) local_unnamed_addr #8

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { inlinehint mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind "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 = { 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 #9 = { nounwind }
attributes #10 = { nounwind willreturn memory(read) }
attributes #11 = { nounwind allocsize(0) }
attributes #12 = { cold }
attributes #13 = { cold nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 8}
!10 = !{!"addrinfo", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !6, i64 24, !6, i64 32, !6, i64 40}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 0}
!13 = !{!10, !11, i64 4}
!14 = !{!10, !11, i64 12}
!15 = !{!10, !6, i64 24}
!16 = !{!10, !11, i64 16}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!21, !22, i64 0}
!21 = !{!"timeval", !22, i64 0, !22, i64 8}
!22 = !{!"long", !7, i64 0}
!23 = !{!21, !22, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass