; LLVM IR from Xingyu-Lin/softgym :: PyFlex/extensions (flexExtCloth)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl" }
%"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl" = type { %"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl_data" }
%"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.(anonymous namespace)::Key" = type { i32, float }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%class.XVector3 = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local i32 @NvFlexExtCreateWeldedMeshIndices(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3, float noundef %4) #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca float, align 4
  %11 = alloca ptr, align 8
  %12 = alloca %"class.std::vector", align 8
  %13 = alloca i32, align 4
  %14 = alloca %"struct.(anonymous namespace)::Key", align 4
  %15 = alloca ptr, align 8
  %16 = alloca i32, align 4
  %17 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %18 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca i32, align 4
  %23 = alloca float, align 4
  %24 = alloca %class.XVector3, align 4
  %25 = alloca %class.XVector3, align 4
  %26 = alloca %class.XVector3, align 4
  %27 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store i32 %1, ptr %7, align 4, !tbaa !9
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store float %4, ptr %10, align 4, !tbaa !11
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = mul i64 %30, 4
  call void @llvm.memset.p0.i64(ptr align 4 %28, i8 -1, i64 %31, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %32, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #8
  call void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %33

33:                                               ; preds = %48, %5
  %34 = load i32, ptr %13, align 4, !tbaa !9
  %35 = load i32, ptr %7, align 4, !tbaa !9
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %55

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %39 = load i32, ptr %13, align 4, !tbaa !9
  %40 = load ptr, ptr %11, align 8, !tbaa !5
  %41 = load i32, ptr %13, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds %class.XVector3, ptr %40, i64 %42
  %44 = getelementptr inbounds %class.XVector3, ptr %43, i32 0, i32 2
  %45 = load float, ptr %44, align 4, !tbaa !13
  invoke void @_ZN12_GLOBAL__N_13KeyC2Eif(ptr noundef nonnull align 4 dereferenceable(8) %14, i32 noundef %39, float noundef %45)
          to label %46 unwind label %51

46:                                               ; preds = %38
  invoke void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %12, ptr noundef nonnull align 4 dereferenceable(8) %14)
          to label %47 unwind label %51

47:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %13, align 4, !tbaa !9
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %13, align 4, !tbaa !9
  br label %33, !llvm.loop !15

51:                                               ; preds = %46, %38
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %15, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %177

55:                                               ; preds = %37
  %56 = call ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  %57 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  store ptr %56, ptr %57, align 8
  %58 = call ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  %59 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  store ptr %58, ptr %59, align 8
  %60 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %17, i32 0, i32 0
  %61 = load ptr, ptr %60, align 8
  %62 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %18, i32 0, i32 0
  %63 = load ptr, ptr %62, align 8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPN12_GLOBAL__N_13KeyESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %61, ptr %63)
          to label %64 unwind label %70

64:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #8
  store i32 0, ptr %19, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  store i32 0, ptr %20, align 4, !tbaa !9
  br label %65

65:                                               ; preds = %172, %64
  %66 = load i32, ptr %20, align 4, !tbaa !9
  %67 = load i32, ptr %7, align 4, !tbaa !9
  %68 = icmp slt i32 %66, %67
  br i1 %68, label %74, label %69

69:                                               ; preds = %65
  store i32 5, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %175

70:                                               ; preds = %55
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %15, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %16, align 4
  br label %177

74:                                               ; preds = %65
  %75 = load ptr, ptr %9, align 8, !tbaa !5
  %76 = load i32, ptr %20, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %77) #8
  %79 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %78, i32 0, i32 0
  %80 = load i32, ptr %79, align 4, !tbaa !17
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds i32, ptr %75, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = icmp ne i32 %83, -1
  br i1 %84, label %85, label %86

85:                                               ; preds = %74
  br label %172

86:                                               ; preds = %74
  call void @llvm.lifetime.start.p0(i64 4, ptr %22) #8
  %87 = load i32, ptr %20, align 4, !tbaa !9
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %22, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %149, %86
  %90 = load i32, ptr %22, align 4, !tbaa !9
  %91 = load i32, ptr %7, align 4, !tbaa !9
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %93, label %107

93:                                               ; preds = %89
  %94 = load i32, ptr %22, align 4, !tbaa !9
  %95 = sext i32 %94 to i64
  %96 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %95) #8
  %97 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %96, i32 0, i32 1
  %98 = load float, ptr %97, align 4, !tbaa !19
  %99 = load i32, ptr %20, align 4, !tbaa !9
  %100 = sext i32 %99 to i64
  %101 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %100) #8
  %102 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %101, i32 0, i32 1
  %103 = load float, ptr %102, align 4, !tbaa !19
  %104 = fsub float %98, %103
  %105 = load float, ptr %10, align 4, !tbaa !11
  %106 = fcmp ole float %104, %105
  br label %107

107:                                              ; preds = %93, %89
  %108 = phi i1 [ false, %89 ], [ %106, %93 ]
  br i1 %108, label %110, label %109

109:                                              ; preds = %107
  store i32 8, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  br label %152

110:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %23) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %24) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr %25) #8
  %111 = load ptr, ptr %11, align 8, !tbaa !5
  %112 = load i32, ptr %20, align 4, !tbaa !9
  %113 = sext i32 %112 to i64
  %114 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %113) #8
  %115 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 4, !tbaa !17
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds %class.XVector3, ptr %111, i64 %117
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %25, ptr align 4 %118, i64 12, i1 false), !tbaa.struct !20
  call void @llvm.lifetime.start.p0(i64 12, ptr %26) #8
  %119 = load ptr, ptr %11, align 8, !tbaa !5
  %120 = load i32, ptr %22, align 4, !tbaa !9
  %121 = sext i32 %120 to i64
  %122 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %121) #8
  %123 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %122, i32 0, i32 0
  %124 = load i32, ptr %123, align 4, !tbaa !17
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds %class.XVector3, ptr %119, i64 %125
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %26, ptr align 4 %126, i64 12, i1 false), !tbaa.struct !20
  %127 = invoke { <2 x float>, float } @_ZNK8XVector3IfEmiERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %25, ptr noundef nonnull align 4 dereferenceable(12) %26)
          to label %128 unwind label %144

128:                                              ; preds = %110
  store { <2 x float>, float } %127, ptr %27, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %24, ptr align 8 %27, i64 12, i1 false)
  %129 = invoke noundef float @_Z6LengthI8XVector3IfEENT_10value_typeERKS2_(ptr noundef nonnull align 4 dereferenceable(12) %24)
          to label %130 unwind label %144

130:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  store float %129, ptr %23, align 4, !tbaa !11
  %131 = load float, ptr %23, align 4, !tbaa !11
  %132 = load float, ptr %10, align 4, !tbaa !11
  %133 = fcmp ole float %131, %132
  br i1 %133, label %134, label %148

134:                                              ; preds = %130
  %135 = load i32, ptr %19, align 4, !tbaa !9
  %136 = load ptr, ptr %9, align 8, !tbaa !5
  %137 = load i32, ptr %22, align 4, !tbaa !9
  %138 = sext i32 %137 to i64
  %139 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %138) #8
  %140 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %139, i32 0, i32 0
  %141 = load i32, ptr %140, align 4, !tbaa !17
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds i32, ptr %136, i64 %142
  store i32 %135, ptr %143, align 4, !tbaa !9
  br label %148

144:                                              ; preds = %128, %110
  %145 = landingpad { ptr, i32 }
          cleanup
  %146 = extractvalue { ptr, i32 } %145, 0
  store ptr %146, ptr %15, align 8
  %147 = extractvalue { ptr, i32 } %145, 1
  store i32 %147, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 12, ptr %26) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %25) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr %24) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %22) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  br label %177

148:                                              ; preds = %134, %130
  call void @llvm.lifetime.end.p0(i64 4, ptr %23) #8
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %22, align 4, !tbaa !9
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %22, align 4, !tbaa !9
  br label %89, !llvm.loop !21

152:                                              ; preds = %109
  %153 = load i32, ptr %19, align 4, !tbaa !9
  %154 = load ptr, ptr %9, align 8, !tbaa !5
  %155 = load i32, ptr %20, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %156) #8
  %158 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %157, i32 0, i32 0
  %159 = load i32, ptr %158, align 4, !tbaa !17
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds i32, ptr %154, i64 %160
  store i32 %153, ptr %161, align 4, !tbaa !9
  %162 = load i32, ptr %20, align 4, !tbaa !9
  %163 = sext i32 %162 to i64
  %164 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %12, i64 noundef %163) #8
  %165 = getelementptr inbounds %"struct.(anonymous namespace)::Key", ptr %164, i32 0, i32 0
  %166 = load i32, ptr %165, align 4, !tbaa !17
  %167 = load ptr, ptr %8, align 8, !tbaa !5
  %168 = load i32, ptr %19, align 4, !tbaa !9
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %19, align 4, !tbaa !9
  %170 = sext i32 %168 to i64
  %171 = getelementptr inbounds i32, ptr %167, i64 %170
  store i32 %166, ptr %171, align 4, !tbaa !9
  br label %172

172:                                              ; preds = %152, %85
  %173 = load i32, ptr %20, align 4, !tbaa !9
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %20, align 4, !tbaa !9
  br label %65, !llvm.loop !22

175:                                              ; preds = %69
  %176 = load i32, ptr %19, align 4, !tbaa !9
  store i32 1, ptr %21, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #8
  call void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  ret i32 %176

177:                                              ; preds = %144, %70, %51
  call void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %178

178:                                              ; preds = %177
  %179 = load ptr, ptr %15, align 8
  %180 = load i32, ptr %16, align 4
  %181 = insertvalue { ptr, i32 } poison, ptr %179, 0
  %182 = insertvalue { ptr, i32 } %181, i32 %180, 1
  resume { ptr, i32 } %182
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_13KeyC2Eif(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, float noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPN12_GLOBAL__N_13KeyESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_Z6LengthI8XVector3IfEENT_10value_typeERKS2_(ptr noundef nonnull align 4 dereferenceable(12)) #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZNK8XVector3IfEmiERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { inlinehint 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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !12, i64 8}
!14 = !{!"_ZTS8XVector3IfE", !12, i64 0, !12, i64 4, !12, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !10, i64 0}
!18 = !{!"_ZTSN12_GLOBAL__N_13KeyE", !10, i64 0, !12, i64 4}
!19 = !{!18, !12, i64 4}
!20 = !{i64 0, i64 4, !11, i64 4, i64 4, !11, i64 8, i64 4, !11}
!21 = distinct !{!21, !16}
!22 = distinct !{!22, !16}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl" }
%"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl" = type { %"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl_data" }
%"struct.std::_Vector_base<(anonymous namespace)::Key, std::allocator<(anonymous namespace)::Key>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.(anonymous namespace)::Key" = type { i32, float }
%class.XVector3 = type { float, float, float }

; Function Attrs: mustprogress uwtable
define dso_local i32 @NvFlexExtCreateWeldedMeshIndices(ptr nocapture noundef readonly %0, i32 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef %3, float noundef %4) local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"class.std::vector", align 8
  %7 = alloca %"struct.(anonymous namespace)::Key", align 4
  %8 = alloca %class.XVector3, align 8
  %9 = alloca %class.XVector3, align 4
  %10 = alloca %class.XVector3, align 4
  %11 = sext i32 %1 to i64
  %12 = shl nsw i64 %11, 2
  tail call void @llvm.memset.p0.i64(ptr align 4 %3, i8 -1, i64 %12, i1 false)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #8
  call void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  %13 = icmp sgt i32 %1, 0
  br i1 %13, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %5
  %wide.trip.count = zext nneg i32 %1 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %19, %5
  %14 = call ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  %15 = call ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  invoke void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPN12_GLOBAL__N_13KeyESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr %14, ptr %15)
          to label %.preheader48 unwind label %22

.preheader48:                                     ; preds = %._crit_edge
  br i1 %13, label %.lr.ph57, label %._crit_edge58

.lr.ph57:                                         ; preds = %.preheader48
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %8, i64 8
  %wide.trip.count71 = zext nneg i32 %1 to i64
  br label %24

.lr.ph:                                           ; preds = %.lr.ph.preheader, %19
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %19 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  %16 = getelementptr inbounds %class.XVector3, ptr %0, i64 %indvars.iv, i32 2
  %17 = load float, ptr %16, align 4, !tbaa !5
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  call void @_ZN12_GLOBAL__N_13KeyC2Eif(ptr noundef nonnull align 4 dereferenceable(8) %7, i32 noundef %18, float noundef %17)
  invoke void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 4 dereferenceable(8) %7)
          to label %19 unwind label %20

19:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !10

20:                                               ; preds = %.lr.ph
  %21 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  br label %71

._crit_edge58:                                    ; preds = %._crit_edge73, %.preheader48
  %.044.lcssa = phi i32 [ 0, %.preheader48 ], [ %.1, %._crit_edge73 ]
  call void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  ret i32 %.044.lcssa

22:                                               ; preds = %._crit_edge
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %71

24:                                               ; preds = %.lr.ph57, %._crit_edge73
  %indvars.iv67 = phi i64 [ 0, %.lr.ph57 ], [ %30, %._crit_edge73 ]
  %indvars.iv60 = phi i64 [ 1, %.lr.ph57 ], [ %indvars.iv.next61, %._crit_edge73 ]
  %.04455 = phi i32 [ 0, %.lr.ph57 ], [ %.1, %._crit_edge73 ]
  %25 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv67) #8
  %26 = load i32, ptr %25, align 4, !tbaa !12
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr %3, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !15
  %.not = icmp eq i32 %29, -1
  %30 = add nuw nsw i64 %indvars.iv67, 1
  br i1 %.not, label %.preheader, label %._crit_edge73

.preheader:                                       ; preds = %24
  %31 = icmp slt i64 %30, %11
  br i1 %31, label %.lr.ph53, label %.critedge

.lr.ph53:                                         ; preds = %.preheader, %70
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %70 ], [ %indvars.iv60, %.preheader ]
  %32 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv62) #8
  %33 = getelementptr inbounds i8, ptr %32, i64 4
  %34 = load float, ptr %33, align 4, !tbaa !16
  %35 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv67) #8
  %36 = getelementptr inbounds i8, ptr %35, i64 4
  %37 = load float, ptr %36, align 4, !tbaa !16
  %38 = fsub float %34, %37
  %39 = fcmp ugt float %38, %4
  br i1 %39, label %.critedge, label %49

.critedge:                                        ; preds = %.lr.ph53, %70, %.preheader
  %40 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv67) #8
  %41 = load i32, ptr %40, align 4, !tbaa !12
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds i32, ptr %3, i64 %42
  store i32 %.04455, ptr %43, align 4, !tbaa !15
  %44 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv67) #8
  %45 = load i32, ptr %44, align 4, !tbaa !12
  %46 = add nsw i32 %.04455, 1
  %47 = sext i32 %.04455 to i64
  %48 = getelementptr inbounds i32, ptr %2, i64 %47
  store i32 %45, ptr %48, align 4, !tbaa !15
  br label %._crit_edge73

49:                                               ; preds = %.lr.ph53
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %8) #8
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %9) #8
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv67) #8
  %51 = load i32, ptr %50, align 4, !tbaa !12
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds %class.XVector3, ptr %0, i64 %52
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %53, i64 12, i1 false), !tbaa.struct !17
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %10) #8
  %54 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv62) #8
  %55 = load i32, ptr %54, align 4, !tbaa !12
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds %class.XVector3, ptr %0, i64 %56
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %10, ptr noundef nonnull align 4 dereferenceable(12) %57, i64 12, i1 false), !tbaa.struct !17
  %58 = invoke { <2 x float>, float } @_ZNK8XVector3IfEmiERKS0_(ptr noundef nonnull align 4 dereferenceable(12) %9, ptr noundef nonnull align 4 dereferenceable(12) %10)
          to label %59 unwind label %68

59:                                               ; preds = %49
  %.fca.0.extract = extractvalue { <2 x float>, float } %58, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %58, 1
  store <2 x float> %.fca.0.extract, ptr %8, align 8
  store float %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %60 = invoke noundef float @_Z6LengthI8XVector3IfEENT_10value_typeERKS2_(ptr noundef nonnull align 4 dereferenceable(12) %8)
          to label %61 unwind label %68

61:                                               ; preds = %59
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  %62 = fcmp ugt float %60, %4
  br i1 %62, label %70, label %63

63:                                               ; preds = %61
  %64 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %6, i64 noundef %indvars.iv62) #8
  %65 = load i32, ptr %64, align 4, !tbaa !12
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %3, i64 %66
  store i32 %.04455, ptr %67, align 4, !tbaa !15
  br label %70

68:                                               ; preds = %59, %49
  %69 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %10) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %9) #8
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %8) #8
  br label %71

70:                                               ; preds = %63, %61
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %exitcond66.not = icmp eq i64 %indvars.iv.next63, %wide.trip.count71
  br i1 %exitcond66.not, label %.critedge, label %.lr.ph53, !llvm.loop !19

._crit_edge73:                                    ; preds = %24, %.critedge
  %.1 = phi i32 [ %46, %.critedge ], [ %.04455, %24 ]
  %indvars.iv.next61 = add nuw nsw i64 %indvars.iv60, 1
  %exitcond72.not = icmp eq i64 %30, %wide.trip.count71
  br i1 %exitcond72.not, label %._crit_edge58, label %24, !llvm.loop !20

71:                                               ; preds = %68, %22, %20
  %.pn = phi { ptr, i32 } [ %21, %20 ], [ %69, %68 ], [ %23, %22 ]
  call void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #8
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #8
  resume { ptr, i32 } %.pn
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare hidden void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZN12_GLOBAL__N_13KeyC2Eif(ptr noundef nonnull align 4 dereferenceable(8), i32 noundef, float noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPN12_GLOBAL__N_13KeyESt6vectorIS3_SaIS3_EEEEEvT_S9_(ptr, ptr) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare hidden ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef float @_Z6LengthI8XVector3IfEENT_10value_typeERKS2_(ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #6

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local { <2 x float>, float } @_ZNK8XVector3IfEmiERKS0_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @_ZNSt6vectorIN12_GLOBAL__N_13KeyESaIS1_EED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #3 align 2

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="64" "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 nounwind willreturn memory(argmem: write) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #5 = { inlinehint 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 #6 = { inlinehint mustprogress uwtable "min-legal-vector-width"="64" "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 8}
!6 = !{!"_ZTS8XVector3IfE", !7, i64 0, !7, i64 4, !7, i64 8}
!7 = !{!"float", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = !{!13, !14, i64 0}
!13 = !{!"_ZTSN12_GLOBAL__N_13KeyE", !14, i64 0, !7, i64 4}
!14 = !{!"int", !8, i64 0}
!15 = !{!14, !14, i64 0}
!16 = !{!13, !7, i64 4}
!17 = !{i64 0, i64 4, !18, i64 4, i64 4, !18, i64 8, i64 4, !18}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !11}
!20 = distinct !{!20, !11}


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