; LLVM IR from aws/s2n-tls :: tests/testlib (s2n_hex_testlib)

; 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.s2n_debug_info = type { ptr, ptr }
%struct.s2n_result = type { i32 }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }

@_s2n_debug_info = external thread_local global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local global i32, align 4
@.str.3 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [101 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

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

declare i32 @s2n_calculate_stacktrace() #2

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

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

declare i32 @s2n_stuffer_free(ptr noundef) #2

declare i32 @s2n_stuffer_alloc(ptr noundef, i32 noundef) #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) #5

declare i32 @s2n_stuffer_read_hex(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_blob_alloc_from_hex_with_whitespace(ptr noundef %0, ptr noundef %1) #6 {
  %3 = alloca %struct.s2n_result, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.s2n_stuffer, align 8
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca %struct.s2n_result, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  br label %11

11:                                               ; preds = %2
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %46, label %14

14:                                               ; preds = %11
  br label %15

15:                                               ; preds = %14
  br label %16

16:                                               ; preds = %15
  %17 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %18 = getelementptr inbounds %struct.s2n_debug_info, ptr %17, i32 0, i32 0
  store ptr @.str.3, ptr %18, align 8, !tbaa !9
  %19 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %20 = getelementptr inbounds %struct.s2n_debug_info, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %21, i64 21
  %23 = call ptr @strrchr(ptr noundef %22, i32 noundef 47) #7
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %32

25:                                               ; preds = %16
  %26 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %27 = getelementptr inbounds %struct.s2n_debug_info, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds i8, ptr %28, i64 21
  %30 = call ptr @strrchr(ptr noundef %29, i32 noundef 47) #7
  %31 = getelementptr inbounds i8, ptr %30, i64 1
  br label %37

32:                                               ; preds = %16
  %33 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %34 = getelementptr inbounds %struct.s2n_debug_info, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds i8, ptr %35, i64 21
  br label %37

37:                                               ; preds = %32, %25
  %38 = phi ptr [ %31, %25 ], [ %36, %32 ]
  %39 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %40 = getelementptr inbounds %struct.s2n_debug_info, ptr %39, i32 0, i32 1
  store ptr %38, ptr %40, align 8, !tbaa !11
  %41 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %41, align 4, !tbaa !12
  %42 = call i32 @s2n_calculate_stacktrace()
  br label %43

43:                                               ; preds = %37
  %44 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %44, align 4, !tbaa !14
  br label %205

45:                                               ; No predecessors!
  br label %46

46:                                               ; preds = %45, %11
  br label %47

47:                                               ; preds = %46
  br label %48

48:                                               ; preds = %47
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = icmp ne ptr %49, null
  br i1 %50, label %83, label %51

51:                                               ; preds = %48
  br label %52

52:                                               ; preds = %51
  br label %53

53:                                               ; preds = %52
  %54 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %55 = getelementptr inbounds %struct.s2n_debug_info, ptr %54, i32 0, i32 0
  store ptr @.str.4, ptr %55, align 8, !tbaa !9
  %56 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %57 = getelementptr inbounds %struct.s2n_debug_info, ptr %56, i32 0, i32 0
  %58 = load ptr, ptr %57, align 8, !tbaa !9
  %59 = getelementptr inbounds i8, ptr %58, i64 21
  %60 = call ptr @strrchr(ptr noundef %59, i32 noundef 47) #7
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %69

62:                                               ; preds = %53
  %63 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %64 = getelementptr inbounds %struct.s2n_debug_info, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !9
  %66 = getelementptr inbounds i8, ptr %65, i64 21
  %67 = call ptr @strrchr(ptr noundef %66, i32 noundef 47) #7
  %68 = getelementptr inbounds i8, ptr %67, i64 1
  br label %74

69:                                               ; preds = %53
  %70 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %71 = getelementptr inbounds %struct.s2n_debug_info, ptr %70, i32 0, i32 0
  %72 = load ptr, ptr %71, align 8, !tbaa !9
  %73 = getelementptr inbounds i8, ptr %72, i64 21
  br label %74

74:                                               ; preds = %69, %62
  %75 = phi ptr [ %68, %62 ], [ %73, %69 ]
  %76 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %77 = getelementptr inbounds %struct.s2n_debug_info, ptr %76, i32 0, i32 1
  store ptr %75, ptr %77, align 8, !tbaa !11
  %78 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %78, align 4, !tbaa !12
  %79 = call i32 @s2n_calculate_stacktrace()
  br label %80

80:                                               ; preds = %74
  %81 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %81, align 4, !tbaa !14
  br label %205

82:                                               ; No predecessors!
  br label %83

83:                                               ; preds = %82, %48
  br label %84

84:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 40, ptr %6) #8
  call void @llvm.memset.p0.i64(ptr align 8 %6, i8 0, i64 40, i1 false)
  br label %85

85:                                               ; preds = %84
  %86 = load ptr, ptr %5, align 8, !tbaa !5
  %87 = call i64 @strlen(ptr noundef %86) #7
  %88 = trunc i64 %87 to i32
  %89 = call i32 @s2n_stuffer_alloc(ptr noundef %6, i32 noundef %88)
  %90 = icmp sgt i32 %89, -1
  br i1 %90, label %93, label %91

91:                                               ; preds = %85
  %92 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %92, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %203

93:                                               ; preds = %85
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 0, ptr %8, align 8, !tbaa !16
  br label %96

96:                                               ; preds = %123, %95
  %97 = load i64, ptr %8, align 8, !tbaa !16
  %98 = load ptr, ptr %5, align 8, !tbaa !5
  %99 = call i64 @strlen(ptr noundef %98) #7
  %100 = icmp ult i64 %97, %99
  br i1 %100, label %102, label %101

101:                                              ; preds = %96
  store i32 16, ptr %7, align 4
  br label %126

102:                                              ; preds = %96
  %103 = load ptr, ptr %5, align 8, !tbaa !5
  %104 = load i64, ptr %8, align 8, !tbaa !16
  %105 = getelementptr inbounds i8, ptr %103, i64 %104
  %106 = load i8, ptr %105, align 1, !tbaa !18
  %107 = sext i8 %106 to i32
  %108 = icmp eq i32 %107, 32
  br i1 %108, label %109, label %110

109:                                              ; preds = %102
  br label %123

110:                                              ; preds = %102
  br label %111

111:                                              ; preds = %110
  %112 = load ptr, ptr %5, align 8, !tbaa !5
  %113 = load i64, ptr %8, align 8, !tbaa !16
  %114 = getelementptr inbounds i8, ptr %112, i64 %113
  %115 = load i8, ptr %114, align 1, !tbaa !18
  %116 = call i32 @s2n_stuffer_write_uint8(ptr noundef %6, i8 noundef zeroext %115)
  %117 = icmp sgt i32 %116, -1
  br i1 %117, label %120, label %118

118:                                              ; preds = %111
  %119 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %119, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %126

120:                                              ; preds = %111
  br label %121

121:                                              ; preds = %120
  br label %122

122:                                              ; preds = %121
  br label %123

123:                                              ; preds = %122, %109
  %124 = load i64, ptr %8, align 8, !tbaa !16
  %125 = add i64 %124, 1
  store i64 %125, ptr %8, align 8, !tbaa !16
  br label %96, !llvm.loop !19

126:                                              ; preds = %118, %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %127 = load i32, ptr %7, align 4
  switch i32 %127, label %203 [
    i32 16, label %128
  ]

128:                                              ; preds = %126
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %129 = getelementptr inbounds %struct.s2n_stuffer, ptr %6, i32 0, i32 2
  %130 = load i32, ptr %129, align 4, !tbaa !21
  %131 = getelementptr inbounds %struct.s2n_stuffer, ptr %6, i32 0, i32 1
  %132 = load i32, ptr %131, align 8, !tbaa !24
  %133 = sub i32 %130, %132
  store i32 %133, ptr %9, align 4, !tbaa !12
  br label %134

134:                                              ; preds = %128
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = load i32, ptr %9, align 4, !tbaa !12
  %137 = udiv i32 %136, 2
  %138 = call i32 @s2n_alloc(ptr noundef %135, i32 noundef %137)
  %139 = icmp sgt i32 %138, -1
  br i1 %139, label %142, label %140

140:                                              ; preds = %134
  %141 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %141, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %202

142:                                              ; preds = %134
  br label %143

143:                                              ; preds = %142
  br label %144

144:                                              ; preds = %143
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %4, align 8, !tbaa !5
  %147 = call i32 @s2n_stuffer_read_hex(ptr noundef %6, ptr noundef %146)
  %148 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  store i32 %147, ptr %148, align 4
  %149 = getelementptr inbounds %struct.s2n_result, ptr %10, i32 0, i32 0
  %150 = load i32, ptr %149, align 4
  %151 = call zeroext i1 @s2n_result_is_ok(i32 %150)
  br i1 %151, label %154, label %152

152:                                              ; preds = %145
  %153 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %153, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %202

154:                                              ; preds = %145
  br label %155

155:                                              ; preds = %154
  br label %156

156:                                              ; preds = %155
  br label %157

157:                                              ; preds = %156
  %158 = getelementptr inbounds %struct.s2n_stuffer, ptr %6, i32 0, i32 2
  %159 = load i32, ptr %158, align 4, !tbaa !21
  %160 = getelementptr inbounds %struct.s2n_stuffer, ptr %6, i32 0, i32 1
  %161 = load i32, ptr %160, align 8, !tbaa !24
  %162 = sub i32 %159, %161
  %163 = icmp eq i32 %162, 0
  br i1 %163, label %198, label %164

164:                                              ; preds = %157
  br label %165

165:                                              ; preds = %164
  br label %166

166:                                              ; preds = %165
  %167 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %168 = getelementptr inbounds %struct.s2n_debug_info, ptr %167, i32 0, i32 0
  store ptr @.str.5, ptr %168, align 8, !tbaa !9
  %169 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %170 = getelementptr inbounds %struct.s2n_debug_info, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !9
  %172 = getelementptr inbounds i8, ptr %171, i64 21
  %173 = call ptr @strrchr(ptr noundef %172, i32 noundef 47) #7
  %174 = icmp ne ptr %173, null
  br i1 %174, label %175, label %182

175:                                              ; preds = %166
  %176 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %177 = getelementptr inbounds %struct.s2n_debug_info, ptr %176, i32 0, i32 0
  %178 = load ptr, ptr %177, align 8, !tbaa !9
  %179 = getelementptr inbounds i8, ptr %178, i64 21
  %180 = call ptr @strrchr(ptr noundef %179, i32 noundef 47) #7
  %181 = getelementptr inbounds i8, ptr %180, i64 1
  br label %187

182:                                              ; preds = %166
  %183 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %184 = getelementptr inbounds %struct.s2n_debug_info, ptr %183, i32 0, i32 0
  %185 = load ptr, ptr %184, align 8, !tbaa !9
  %186 = getelementptr inbounds i8, ptr %185, i64 21
  br label %187

187:                                              ; preds = %182, %175
  %188 = phi ptr [ %181, %175 ], [ %186, %182 ]
  %189 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %190 = getelementptr inbounds %struct.s2n_debug_info, ptr %189, i32 0, i32 1
  store ptr %188, ptr %190, align 8, !tbaa !11
  %191 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653270, ptr %191, align 4, !tbaa !12
  %192 = call i32 @s2n_calculate_stacktrace()
  br label %193

193:                                              ; preds = %187
  br label %194

194:                                              ; preds = %193
  %195 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %195, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %202

196:                                              ; No predecessors!
  br label %197

197:                                              ; preds = %196
  br label %198

198:                                              ; preds = %197, %157
  br label %199

199:                                              ; preds = %198
  br label %200

200:                                              ; preds = %199
  %201 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 0, ptr %201, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %202

202:                                              ; preds = %200, %194, %152, %140
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %203

203:                                              ; preds = %202, %126, %91
  %204 = call i32 @s2n_stuffer_free(ptr noundef %6)
  call void @llvm.lifetime.end.p0(i64 40, ptr %6) #8
  br label %205

205:                                              ; preds = %203, %80, %43
  %206 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  %207 = load i32, ptr %206, align 4
  ret i32 %207
}

declare i32 @s2n_stuffer_write_uint8(ptr noundef, i8 noundef zeroext) #2

declare i32 @s2n_alloc(ptr noundef, i32 noundef) #2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"s2n_debug_info", !6, i64 0, !6, i64 8}
!11 = !{!10, !6, i64 8}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 0}
!15 = !{!"", !13, i64 0}
!16 = !{!17, !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!22, !13, i64 28}
!22 = !{!"s2n_stuffer", !23, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!23 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!24 = !{!22, !13, i64 24}


; 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.s2n_debug_info = type { ptr, ptr }
%struct.s2n_stuffer = type { %struct.s2n_blob, i32, i32, i32, i8 }
%struct.s2n_blob = type { ptr, i32, i32, i8 }

@_s2n_debug_info = external thread_local local_unnamed_addr global %struct.s2n_debug_info, align 8
@s2n_errno = external thread_local local_unnamed_addr global i32, align 4
@.str.3 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [101 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #2

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

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

declare i32 @s2n_stuffer_free(ptr noundef) local_unnamed_addr #2

declare i32 @s2n_stuffer_alloc(ptr noundef, i32 noundef) local_unnamed_addr #2

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @s2n_result_is_ok(i32) local_unnamed_addr #5

declare i32 @s2n_stuffer_read_hex(ptr noundef, ptr noundef) local_unnamed_addr #2

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

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_blob_alloc_from_hex_with_whitespace(ptr noundef %0, ptr noundef readonly %1) local_unnamed_addr #6 {
  %3 = alloca %struct.s2n_stuffer, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %12

4:                                                ; preds = %2
  %5 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.3, ptr %5, align 8, !tbaa !5
  %6 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.3, i64 21), i32 noundef 47) #7
  %.not20 = icmp eq ptr %6, null
  %7 = getelementptr inbounds i8, ptr %6, i64 1
  %8 = select i1 %.not20, ptr getelementptr inbounds (i8, ptr @.str.3, i64 21), ptr %7
  %9 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %8, ptr %9, align 8, !tbaa !10
  %10 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %10, align 4, !tbaa !11
  %11 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %59

12:                                               ; preds = %2
  %.not21 = icmp eq ptr %1, null
  br i1 %.not21, label %13, label %21

13:                                               ; preds = %12
  %14 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.4, ptr %14, align 8, !tbaa !5
  %15 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.4, i64 21), i32 noundef 47) #7
  %.not22 = icmp eq ptr %15, null
  %16 = getelementptr inbounds i8, ptr %15, i64 1
  %17 = select i1 %.not22, ptr getelementptr inbounds (i8, ptr @.str.4, i64 21), ptr %16
  %18 = getelementptr inbounds i8, ptr %14, i64 8
  store ptr %17, ptr %18, align 8, !tbaa !10
  %19 = tail call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653193, ptr %19, align 4, !tbaa !11
  %20 = tail call i32 @s2n_calculate_stacktrace() #8
  br label %59

21:                                               ; preds = %12
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %3) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(40) %3, i8 0, i64 40, i1 false)
  %22 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %23 = trunc i64 %22 to i32
  %24 = call i32 @s2n_stuffer_alloc(ptr noundef nonnull %3, i32 noundef %23) #8
  %25 = icmp sgt i32 %24, -1
  br i1 %25, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %21
  %char0 = load i8, ptr %1, align 1
  %.not2325.not = icmp eq i8 %char0, 0
  br i1 %.not2325.not, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader, %32
  %.01426 = phi i64 [ %33, %32 ], [ 0, %.preheader ]
  %26 = getelementptr inbounds i8, ptr %1, i64 %.01426
  %27 = load i8, ptr %26, align 1, !tbaa !13
  %28 = icmp eq i8 %27, 32
  br i1 %28, label %32, label %29

29:                                               ; preds = %.lr.ph
  %30 = call i32 @s2n_stuffer_write_uint8(ptr noundef nonnull %3, i8 noundef zeroext %27) #8
  %31 = icmp sgt i32 %30, -1
  br i1 %31, label %32, label %.loopexit

32:                                               ; preds = %29, %.lr.ph
  %33 = add nuw i64 %.01426, 1
  %34 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %.not23 = icmp ult i64 %33, %34
  br i1 %.not23, label %.lr.ph, label %.critedge, !llvm.loop !14

.critedge:                                        ; preds = %32, %.preheader
  %35 = getelementptr inbounds i8, ptr %3, i64 28
  %36 = load i32, ptr %35, align 4, !tbaa !16
  %37 = getelementptr inbounds i8, ptr %3, i64 24
  %38 = load i32, ptr %37, align 8, !tbaa !19
  %39 = sub i32 %36, %38
  %40 = lshr i32 %39, 1
  %41 = call i32 @s2n_alloc(ptr noundef nonnull %0, i32 noundef %40) #8
  %42 = icmp sgt i32 %41, -1
  br i1 %42, label %43, label %.loopexit

43:                                               ; preds = %.critedge
  %44 = call i32 @s2n_stuffer_read_hex(ptr noundef nonnull %3, ptr noundef nonnull %0) #8
  %45 = call zeroext i1 @s2n_result_is_ok(i32 %44)
  br i1 %45, label %46, label %.loopexit

46:                                               ; preds = %43
  %47 = load i32, ptr %35, align 4, !tbaa !16
  %48 = load i32, ptr %37, align 8, !tbaa !19
  %49 = icmp eq i32 %47, %48
  br i1 %49, label %.loopexit, label %50

50:                                               ; preds = %46
  %51 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  store ptr @.str.5, ptr %51, align 8, !tbaa !5
  %52 = call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.5, i64 21), i32 noundef 47) #7
  %.not24 = icmp eq ptr %52, null
  %53 = getelementptr inbounds i8, ptr %52, i64 1
  %54 = select i1 %.not24, ptr getelementptr inbounds (i8, ptr @.str.5, i64 21), ptr %53
  %55 = getelementptr inbounds i8, ptr %51, i64 8
  store ptr %54, ptr %55, align 8, !tbaa !10
  %56 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653270, ptr %56, align 4, !tbaa !11
  %57 = call i32 @s2n_calculate_stacktrace() #8
  br label %.loopexit

.loopexit:                                        ; preds = %29, %50, %.critedge, %43, %46, %21
  %.sroa.013.2 = phi i32 [ -1, %21 ], [ -1, %50 ], [ -1, %.critedge ], [ -1, %43 ], [ 0, %46 ], [ -1, %29 ]
  %58 = call i32 @s2n_stuffer_free(ptr noundef nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  br label %59

59:                                               ; preds = %.loopexit, %13, %4
  %.sroa.013.3 = phi i32 [ %.sroa.013.2, %.loopexit ], [ -1, %13 ], [ -1, %4 ]
  ret i32 %.sroa.013.3
}

declare i32 @s2n_stuffer_write_uint8(ptr noundef, i8 noundef zeroext) local_unnamed_addr #2

declare i32 @s2n_alloc(ptr noundef, i32 noundef) local_unnamed_addr #2

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"s2n_debug_info", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!6, !7, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}
!13 = !{!8, !8, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!17, !12, i64 28}
!17 = !{!"s2n_stuffer", !18, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!18 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!19 = !{!17, !12, i64 24}


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