; LLVM IR from TobiasKozel/VAE :: external/tracy/common/TracySocket.ll (ZN5tracy6Socket7ConnectEPKct)

; 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.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }
%"class.tracy::Socket" = type <{ ptr, ptr, %"struct.std::atomic", i32, ptr, ptr, i32, [4 x i8] }>
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i32 }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@__PRETTY_FUNCTION__._ZN5tracy6Socket7ConnectEPKct = external hidden unnamed_addr constant [52 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind
declare void @freeaddrinfo(ptr noundef) #0

declare i32 @close(i32 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5tracy6Socket7ConnectEPKct(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef %1, i16 noundef zeroext %2) #2 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i16, align 2
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %struct.addrinfo, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca [32 x i8], align 16
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i16 %2, ptr %7, align 2, !tbaa !9
  %19 = load ptr, ptr %5, align 8
  %20 = call noundef zeroext i1 @_ZNK5tracy6Socket7IsValidEv(ptr noundef nonnull align 8 dereferenceable(44) %19)
  %21 = xor i1 %20, true
  br i1 %21, label %22, label %23

22:                                               ; preds = %3
  br label %25

23:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 113, ptr noundef @__PRETTY_FUNCTION__._ZN5tracy6Socket7ConnectEPKct) #9
  unreachable

24:                                               ; No predecessors!
  br label %25

25:                                               ; preds = %24, %22
  %26 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 5
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = icmp ne ptr %27, null
  br i1 %28, label %29, label %82

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #10
  %30 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 6
  %31 = load i32, ptr %30, align 8, !tbaa !16
  %32 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 5
  %33 = load ptr, ptr %32, align 8, !tbaa !11
  %34 = getelementptr inbounds %struct.addrinfo, ptr %33, i32 0, i32 5
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 5
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  %38 = getelementptr inbounds %struct.addrinfo, ptr %37, i32 0, i32 4
  %39 = load i32, ptr %38, align 8, !tbaa !19
  %40 = call i32 @connect(i32 noundef %31, ptr noundef %35, i32 noundef %39)
  store i32 %40, ptr %8, align 4, !tbaa !20
  %41 = load i32, ptr %8, align 4, !tbaa !20
  %42 = icmp eq i32 %41, -1
  br i1 %42, label %43, label %66

43:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #10
  %44 = call ptr @__errno_location() #11
  %45 = load i32, ptr %44, align 4, !tbaa !20
  store i32 %45, ptr %9, align 4, !tbaa !20
  %46 = load i32, ptr %9, align 4, !tbaa !20
  %47 = icmp eq i32 %46, 114
  br i1 %47, label %51, label %48

48:                                               ; preds = %43
  %49 = load i32, ptr %9, align 4, !tbaa !20
  %50 = icmp eq i32 %49, 115
  br i1 %50, label %51, label %52

51:                                               ; preds = %48, %43
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %63

52:                                               ; preds = %48
  %53 = load i32, ptr %9, align 4, !tbaa !20
  %54 = icmp ne i32 %53, 106
  br i1 %54, label %55, label %62

55:                                               ; preds = %52
  %56 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 4
  %57 = load ptr, ptr %56, align 8, !tbaa !21
  call void @freeaddrinfo(ptr noundef %57) #10
  %58 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 6
  %59 = load i32, ptr %58, align 8, !tbaa !16
  %60 = call i32 @close(i32 noundef %59)
  %61 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 5
  store ptr null, ptr %61, align 8, !tbaa !11
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %63

62:                                               ; preds = %52
  store i32 0, ptr %10, align 4
  br label %63

63:                                               ; preds = %62, %55, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #10
  %64 = load i32, ptr %10, align 4
  switch i32 %64, label %81 [
    i32 0, label %65
  ]

65:                                               ; preds = %63
  br label %66

66:                                               ; preds = %65, %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #10
  %67 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 6
  %68 = load i32, ptr %67, align 8, !tbaa !16
  %69 = call i32 (i32, i32, ...) @fcntl(i32 noundef %68, i32 noundef 3, i32 noundef 0)
  store i32 %69, ptr %11, align 4, !tbaa !20
  %70 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 6
  %71 = load i32, ptr %70, align 8, !tbaa !16
  %72 = load i32, ptr %11, align 4, !tbaa !20
  %73 = and i32 %72, -2049
  %74 = call i32 (i32, i32, ...) @fcntl(i32 noundef %71, i32 noundef 4, i32 noundef %73)
  %75 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 2
  %76 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 6
  %77 = load i32, ptr %76, align 8, !tbaa !16
  call void @_ZNSt13__atomic_baseIiE5storeEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %75, i32 noundef %77, i32 noundef 0) #10
  %78 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 4
  %79 = load ptr, ptr %78, align 8, !tbaa !21
  call void @freeaddrinfo(ptr noundef %79) #10
  %80 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 5
  store ptr null, ptr %80, align 8, !tbaa !11
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  br label %81

81:                                               ; preds = %66, %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #10
  br label %166

82:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 48, ptr %12) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #10
  call void @llvm.memset.p0.i64(ptr align 8 %12, i8 0, i64 48, i1 false)
  %83 = getelementptr inbounds %struct.addrinfo, ptr %12, i32 0, i32 1
  store i32 0, ptr %83, align 4, !tbaa !22
  %84 = getelementptr inbounds %struct.addrinfo, ptr %12, i32 0, i32 2
  store i32 1, ptr %84, align 8, !tbaa !23
  call void @llvm.lifetime.start.p0(i64 32, ptr %15) #10
  %85 = getelementptr inbounds [32 x i8], ptr %15, i64 0, i64 0
  %86 = load i16, ptr %7, align 2, !tbaa !9
  %87 = zext i16 %86 to i32
  %88 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %85, ptr noundef @.str.2, i32 noundef %87) #10
  %89 = load ptr, ptr %6, align 8, !tbaa !5
  %90 = getelementptr inbounds [32 x i8], ptr %15, i64 0, i64 0
  %91 = call i32 @getaddrinfo(ptr noundef %89, ptr noundef %90, ptr noundef %12, ptr noundef %13)
  %92 = icmp ne i32 %91, 0
  br i1 %92, label %93, label %94

93:                                               ; preds = %82
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %165

94:                                               ; preds = %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #10
  store i32 0, ptr %16, align 4, !tbaa !20
  %95 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %95, ptr %14, align 8, !tbaa !5
  br label %96

96:                                               ; preds = %146, %94
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = icmp ne ptr %97, null
  br i1 %98, label %99, label %150

99:                                               ; preds = %96
  %100 = load ptr, ptr %14, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.addrinfo, ptr %100, i32 0, i32 1
  %102 = load i32, ptr %101, align 4, !tbaa !22
  %103 = load ptr, ptr %14, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.addrinfo, ptr %103, i32 0, i32 2
  %105 = load i32, ptr %104, align 8, !tbaa !23
  %106 = load ptr, ptr %14, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.addrinfo, ptr %106, i32 0, i32 3
  %108 = load i32, ptr %107, align 4, !tbaa !24
  %109 = call i32 @socket(i32 noundef %102, i32 noundef %105, i32 noundef %108) #10
  store i32 %109, ptr %16, align 4, !tbaa !20
  %110 = icmp eq i32 %109, -1
  br i1 %110, label %111, label %112

111:                                              ; preds = %99
  br label %146

112:                                              ; preds = %99
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #10
  %113 = load i32, ptr %16, align 4, !tbaa !20
  %114 = call i32 (i32, i32, ...) @fcntl(i32 noundef %113, i32 noundef 3, i32 noundef 0)
  store i32 %114, ptr %17, align 4, !tbaa !20
  %115 = load i32, ptr %16, align 4, !tbaa !20
  %116 = load i32, ptr %17, align 4, !tbaa !20
  %117 = or i32 %116, 2048
  %118 = call i32 (i32, i32, ...) @fcntl(i32 noundef %115, i32 noundef 4, i32 noundef %117)
  %119 = load i32, ptr %16, align 4, !tbaa !20
  %120 = load ptr, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.addrinfo, ptr %120, i32 0, i32 5
  %122 = load ptr, ptr %121, align 8, !tbaa !17
  %123 = load ptr, ptr %14, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.addrinfo, ptr %123, i32 0, i32 4
  %125 = load i32, ptr %124, align 8, !tbaa !19
  %126 = call i32 @connect(i32 noundef %119, ptr noundef %122, i32 noundef %125)
  %127 = icmp eq i32 %126, 0
  br i1 %127, label %128, label %129

128:                                              ; preds = %112
  store i32 2, ptr %10, align 4
  br label %144

129:                                              ; preds = %112
  %130 = call ptr @__errno_location() #11
  %131 = load i32, ptr %130, align 4, !tbaa !20
  %132 = icmp ne i32 %131, 115
  br i1 %132, label %133, label %136

133:                                              ; preds = %129
  %134 = load i32, ptr %16, align 4, !tbaa !20
  %135 = call i32 @close(i32 noundef %134)
  store i32 4, ptr %10, align 4
  br label %144

136:                                              ; preds = %129
  br label %137

137:                                              ; preds = %136
  %138 = load ptr, ptr %13, align 8, !tbaa !5
  %139 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 4
  store ptr %138, ptr %139, align 8, !tbaa !21
  %140 = load ptr, ptr %14, align 8, !tbaa !5
  %141 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 5
  store ptr %140, ptr %141, align 8, !tbaa !11
  %142 = load i32, ptr %16, align 4, !tbaa !20
  %143 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 6
  store i32 %142, ptr %143, align 8, !tbaa !16
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %144

144:                                              ; preds = %137, %133, %128
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #10
  %145 = load i32, ptr %10, align 4
  switch i32 %145, label %164 [
    i32 2, label %150
    i32 4, label %146
  ]

146:                                              ; preds = %144, %111
  %147 = load ptr, ptr %14, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.addrinfo, ptr %147, i32 0, i32 7
  %149 = load ptr, ptr %148, align 8, !tbaa !25
  store ptr %149, ptr %14, align 8, !tbaa !5
  br label %96, !llvm.loop !26

150:                                              ; preds = %144, %96
  %151 = load ptr, ptr %13, align 8, !tbaa !5
  call void @freeaddrinfo(ptr noundef %151) #10
  %152 = load ptr, ptr %14, align 8, !tbaa !5
  %153 = icmp ne ptr %152, null
  br i1 %153, label %155, label %154

154:                                              ; preds = %150
  store i1 false, ptr %4, align 1
  store i32 1, ptr %10, align 4
  br label %164

155:                                              ; preds = %150
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #10
  %156 = load i32, ptr %16, align 4, !tbaa !20
  %157 = call i32 (i32, i32, ...) @fcntl(i32 noundef %156, i32 noundef 3, i32 noundef 0)
  store i32 %157, ptr %18, align 4, !tbaa !20
  %158 = load i32, ptr %16, align 4, !tbaa !20
  %159 = load i32, ptr %18, align 4, !tbaa !20
  %160 = and i32 %159, -2049
  %161 = call i32 (i32, i32, ...) @fcntl(i32 noundef %158, i32 noundef 4, i32 noundef %160)
  %162 = getelementptr inbounds %"class.tracy::Socket", ptr %19, i32 0, i32 2
  %163 = load i32, ptr %16, align 4, !tbaa !20
  call void @_ZNSt13__atomic_baseIiE5storeEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %162, i32 noundef %163, i32 noundef 0) #10
  store i1 true, ptr %4, align 1
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #10
  br label %164

164:                                              ; preds = %155, %154, %144
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #10
  br label %165

165:                                              ; preds = %164, %93
  call void @llvm.lifetime.end.p0(i64 32, ptr %15) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  call void @llvm.lifetime.end.p0(i64 48, ptr %12) #10
  br label %166

166:                                              ; preds = %165, %81
  %167 = load i1, ptr %4, align 1
  ret i1 %167
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5tracy6Socket7IsValidEv(ptr noundef nonnull align 8 dereferenceable(44)) #3 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

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

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

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

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

declare i32 @fcntl(i32 noundef, i32 noundef, ...) #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZNSt13__atomic_baseIiE5storeEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) #7 align 2

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #0

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

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

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%struct.addrinfo = type { i32, i32, i32, i32, i32, ptr, ptr, ptr }

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [87 x i8], align 1
@__PRETTY_FUNCTION__._ZN5tracy6Socket7ConnectEPKct = external hidden unnamed_addr constant [52 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind
declare void @freeaddrinfo(ptr noundef) local_unnamed_addr #0

declare i32 @close(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5tracy6Socket7ConnectEPKct(ptr noundef nonnull align 8 dereferenceable(44) %0, ptr noundef %1, i16 noundef zeroext %2) local_unnamed_addr #2 align 2 {
  %4 = alloca %struct.addrinfo, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [32 x i8], align 16
  %7 = tail call noundef zeroext i1 @_ZNK5tracy6Socket7IsValidEv(ptr noundef nonnull align 8 dereferenceable(44) %0)
  br i1 %7, label %8, label %9

8:                                                ; preds = %3
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 113, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5tracy6Socket7ConnectEPKct) #10
  unreachable

9:                                                ; preds = %3
  %10 = getelementptr inbounds i8, ptr %0, i64 32
  %11 = load ptr, ptr %10, align 8, !tbaa !5
  %.not = icmp eq ptr %11, null
  br i1 %.not, label %41, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %0, i64 40
  %14 = load i32, ptr %13, align 8, !tbaa !13
  %15 = getelementptr inbounds i8, ptr %11, i64 24
  %16 = load ptr, ptr %15, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %11, i64 16
  %18 = load i32, ptr %17, align 8, !tbaa !16
  %19 = tail call i32 @connect(i32 noundef %14, ptr noundef %16, i32 noundef %18)
  %20 = icmp eq i32 %19, -1
  br i1 %20, label %21, label %31

21:                                               ; preds = %12
  %22 = tail call ptr @__errno_location() #11
  %23 = load i32, ptr %22, align 4, !tbaa !17
  %24 = and i32 %23, -2
  %or.cond = icmp eq i32 %24, 114
  br i1 %or.cond, label %.critedge, label %25

25:                                               ; preds = %21
  %.not40 = icmp eq i32 %23, 106
  br i1 %.not40, label %31, label %26

26:                                               ; preds = %25
  %27 = getelementptr inbounds i8, ptr %0, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !18
  tail call void @freeaddrinfo(ptr noundef %28) #12
  %29 = load i32, ptr %13, align 8, !tbaa !13
  %30 = tail call i32 @close(i32 noundef %29)
  store ptr null, ptr %10, align 8, !tbaa !5
  br label %.critedge

31:                                               ; preds = %25, %12
  %32 = load i32, ptr %13, align 8, !tbaa !13
  %33 = tail call i32 (i32, i32, ...) @fcntl(i32 noundef %32, i32 noundef 3, i32 noundef 0)
  %34 = load i32, ptr %13, align 8, !tbaa !13
  %35 = and i32 %33, -2049
  %36 = tail call i32 (i32, i32, ...) @fcntl(i32 noundef %34, i32 noundef 4, i32 noundef %35)
  %37 = getelementptr inbounds i8, ptr %0, i64 16
  %38 = load i32, ptr %13, align 8, !tbaa !13
  tail call void @_ZNSt13__atomic_baseIiE5storeEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %37, i32 noundef %38, i32 noundef 0) #12
  %39 = getelementptr inbounds i8, ptr %0, i64 24
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  tail call void @freeaddrinfo(ptr noundef %40) #12
  store ptr null, ptr %10, align 8, !tbaa !5
  br label %.critedge

41:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %4) #12
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #12
  %42 = getelementptr inbounds i8, ptr %4, i64 8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %4, i8 0, i64 48, i1 false)
  store i32 1, ptr %42, align 8, !tbaa !19
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #12
  %43 = zext i16 %2 to i32
  %44 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %6, ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %43) #12
  %45 = call i32 @getaddrinfo(ptr noundef %1, ptr noundef nonnull %6, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %.not37 = icmp eq i32 %45, 0
  br i1 %.not37, label %.preheader, label %81

.preheader:                                       ; preds = %41
  %.03449 = load ptr, ptr %5, align 8, !tbaa !20
  %.not3850 = icmp eq ptr %.03449, null
  br i1 %.not3850, label %.thread44, label %.lr.ph

.thread44.loopexit:                               ; preds = %73
  %.pre = load ptr, ptr %5, align 8, !tbaa !20
  br label %.thread44

.thread44:                                        ; preds = %.thread44.loopexit, %.preheader
  %46 = phi ptr [ %.pre, %.thread44.loopexit ], [ null, %.preheader ]
  call void @freeaddrinfo(ptr noundef %46) #12
  br label %81

.lr.ph:                                           ; preds = %.preheader, %73
  %.03451 = phi ptr [ %.034, %73 ], [ %.03449, %.preheader ]
  %47 = getelementptr inbounds i8, ptr %.03451, i64 4
  %48 = load i32, ptr %47, align 4, !tbaa !21
  %49 = getelementptr inbounds i8, ptr %.03451, i64 8
  %50 = load i32, ptr %49, align 8, !tbaa !19
  %51 = getelementptr inbounds i8, ptr %.03451, i64 12
  %52 = load i32, ptr %51, align 4, !tbaa !22
  %53 = call i32 @socket(i32 noundef %48, i32 noundef %50, i32 noundef %52) #12
  %54 = icmp eq i32 %53, -1
  br i1 %54, label %73, label %55

55:                                               ; preds = %.lr.ph
  %56 = call i32 (i32, i32, ...) @fcntl(i32 noundef %53, i32 noundef 3, i32 noundef 0)
  %57 = or i32 %56, 2048
  %58 = call i32 (i32, i32, ...) @fcntl(i32 noundef %53, i32 noundef 4, i32 noundef %57)
  %59 = getelementptr inbounds i8, ptr %.03451, i64 24
  %60 = load ptr, ptr %59, align 8, !tbaa !14
  %61 = getelementptr inbounds i8, ptr %.03451, i64 16
  %62 = load i32, ptr %61, align 8, !tbaa !16
  %63 = call i32 @connect(i32 noundef %53, ptr noundef %60, i32 noundef %62)
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %75, label %65

65:                                               ; preds = %55
  %66 = tail call ptr @__errno_location() #11
  %67 = load i32, ptr %66, align 4, !tbaa !17
  %.not39 = icmp eq i32 %67, 115
  br i1 %.not39, label %.thread, label %71

.thread:                                          ; preds = %65
  %68 = load ptr, ptr %5, align 8, !tbaa !20
  %69 = getelementptr inbounds i8, ptr %0, i64 24
  store ptr %68, ptr %69, align 8, !tbaa !18
  store ptr %.03451, ptr %10, align 8, !tbaa !5
  %70 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 %53, ptr %70, align 8, !tbaa !13
  br label %81

71:                                               ; preds = %65
  %72 = call i32 @close(i32 noundef %53)
  br label %73

73:                                               ; preds = %71, %.lr.ph
  %74 = getelementptr inbounds i8, ptr %.03451, i64 40
  %.034 = load ptr, ptr %74, align 8, !tbaa !20
  %.not38 = icmp eq ptr %.034, null
  br i1 %.not38, label %.thread44.loopexit, label %.lr.ph, !llvm.loop !23

75:                                               ; preds = %55
  %76 = load ptr, ptr %5, align 8, !tbaa !20
  call void @freeaddrinfo(ptr noundef %76) #12
  %77 = call i32 (i32, i32, ...) @fcntl(i32 noundef %53, i32 noundef 3, i32 noundef 0)
  %78 = and i32 %77, -2049
  %79 = call i32 (i32, i32, ...) @fcntl(i32 noundef %53, i32 noundef 4, i32 noundef %78)
  %80 = getelementptr inbounds i8, ptr %0, i64 16
  call void @_ZNSt13__atomic_baseIiE5storeEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4) %80, i32 noundef %53, i32 noundef 0) #12
  br label %81

81:                                               ; preds = %.thread44, %.thread, %75, %41
  %.6 = phi i1 [ false, %41 ], [ true, %75 ], [ false, %.thread ], [ false, %.thread44 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #12
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #12
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %4) #12
  br label %.critedge

.critedge:                                        ; preds = %31, %21, %26, %81
  %.7 = phi i1 [ %.6, %81 ], [ true, %31 ], [ false, %21 ], [ false, %26 ]
  ret i1 %.7
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5tracy6Socket7IsValidEv(ptr noundef nonnull align 8 dereferenceable(44)) local_unnamed_addr #3 align 2

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

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

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

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

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

declare i32 @fcntl(i32 noundef, i32 noundef, ...) local_unnamed_addr #1

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZNSt13__atomic_baseIiE5storeEiSt12memory_order(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, i32 noundef) local_unnamed_addr #7 align 2

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #9

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

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

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { alwaysinline mustprogress 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 #8 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #9 = { 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 #10 = { noreturn nounwind }
attributes #11 = { nounwind willreturn memory(none) }
attributes #12 = { 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, !7, i64 32}
!6 = !{!"_ZTSN5tracy6SocketE", !7, i64 0, !7, i64 8, !10, i64 16, !12, i64 20, !7, i64 24, !7, i64 32, !12, i64 40}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6atomicIiE", !11, i64 0}
!11 = !{!"_ZTSSt13__atomic_baseIiE", !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!6, !12, i64 40}
!14 = !{!15, !7, i64 24}
!15 = !{!"_ZTS8addrinfo", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !7, i64 24, !7, i64 32, !7, i64 40}
!16 = !{!15, !12, i64 16}
!17 = !{!12, !12, i64 0}
!18 = !{!6, !7, i64 24}
!19 = !{!15, !12, i64 8}
!20 = !{!7, !7, i64 0}
!21 = !{!15, !12, i64 4}
!22 = !{!15, !12, i64 12}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


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