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

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

; Function Attrs: nounwind uwtable
define dso_local i32 @s2n_stuffer_alloc_from_hex(ptr noundef %0, ptr noundef %1) #0 {
  %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 i32, align 4
  %9 = 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 %10

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

13:                                               ; preds = %10
  br label %14

14:                                               ; preds = %13
  br label %15

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

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

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

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

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

44:                                               ; No predecessors!
  br label %45

45:                                               ; preds = %44, %10
  br label %46

46:                                               ; preds = %45
  br label %47

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

50:                                               ; preds = %47
  br label %51

51:                                               ; preds = %50
  br label %52

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

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

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

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

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

81:                                               ; No predecessors!
  br label %82

82:                                               ; preds = %81, %47
  br label %83

83:                                               ; preds = %82
  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 %84

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

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

92:                                               ; preds = %84
  br label %93

93:                                               ; preds = %92
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  %96 = load ptr, ptr %5, align 8, !tbaa !5
  %97 = load ptr, ptr %5, align 8, !tbaa !5
  %98 = call i64 @strlen(ptr noundef %97) #7
  %99 = trunc i64 %98 to i32
  %100 = call i32 @s2n_stuffer_write_bytes(ptr noundef %6, ptr noundef %96, i32 noundef %99)
  %101 = icmp sgt i32 %100, -1
  br i1 %101, label %104, label %102

102:                                              ; preds = %95
  %103 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %103, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %190

104:                                              ; preds = %95
  br label %105

105:                                              ; preds = %104
  br label %106

106:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = call i64 @strlen(ptr noundef %107) #7
  %109 = udiv i64 %108, 2
  %110 = trunc i64 %109 to i32
  store i32 %110, ptr %8, align 4, !tbaa !12
  br label %111

111:                                              ; preds = %106
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = load i32, ptr %8, align 4, !tbaa !12
  %114 = call i32 @s2n_stuffer_alloc(ptr noundef %112, i32 noundef %113)
  %115 = icmp sgt i32 %114, -1
  br i1 %115, label %118, label %116

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

118:                                              ; preds = %111
  br label %119

119:                                              ; preds = %118
  br label %120

120:                                              ; preds = %119
  br label %121

121:                                              ; preds = %120
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.s2n_stuffer, ptr %122, i32 0, i32 0
  %124 = call i32 @s2n_stuffer_read_hex(ptr noundef %6, ptr noundef %123)
  %125 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  store i32 %124, ptr %125, align 4
  %126 = getelementptr inbounds %struct.s2n_result, ptr %9, i32 0, i32 0
  %127 = load i32, ptr %126, align 4
  %128 = call zeroext i1 @s2n_result_is_ok(i32 %127)
  br i1 %128, label %131, label %129

129:                                              ; preds = %121
  %130 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %130, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %189

131:                                              ; preds = %121
  br label %132

132:                                              ; preds = %131
  br label %133

133:                                              ; preds = %132
  br label %134

134:                                              ; preds = %133
  %135 = getelementptr inbounds %struct.s2n_stuffer, ptr %6, i32 0, i32 2
  %136 = load i32, ptr %135, align 4, !tbaa !16
  %137 = getelementptr inbounds %struct.s2n_stuffer, ptr %6, i32 0, i32 1
  %138 = load i32, ptr %137, align 8, !tbaa !19
  %139 = sub i32 %136, %138
  %140 = icmp eq i32 %139, 0
  br i1 %140, label %175, label %141

141:                                              ; preds = %134
  br label %142

142:                                              ; preds = %141
  br label %143

143:                                              ; preds = %142
  %144 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %145 = getelementptr inbounds %struct.s2n_debug_info, ptr %144, i32 0, i32 0
  store ptr @.str.2, ptr %145, align 8, !tbaa !9
  %146 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %147 = getelementptr inbounds %struct.s2n_debug_info, ptr %146, i32 0, i32 0
  %148 = load ptr, ptr %147, align 8, !tbaa !9
  %149 = getelementptr inbounds i8, ptr %148, i64 21
  %150 = call ptr @strrchr(ptr noundef %149, i32 noundef 47) #7
  %151 = icmp ne ptr %150, null
  br i1 %151, label %152, label %159

152:                                              ; preds = %143
  %153 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %154 = getelementptr inbounds %struct.s2n_debug_info, ptr %153, i32 0, i32 0
  %155 = load ptr, ptr %154, align 8, !tbaa !9
  %156 = getelementptr inbounds i8, ptr %155, i64 21
  %157 = call ptr @strrchr(ptr noundef %156, i32 noundef 47) #7
  %158 = getelementptr inbounds i8, ptr %157, i64 1
  br label %164

159:                                              ; preds = %143
  %160 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %161 = getelementptr inbounds %struct.s2n_debug_info, ptr %160, i32 0, i32 0
  %162 = load ptr, ptr %161, align 8, !tbaa !9
  %163 = getelementptr inbounds i8, ptr %162, i64 21
  br label %164

164:                                              ; preds = %159, %152
  %165 = phi ptr [ %158, %152 ], [ %163, %159 ]
  %166 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @_s2n_debug_info)
  %167 = getelementptr inbounds %struct.s2n_debug_info, ptr %166, i32 0, i32 1
  store ptr %165, ptr %167, align 8, !tbaa !11
  %168 = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @s2n_errno)
  store i32 402653270, ptr %168, align 4, !tbaa !12
  %169 = call i32 @s2n_calculate_stacktrace()
  br label %170

170:                                              ; preds = %164
  br label %171

171:                                              ; preds = %170
  %172 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %172, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %189

173:                                              ; No predecessors!
  br label %174

174:                                              ; preds = %173
  br label %175

175:                                              ; preds = %174, %134
  br label %176

176:                                              ; preds = %175
  br label %177

177:                                              ; preds = %176
  br label %178

178:                                              ; preds = %177
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = load i32, ptr %8, align 4, !tbaa !12
  %181 = call i32 @s2n_stuffer_skip_write(ptr noundef %179, i32 noundef %180)
  %182 = icmp sgt i32 %181, -1
  br i1 %182, label %185, label %183

183:                                              ; preds = %178
  %184 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 -1, ptr %184, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %189

185:                                              ; preds = %178
  br label %186

186:                                              ; preds = %185
  br label %187

187:                                              ; preds = %186
  %188 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  store i32 0, ptr %188, align 4, !tbaa !14
  store i32 1, ptr %7, align 4
  br label %189

189:                                              ; preds = %187, %183, %171, %129, %116
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  br label %190

190:                                              ; preds = %189, %102, %90
  %191 = call i32 @s2n_stuffer_free(ptr noundef %6)
  call void @llvm.lifetime.end.p0(i64 40, ptr %6) #8
  br label %192

192:                                              ; preds = %190, %79, %42
  %193 = getelementptr inbounds %struct.s2n_result, ptr %3, i32 0, i32 0
  %194 = load i32, ptr %193, align 4
  ret i32 %194
}

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

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

declare i32 @s2n_calculate_stacktrace() #3

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

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

declare i32 @s2n_stuffer_free(ptr noundef) #3

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

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

declare i32 @s2n_stuffer_write_bytes(ptr noundef, ptr noundef, i32 noundef) #3

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

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

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) #3

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

attributes #0 = { 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 speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #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, !13, i64 28}
!17 = !{!"s2n_stuffer", !18, i64 0, !13, i64 24, !13, i64 28, !13, i64 32, !13, i64 36, !13, i64 36, !13, i64 36}
!18 = !{!"s2n_blob", !6, i64 0, !13, i64 8, !13, i64 12, !13, i64 16}
!19 = !{!17, !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 }

@.str = external hidden unnamed_addr constant [101 x i8], align 1
@_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.1 = external hidden unnamed_addr constant [101 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [101 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 -1, 1) i32 @s2n_stuffer_alloc_from_hex(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %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, ptr %5, align 8, !tbaa !5
  %6 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str, i64 21), i32 noundef 47) #7
  %.not15 = icmp eq ptr %6, null
  %7 = getelementptr inbounds i8, ptr %6, i64 1
  %8 = select i1 %.not15, ptr getelementptr inbounds (i8, ptr @.str, 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 %58

12:                                               ; preds = %2
  %.not16 = icmp eq ptr %1, null
  br i1 %.not16, 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.1, ptr %14, align 8, !tbaa !5
  %15 = tail call ptr @strrchr(ptr noundef nonnull dereferenceable(1) getelementptr inbounds (i8, ptr @.str.1, i64 21), i32 noundef 47) #7
  %.not17 = icmp eq ptr %15, null
  %16 = getelementptr inbounds i8, ptr %15, i64 1
  %17 = select i1 %.not17, ptr getelementptr inbounds (i8, ptr @.str.1, 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 %58

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 %26, label %56

26:                                               ; preds = %21
  %27 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %28 = trunc i64 %27 to i32
  %29 = call i32 @s2n_stuffer_write_bytes(ptr noundef nonnull %3, ptr noundef nonnull %1, i32 noundef %28) #8
  %30 = icmp sgt i32 %29, -1
  br i1 %30, label %31, label %56

31:                                               ; preds = %26
  %32 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %1) #7
  %33 = lshr i64 %32, 1
  %34 = trunc i64 %33 to i32
  %35 = call i32 @s2n_stuffer_alloc(ptr noundef nonnull %0, i32 noundef %34) #8
  %36 = icmp sgt i32 %35, -1
  br i1 %36, label %37, label %56

37:                                               ; preds = %31
  %38 = call i32 @s2n_stuffer_read_hex(ptr noundef nonnull %3, ptr noundef nonnull %0) #8
  %39 = call zeroext i1 @s2n_result_is_ok(i32 %38)
  br i1 %39, label %40, label %56

40:                                               ; preds = %37
  %41 = getelementptr inbounds i8, ptr %3, i64 28
  %42 = load i32, ptr %41, align 4, !tbaa !13
  %43 = getelementptr inbounds i8, ptr %3, i64 24
  %44 = load i32, ptr %43, align 8, !tbaa !16
  %45 = icmp eq i32 %42, %44
  br i1 %45, label %54, label %46

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

54:                                               ; preds = %40
  %55 = call i32 @s2n_stuffer_skip_write(ptr noundef nonnull %0, i32 noundef %34) #8
  %.lobit = ashr i32 %55, 31
  br label %56

56:                                               ; preds = %46, %31, %37, %54, %26, %21
  %.sroa.010.1 = phi i32 [ -1, %21 ], [ -1, %26 ], [ -1, %46 ], [ -1, %31 ], [ -1, %37 ], [ %.lobit, %54 ]
  %57 = call i32 @s2n_stuffer_free(ptr noundef nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %3) #8
  br label %58

58:                                               ; preds = %56, %13, %4
  %.sroa.010.2 = phi i32 [ %.sroa.010.1, %56 ], [ -1, %13 ], [ -1, %4 ]
  ret i32 %.sroa.010.2
}

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

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

declare i32 @s2n_calculate_stacktrace() local_unnamed_addr #3

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

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

declare i32 @s2n_stuffer_free(ptr noundef) local_unnamed_addr #3

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

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

declare i32 @s2n_stuffer_write_bytes(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #3

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

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

declare i32 @s2n_stuffer_skip_write(ptr noundef, i32 noundef) local_unnamed_addr #3

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

attributes #0 = { 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 speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #6 = { 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 #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 = !{!14, !12, i64 28}
!14 = !{!"s2n_stuffer", !15, i64 0, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 36, !12, i64 36}
!15 = !{!"s2n_blob", !7, i64 0, !12, i64 8, !12, i64 12, !12, i64 16}
!16 = !{!14, !12, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass