; LLVM IR from kevin2431/Traj-LO :: thirdparty/ros/ros_comm/utilities/xmlrpcpp/src (XmlRpcSocket)

; 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.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }
%struct.sockaddr_in6 = type { i16, i16, i32, %struct.in6_addr, i32 }
%struct.sockaddr_in = type { i16, i16, %struct.in_addr, [8 x i8] }
%struct.in_addr = type { i32 }

@_ZN6XmlRpc12XmlRpcSocket11s_use_ipv6_E = external dso_local global i8, align 1
@in6addr_any = external global %struct.in6_addr, align 4

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN6XmlRpc12XmlRpcSocket4bindEii(i32 noundef %0, i32 noundef %1) #1 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %struct.sockaddr_storage, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 128, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.memset.p0.i64(ptr align 8 %5, i8 0, i64 128, i1 false)
  %9 = load i8, ptr @_ZN6XmlRpc12XmlRpcSocket11s_use_ipv6_E, align 1, !tbaa !9, !range !11, !noundef !12
  %10 = trunc i8 %9 to i1
  br i1 %10, label %11, label %21

11:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store ptr %5, ptr %7, align 8, !tbaa !13
  store i32 28, ptr %6, align 4, !tbaa !5
  %12 = load ptr, ptr %7, align 8, !tbaa !13
  %13 = getelementptr inbounds %struct.sockaddr_in6, ptr %12, i32 0, i32 0
  store i16 10, ptr %13, align 4, !tbaa !15
  %14 = load ptr, ptr %7, align 8, !tbaa !13
  %15 = getelementptr inbounds %struct.sockaddr_in6, ptr %14, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 @in6addr_any, i64 16, i1 false), !tbaa.struct !19
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = trunc i32 %16 to i16
  %18 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %17)
  %19 = load ptr, ptr %7, align 8, !tbaa !13
  %20 = getelementptr inbounds %struct.sockaddr_in6, ptr %19, i32 0, i32 1
  store i16 %18, ptr %20, align 2, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %33

21:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store ptr %5, ptr %8, align 8, !tbaa !13
  store i32 16, ptr %6, align 4, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !13
  %23 = getelementptr inbounds %struct.sockaddr_in, ptr %22, i32 0, i32 0
  store i16 2, ptr %23, align 4, !tbaa !22
  %24 = call noundef i32 @_ZL10__bswap_32j(i32 noundef 0)
  %25 = load ptr, ptr %8, align 8, !tbaa !13
  %26 = getelementptr inbounds %struct.sockaddr_in, ptr %25, i32 0, i32 2
  %27 = getelementptr inbounds %struct.in_addr, ptr %26, i32 0, i32 0
  store i32 %24, ptr %27, align 4, !tbaa !25
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = trunc i32 %28 to i16
  %30 = call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %29)
  %31 = load ptr, ptr %8, align 8, !tbaa !13
  %32 = getelementptr inbounds %struct.sockaddr_in, ptr %31, i32 0, i32 1
  store i16 %30, ptr %32, align 2, !tbaa !26
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %33

33:                                               ; preds = %21, %11
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr %6, align 4, !tbaa !5
  %36 = call i32 @bind(i32 noundef %34, ptr noundef %5, i32 noundef %35) #6
  %37 = icmp eq i32 %36, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 128, ptr %5) #6
  ret i1 %37
}

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

; 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) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL10__bswap_32j(i32 noundef) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !17, i64 0}
!16 = !{!"_ZTS12sockaddr_in6", !17, i64 0, !17, i64 2, !6, i64 4, !18, i64 8, !6, i64 24}
!17 = !{!"short", !7, i64 0}
!18 = !{!"_ZTS8in6_addr", !7, i64 0}
!19 = !{i64 0, i64 16, !20}
!20 = !{!7, !7, i64 0}
!21 = !{!16, !17, i64 2}
!22 = !{!23, !17, i64 0}
!23 = !{!"_ZTS11sockaddr_in", !17, i64 0, !17, i64 2, !24, i64 4, !7, i64 8}
!24 = !{!"_ZTS7in_addr", !6, i64 0}
!25 = !{!23, !6, i64 4}
!26 = !{!23, !17, i64 2}


; 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.in6_addr = type { %union.anon }
%union.anon = type { [4 x i32] }
%struct.sockaddr_storage = type { i16, [118 x i8], i64 }

@_ZN6XmlRpc12XmlRpcSocket11s_use_ipv6_E = external dso_local local_unnamed_addr global i8, align 1
@in6addr_any = external local_unnamed_addr global %struct.in6_addr, align 4

; 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: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_ZN6XmlRpc12XmlRpcSocket4bindEii(i32 noundef %0, i32 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %struct.sockaddr_storage, align 8
  call void @llvm.lifetime.start.p0(i64 128, ptr nonnull %3) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(128) %3, i8 0, i64 128, i1 false)
  %4 = load i8, ptr @_ZN6XmlRpc12XmlRpcSocket11s_use_ipv6_E, align 1, !tbaa !5, !range !9, !noundef !10
  %5 = trunc nuw i8 %4 to i1
  br i1 %5, label %6, label %8

6:                                                ; preds = %2
  %7 = getelementptr inbounds i8, ptr %3, i64 8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 4 dereferenceable(16) @in6addr_any, i64 16, i1 false), !tbaa.struct !11
  br label %11

8:                                                ; preds = %2
  %9 = tail call noundef i32 @_ZL10__bswap_32j(i32 noundef 0)
  %10 = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %9, ptr %10, align 4, !tbaa !13
  br label %11

11:                                               ; preds = %8, %6
  %.sink9 = phi i16 [ 10, %6 ], [ 2, %8 ]
  %.0 = phi i32 [ 28, %6 ], [ 16, %8 ]
  %12 = trunc i32 %1 to i16
  %13 = tail call noundef zeroext i16 @_ZL10__bswap_16t(i16 noundef zeroext %12)
  store i16 %.sink9, ptr %3, align 8
  %14 = getelementptr inbounds i8, ptr %3, i64 2
  store i16 %13, ptr %14, align 2
  %15 = call i32 @bind(i32 noundef %0, ptr noundef nonnull %3, i32 noundef %.0) #6
  %16 = icmp eq i32 %15, 0
  call void @llvm.lifetime.end.p0(i64 128, ptr nonnull %3) #6
  ret i1 %16
}

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

; 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) #3

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL10__bswap_32j(i32 noundef) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { inlinehint 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 #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 = { 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 = !{!"bool", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{i8 0, i8 2}
!10 = !{}
!11 = !{i64 0, i64 16, !12}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !17, i64 4}
!14 = !{!"_ZTS11sockaddr_in", !15, i64 0, !15, i64 2, !16, i64 4, !7, i64 8}
!15 = !{!"short", !7, i64 0}
!16 = !{!"_ZTS7in_addr", !17, i64 0}
!17 = !{!"int", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,MergedLoadStoreMotionPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass