; LLVM IR from dmr-goncalves/HumanAwareRobotNavigation :: src/husky/husky_base/src/horizon_legacy (Message_cmd)

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

@_ZTVN9clearpath15SetPlatformNameE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9clearpath10CmdMessageC2Ev(ptr noundef nonnull align 8 dereferenceable(273)) unnamed_addr #0 align 2

declare void @_ZN9clearpath7Message16setPayloadLengthEh(ptr noundef nonnull align 8 dereferenceable(273), i8 noundef zeroext) #1

declare i32 @__gxx_personality_v0(...)

declare noundef ptr @_ZN9clearpath7Message17getPayloadPointerEm(ptr noundef nonnull align 8 dereferenceable(273), i64 noundef) #1

declare void @_ZN9clearpath7Message7setTypeEt(ptr noundef nonnull align 8 dereferenceable(273), i16 noundef zeroext) #1

declare void @_ZN9clearpath7Message9makeValidEv(ptr noundef nonnull align 8 dereferenceable(273)) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9clearpath15SetPlatformNameC2EPKc(ptr noundef nonnull align 8 dereferenceable(273) %0, ptr noundef %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8
  call void @_ZN9clearpath10CmdMessageC2Ev(ptr noundef nonnull align 8 dereferenceable(273) %9)
  store ptr getelementptr inbounds inrange(-16, 24) ({ [5 x ptr] }, ptr @_ZTVN9clearpath15SetPlatformNameE, i32 0, i32 0, i32 2), ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = call i64 @strlen(ptr noundef %10) #7
  store i64 %11, ptr %5, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 241, ptr %6, align 8, !tbaa !11
  %12 = load i64, ptr %5, align 8, !tbaa !11
  %13 = load i64, ptr %6, align 8, !tbaa !11
  %14 = icmp ugt i64 %12, %13
  br i1 %14, label %15, label %17

15:                                               ; preds = %2
  %16 = load i64, ptr %6, align 8, !tbaa !11
  store i64 %16, ptr %5, align 8, !tbaa !11
  br label %17

17:                                               ; preds = %15, %2
  %18 = load i64, ptr %5, align 8, !tbaa !11
  %19 = add i64 %18, 1
  %20 = trunc i64 %19 to i8
  invoke void @_ZN9clearpath7Message16setPayloadLengthEh(ptr noundef nonnull align 8 dereferenceable(273) %9, i8 noundef zeroext %20)
          to label %21 unwind label %33

21:                                               ; preds = %17
  %22 = load i64, ptr %5, align 8, !tbaa !11
  %23 = trunc i64 %22 to i8
  %24 = invoke noundef ptr @_ZN9clearpath7Message17getPayloadPointerEm(ptr noundef nonnull align 8 dereferenceable(273) %9, i64 noundef 0)
          to label %25 unwind label %33

25:                                               ; preds = %21
  %26 = getelementptr inbounds i8, ptr %24, i64 0
  store i8 %23, ptr %26, align 1, !tbaa !13
  %27 = invoke noundef ptr @_ZN9clearpath7Message17getPayloadPointerEm(ptr noundef nonnull align 8 dereferenceable(273) %9, i64 noundef 1)
          to label %28 unwind label %33

28:                                               ; preds = %25
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = load i64, ptr %5, align 8, !tbaa !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %27, ptr align 1 %29, i64 %30, i1 false)
  invoke void @_ZN9clearpath7Message7setTypeEt(ptr noundef nonnull align 8 dereferenceable(273) %9, i16 noundef zeroext 2)
          to label %31 unwind label %33

31:                                               ; preds = %28
  invoke void @_ZN9clearpath7Message9makeValidEv(ptr noundef nonnull align 8 dereferenceable(273) %9)
          to label %32 unwind label %33

32:                                               ; preds = %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  ret void

33:                                               ; preds = %31, %28, %25, %21, %17
  %34 = landingpad { ptr, i32 }
          cleanup
  %35 = extractvalue { ptr, i32 } %34, 0
  store ptr %35, ptr %7, align 8
  %36 = extractvalue { ptr, i32 } %34, 1
  store i32 %36, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @_ZN9clearpath10CmdMessageD2Ev(ptr noundef nonnull align 8 dereferenceable(273) %9) #6
  br label %37

37:                                               ; preds = %33
  %38 = load ptr, ptr %7, align 8
  %39 = load i32, ptr %8, align 4
  %40 = insertvalue { ptr, i32 } poison, ptr %38, 0
  %41 = insertvalue { ptr, i32 } %40, i32 %39, 1
  resume { ptr, i32 } %41
}

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9clearpath10CmdMessageD2Ev(ptr noundef nonnull align 8 dereferenceable(273)) unnamed_addr #5 align 2

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(read) "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(read) }

!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 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}


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

@_ZTVN9clearpath15SetPlatformNameE = external dso_local unnamed_addr constant { [5 x ptr] }, align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN9clearpath10CmdMessageC2Ev(ptr noundef nonnull align 8 dereferenceable(273)) unnamed_addr #0 align 2

declare void @_ZN9clearpath7Message16setPayloadLengthEh(ptr noundef nonnull align 8 dereferenceable(273), i8 noundef zeroext) local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

declare noundef ptr @_ZN9clearpath7Message17getPayloadPointerEm(ptr noundef nonnull align 8 dereferenceable(273), i64 noundef) local_unnamed_addr #1

declare void @_ZN9clearpath7Message7setTypeEt(ptr noundef nonnull align 8 dereferenceable(273), i16 noundef zeroext) local_unnamed_addr #1

declare void @_ZN9clearpath7Message9makeValidEv(ptr noundef nonnull align 8 dereferenceable(273)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9clearpath15SetPlatformNameC2EPKc(ptr noundef nonnull align 8 dereferenceable(273) %0, ptr nocapture noundef readonly %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  tail call void @_ZN9clearpath10CmdMessageC2Ev(ptr noundef nonnull align 8 dereferenceable(273) %0)
  store ptr getelementptr inbounds inrange(-16, 24) (i8, ptr @_ZTVN9clearpath15SetPlatformNameE, i64 16), ptr %0, align 8, !tbaa !5
  %3 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #6
  %spec.select = tail call i64 @llvm.umin.i64(i64 %3, i64 241)
  %4 = trunc nuw i64 %spec.select to i8
  %5 = add nuw i8 %4, 1
  invoke void @_ZN9clearpath7Message16setPayloadLengthEh(ptr noundef nonnull align 8 dereferenceable(273) %0, i8 noundef zeroext %5)
          to label %6 unwind label %13

6:                                                ; preds = %2
  %7 = invoke noundef ptr @_ZN9clearpath7Message17getPayloadPointerEm(ptr noundef nonnull align 8 dereferenceable(273) %0, i64 noundef 0)
          to label %8 unwind label %13

8:                                                ; preds = %6
  store i8 %4, ptr %7, align 1, !tbaa !8
  %9 = invoke noundef ptr @_ZN9clearpath7Message17getPayloadPointerEm(ptr noundef nonnull align 8 dereferenceable(273) %0, i64 noundef 1)
          to label %10 unwind label %13

10:                                               ; preds = %8
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %9, ptr align 1 %1, i64 %spec.select, i1 false)
  invoke void @_ZN9clearpath7Message7setTypeEt(ptr noundef nonnull align 8 dereferenceable(273) %0, i16 noundef zeroext 2)
          to label %11 unwind label %13

11:                                               ; preds = %10
  invoke void @_ZN9clearpath7Message9makeValidEv(ptr noundef nonnull align 8 dereferenceable(273) %0)
          to label %12 unwind label %13

12:                                               ; preds = %11
  ret void

13:                                               ; preds = %11, %10, %8, %6, %2
  %14 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN9clearpath10CmdMessageD2Ev(ptr noundef nonnull align 8 dereferenceable(273) %0) #7
  resume { ptr, i32 } %14
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #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: mustprogress nounwind uwtable
declare dso_local void @_ZN9clearpath10CmdMessageD2Ev(ptr noundef nonnull align 8 dereferenceable(273)) unnamed_addr #4 align 2

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umin.i64(i64, i64) #5

attributes #0 = { 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 #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 nofree nounwind willreturn memory(argmem: read) "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 nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #6 = { nounwind willreturn memory(read) }
attributes #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"omnipotent char", !7, i64 0}


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