; LLVM IR from HiroIshida/tinyfk :: urdf_parser/tinyxml/tinyxmlparser.ll (ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding)

; 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.TiXmlBase::Entity" = type { ptr, i32, i8 }
%"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] }

@_ZN9TiXmlBase6entityE = external dso_local global [5 x %"struct.TiXmlBase::Entity"], align 16
@.str.6 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [47 x i8], align 1
@__PRETTY_FUNCTION__._ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding = external hidden unnamed_addr constant [84 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9TiXmlBase18ConvertUTF32ToUTF8EmPcPi(i64 noundef, ptr noundef, ptr noundef) #0 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) #0 align 2 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store i32 %3, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  %18 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 0, ptr %18, align 4, !tbaa !11
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 1
  %21 = load i8, ptr %20, align 1, !tbaa !13
  %22 = icmp ne i8 %21, 0
  br i1 %22, label %23, label %224

23:                                               ; preds = %4
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %24, i64 1
  %26 = load i8, ptr %25, align 1, !tbaa !13
  %27 = sext i8 %26 to i32
  %28 = icmp eq i32 %27, 35
  br i1 %28, label %29, label %224

29:                                               ; preds = %23
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %30, i64 2
  %32 = load i8, ptr %31, align 1, !tbaa !13
  %33 = icmp ne i8 %32, 0
  br i1 %33, label %34, label %224

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  store i64 0, ptr %12, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  store i32 1, ptr %14, align 4, !tbaa !11
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds i8, ptr %35, i64 2
  %37 = load i8, ptr %36, align 1, !tbaa !13
  %38 = sext i8 %37 to i32
  %39 = icmp eq i32 %38, 120
  br i1 %39, label %40, label %145

40:                                               ; preds = %34
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %41, i64 3
  %43 = load i8, ptr %42, align 1, !tbaa !13
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %46, label %45

45:                                               ; preds = %40
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %223

46:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = getelementptr inbounds i8, ptr %47, i64 3
  store ptr %48, ptr %16, align 8, !tbaa !5
  %49 = load ptr, ptr %16, align 8, !tbaa !5
  %50 = call noundef ptr @strchr(ptr noundef %49, i32 noundef 59) #5
  store ptr %50, ptr %16, align 8, !tbaa !5
  %51 = load ptr, ptr %16, align 8, !tbaa !5
  %52 = icmp ne ptr %51, null
  br i1 %52, label %53, label %57

53:                                               ; preds = %46
  %54 = load ptr, ptr %16, align 8, !tbaa !5
  %55 = load i8, ptr %54, align 1, !tbaa !13
  %56 = icmp ne i8 %55, 0
  br i1 %56, label %58, label %57

57:                                               ; preds = %53, %46
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %142

58:                                               ; preds = %53
  %59 = load ptr, ptr %16, align 8, !tbaa !5
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = ptrtoint ptr %59 to i64
  %62 = ptrtoint ptr %60 to i64
  %63 = sub i64 %61, %62
  store i64 %63, ptr %13, align 8, !tbaa !14
  %64 = load ptr, ptr %16, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %64, i32 -1
  store ptr %65, ptr %16, align 8, !tbaa !5
  br label %66

66:                                               ; preds = %136, %58
  %67 = load ptr, ptr %16, align 8, !tbaa !5
  %68 = load i8, ptr %67, align 1, !tbaa !13
  %69 = sext i8 %68 to i32
  %70 = icmp ne i32 %69, 120
  br i1 %70, label %71, label %141

71:                                               ; preds = %66
  %72 = load ptr, ptr %16, align 8, !tbaa !5
  %73 = load i8, ptr %72, align 1, !tbaa !13
  %74 = sext i8 %73 to i32
  %75 = icmp sge i32 %74, 48
  br i1 %75, label %76, label %91

76:                                               ; preds = %71
  %77 = load ptr, ptr %16, align 8, !tbaa !5
  %78 = load i8, ptr %77, align 1, !tbaa !13
  %79 = sext i8 %78 to i32
  %80 = icmp sle i32 %79, 57
  br i1 %80, label %81, label %91

81:                                               ; preds = %76
  %82 = load i32, ptr %14, align 4, !tbaa !11
  %83 = load ptr, ptr %16, align 8, !tbaa !5
  %84 = load i8, ptr %83, align 1, !tbaa !13
  %85 = sext i8 %84 to i32
  %86 = sub nsw i32 %85, 48
  %87 = mul i32 %82, %86
  %88 = zext i32 %87 to i64
  %89 = load i64, ptr %12, align 8, !tbaa !14
  %90 = add i64 %89, %88
  store i64 %90, ptr %12, align 8, !tbaa !14
  br label %136

91:                                               ; preds = %76, %71
  %92 = load ptr, ptr %16, align 8, !tbaa !5
  %93 = load i8, ptr %92, align 1, !tbaa !13
  %94 = sext i8 %93 to i32
  %95 = icmp sge i32 %94, 97
  br i1 %95, label %96, label %112

96:                                               ; preds = %91
  %97 = load ptr, ptr %16, align 8, !tbaa !5
  %98 = load i8, ptr %97, align 1, !tbaa !13
  %99 = sext i8 %98 to i32
  %100 = icmp sle i32 %99, 102
  br i1 %100, label %101, label %112

101:                                              ; preds = %96
  %102 = load i32, ptr %14, align 4, !tbaa !11
  %103 = load ptr, ptr %16, align 8, !tbaa !5
  %104 = load i8, ptr %103, align 1, !tbaa !13
  %105 = sext i8 %104 to i32
  %106 = sub nsw i32 %105, 97
  %107 = add nsw i32 %106, 10
  %108 = mul i32 %102, %107
  %109 = zext i32 %108 to i64
  %110 = load i64, ptr %12, align 8, !tbaa !14
  %111 = add i64 %110, %109
  store i64 %111, ptr %12, align 8, !tbaa !14
  br label %135

112:                                              ; preds = %96, %91
  %113 = load ptr, ptr %16, align 8, !tbaa !5
  %114 = load i8, ptr %113, align 1, !tbaa !13
  %115 = sext i8 %114 to i32
  %116 = icmp sge i32 %115, 65
  br i1 %116, label %117, label %133

117:                                              ; preds = %112
  %118 = load ptr, ptr %16, align 8, !tbaa !5
  %119 = load i8, ptr %118, align 1, !tbaa !13
  %120 = sext i8 %119 to i32
  %121 = icmp sle i32 %120, 70
  br i1 %121, label %122, label %133

122:                                              ; preds = %117
  %123 = load i32, ptr %14, align 4, !tbaa !11
  %124 = load ptr, ptr %16, align 8, !tbaa !5
  %125 = load i8, ptr %124, align 1, !tbaa !13
  %126 = sext i8 %125 to i32
  %127 = sub nsw i32 %126, 65
  %128 = add nsw i32 %127, 10
  %129 = mul i32 %123, %128
  %130 = zext i32 %129 to i64
  %131 = load i64, ptr %12, align 8, !tbaa !14
  %132 = add i64 %131, %130
  store i64 %132, ptr %12, align 8, !tbaa !14
  br label %134

133:                                              ; preds = %117, %112
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %142

134:                                              ; preds = %122
  br label %135

135:                                              ; preds = %134, %101
  br label %136

136:                                              ; preds = %135, %81
  %137 = load i32, ptr %14, align 4, !tbaa !11
  %138 = mul i32 %137, 16
  store i32 %138, ptr %14, align 4, !tbaa !11
  %139 = load ptr, ptr %16, align 8, !tbaa !5
  %140 = getelementptr inbounds i8, ptr %139, i32 -1
  store ptr %140, ptr %16, align 8, !tbaa !5
  br label %66, !llvm.loop !16

141:                                              ; preds = %66
  store i32 0, ptr %15, align 4
  br label %142

142:                                              ; preds = %141, %133, %57
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  %143 = load i32, ptr %15, align 4
  switch i32 %143, label %223 [
    i32 0, label %144
  ]

144:                                              ; preds = %142
  br label %206

145:                                              ; preds = %34
  %146 = load ptr, ptr %6, align 8, !tbaa !5
  %147 = getelementptr inbounds i8, ptr %146, i64 2
  %148 = load i8, ptr %147, align 1, !tbaa !13
  %149 = icmp ne i8 %148, 0
  br i1 %149, label %151, label %150

150:                                              ; preds = %145
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %223

151:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %152 = load ptr, ptr %6, align 8, !tbaa !5
  %153 = getelementptr inbounds i8, ptr %152, i64 2
  store ptr %153, ptr %17, align 8, !tbaa !5
  %154 = load ptr, ptr %17, align 8, !tbaa !5
  %155 = call noundef ptr @strchr(ptr noundef %154, i32 noundef 59) #5
  store ptr %155, ptr %17, align 8, !tbaa !5
  %156 = load ptr, ptr %17, align 8, !tbaa !5
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %162

158:                                              ; preds = %151
  %159 = load ptr, ptr %17, align 8, !tbaa !5
  %160 = load i8, ptr %159, align 1, !tbaa !13
  %161 = icmp ne i8 %160, 0
  br i1 %161, label %163, label %162

162:                                              ; preds = %158, %151
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %203

163:                                              ; preds = %158
  %164 = load ptr, ptr %17, align 8, !tbaa !5
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = ptrtoint ptr %164 to i64
  %167 = ptrtoint ptr %165 to i64
  %168 = sub i64 %166, %167
  store i64 %168, ptr %13, align 8, !tbaa !14
  %169 = load ptr, ptr %17, align 8, !tbaa !5
  %170 = getelementptr inbounds i8, ptr %169, i32 -1
  store ptr %170, ptr %17, align 8, !tbaa !5
  br label %171

171:                                              ; preds = %197, %163
  %172 = load ptr, ptr %17, align 8, !tbaa !5
  %173 = load i8, ptr %172, align 1, !tbaa !13
  %174 = sext i8 %173 to i32
  %175 = icmp ne i32 %174, 35
  br i1 %175, label %176, label %202

176:                                              ; preds = %171
  %177 = load ptr, ptr %17, align 8, !tbaa !5
  %178 = load i8, ptr %177, align 1, !tbaa !13
  %179 = sext i8 %178 to i32
  %180 = icmp sge i32 %179, 48
  br i1 %180, label %181, label %196

181:                                              ; preds = %176
  %182 = load ptr, ptr %17, align 8, !tbaa !5
  %183 = load i8, ptr %182, align 1, !tbaa !13
  %184 = sext i8 %183 to i32
  %185 = icmp sle i32 %184, 57
  br i1 %185, label %186, label %196

186:                                              ; preds = %181
  %187 = load i32, ptr %14, align 4, !tbaa !11
  %188 = load ptr, ptr %17, align 8, !tbaa !5
  %189 = load i8, ptr %188, align 1, !tbaa !13
  %190 = sext i8 %189 to i32
  %191 = sub nsw i32 %190, 48
  %192 = mul i32 %187, %191
  %193 = zext i32 %192 to i64
  %194 = load i64, ptr %12, align 8, !tbaa !14
  %195 = add i64 %194, %193
  store i64 %195, ptr %12, align 8, !tbaa !14
  br label %197

196:                                              ; preds = %181, %176
  store ptr null, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %203

197:                                              ; preds = %186
  %198 = load i32, ptr %14, align 4, !tbaa !11
  %199 = mul i32 %198, 10
  store i32 %199, ptr %14, align 4, !tbaa !11
  %200 = load ptr, ptr %17, align 8, !tbaa !5
  %201 = getelementptr inbounds i8, ptr %200, i32 -1
  store ptr %201, ptr %17, align 8, !tbaa !5
  br label %171, !llvm.loop !18

202:                                              ; preds = %171
  store i32 0, ptr %15, align 4
  br label %203

203:                                              ; preds = %202, %196, %162
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  %204 = load i32, ptr %15, align 4
  switch i32 %204, label %223 [
    i32 0, label %205
  ]

205:                                              ; preds = %203
  br label %206

206:                                              ; preds = %205, %144
  %207 = load i32, ptr %9, align 4, !tbaa !9
  %208 = icmp eq i32 %207, 1
  br i1 %208, label %209, label %213

209:                                              ; preds = %206
  %210 = load i64, ptr %12, align 8, !tbaa !14
  %211 = load ptr, ptr %7, align 8, !tbaa !5
  %212 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN9TiXmlBase18ConvertUTF32ToUTF8EmPcPi(i64 noundef %210, ptr noundef %211, ptr noundef %212)
  br label %218

213:                                              ; preds = %206
  %214 = load i64, ptr %12, align 8, !tbaa !14
  %215 = trunc i64 %214 to i8
  %216 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 %215, ptr %216, align 1, !tbaa !13
  %217 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %217, align 4, !tbaa !11
  br label %218

218:                                              ; preds = %213, %209
  %219 = load ptr, ptr %6, align 8, !tbaa !5
  %220 = load i64, ptr %13, align 8, !tbaa !14
  %221 = getelementptr inbounds i8, ptr %219, i64 %220
  %222 = getelementptr inbounds i8, ptr %221, i64 1
  store ptr %222, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %223

223:                                              ; preds = %218, %203, %150, %142, %45
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %286

224:                                              ; preds = %29, %23, %4
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %225

225:                                              ; preds = %277, %224
  %226 = load i32, ptr %11, align 4, !tbaa !11
  %227 = icmp slt i32 %226, 5
  br i1 %227, label %228, label %280

228:                                              ; preds = %225
  %229 = load i32, ptr %11, align 4, !tbaa !11
  %230 = sext i32 %229 to i64
  %231 = getelementptr inbounds [5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 %230
  %232 = getelementptr inbounds %"struct.TiXmlBase::Entity", ptr %231, i32 0, i32 0
  %233 = load ptr, ptr %232, align 16, !tbaa !19
  %234 = load ptr, ptr %6, align 8, !tbaa !5
  %235 = load i32, ptr %11, align 4, !tbaa !11
  %236 = sext i32 %235 to i64
  %237 = getelementptr inbounds [5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 %236
  %238 = getelementptr inbounds %"struct.TiXmlBase::Entity", ptr %237, i32 0, i32 1
  %239 = load i32, ptr %238, align 8, !tbaa !21
  %240 = zext i32 %239 to i64
  %241 = call i32 @strncmp(ptr noundef %233, ptr noundef %234, i64 noundef %240) #5
  %242 = icmp eq i32 %241, 0
  br i1 %242, label %243, label %276

243:                                              ; preds = %228
  %244 = load i32, ptr %11, align 4, !tbaa !11
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 %245
  %247 = getelementptr inbounds %"struct.TiXmlBase::Entity", ptr %246, i32 0, i32 0
  %248 = load ptr, ptr %247, align 16, !tbaa !19
  %249 = call i64 @strlen(ptr noundef %248) #5
  %250 = load i32, ptr %11, align 4, !tbaa !11
  %251 = sext i32 %250 to i64
  %252 = getelementptr inbounds [5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 %251
  %253 = getelementptr inbounds %"struct.TiXmlBase::Entity", ptr %252, i32 0, i32 1
  %254 = load i32, ptr %253, align 8, !tbaa !21
  %255 = zext i32 %254 to i64
  %256 = icmp eq i64 %249, %255
  br i1 %256, label %257, label %258

257:                                              ; preds = %243
  br label %260

258:                                              ; preds = %243
  call void @__assert_fail(ptr noundef @.str.12, ptr noundef @.str.6, i32 noundef 519, ptr noundef @__PRETTY_FUNCTION__._ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding) #6
  unreachable

259:                                              ; No predecessors!
  br label %260

260:                                              ; preds = %259, %257
  %261 = load i32, ptr %11, align 4, !tbaa !11
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 %262
  %264 = getelementptr inbounds %"struct.TiXmlBase::Entity", ptr %263, i32 0, i32 2
  %265 = load i8, ptr %264, align 4, !tbaa !22
  %266 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 %265, ptr %266, align 1, !tbaa !13
  %267 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 1, ptr %267, align 4, !tbaa !11
  %268 = load ptr, ptr %6, align 8, !tbaa !5
  %269 = load i32, ptr %11, align 4, !tbaa !11
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [5 x %"struct.TiXmlBase::Entity"], ptr @_ZN9TiXmlBase6entityE, i64 0, i64 %270
  %272 = getelementptr inbounds %"struct.TiXmlBase::Entity", ptr %271, i32 0, i32 1
  %273 = load i32, ptr %272, align 8, !tbaa !21
  %274 = zext i32 %273 to i64
  %275 = getelementptr inbounds i8, ptr %268, i64 %274
  store ptr %275, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %286

276:                                              ; preds = %228
  br label %277

277:                                              ; preds = %276
  %278 = load i32, ptr %11, align 4, !tbaa !11
  %279 = add nsw i32 %278, 1
  store i32 %279, ptr %11, align 4, !tbaa !11
  br label %225, !llvm.loop !23

280:                                              ; preds = %225
  %281 = load ptr, ptr %6, align 8, !tbaa !5
  %282 = load i8, ptr %281, align 1, !tbaa !13
  %283 = load ptr, ptr %7, align 8, !tbaa !5
  store i8 %282, ptr %283, align 1, !tbaa !13
  %284 = load ptr, ptr %6, align 8, !tbaa !5
  %285 = getelementptr inbounds i8, ptr %284, i64 1
  store ptr %285, ptr %5, align 8
  store i32 1, ptr %15, align 4
  br label %286

286:                                              ; preds = %280, %260, %223
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #4
  %287 = load ptr, ptr %5, align 8
  ret ptr %287
}

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

; Function Attrs: nounwind willreturn memory(read)
declare noundef ptr @strchr(ptr noundef, i32 noundef) #3

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { 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 = !{!"_ZTS13TiXmlEncoding", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"long", !7, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = distinct !{!18, !17}
!19 = !{!20, !6, i64 0}
!20 = !{!"_ZTSN9TiXmlBase6EntityE", !6, i64 0, !12, i64 8, !7, i64 12}
!21 = !{!20, !12, i64 8}
!22 = !{!20, !7, i64 12}
!23 = distinct !{!23, !17}


; 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.TiXmlBase::Entity" = type { ptr, i32, i8 }
%"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] }

@_ZN9TiXmlBase6entityE = external dso_local local_unnamed_addr global [5 x %"struct.TiXmlBase::Entity"], align 16
@.str.6 = external hidden unnamed_addr constant [89 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [47 x i8], align 1
@__PRETTY_FUNCTION__._ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding = external hidden unnamed_addr constant [84 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN9TiXmlBase18ConvertUTF32ToUTF8EmPcPi(i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef ptr @_ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding(ptr noundef %0, ptr noundef %1, ptr noundef %2, i32 noundef %3) local_unnamed_addr #0 align 2 {
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 1
  %7 = load i8, ptr %6, align 1, !tbaa !9
  %cond113 = icmp eq i8 %7, 35
  br i1 %cond113, label %8, label %65

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 2
  %10 = load i8, ptr %9, align 1, !tbaa !9
  switch i8 %10, label %40 [
    i8 0, label %65
    i8 120, label %11
  ]

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %0, i64 3
  %13 = load i8, ptr %12, align 1, !tbaa !9
  %.not100 = icmp eq i8 %13, 0
  br i1 %.not100, label %.thread, label %14

14:                                               ; preds = %11
  %15 = call noundef ptr @strchr(ptr noundef nonnull dereferenceable(1) %12, i32 noundef 59) #5
  %.not101 = icmp eq ptr %15, null
  br i1 %.not101, label %.thread, label %16

16:                                               ; preds = %14
  %17 = load i8, ptr %15, align 1, !tbaa !9
  %.not102 = icmp eq i8 %17, 0
  br i1 %.not102, label %.thread, label %18

18:                                               ; preds = %16
  %19 = ptrtoint ptr %15 to i64
  %20 = ptrtoint ptr %0 to i64
  %21 = sub i64 %19, %20
  %.074129 = getelementptr inbounds i8, ptr %15, i64 -1
  %22 = load i8, ptr %.074129, align 1, !tbaa !9
  %.not103130 = icmp eq i8 %22, 120
  br i1 %.not103130, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %18, %37
  %23 = phi i8 [ %39, %37 ], [ %22, %18 ]
  %.074133 = phi ptr [ %.074, %37 ], [ %.074129, %18 ]
  %.076132 = phi i32 [ %38, %37 ], [ 1, %18 ]
  %.080131 = phi i64 [ %.181, %37 ], [ 0, %18 ]
  %24 = add i8 %23, -48
  %or.cond = icmp ult i8 %24, 10
  br i1 %or.cond, label %25, label %27

25:                                               ; preds = %.lr.ph
  %26 = zext nneg i8 %24 to i32
  br label %37

27:                                               ; preds = %.lr.ph
  %28 = add i8 %23, -97
  %or.cond110 = icmp ult i8 %28, 6
  br i1 %or.cond110, label %29, label %32

29:                                               ; preds = %27
  %30 = zext nneg i8 %23 to i32
  %31 = add nsw i32 %30, -87
  br label %37

32:                                               ; preds = %27
  %33 = add i8 %23, -65
  %or.cond111 = icmp ult i8 %33, 6
  br i1 %or.cond111, label %34, label %.thread

34:                                               ; preds = %32
  %35 = zext nneg i8 %23 to i32
  %36 = add nsw i32 %35, -55
  br label %37

37:                                               ; preds = %29, %34, %25
  %.pn108 = phi i32 [ %26, %25 ], [ %31, %29 ], [ %36, %34 ]
  %.pn107.in = mul i32 %.pn108, %.076132
  %.pn107 = zext i32 %.pn107.in to i64
  %.181 = add i64 %.080131, %.pn107
  %38 = shl i32 %.076132, 4
  %.074 = getelementptr inbounds i8, ptr %.074133, i64 -1
  %39 = load i8, ptr %.074, align 1, !tbaa !9
  %.not103 = icmp eq i8 %39, 120
  br i1 %.not103, label %.loopexit, label %.lr.ph, !llvm.loop !10

40:                                               ; preds = %8
  %41 = call noundef ptr @strchr(ptr noundef nonnull dereferenceable(1) %9, i32 noundef 59) #5
  %.not97 = icmp eq ptr %41, null
  br i1 %.not97, label %.thread, label %42

42:                                               ; preds = %40
  %43 = load i8, ptr %41, align 1, !tbaa !9
  %.not98 = icmp eq i8 %43, 0
  br i1 %.not98, label %.thread, label %44

44:                                               ; preds = %42
  %45 = ptrtoint ptr %41 to i64
  %46 = ptrtoint ptr %0 to i64
  %47 = sub i64 %45, %46
  %.0136 = getelementptr inbounds i8, ptr %41, i64 -1
  %48 = load i8, ptr %.0136, align 1, !tbaa !9
  %.not99137 = icmp eq i8 %48, 35
  br i1 %.not99137, label %.loopexit, label %.lr.ph141

.lr.ph141:                                        ; preds = %44, %51
  %49 = phi i8 [ %57, %51 ], [ %48, %44 ]
  %.0140 = phi ptr [ %.0, %51 ], [ %.0136, %44 ]
  %.177139 = phi i32 [ %56, %51 ], [ 1, %44 ]
  %.3138 = phi i64 [ %55, %51 ], [ 0, %44 ]
  %50 = add i8 %49, -48
  %or.cond112 = icmp ult i8 %50, 10
  br i1 %or.cond112, label %51, label %.thread

51:                                               ; preds = %.lr.ph141
  %52 = zext nneg i8 %50 to i32
  %53 = mul i32 %.177139, %52
  %54 = zext i32 %53 to i64
  %55 = add i64 %.3138, %54
  %56 = mul i32 %.177139, 10
  %.0 = getelementptr inbounds i8, ptr %.0140, i64 -1
  %57 = load i8, ptr %.0, align 1, !tbaa !9
  %.not99 = icmp eq i8 %57, 35
  br i1 %.not99, label %.loopexit, label %.lr.ph141, !llvm.loop !12

.loopexit:                                        ; preds = %37, %51, %18, %44
  %.5 = phi i64 [ 0, %44 ], [ 0, %18 ], [ %55, %51 ], [ %.181, %37 ]
  %.2 = phi i64 [ %47, %44 ], [ %21, %18 ], [ %47, %51 ], [ %21, %37 ]
  %58 = icmp eq i32 %3, 1
  br i1 %58, label %59, label %60

59:                                               ; preds = %.loopexit
  call void @_ZN9TiXmlBase18ConvertUTF32ToUTF8EmPcPi(i64 noundef %.5, ptr noundef %1, ptr noundef nonnull %2)
  br label %62

60:                                               ; preds = %.loopexit
  %61 = trunc i64 %.5 to i8
  store i8 %61, ptr %1, align 1, !tbaa !9
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %60, %59
  %63 = getelementptr inbounds i8, ptr %0, i64 %.2
  %64 = getelementptr inbounds i8, ptr %63, i64 1
  br label %.thread

65:                                               ; preds = %4, %8
  %66 = load ptr, ptr @_ZN9TiXmlBase6entityE, align 16, !tbaa !13
  %67 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 8), align 8, !tbaa !16
  %68 = zext i32 %67 to i64
  %69 = call i32 @strncmp(ptr noundef %66, ptr noundef nonnull %0, i64 noundef %68) #5
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %97, label %71

71:                                               ; preds = %65
  %72 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 16), align 16, !tbaa !13
  %73 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 24), align 8, !tbaa !16
  %74 = zext i32 %73 to i64
  %75 = call i32 @strncmp(ptr noundef %72, ptr noundef nonnull %0, i64 noundef %74) #5
  %76 = icmp eq i32 %75, 0
  br i1 %76, label %97, label %77

77:                                               ; preds = %71
  %78 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 32), align 16, !tbaa !13
  %79 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 40), align 8, !tbaa !16
  %80 = zext i32 %79 to i64
  %81 = call i32 @strncmp(ptr noundef %78, ptr noundef nonnull %0, i64 noundef %80) #5
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %97, label %83

83:                                               ; preds = %77
  %84 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 48), align 16, !tbaa !13
  %85 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 56), align 8, !tbaa !16
  %86 = zext i32 %85 to i64
  %87 = call i32 @strncmp(ptr noundef %84, ptr noundef nonnull %0, i64 noundef %86) #5
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %97, label %89

89:                                               ; preds = %83
  %90 = load ptr, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 64), align 16, !tbaa !13
  %91 = load i32, ptr getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 72), align 8, !tbaa !16
  %92 = zext i32 %91 to i64
  %93 = call i32 @strncmp(ptr noundef %90, ptr noundef nonnull %0, i64 noundef %92) #5
  %94 = icmp eq i32 %93, 0
  br i1 %94, label %97, label %95

95:                                               ; preds = %89
  %96 = load i8, ptr %0, align 1, !tbaa !9
  store i8 %96, ptr %1, align 1, !tbaa !9
  br label %.thread

97:                                               ; preds = %89, %83, %77, %71, %65
  %.lcssa149 = phi ptr [ @_ZN9TiXmlBase6entityE, %65 ], [ getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 16), %71 ], [ getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 32), %77 ], [ getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 48), %83 ], [ getelementptr inbounds (i8, ptr @_ZN9TiXmlBase6entityE, i64 64), %89 ]
  %.lcssa147 = phi ptr [ %66, %65 ], [ %72, %71 ], [ %78, %77 ], [ %84, %83 ], [ %90, %89 ]
  %.lcssa145 = phi i64 [ %68, %65 ], [ %74, %71 ], [ %80, %77 ], [ %86, %83 ], [ %92, %89 ]
  %98 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.lcssa147) #5
  %99 = icmp eq i64 %98, %.lcssa145
  br i1 %99, label %101, label %100

100:                                              ; preds = %97
  call void @__assert_fail(ptr noundef nonnull @.str.12, ptr noundef nonnull @.str.6, i32 noundef 519, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN9TiXmlBase9GetEntityEPKcPcPi13TiXmlEncoding) #6
  unreachable

101:                                              ; preds = %97
  %102 = getelementptr inbounds i8, ptr %.lcssa149, i64 8
  %103 = getelementptr inbounds i8, ptr %.lcssa149, i64 12
  %104 = load i8, ptr %103, align 4, !tbaa !17
  store i8 %104, ptr %1, align 1, !tbaa !9
  store i32 1, ptr %2, align 4, !tbaa !5
  %105 = load i32, ptr %102, align 8, !tbaa !16
  %106 = zext i32 %105 to i64
  %107 = getelementptr inbounds i8, ptr %0, i64 %106
  br label %.thread

.thread:                                          ; preds = %32, %.lr.ph141, %40, %42, %14, %16, %62, %11, %95, %101
  %.387 = phi ptr [ %107, %101 ], [ %6, %95 ], [ %64, %62 ], [ null, %11 ], [ null, %16 ], [ null, %14 ], [ null, %42 ], [ null, %40 ], [ null, %.lr.ph141 ], [ null, %32 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #4
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #4
  ret ptr %.387
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare noundef ptr @strchr(ptr noundef, i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strncmp(ptr nocapture noundef, ptr nocapture noundef, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nounwind }
attributes #5 = { nounwind willreturn memory(read) }
attributes #6 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = !{!14, !15, i64 0}
!14 = !{!"_ZTSN9TiXmlBase6EntityE", !15, i64 0, !6, i64 8, !7, i64 12}
!15 = !{!"any pointer", !7, i64 0}
!16 = !{!14, !6, i64 8}
!17 = !{!14, !7, i64 12}


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