; LLVM IR from GPUOpen-LibrariesAndSDKs/TAN :: amf/public/common (AMFSTL)

; 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::__cxx11::basic_string.0" = type { %"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider", i64, %union.anon.5 }
%"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider" = type { ptr }
%union.anon.5 = type { i64, [8 x i8] }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char, std::char_traits<char>, amf::amf_allocator<char>>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char, std::char_traits<char>, amf::amf_allocator<char>>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@__const._ZN3amf28amf_from_url_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE.buf = external hidden unnamed_addr constant [5 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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3amf24amf_from_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string.0") align 8, ptr noundef nonnull align 8 dereferenceable(32)) #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE4findEcm(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext, i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3amf28amf_from_url_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string.0") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::__cxx11::basic_string", align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca %"class.std::__cxx11::basic_string", align 8
  %13 = alloca [5 x i8], align 1
  %14 = alloca ptr, align 8
  %15 = alloca i1, align 1
  store ptr %0, ptr %3, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %5) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 0, ptr %6, align 8, !tbaa !9
  br label %16

16:                                               ; preds = %86, %2
  %17 = load i64, ptr %6, align 8, !tbaa !9
  %18 = icmp ne i64 %17, -1
  br i1 %18, label %19, label %92

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %20 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %20, ptr %7, align 8, !tbaa !9
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE4findEcm(ptr noundef nonnull align 8 dereferenceable(32) %21, i8 noundef signext 37, i64 noundef %22) #5
  store i64 %23, ptr %6, align 8, !tbaa !9
  %24 = load i64, ptr %6, align 8, !tbaa !9
  %25 = icmp eq i64 %24, -1
  br i1 %25, label %26, label %41

26:                                               ; preds = %19
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load i64, ptr %7, align 8, !tbaa !9
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %27, i64 noundef %28, i64 noundef -1)
          to label %29 unwind label %32

29:                                               ; preds = %26
  %30 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLERKS6_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %31 unwind label %36

31:                                               ; preds = %29
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  store i32 3, ptr %11, align 4
  br label %84

32:                                               ; preds = %26
  %33 = landingpad { ptr, i32 }
          cleanup
  %34 = extractvalue { ptr, i32 } %33, 0
  store ptr %34, ptr %9, align 8
  %35 = extractvalue { ptr, i32 } %33, 1
  store i32 %35, ptr %10, align 4
  br label %40

36:                                               ; preds = %29
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %9, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #5
  br label %40

40:                                               ; preds = %36, %32
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #5
  br label %91

41:                                               ; preds = %19
  %42 = load i64, ptr %6, align 8, !tbaa !9
  %43 = load i64, ptr %7, align 8, !tbaa !9
  %44 = sub i64 %42, %43
  %45 = icmp ugt i64 %44, 0
  br i1 %45, label %46, label %64

46:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 32, ptr %12) #5
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = load i64, ptr %7, align 8, !tbaa !9
  %49 = load i64, ptr %6, align 8, !tbaa !9
  %50 = load i64, ptr %7, align 8, !tbaa !9
  %51 = sub i64 %49, %50
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE6substrEmm(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %12, ptr noundef nonnull align 8 dereferenceable(32) %47, i64 noundef %48, i64 noundef %51)
          to label %52 unwind label %55

52:                                               ; preds = %46
  %53 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLERKS6_(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(32) %12)
          to label %54 unwind label %59

54:                                               ; preds = %52
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #5
  br label %64

55:                                               ; preds = %46
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %9, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %10, align 4
  br label %63

59:                                               ; preds = %52
  %60 = landingpad { ptr, i32 }
          cleanup
  %61 = extractvalue { ptr, i32 } %60, 0
  store ptr %61, ptr %9, align 8
  %62 = extractvalue { ptr, i32 } %60, 1
  store i32 %62, ptr %10, align 4
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %12) #5
  br label %63

63:                                               ; preds = %59, %55
  call void @llvm.lifetime.end.p0(i64 32, ptr %12) #5
  br label %91

64:                                               ; preds = %54, %41
  call void @llvm.lifetime.start.p0(i64 5, ptr %13) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %13, ptr align 1 @__const._ZN3amf28amf_from_url_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE.buf, i64 5, i1 false)
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load i64, ptr %6, align 8, !tbaa !9
  %67 = add i64 %66, 1
  %68 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %65, i64 noundef %67) #5
  %69 = load i8, ptr %68, align 1, !tbaa !11
  %70 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 2
  store i8 %69, ptr %70, align 1, !tbaa !11
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = load i64, ptr %6, align 8, !tbaa !9
  %73 = add i64 %72, 2
  %74 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %71, i64 noundef %73) #5
  %75 = load i8, ptr %74, align 1, !tbaa !11
  %76 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 3
  store i8 %75, ptr %76, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #5
  store ptr null, ptr %14, align 8, !tbaa !5
  %77 = getelementptr inbounds [5 x i8], ptr %13, i64 0, i64 0
  %78 = call i64 @strtol(ptr noundef %77, ptr noundef %14, i32 noundef 16) #5
  %79 = trunc i64 %78 to i8
  %80 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %5, i8 noundef signext %79)
          to label %81 unwind label %87

81:                                               ; preds = %64
  %82 = load i64, ptr %6, align 8, !tbaa !9
  %83 = add i64 %82, 3
  store i64 %83, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr %13) #5
  store i32 0, ptr %11, align 4
  br label %84

84:                                               ; preds = %81, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %85 = load i32, ptr %11, align 4
  switch i32 %85, label %107 [
    i32 0, label %86
    i32 3, label %92
  ]

86:                                               ; preds = %84
  br label %16, !llvm.loop !12

87:                                               ; preds = %64
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %9, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr %13) #5
  br label %91

91:                                               ; preds = %87, %63, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %101

92:                                               ; preds = %84, %16
  store i1 false, ptr %15, align 1
  invoke void @_ZN3amf24amf_from_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string.0") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %93 unwind label %95

93:                                               ; preds = %92
  store i1 true, ptr %15, align 1
  store i32 1, ptr %11, align 4
  %94 = load i1, ptr %15, align 1
  br i1 %94, label %100, label %99

95:                                               ; preds = %92
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %9, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %10, align 4
  br label %101

99:                                               ; preds = %93
  call void @_ZNSt7__cxx1112basic_stringIwSt11char_traitsIwEN3amf13amf_allocatorIwEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %0) #5
  br label %100

100:                                              ; preds = %99, %93
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  ret void

101:                                              ; preds = %95, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr %5) #5
  br label %102

102:                                              ; preds = %101
  %103 = load ptr, ptr %9, align 8
  %104 = load i32, ptr %10, align 4
  %105 = insertvalue { ptr, i32 } poison, ptr %103, 0
  %106 = insertvalue { ptr, i32 } %105, i32 %104, 1
  resume { ptr, i32 } %106

107:                                              ; preds = %84
  unreachable
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLERKS6_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: nounwind
declare i64 @strtol(ptr noundef, ptr noundef, i32 noundef) #4

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = !{!"long", !7, i64 0}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; 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::__cxx11::basic_string.0" = type { %"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider", i64, %union.anon.5 }
%"struct.std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, amf::amf_allocator<wchar_t>>::_Alloc_hider" = type { ptr }
%union.anon.5 = type { i64, [8 x i8] }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char, std::char_traits<char>, amf::amf_allocator<char>>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char, std::char_traits<char>, amf::amf_allocator<char>>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

@__const._ZN3amf28amf_from_url_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE.buf = external hidden unnamed_addr constant [5 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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3amf24amf_from_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string.0") align 8, ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE4findEcm(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext, i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3amf28amf_from_url_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string.0") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %"class.std::__cxx11::basic_string", align 8
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  %6 = alloca [5 x i8], align 1
  %7 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %3) #5
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3)
  %8 = getelementptr inbounds i8, ptr %6, i64 2
  %9 = getelementptr inbounds i8, ptr %6, i64 3
  br label %10

10:                                               ; preds = %2, %42
  %.02645 = phi i64 [ 0, %2 ], [ %43, %42 ]
  %11 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE4findEcm(ptr noundef nonnull align 8 dereferenceable(32) %1, i8 noundef signext 37, i64 noundef %.02645) #5
  %12 = icmp eq i64 %11, -1
  br i1 %12, label %13, label %21

13:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #5
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE6substrEmm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %4, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %.02645, i64 noundef -1)
          to label %14 unwind label %16

14:                                               ; preds = %13
  %15 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLERKS6_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %.thread unwind label %18

.thread:                                          ; preds = %14
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %.loopexit

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

18:                                               ; preds = %14
  %19 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #5
  br label %20

20:                                               ; preds = %18, %16
  %.pn33 = phi { ptr, i32 } [ %19, %18 ], [ %17, %16 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #5
  br label %49

21:                                               ; preds = %10
  %.not31 = icmp eq i64 %11, %.02645
  br i1 %.not31, label %32, label %22

22:                                               ; preds = %21
  %23 = sub i64 %11, %.02645
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #5
  invoke void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE6substrEmm(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %.02645, i64 noundef %23)
          to label %24 unwind label %27

24:                                               ; preds = %22
  %25 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLERKS6_(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 8 dereferenceable(32) %5)
          to label %26 unwind label %29

26:                                               ; preds = %24
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  br label %32

27:                                               ; preds = %22
  %28 = landingpad { ptr, i32 }
          cleanup
  br label %31

29:                                               ; preds = %24
  %30 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #5
  br label %31

31:                                               ; preds = %29, %27
  %.pn = phi { ptr, i32 } [ %30, %29 ], [ %28, %27 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #5
  br label %49

32:                                               ; preds = %26, %21
  call void @llvm.lifetime.start.p0(i64 5, ptr nonnull %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(5) %6, ptr noundef nonnull align 1 dereferenceable(5) @__const._ZN3amf28amf_from_url_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE.buf, i64 5, i1 false)
  %33 = add nuw i64 %11, 1
  %34 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %33) #5
  %35 = load i8, ptr %34, align 1, !tbaa !5
  store i8 %35, ptr %8, align 1, !tbaa !5
  %36 = add i64 %11, 2
  %37 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %36) #5
  %38 = load i8, ptr %37, align 1, !tbaa !5
  store i8 %38, ptr %9, align 1, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #5
  store ptr null, ptr %7, align 8, !tbaa !8
  %39 = call i64 @strtol(ptr noundef nonnull %6, ptr noundef nonnull %7, i32 noundef 16) #5
  %40 = trunc i64 %39 to i8
  %41 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) %3, i8 noundef signext %40)
          to label %42 unwind label %44

42:                                               ; preds = %32
  %43 = add i64 %11, 3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %6) #5
  %.not = icmp eq i64 %43, -1
  br i1 %.not, label %.loopexit, label %10

44:                                               ; preds = %32
  %45 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 5, ptr nonnull %6) #5
  br label %49

.loopexit:                                        ; preds = %42, %.thread
  invoke void @_ZN3amf24amf_from_utf8_to_unicodeERKNSt7__cxx1112basic_stringIcSt11char_traitsIcENS_13amf_allocatorIcEEEE(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string.0") align 8 %0, ptr noundef nonnull align 8 dereferenceable(32) %3)
          to label %48 unwind label %46

46:                                               ; preds = %.loopexit
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %49

48:                                               ; preds = %.loopexit
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  ret void

49:                                               ; preds = %20, %31, %44, %46
  %.pn36 = phi { ptr, i32 } [ %47, %46 ], [ %.pn33, %20 ], [ %45, %44 ], [ %.pn, %31 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #5
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn36
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcEN3amf13amf_allocatorIcEEE6substrEmm(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #2 align 2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

; Function Attrs: mustprogress nofree nounwind willreturn
declare i64 @strtol(ptr noundef readonly, ptr nocapture noundef, i32 noundef) local_unnamed_addr #4

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { mustprogress nofree nounwind willreturn "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!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 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}


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