; LLVM IR from kala13x/libxutils :: src/net (api)

; 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.xapi_endpoint_ = type { i32, %struct.XSocketCert, ptr, ptr, ptr, i32, i16, i32, i8, i8, i8 }
%struct.XSocketCert = type { ptr, ptr, ptr, ptr, ptr, i32 }
%struct.xapi_data_ = type { [128 x i8], [128 x i8], [2048 x i8], i16, %struct.XSocket, i32, i8, i8, i8, i8, i8, i8, %struct.XByteBuffer, %struct.XByteBuffer, ptr, i32, i32, ptr, ptr, ptr }
%struct.XSocket = type { i32, %union.xsock_addr_t, i32, i32, i16, i32, i32, i32, i32, ptr }
%union.xsock_addr_t = type { %struct.sockaddr_in, [96 x i8] }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }
%struct.XByteBuffer = type { ptr, i64, i64, i16, i16, i32 }

@.str.27 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @XAPI_ErrorCb(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext) #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @XAPI_GetOrCreateEvents(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare hidden ptr @XAPI_NewData(ptr noundef, i32 noundef) #1

declare i64 @xstrncpy(ptr noundef, i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @XAPI_FreeData(ptr noundef) #1

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

; Function Attrs: nounwind uwtable
declare hidden i32 @XAPI_ServiceCb(ptr noundef, ptr noundef, i32 noundef) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @XAPI_AddEvent(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %18, label %21

18:                                               ; preds = %3
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %22, label %21

21:                                               ; preds = %18, %3
  store i32 -2, ptr %4, align 4
  br label %156

22:                                               ; preds = %18
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.xapi_endpoint_, ptr %23, i32 0, i32 0
  %25 = load i32, ptr %24, align 8, !tbaa !11
  %26 = icmp ne i32 %25, 0
  br i1 %26, label %28, label %27

27:                                               ; preds = %22
  store i32 -2, ptr %4, align 4
  br label %156

28:                                               ; preds = %22
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.xapi_endpoint_, ptr %29, i32 0, i32 7
  %31 = load i32, ptr %30, align 8, !tbaa !15
  %32 = icmp ne i32 %31, -1
  br i1 %32, label %34, label %33

33:                                               ; preds = %28
  store i32 -2, ptr %4, align 4
  br label %156

34:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.xapi_endpoint_, ptr %36, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !11
  %39 = call ptr @XAPI_NewData(ptr noundef %35, i32 noundef %38)
  store ptr %39, ptr %8, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = icmp eq ptr %40, null
  br i1 %41, label %42, label %45

42:                                               ; preds = %34
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = call i32 @XAPI_ErrorCb(ptr noundef %43, ptr noundef null, i32 noundef 0, i8 noundef zeroext 12)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %155

45:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.xapi_endpoint_, ptr %46, i32 0, i32 4
  %48 = load ptr, ptr %47, align 8, !tbaa !16
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %54

50:                                               ; preds = %45
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.xapi_endpoint_, ptr %51, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  br label %55

54:                                               ; preds = %45
  br label %55

55:                                               ; preds = %54, %50
  %56 = phi ptr [ %53, %50 ], [ @.str.27, %54 ]
  store ptr %56, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.xapi_endpoint_, ptr %57, i32 0, i32 5
  %59 = load i32, ptr %58, align 8, !tbaa !17
  %60 = icmp ne i32 %59, 0
  br i1 %60, label %61, label %65

61:                                               ; preds = %55
  %62 = load ptr, ptr %6, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.xapi_endpoint_, ptr %62, i32 0, i32 5
  %64 = load i32, ptr %63, align 8, !tbaa !17
  br label %66

65:                                               ; preds = %55
  br label %66

66:                                               ; preds = %65, %61
  %67 = phi i32 [ %64, %61 ], [ 5, %65 ]
  store i32 %67, ptr %11, align 4, !tbaa !9
  %68 = load ptr, ptr %8, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.xapi_data_, ptr %68, i32 0, i32 2
  %70 = getelementptr inbounds [2048 x i8], ptr %69, i64 0, i64 0
  %71 = load ptr, ptr %10, align 8, !tbaa !5
  %72 = call i64 @xstrncpy(ptr noundef %70, i64 noundef 2048, ptr noundef %71)
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.xapi_endpoint_, ptr %73, i32 0, i32 2
  %75 = load ptr, ptr %74, align 8, !tbaa !18
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.xapi_data_, ptr %76, i32 0, i32 18
  store ptr %75, ptr %77, align 8, !tbaa !19
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.xapi_endpoint_, ptr %78, i32 0, i32 6
  %80 = load i16, ptr %79, align 4, !tbaa !24
  %81 = load ptr, ptr %8, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.xapi_data_, ptr %81, i32 0, i32 3
  store i16 %80, ptr %82, align 8, !tbaa !25
  %83 = load i32, ptr %7, align 4, !tbaa !9
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.xapi_data_, ptr %84, i32 0, i32 16
  store i32 %83, ptr %85, align 4, !tbaa !26
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 16512, ptr %12, align 4, !tbaa !9
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.xapi_endpoint_, ptr %86, i32 0, i32 10
  %88 = load i8, ptr %87, align 2, !tbaa !27
  %89 = icmp ne i8 %88, 0
  br i1 %89, label %90, label %93

90:                                               ; preds = %66
  %91 = load i32, ptr %12, align 4, !tbaa !9
  %92 = or i32 %91, 16
  store i32 %92, ptr %12, align 4, !tbaa !9
  br label %93

93:                                               ; preds = %90, %66
  %94 = load ptr, ptr %6, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.xapi_endpoint_, ptr %94, i32 0, i32 9
  %96 = load i8, ptr %95, align 1, !tbaa !28
  %97 = icmp ne i8 %96, 0
  br i1 %97, label %98, label %101

98:                                               ; preds = %93
  %99 = load i32, ptr %12, align 4, !tbaa !9
  %100 = or i32 %99, 8
  store i32 %100, ptr %12, align 4, !tbaa !9
  br label %104

101:                                              ; preds = %93
  %102 = load i32, ptr %12, align 4, !tbaa !9
  %103 = or i32 %102, 1
  store i32 %103, ptr %12, align 4, !tbaa !9
  br label %104

104:                                              ; preds = %101, %98
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.xapi_data_, ptr %105, i32 0, i32 4
  store ptr %106, ptr %13, align 8, !tbaa !5
  %107 = load ptr, ptr %13, align 8, !tbaa !5
  %108 = load i32, ptr %12, align 4, !tbaa !9
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.xapi_endpoint_, ptr %109, i32 0, i32 7
  %111 = load i32, ptr %110, align 8, !tbaa !15
  %112 = call i32 @XSock_Init(ptr noundef %107, i32 noundef %108, i32 noundef %111)
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = call ptr @XAPI_GetOrCreateEvents(ptr noundef %113)
  store ptr %114, ptr %14, align 8, !tbaa !5
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = icmp eq ptr %115, null
  br i1 %116, label %117, label %118

117:                                              ; preds = %104
  call void @XAPI_FreeData(ptr noundef %8)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %154

118:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  %119 = load ptr, ptr %14, align 8, !tbaa !5
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = load ptr, ptr %13, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.XSocket, ptr %121, i32 0, i32 5
  %123 = load i32, ptr %122, align 8, !tbaa !29
  %124 = load i32, ptr %11, align 4, !tbaa !9
  %125 = load i32, ptr %7, align 4, !tbaa !9
  %126 = call ptr @XEvents_RegisterEvent(ptr noundef %119, ptr noundef %120, i32 noundef %123, i32 noundef %124, i32 noundef %125)
  store ptr %126, ptr %15, align 8, !tbaa !5
  %127 = load ptr, ptr %15, align 8, !tbaa !5
  %128 = icmp eq ptr %127, null
  br i1 %128, label %129, label %133

129:                                              ; preds = %118
  %130 = load ptr, ptr %5, align 8, !tbaa !5
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = call i32 @XAPI_ErrorCb(ptr noundef %130, ptr noundef %131, i32 noundef 0, i8 noundef zeroext 9)
  call void @XAPI_FreeData(ptr noundef %8)
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %153

133:                                              ; preds = %118
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.xapi_data_, ptr %135, i32 0, i32 14
  store ptr %134, ptr %136, align 8, !tbaa !30
  %137 = load i32, ptr %11, align 4, !tbaa !9
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.xapi_data_, ptr %138, i32 0, i32 5
  store i32 %137, ptr %139, align 8, !tbaa !31
  %140 = load ptr, ptr %5, align 8, !tbaa !5
  %141 = load ptr, ptr %8, align 8, !tbaa !5
  %142 = call i32 @XAPI_ServiceCb(ptr noundef %140, ptr noundef %141, i32 noundef 5)
  %143 = icmp slt i32 %142, 0
  br i1 %143, label %144, label %152

144:                                              ; preds = %133
  %145 = load ptr, ptr %14, align 8, !tbaa !5
  %146 = load ptr, ptr %8, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.xapi_data_, ptr %146, i32 0, i32 14
  %148 = load ptr, ptr %147, align 8, !tbaa !30
  %149 = call i32 @XEvents_Delete(ptr noundef %145, ptr noundef %148)
  %150 = load ptr, ptr %8, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.xapi_data_, ptr %150, i32 0, i32 14
  store ptr null, ptr %151, align 8, !tbaa !30
  store i32 -1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %153

152:                                              ; preds = %133
  store i32 1, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %153

153:                                              ; preds = %152, %144, %129
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %154

154:                                              ; preds = %153, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %155

155:                                              ; preds = %154, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %156

156:                                              ; preds = %155, %33, %27, %21
  %157 = load i32, ptr %4, align 4
  ret i32 %157
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"xapi_endpoint_", !10, i64 0, !13, i64 8, !6, i64 56, !6, i64 64, !6, i64 72, !10, i64 80, !14, i64 84, !10, i64 88, !7, i64 92, !7, i64 93, !7, i64 94}
!13 = !{!"XSocketCert", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !10, i64 88}
!16 = !{!12, !6, i64 72}
!17 = !{!12, !10, i64 80}
!18 = !{!12, !6, i64 56}
!19 = !{!20, !6, i64 2568}
!20 = !{!"xapi_data_", !7, i64 0, !7, i64 128, !7, i64 256, !14, i64 2304, !21, i64 2312, !10, i64 2464, !7, i64 2468, !7, i64 2469, !7, i64 2470, !7, i64 2471, !7, i64 2472, !7, i64 2473, !22, i64 2480, !22, i64 2512, !6, i64 2544, !10, i64 2552, !10, i64 2556, !6, i64 2560, !6, i64 2568, !6, i64 2576}
!21 = !{!"XSocket", !10, i64 0, !7, i64 4, !10, i64 116, !10, i64 120, !14, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !6, i64 144}
!22 = !{!"XByteBuffer", !6, i64 0, !23, i64 8, !23, i64 16, !14, i64 24, !14, i64 26, !10, i64 28}
!23 = !{!"long", !7, i64 0}
!24 = !{!12, !14, i64 84}
!25 = !{!20, !14, i64 2304}
!26 = !{!20, !10, i64 2556}
!27 = !{!12, !7, i64 94}
!28 = !{!12, !7, i64 93}
!29 = !{!21, !10, i64 128}
!30 = !{!20, !6, i64 2544}
!31 = !{!20, !10, i64 2464}


; 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"

@.str.27 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @XAPI_ErrorCb(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local ptr @XAPI_GetOrCreateEvents(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden ptr @XAPI_NewData(ptr noundef, i32 noundef) local_unnamed_addr #1

declare i64 @xstrncpy(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

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

declare ptr @XEvents_RegisterEvent(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @XAPI_ServiceCb(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i32 @XEvents_Delete(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local range(i32 -2, 2) i32 @XAPI_AddEvent(ptr noundef %0, ptr noundef readonly %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca ptr, align 8
  %5 = icmp ne ptr %0, null
  %6 = icmp ne ptr %1, null
  %or.cond = and i1 %5, %6
  br i1 %or.cond, label %7, label %58

7:                                                ; preds = %3
  %8 = load i32, ptr %1, align 8, !tbaa !5
  %.not = icmp eq i32 %8, 0
  br i1 %.not, label %58, label %9

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %1, i64 88
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %.not44 = icmp eq i32 %11, -1
  br i1 %.not44, label %58, label %12

12:                                               ; preds = %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %13 = tail call ptr @XAPI_NewData(ptr noundef nonnull %0, i32 noundef %8)
  store ptr %13, ptr %4, align 8, !tbaa !14
  %14 = icmp eq ptr %13, null
  br i1 %14, label %15, label %17

15:                                               ; preds = %12
  %16 = tail call i32 @XAPI_ErrorCb(ptr noundef nonnull %0, ptr noundef null, i32 noundef 0, i8 noundef zeroext 12)
  br label %57

17:                                               ; preds = %12
  %18 = getelementptr inbounds i8, ptr %1, i64 72
  %19 = load ptr, ptr %18, align 8, !tbaa !15
  %.not45 = icmp eq ptr %19, null
  %spec.select = select i1 %.not45, ptr @.str.27, ptr %19
  %20 = getelementptr inbounds i8, ptr %1, i64 80
  %21 = load i32, ptr %20, align 8, !tbaa !16
  %.not46 = icmp eq i32 %21, 0
  %22 = select i1 %.not46, i32 5, i32 %21
  %23 = getelementptr inbounds i8, ptr %13, i64 256
  %24 = tail call i64 @xstrncpy(ptr noundef nonnull %23, i64 noundef 2048, ptr noundef nonnull %spec.select) #3
  %25 = getelementptr inbounds i8, ptr %1, i64 56
  %26 = load ptr, ptr %25, align 8, !tbaa !17
  %27 = getelementptr inbounds i8, ptr %13, i64 2568
  store ptr %26, ptr %27, align 8, !tbaa !18
  %28 = getelementptr inbounds i8, ptr %1, i64 84
  %29 = load i16, ptr %28, align 4, !tbaa !23
  %30 = getelementptr inbounds i8, ptr %13, i64 2304
  store i16 %29, ptr %30, align 8, !tbaa !24
  %31 = getelementptr inbounds i8, ptr %13, i64 2556
  store i32 %2, ptr %31, align 4, !tbaa !25
  %32 = getelementptr inbounds i8, ptr %1, i64 94
  %33 = load i8, ptr %32, align 2, !tbaa !26
  %.not47 = icmp eq i8 %33, 0
  %.036 = select i1 %.not47, i32 16512, i32 16528
  %34 = getelementptr inbounds i8, ptr %1, i64 93
  %35 = load i8, ptr %34, align 1, !tbaa !27
  %.not48 = icmp eq i8 %35, 0
  %.137.v = select i1 %.not48, i32 1, i32 8
  %.137 = or disjoint i32 %.137.v, %.036
  %36 = getelementptr inbounds i8, ptr %13, i64 2312
  %37 = load i32, ptr %10, align 8, !tbaa !13
  %38 = tail call i32 @XSock_Init(ptr noundef nonnull %36, i32 noundef %.137, i32 noundef %37) #3
  %39 = tail call ptr @XAPI_GetOrCreateEvents(ptr noundef nonnull %0)
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %42

41:                                               ; preds = %17
  call void @XAPI_FreeData(ptr noundef nonnull %4)
  br label %57

42:                                               ; preds = %17
  %43 = getelementptr inbounds i8, ptr %13, i64 2440
  %44 = load i32, ptr %43, align 8, !tbaa !28
  %45 = tail call ptr @XEvents_RegisterEvent(ptr noundef nonnull %39, ptr noundef nonnull %13, i32 noundef %44, i32 noundef %22, i32 noundef %2) #3
  %46 = icmp eq ptr %45, null
  br i1 %46, label %47, label %49

47:                                               ; preds = %42
  %48 = tail call i32 @XAPI_ErrorCb(ptr noundef nonnull %0, ptr noundef nonnull %13, i32 noundef 0, i8 noundef zeroext 9)
  call void @XAPI_FreeData(ptr noundef nonnull %4)
  br label %57

49:                                               ; preds = %42
  %50 = getelementptr inbounds i8, ptr %13, i64 2544
  store ptr %45, ptr %50, align 8, !tbaa !29
  %51 = getelementptr inbounds i8, ptr %13, i64 2464
  store i32 %22, ptr %51, align 8, !tbaa !30
  %52 = tail call i32 @XAPI_ServiceCb(ptr noundef nonnull %0, ptr noundef nonnull %13, i32 noundef 5)
  %53 = icmp slt i32 %52, 0
  br i1 %53, label %54, label %57

54:                                               ; preds = %49
  %55 = load ptr, ptr %50, align 8, !tbaa !29
  %56 = tail call i32 @XEvents_Delete(ptr noundef nonnull %39, ptr noundef %55) #3
  store ptr null, ptr %50, align 8, !tbaa !29
  br label %57

57:                                               ; preds = %41, %49, %54, %47, %15
  %.2 = phi i32 [ -1, %15 ], [ -1, %41 ], [ -1, %47 ], [ -1, %54 ], [ 1, %49 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %58

58:                                               ; preds = %9, %7, %3, %57
  %.3 = phi i32 [ %.2, %57 ], [ -2, %3 ], [ -2, %7 ], [ -2, %9 ]
  ret i32 %.3
}

declare i32 @XSock_Init(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 0}
!6 = !{!"xapi_endpoint_", !7, i64 0, !10, i64 8, !11, i64 56, !11, i64 64, !11, i64 72, !7, i64 80, !12, i64 84, !7, i64 88, !8, i64 92, !8, i64 93, !8, i64 94}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"XSocketCert", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !7, i64 40}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!"short", !8, i64 0}
!13 = !{!6, !7, i64 88}
!14 = !{!11, !11, i64 0}
!15 = !{!6, !11, i64 72}
!16 = !{!6, !7, i64 80}
!17 = !{!6, !11, i64 56}
!18 = !{!19, !11, i64 2568}
!19 = !{!"xapi_data_", !8, i64 0, !8, i64 128, !8, i64 256, !12, i64 2304, !20, i64 2312, !7, i64 2464, !8, i64 2468, !8, i64 2469, !8, i64 2470, !8, i64 2471, !8, i64 2472, !8, i64 2473, !21, i64 2480, !21, i64 2512, !11, i64 2544, !7, i64 2552, !7, i64 2556, !11, i64 2560, !11, i64 2568, !11, i64 2576}
!20 = !{!"XSocket", !7, i64 0, !8, i64 4, !7, i64 116, !7, i64 120, !12, i64 124, !7, i64 128, !7, i64 132, !7, i64 136, !7, i64 140, !11, i64 144}
!21 = !{!"XByteBuffer", !11, i64 0, !22, i64 8, !22, i64 16, !12, i64 24, !12, i64 26, !7, i64 28}
!22 = !{!"long", !8, i64 0}
!23 = !{!6, !12, i64 84}
!24 = !{!19, !12, i64 2304}
!25 = !{!19, !7, i64 2556}
!26 = !{!6, !8, i64 94}
!27 = !{!6, !8, i64 93}
!28 = !{!20, !7, i64 128}
!29 = !{!19, !11, i64 2544}
!30 = !{!19, !7, i64 2464}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass