; LLVM IR from simbody/simbody :: SimTKcommon/src/tinyxml.ll (ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE)

; 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.SimTK::String" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.SimTK::TiXmlBase" = type { ptr, %"struct.SimTK::TiXmlCursor", ptr }
%"struct.SimTK::TiXmlCursor" = type { i32, i32 }

@.str.19 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE = external hidden unnamed_addr constant [59 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [18 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: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; 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
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #1 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK9TiXmlNode5ClearEv(ptr noundef nonnull align 8 dereferenceable(104)) #2 align 2

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

declare void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192), i32 noundef, ptr noundef, ptr noundef, i32 noundef) #4

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef %1, i32 noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.SimTK::String", align 8
  %11 = alloca ptr, align 8
  %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
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %20, label %19

19:                                               ; preds = %3
  call void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %16, i32 noundef 2, ptr noundef null, ptr noundef null, i32 noundef 0)
  store i1 false, ptr %4, align 1
  br label %208

20:                                               ; preds = %3
  call void @_ZN5SimTK9TiXmlNode5ClearEv(ptr noundef nonnull align 8 dereferenceable(104) %16)
  %21 = getelementptr inbounds %"class.SimTK::TiXmlBase", ptr %16, i32 0, i32 1
  call void @_ZN5SimTK11TiXmlCursor5ClearEv(ptr noundef nonnull align 4 dereferenceable(8) %21)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 0, ptr %8, align 8, !tbaa !11
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = call i32 @fseek(ptr noundef %22, i64 noundef 0, i32 noundef 2)
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call i64 @ftell(ptr noundef %24)
  store i64 %25, ptr %8, align 8, !tbaa !11
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = call i32 @fseek(ptr noundef %26, i64 noundef 0, i32 noundef 0)
  %28 = load i64, ptr %8, align 8, !tbaa !11
  %29 = icmp sle i64 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %20
  call void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %16, i32 noundef 13, ptr noundef null, ptr noundef null, i32 noundef 0)
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %207

31:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  call void @_ZN5SimTK6StringC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10)
  %32 = load i64, ptr %8, align 8, !tbaa !11
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32) %10, i64 noundef %32)
          to label %33 unwind label %52

33:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %34 = load i64, ptr %8, align 8, !tbaa !11
  %35 = add nsw i64 %34, 1
  %36 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %35) #8
          to label %37 unwind label %56

37:                                               ; preds = %33
  store ptr %36, ptr %13, align 8, !tbaa !5
  %38 = load ptr, ptr %13, align 8, !tbaa !5
  %39 = getelementptr inbounds i8, ptr %38, i64 0
  store i8 0, ptr %39, align 1, !tbaa !13
  %40 = load ptr, ptr %13, align 8, !tbaa !5
  %41 = load i64, ptr %8, align 8, !tbaa !11
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = invoke i64 @fread(ptr noundef %40, i64 noundef %41, i64 noundef 1, ptr noundef %42)
          to label %44 unwind label %56

44:                                               ; preds = %37
  %45 = icmp ne i64 %43, 1
  br i1 %45, label %46, label %60

46:                                               ; preds = %44
  %47 = load ptr, ptr %13, align 8, !tbaa !5
  %48 = icmp eq ptr %47, null
  br i1 %48, label %50, label %49

49:                                               ; preds = %46
  call void @_ZdaPv(ptr noundef %47) #9
  br label %50

50:                                               ; preds = %49, %46
  invoke void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %16, i32 noundef 2, ptr noundef null, ptr noundef null, i32 noundef 0)
          to label %51 unwind label %56

51:                                               ; preds = %50
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %204

52:                                               ; preds = %31
  %53 = landingpad { ptr, i32 }
          cleanup
  %54 = extractvalue { ptr, i32 } %53, 0
  store ptr %54, ptr %11, align 8
  %55 = extractvalue { ptr, i32 } %53, 1
  store i32 %55, ptr %12, align 4
  br label %206

56:                                               ; preds = %50, %37, %33
  %57 = landingpad { ptr, i32 }
          cleanup
  %58 = extractvalue { ptr, i32 } %57, 0
  store ptr %58, ptr %11, align 8
  %59 = extractvalue { ptr, i32 } %57, 1
  store i32 %59, ptr %12, align 4
  br label %205

60:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %61, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %62 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %62, ptr %15, align 8, !tbaa !5
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = load i64, ptr %8, align 8, !tbaa !11
  %65 = getelementptr inbounds i8, ptr %63, i64 %64
  store i8 0, ptr %65, align 1, !tbaa !13
  br label %66

66:                                               ; preds = %170, %60
  %67 = load ptr, ptr %15, align 8, !tbaa !5
  %68 = load i8, ptr %67, align 1, !tbaa !13
  %69 = icmp ne i8 %68, 0
  br i1 %69, label %70, label %171

70:                                               ; preds = %66
  %71 = load ptr, ptr %15, align 8, !tbaa !5
  %72 = load ptr, ptr %13, align 8, !tbaa !5
  %73 = load i64, ptr %8, align 8, !tbaa !11
  %74 = getelementptr inbounds i8, ptr %72, i64 %73
  %75 = icmp ult ptr %71, %74
  br i1 %75, label %76, label %77

76:                                               ; preds = %70
  br label %79

77:                                               ; preds = %70
  call void @__assert_fail(ptr noundef @.str.46, ptr noundef @.str.19, i32 noundef 1173, ptr noundef @__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE) #10
  unreachable

78:                                               ; No predecessors!
  br label %79

79:                                               ; preds = %78, %76
  %80 = load ptr, ptr %15, align 8, !tbaa !5
  %81 = load i8, ptr %80, align 1, !tbaa !13
  %82 = sext i8 %81 to i32
  %83 = icmp eq i32 %82, 10
  br i1 %83, label %84, label %110

84:                                               ; preds = %79
  %85 = load ptr, ptr %14, align 8, !tbaa !5
  %86 = load ptr, ptr %15, align 8, !tbaa !5
  %87 = load ptr, ptr %14, align 8, !tbaa !5
  %88 = ptrtoint ptr %86 to i64
  %89 = ptrtoint ptr %87 to i64
  %90 = sub i64 %88, %89
  %91 = add nsw i64 %90, 1
  %92 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %85, i64 noundef %91)
          to label %93 unwind label %104

93:                                               ; preds = %84
  %94 = load ptr, ptr %15, align 8, !tbaa !5
  %95 = getelementptr inbounds i8, ptr %94, i32 1
  store ptr %95, ptr %15, align 8, !tbaa !5
  %96 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %96, ptr %14, align 8, !tbaa !5
  %97 = load ptr, ptr %15, align 8, !tbaa !5
  %98 = load ptr, ptr %13, align 8, !tbaa !5
  %99 = load i64, ptr %8, align 8, !tbaa !11
  %100 = getelementptr inbounds i8, ptr %98, i64 %99
  %101 = icmp ule ptr %97, %100
  br i1 %101, label %102, label %103

102:                                              ; preds = %93
  br label %109

103:                                              ; preds = %93
  call void @__assert_fail(ptr noundef @.str.47, ptr noundef @.str.19, i32 noundef 1180, ptr noundef @__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE) #10
  unreachable

104:                                              ; preds = %198, %191, %178, %131, %122, %84
  %105 = landingpad { ptr, i32 }
          cleanup
  %106 = extractvalue { ptr, i32 } %105, 0
  store ptr %106, ptr %11, align 8
  %107 = extractvalue { ptr, i32 } %105, 1
  store i32 %107, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %205

108:                                              ; No predecessors!
  br label %109

109:                                              ; preds = %108, %102
  br label %170

110:                                              ; preds = %79
  %111 = load ptr, ptr %15, align 8, !tbaa !5
  %112 = load i8, ptr %111, align 1, !tbaa !13
  %113 = sext i8 %112 to i32
  %114 = icmp eq i32 %113, 13
  br i1 %114, label %115, label %166

115:                                              ; preds = %110
  %116 = load ptr, ptr %15, align 8, !tbaa !5
  %117 = load ptr, ptr %14, align 8, !tbaa !5
  %118 = ptrtoint ptr %116 to i64
  %119 = ptrtoint ptr %117 to i64
  %120 = sub i64 %118, %119
  %121 = icmp sgt i64 %120, 0
  br i1 %121, label %122, label %131

122:                                              ; preds = %115
  %123 = load ptr, ptr %14, align 8, !tbaa !5
  %124 = load ptr, ptr %15, align 8, !tbaa !5
  %125 = load ptr, ptr %14, align 8, !tbaa !5
  %126 = ptrtoint ptr %124 to i64
  %127 = ptrtoint ptr %125 to i64
  %128 = sub i64 %126, %127
  %129 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %123, i64 noundef %128)
          to label %130 unwind label %104

130:                                              ; preds = %122
  br label %131

131:                                              ; preds = %130, %115
  %132 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %10, i8 noundef signext 10)
          to label %133 unwind label %104

133:                                              ; preds = %131
  %134 = load ptr, ptr %15, align 8, !tbaa !5
  %135 = getelementptr inbounds i8, ptr %134, i64 1
  %136 = load i8, ptr %135, align 1, !tbaa !13
  %137 = sext i8 %136 to i32
  %138 = icmp eq i32 %137, 10
  br i1 %138, label %139, label %152

139:                                              ; preds = %133
  %140 = load ptr, ptr %15, align 8, !tbaa !5
  %141 = getelementptr inbounds i8, ptr %140, i64 2
  store ptr %141, ptr %15, align 8, !tbaa !5
  %142 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %142, ptr %14, align 8, !tbaa !5
  %143 = load ptr, ptr %15, align 8, !tbaa !5
  %144 = load ptr, ptr %13, align 8, !tbaa !5
  %145 = load i64, ptr %8, align 8, !tbaa !11
  %146 = getelementptr inbounds i8, ptr %144, i64 %145
  %147 = icmp ule ptr %143, %146
  br i1 %147, label %148, label %149

148:                                              ; preds = %139
  br label %151

149:                                              ; preds = %139
  call void @__assert_fail(ptr noundef @.str.47, ptr noundef @.str.19, i32 noundef 1194, ptr noundef @__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE) #10
  unreachable

150:                                              ; No predecessors!
  br label %151

151:                                              ; preds = %150, %148
  br label %165

152:                                              ; preds = %133
  %153 = load ptr, ptr %15, align 8, !tbaa !5
  %154 = getelementptr inbounds i8, ptr %153, i32 1
  store ptr %154, ptr %15, align 8, !tbaa !5
  %155 = load ptr, ptr %15, align 8, !tbaa !5
  store ptr %155, ptr %14, align 8, !tbaa !5
  %156 = load ptr, ptr %15, align 8, !tbaa !5
  %157 = load ptr, ptr %13, align 8, !tbaa !5
  %158 = load i64, ptr %8, align 8, !tbaa !11
  %159 = getelementptr inbounds i8, ptr %157, i64 %158
  %160 = icmp ule ptr %156, %159
  br i1 %160, label %161, label %162

161:                                              ; preds = %152
  br label %164

162:                                              ; preds = %152
  call void @__assert_fail(ptr noundef @.str.47, ptr noundef @.str.19, i32 noundef 1200, ptr noundef @__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE) #10
  unreachable

163:                                              ; No predecessors!
  br label %164

164:                                              ; preds = %163, %161
  br label %165

165:                                              ; preds = %164, %151
  br label %169

166:                                              ; preds = %110
  %167 = load ptr, ptr %15, align 8, !tbaa !5
  %168 = getelementptr inbounds i8, ptr %167, i32 1
  store ptr %168, ptr %15, align 8, !tbaa !5
  br label %169

169:                                              ; preds = %166, %165
  br label %170

170:                                              ; preds = %169, %109
  br label %66, !llvm.loop !14

171:                                              ; preds = %66
  %172 = load ptr, ptr %15, align 8, !tbaa !5
  %173 = load ptr, ptr %14, align 8, !tbaa !5
  %174 = ptrtoint ptr %172 to i64
  %175 = ptrtoint ptr %173 to i64
  %176 = sub i64 %174, %175
  %177 = icmp ne i64 %176, 0
  br i1 %177, label %178, label %187

178:                                              ; preds = %171
  %179 = load ptr, ptr %14, align 8, !tbaa !5
  %180 = load ptr, ptr %15, align 8, !tbaa !5
  %181 = load ptr, ptr %14, align 8, !tbaa !5
  %182 = ptrtoint ptr %180 to i64
  %183 = ptrtoint ptr %181 to i64
  %184 = sub i64 %182, %183
  %185 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %179, i64 noundef %184)
          to label %186 unwind label %104

186:                                              ; preds = %178
  br label %187

187:                                              ; preds = %186, %171
  %188 = load ptr, ptr %13, align 8, !tbaa !5
  %189 = icmp eq ptr %188, null
  br i1 %189, label %191, label %190

190:                                              ; preds = %187
  call void @_ZdaPv(ptr noundef %188) #9
  br label %191

191:                                              ; preds = %190, %187
  store ptr null, ptr %13, align 8, !tbaa !5
  %192 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  %193 = load i32, ptr %7, align 4, !tbaa !9
  %194 = load ptr, ptr %16, align 8, !tbaa !16
  %195 = getelementptr inbounds ptr, ptr %194, i64 3
  %196 = load ptr, ptr %195, align 8
  %197 = invoke noundef ptr %196(ptr noundef nonnull align 8 dereferenceable(192) %16, ptr noundef %192, ptr noundef null, i32 noundef %193)
          to label %198 unwind label %104

198:                                              ; preds = %191
  %199 = invoke noundef zeroext i1 @_ZNK5SimTK13TiXmlDocument5ErrorEv(ptr noundef nonnull align 8 dereferenceable(192) %16)
          to label %200 unwind label %104

200:                                              ; preds = %198
  br i1 %199, label %201, label %202

201:                                              ; preds = %200
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %203

202:                                              ; preds = %200
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %203

203:                                              ; preds = %202, %201
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br label %204

204:                                              ; preds = %203, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  br label %207

205:                                              ; preds = %104, %56
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %206

206:                                              ; preds = %205, %52
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %210

207:                                              ; preds = %204, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %208

208:                                              ; preds = %207, %19
  %209 = load i1, ptr %4, align 1
  ret i1 %209

210:                                              ; preds = %206
  %211 = load ptr, ptr %11, align 8
  %212 = load i32, ptr %12, align 4
  %213 = insertvalue { ptr, i32 } poison, ptr %211, 0
  %214 = insertvalue { ptr, i32 } %213, i32 %212, 1
  resume { ptr, i32 } %214
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK11TiXmlCursor5ClearEv(ptr noundef nonnull align 4 dereferenceable(8)) #2 align 2

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #4

declare i64 @ftell(ptr noundef) #4

declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #5

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #4

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #6

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

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 = { 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 #3 = { 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 #4 = { "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 = { nobuiltin allocsize(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 = { nobuiltin 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin nounwind }
attributes #10 = { noreturn 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 = !{!"_ZTSN5SimTK13TiXmlEncodingE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !8, 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"

%"class.SimTK::String" = type { %"class.std::__cxx11::basic_string" }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@.str.19 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [17 x i8], align 1
@__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE = external hidden unnamed_addr constant [59 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [18 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 uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2 align 2

; 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 uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #1 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK9TiXmlNode5ClearEv(ptr noundef nonnull align 8 dereferenceable(104)) local_unnamed_addr #2 align 2

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

declare void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192), i32 noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.SimTK::String", align 8
  %.not = icmp eq ptr %1, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %3
  tail call void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %0, i32 noundef 2, ptr noundef null, ptr noundef null, i32 noundef 0)
  br label %71

6:                                                ; preds = %3
  tail call void @_ZN5SimTK9TiXmlNode5ClearEv(ptr noundef nonnull align 8 dereferenceable(104) %0)
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  tail call void @_ZN5SimTK11TiXmlCursor5ClearEv(ptr noundef nonnull align 4 dereferenceable(8) %7)
  %8 = tail call i32 @fseek(ptr noundef nonnull %1, i64 noundef 0, i32 noundef 2)
  %9 = tail call i64 @ftell(ptr noundef nonnull %1)
  %10 = tail call i32 @fseek(ptr noundef nonnull %1, i64 noundef 0, i32 noundef 0)
  %11 = icmp slt i64 %9, 1
  br i1 %11, label %12, label %13

12:                                               ; preds = %6
  tail call void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %0, i32 noundef 13, ptr noundef null, ptr noundef null, i32 noundef 0)
  br label %71

13:                                               ; preds = %6
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #8
  call void @_ZN5SimTK6StringC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4)
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32) %4, i64 noundef %9)
          to label %14 unwind label %20

14:                                               ; preds = %13
  %15 = add nuw nsw i64 %9, 1
  %16 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %15) #9
          to label %17 unwind label %22

17:                                               ; preds = %14
  store i8 0, ptr %16, align 1, !tbaa !5
  %18 = call i64 @fread(ptr noundef nonnull %16, i64 noundef %9, i64 noundef 1, ptr noundef nonnull %1)
  %.not75 = icmp eq i64 %18, 1
  br i1 %.not75, label %.split, label %19

19:                                               ; preds = %17
  call void @_ZdaPv(ptr noundef nonnull %16) #10
  invoke void @_ZN5SimTK13TiXmlDocument8SetErrorEiPKcPNS_16TiXmlParsingDataENS_13TiXmlEncodingE(ptr noundef nonnull align 8 dereferenceable(192) %0, i32 noundef 2, ptr noundef null, ptr noundef null, i32 noundef 0)
          to label %69 unwind label %22

20:                                               ; preds = %13
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %70

22:                                               ; preds = %19, %14
  %23 = landingpad { ptr, i32 }
          cleanup
  br label %70

.split:                                           ; preds = %17
  %24 = getelementptr inbounds i8, ptr %16, i64 %9
  store i8 0, ptr %24, align 1, !tbaa !5
  %25 = load i8, ptr %16, align 1, !tbaa !5
  %.not7693 = icmp eq i8 %25, 0
  br i1 %.not7693, label %._crit_edge.thread, label %.lr.ph

.lr.ph:                                           ; preds = %.split, %55
  %26 = phi i8 [ %56, %55 ], [ %25, %.split ]
  %.095 = phi ptr [ %.1, %55 ], [ %16, %.split ]
  %.05794 = phi ptr [ %.158, %55 ], [ %16, %.split ]
  %27 = icmp ult ptr %.095, %24
  br i1 %27, label %29, label %28

28:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.46, ptr noundef nonnull @.str.19, i32 noundef 1173, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE) #11
  unreachable

29:                                               ; preds = %.lr.ph
  switch i8 %26, label %53 [
    i8 10, label %30
    i8 13, label %37
  ]

30:                                               ; preds = %29
  %31 = ptrtoint ptr %.095 to i64
  %32 = ptrtoint ptr %.05794 to i64
  %reass.sub = sub i64 %31, %32
  %33 = add i64 %reass.sub, 1
  %34 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %.05794, i64 noundef %33)
          to label %35 unwind label %.loopexit

35:                                               ; preds = %30
  %36 = getelementptr inbounds i8, ptr %.095, i64 1
  br label %thread-pre-split

.loopexit:                                        ; preds = %30, %42, %44
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %70

.loopexit.split-lp:                               ; preds = %57, %._crit_edge.thread
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %70

37:                                               ; preds = %29
  %38 = ptrtoint ptr %.095 to i64
  %39 = ptrtoint ptr %.05794 to i64
  %40 = sub i64 %38, %39
  %41 = icmp sgt i64 %40, 0
  br i1 %41, label %42, label %44

42:                                               ; preds = %37
  %43 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %.05794, i64 noundef %40)
          to label %44 unwind label %.loopexit

44:                                               ; preds = %42, %37
  %45 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %4, i8 noundef signext 10)
          to label %46 unwind label %.loopexit

46:                                               ; preds = %44
  %47 = getelementptr inbounds i8, ptr %.095, i64 1
  %48 = load i8, ptr %47, align 1, !tbaa !5
  %49 = icmp eq i8 %48, 10
  br i1 %49, label %50, label %55

50:                                               ; preds = %46
  %51 = getelementptr inbounds i8, ptr %.095, i64 2
  %.not79 = icmp ugt ptr %51, %24
  br i1 %.not79, label %52, label %thread-pre-split

52:                                               ; preds = %50
  call void @__assert_fail(ptr noundef nonnull @.str.47, ptr noundef nonnull @.str.19, i32 noundef 1194, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN5SimTK13TiXmlDocument8LoadFileEP8_IO_FILENS_13TiXmlEncodingE) #11
  unreachable

53:                                               ; preds = %29
  %54 = getelementptr inbounds i8, ptr %.095, i64 1
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %50, %53, %35
  %.158.ph = phi ptr [ %.05794, %53 ], [ %51, %50 ], [ %36, %35 ]
  %.1.ph = phi ptr [ %54, %53 ], [ %51, %50 ], [ %36, %35 ]
  %.pr = load i8, ptr %.1.ph, align 1, !tbaa !5
  br label %55

55:                                               ; preds = %thread-pre-split, %46
  %56 = phi i8 [ %.pr, %thread-pre-split ], [ %48, %46 ]
  %.158 = phi ptr [ %.158.ph, %thread-pre-split ], [ %47, %46 ]
  %.1 = phi ptr [ %.1.ph, %thread-pre-split ], [ %47, %46 ]
  %.not76 = icmp eq i8 %56, 0
  br i1 %.not76, label %._crit_edge, label %.lr.ph, !llvm.loop !8

._crit_edge:                                      ; preds = %55
  %.not77 = icmp eq ptr %.1, %.158
  br i1 %.not77, label %._crit_edge.thread, label %57

57:                                               ; preds = %._crit_edge
  %58 = ptrtoint ptr %.158 to i64
  %59 = ptrtoint ptr %.1 to i64
  %60 = sub i64 %59, %58
  %61 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6appendEPKcm(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef %.158, i64 noundef %60)
          to label %._crit_edge.thread unwind label %.loopexit.split-lp

._crit_edge.thread:                               ; preds = %.split, %._crit_edge, %57
  call void @_ZdaPv(ptr noundef nonnull %16) #10
  %62 = call noundef ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE5c_strEv(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  %63 = load ptr, ptr %0, align 8, !tbaa !10
  %64 = getelementptr inbounds i8, ptr %63, i64 24
  %65 = load ptr, ptr %64, align 8
  %66 = invoke noundef ptr %65(ptr noundef nonnull align 8 dereferenceable(192) %0, ptr noundef %62, ptr noundef null, i32 noundef %2)
          to label %67 unwind label %.loopexit.split-lp

67:                                               ; preds = %._crit_edge.thread
  %68 = call noundef zeroext i1 @_ZNK5SimTK13TiXmlDocument5ErrorEv(ptr noundef nonnull align 8 dereferenceable(192) %0)
  %.063 = xor i1 %68, true
  br label %69

69:                                               ; preds = %19, %67
  %.164 = phi i1 [ %.063, %67 ], [ false, %19 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  br label %71

70:                                               ; preds = %.loopexit, %.loopexit.split-lp, %22, %20
  %.pn.pn = phi { ptr, i32 } [ %21, %20 ], [ %23, %22 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #8
  resume { ptr, i32 } %.pn.pn

71:                                               ; preds = %12, %69, %5
  %.3 = phi i1 [ false, %5 ], [ false, %12 ], [ %.164, %69 ]
  ret i1 %.3
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5SimTK11TiXmlCursor5ClearEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #2 align 2

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #5

; Function Attrs: nofree nounwind
declare noundef i64 @ftell(ptr nocapture noundef) local_unnamed_addr #5

declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #4

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #6

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #7

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

attributes #0 = { mustprogress 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 = { 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 #3 = { 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 #4 = { "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 = { 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 #6 = { nobuiltin allocsize(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 #7 = { nobuiltin 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }
attributes #11 = { noreturn 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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"vtable pointer", !7, i64 0}


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