; LLVM IR from Softmotions/iowow :: src/json (iwjsreg)

; 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.iwjsreg_spec = type { ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.iwjsreg = type { ptr, ptr, ptr, ptr, ptr, %union.pthread_rwlock_t, %struct.iwref_holder, ptr, ptr, ptr, ptr, i32, i8 }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%struct.iwref_holder = type { ptr, i64, ptr }

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @iwjsreg_open(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = icmp ne ptr %10, null
  br i1 %11, label %12, label %20

12:                                               ; preds = %2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.iwjsreg_spec, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !11
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %20

17:                                               ; preds = %12
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %21, label %20

20:                                               ; preds = %17, %12, %2
  store i64 70017, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %187

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store ptr null, ptr %9, align 8, !tbaa !5
  %22 = call ptr @iwpool_create_empty()
  store ptr %22, ptr %8, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %28, label %24

24:                                               ; preds = %21
  %25 = call ptr @__errno_location() #7
  %26 = load i32, ptr %25, align 4, !tbaa !14
  %27 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %26)
  store i64 %27, ptr %6, align 8, !tbaa !9
  br label %168

28:                                               ; preds = %21
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = call ptr @iwpool_calloc(i64 noundef 160, ptr noundef %29)
  store ptr %30, ptr %9, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %36, label %32

32:                                               ; preds = %28
  %33 = call ptr @__errno_location() #7
  %34 = load i32, ptr %33, align 4, !tbaa !14
  %35 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %34)
  store i64 %35, ptr %6, align 8, !tbaa !9
  br label %168

36:                                               ; preds = %28
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.iwjsreg, ptr %38, i32 0, i32 0
  store ptr %37, ptr %39, align 8, !tbaa !15
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.iwjsreg, ptr %40, i32 0, i32 6
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  call void @iwref_init(ptr noundef %41, ptr noundef %42, ptr noundef @_destroy)
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.iwjsreg_spec, ptr %43, i32 0, i32 6
  %45 = load i32, ptr %44, align 8, !tbaa !19
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.iwjsreg, ptr %46, i32 0, i32 11
  store i32 %45, ptr %47, align 8, !tbaa !20
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.iwjsreg_spec, ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !21
  %51 = icmp ne ptr %50, null
  br i1 %51, label %52, label %83

52:                                               ; preds = %36
  %53 = load ptr, ptr %4, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.iwjsreg_spec, ptr %53, i32 0, i32 3
  %55 = load ptr, ptr %54, align 8, !tbaa !22
  %56 = icmp ne ptr %55, null
  br i1 %56, label %57, label %83

57:                                               ; preds = %52
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.iwjsreg_spec, ptr %58, i32 0, i32 4
  %60 = load ptr, ptr %59, align 8, !tbaa !23
  %61 = icmp ne ptr %60, null
  br i1 %61, label %62, label %83

62:                                               ; preds = %57
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.iwjsreg_spec, ptr %63, i32 0, i32 2
  %65 = load ptr, ptr %64, align 8, !tbaa !21
  %66 = load ptr, ptr %9, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.iwjsreg, ptr %66, i32 0, i32 8
  store ptr %65, ptr %67, align 8, !tbaa !24
  %68 = load ptr, ptr %4, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.iwjsreg_spec, ptr %68, i32 0, i32 3
  %70 = load ptr, ptr %69, align 8, !tbaa !22
  %71 = load ptr, ptr %9, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.iwjsreg, ptr %71, i32 0, i32 7
  store ptr %70, ptr %72, align 8, !tbaa !25
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.iwjsreg_spec, ptr %73, i32 0, i32 4
  %75 = load ptr, ptr %74, align 8, !tbaa !23
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.iwjsreg, ptr %76, i32 0, i32 9
  store ptr %75, ptr %77, align 8, !tbaa !26
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.iwjsreg_spec, ptr %78, i32 0, i32 5
  %80 = load ptr, ptr %79, align 8, !tbaa !27
  %81 = load ptr, ptr %9, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.iwjsreg, ptr %81, i32 0, i32 10
  store ptr %80, ptr %82, align 8, !tbaa !28
  br label %118

83:                                               ; preds = %57, %52, %36
  %84 = load ptr, ptr %4, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.iwjsreg_spec, ptr %84, i32 0, i32 1
  %86 = load ptr, ptr %85, align 8, !tbaa !29
  %87 = icmp ne ptr %86, null
  br i1 %87, label %88, label %94

88:                                               ; preds = %83
  %89 = load ptr, ptr %4, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct.iwjsreg_spec, ptr %89, i32 0, i32 1
  %91 = load ptr, ptr %90, align 8, !tbaa !29
  %92 = load ptr, ptr %9, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.iwjsreg, ptr %92, i32 0, i32 4
  store ptr %91, ptr %93, align 8, !tbaa !30
  br label %108

94:                                               ; preds = %83
  %95 = load ptr, ptr %9, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.iwjsreg, ptr %95, i32 0, i32 5
  %97 = call i32 @pthread_rwlock_init(ptr noundef %96, ptr noundef null) #6
  %98 = icmp slt i32 %97, 0
  br i1 %98, label %99, label %103

99:                                               ; preds = %94
  %100 = call ptr @__errno_location() #7
  %101 = load i32, ptr %100, align 4, !tbaa !14
  %102 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %101)
  store i64 %102, ptr %6, align 8, !tbaa !9
  br label %168

103:                                              ; preds = %94
  %104 = load ptr, ptr %9, align 8, !tbaa !5
  %105 = getelementptr inbounds %struct.iwjsreg, ptr %104, i32 0, i32 5
  %106 = load ptr, ptr %9, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.iwjsreg, ptr %106, i32 0, i32 4
  store ptr %105, ptr %107, align 8, !tbaa !30
  br label %108

108:                                              ; preds = %103, %88
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.iwjsreg, ptr %109, i32 0, i32 8
  store ptr @_wlock, ptr %110, align 8, !tbaa !24
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.iwjsreg, ptr %111, i32 0, i32 7
  store ptr @_rlock, ptr %112, align 8, !tbaa !25
  %113 = load ptr, ptr %9, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.iwjsreg, ptr %113, i32 0, i32 9
  store ptr @_unlock, ptr %114, align 8, !tbaa !26
  %115 = load ptr, ptr %9, align 8, !tbaa !5
  %116 = load ptr, ptr %9, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.iwjsreg, ptr %116, i32 0, i32 10
  store ptr %115, ptr %117, align 8, !tbaa !28
  br label %118

118:                                              ; preds = %108, %62
  %119 = load ptr, ptr %8, align 8, !tbaa !5
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.iwjsreg_spec, ptr %120, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !11
  %123 = call ptr @iwpool_strdup2(ptr noundef %119, ptr noundef %122)
  %124 = load ptr, ptr %9, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.iwjsreg, ptr %124, i32 0, i32 2
  store ptr %123, ptr %125, align 8, !tbaa !31
  %126 = icmp ne ptr %123, null
  br i1 %126, label %131, label %127

127:                                              ; preds = %118
  %128 = call ptr @__errno_location() #7
  %129 = load i32, ptr %128, align 4, !tbaa !14
  %130 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %129)
  store i64 %130, ptr %6, align 8, !tbaa !9
  br label %168

131:                                              ; preds = %118
  %132 = load ptr, ptr %8, align 8, !tbaa !5
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.iwjsreg_spec, ptr %133, i32 0, i32 0
  %135 = load ptr, ptr %134, align 8, !tbaa !11
  %136 = call ptr (ptr, ptr, ...) @iwpool_printf(ptr noundef %132, ptr noundef @.str, ptr noundef %135)
  %137 = load ptr, ptr %9, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.iwjsreg, ptr %137, i32 0, i32 3
  store ptr %136, ptr %138, align 8, !tbaa !32
  %139 = icmp ne ptr %136, null
  br i1 %139, label %144, label %140

140:                                              ; preds = %131
  %141 = call ptr @__errno_location() #7
  %142 = load i32, ptr %141, align 4, !tbaa !14
  %143 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %142)
  store i64 %143, ptr %6, align 8, !tbaa !9
  br label %168

144:                                              ; preds = %131
  %145 = load ptr, ptr %9, align 8, !tbaa !5
  %146 = call i64 @_load(ptr noundef %145)
  store i64 %146, ptr %6, align 8, !tbaa !9
  %147 = load i64, ptr %6, align 8, !tbaa !9
  %148 = icmp ne i64 %147, 0
  br i1 %148, label %149, label %167

149:                                              ; preds = %144
  %150 = load i64, ptr %6, align 8, !tbaa !9
  %151 = icmp ne i64 %150, 70004
  br i1 %151, label %152, label %153

152:                                              ; preds = %149
  br label %168

153:                                              ; preds = %149
  store i64 0, ptr %6, align 8, !tbaa !9
  %154 = load ptr, ptr %9, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.iwjsreg, ptr %154, i32 0, i32 1
  %156 = call i64 @jbn_from_json(ptr noundef @.str.1, ptr noundef %155, ptr noundef null)
  store i64 %156, ptr %6, align 8, !tbaa !9
  %157 = load i64, ptr %6, align 8, !tbaa !9
  %158 = icmp ne i64 %157, 0
  %159 = xor i1 %158, true
  %160 = xor i1 %159, true
  %161 = zext i1 %160 to i32
  %162 = sext i32 %161 to i64
  %163 = call i64 @llvm.expect.i64(i64 %162, i64 0)
  %164 = icmp ne i64 %163, 0
  br i1 %164, label %165, label %166

165:                                              ; preds = %153
  br label %168

166:                                              ; preds = %153
  br label %167

167:                                              ; preds = %166, %144
  br label %168

168:                                              ; preds = %167, %165, %152, %140, %127, %99, %32, %24
  %169 = load i64, ptr %6, align 8, !tbaa !9
  %170 = icmp ne i64 %169, 0
  br i1 %170, label %171, label %182

171:                                              ; preds = %168
  %172 = load ptr, ptr %9, align 8, !tbaa !5
  %173 = icmp ne ptr %172, null
  br i1 %173, label %174, label %178

174:                                              ; preds = %171
  %175 = load ptr, ptr %9, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.iwjsreg, ptr %175, i32 0, i32 6
  %177 = call zeroext i1 @iwref_unref(ptr noundef %176)
  br label %181

178:                                              ; preds = %171
  %179 = load ptr, ptr %8, align 8, !tbaa !5
  %180 = call zeroext i1 @iwpool_destroy(ptr noundef %179)
  br label %181

181:                                              ; preds = %178, %174
  br label %185

182:                                              ; preds = %168
  %183 = load ptr, ptr %9, align 8, !tbaa !5
  %184 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %183, ptr %184, align 8, !tbaa !5
  br label %185

185:                                              ; preds = %182, %181
  %186 = load i64, ptr %6, align 8, !tbaa !9
  store i64 %186, ptr %3, align 8
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %187

187:                                              ; preds = %185, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %188 = load i64, ptr %3, align 8
  ret i64 %188
}

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

declare ptr @iwpool_create_empty() #2

declare i64 @iwrc_set_errno(i64 noundef, i32 noundef) #2

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #3

declare ptr @iwpool_calloc(i64 noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @iwref_init(ptr noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @_destroy(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden i64 @_wlock(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @_rlock(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @_unlock(ptr noundef) #0

declare ptr @iwpool_strdup2(ptr noundef, ptr noundef) #2

declare ptr @iwpool_printf(ptr noundef, ptr noundef, ...) #2

; Function Attrs: nounwind uwtable
declare hidden i64 @_load(ptr noundef) #0

declare i64 @jbn_from_json(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #5

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @iwref_unref(ptr noundef) #0

declare zeroext i1 @iwpool_destroy(ptr noundef) #2

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

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 willreturn memory(argmem: readwrite) }
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 = { nounwind willreturn memory(none) "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 "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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { nounwind }
attributes #7 = { nounwind willreturn memory(none) }

!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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"iwjsreg_spec", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, i64 0}
!15 = !{!16, !6, i64 0}
!16 = !{!"iwjsreg", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !17, i64 96, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !13, i64 152, !18, i64 156}
!17 = !{!"iwref_holder", !6, i64 0, !7, i64 8, !6, i64 16}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!12, !13, i64 48}
!20 = !{!16, !13, i64 152}
!21 = !{!12, !6, i64 16}
!22 = !{!12, !6, i64 24}
!23 = !{!12, !6, i64 32}
!24 = !{!16, !6, i64 128}
!25 = !{!16, !6, i64 120}
!26 = !{!16, !6, i64 136}
!27 = !{!12, !6, i64 40}
!28 = !{!16, !6, i64 144}
!29 = !{!12, !6, i64 8}
!30 = !{!16, !6, i64 32}
!31 = !{!16, !6, i64 16}
!32 = !{!16, !6, 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"

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i64 @iwjsreg_open(ptr noundef readonly %0, ptr noundef writeonly %1) local_unnamed_addr #0 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %84, label %3

3:                                                ; preds = %2
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = icmp ne ptr %4, null
  %6 = icmp ne ptr %1, null
  %or.cond = and i1 %6, %5
  br i1 %or.cond, label %7, label %84

7:                                                ; preds = %3
  %8 = tail call ptr @iwpool_create_empty() #4
  %.not61 = icmp eq ptr %8, null
  br i1 %.not61, label %9, label %13

9:                                                ; preds = %7
  %10 = tail call ptr @__errno_location() #5
  %11 = load i32, ptr %10, align 4, !tbaa !11
  %12 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %11) #4
  br label %76

13:                                               ; preds = %7
  %14 = tail call ptr @iwpool_calloc(i64 noundef 160, ptr noundef nonnull %8) #4
  %.not62 = icmp eq ptr %14, null
  br i1 %.not62, label %15, label %19

15:                                               ; preds = %13
  %16 = tail call ptr @__errno_location() #5
  %17 = load i32, ptr %16, align 4, !tbaa !11
  %18 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %17) #4
  br label %76

19:                                               ; preds = %13
  store ptr %8, ptr %14, align 8, !tbaa !12
  %20 = getelementptr inbounds i8, ptr %14, i64 96
  tail call void @iwref_init(ptr noundef nonnull %20, ptr noundef nonnull %14, ptr noundef nonnull @_destroy)
  %21 = getelementptr inbounds i8, ptr %0, i64 48
  %22 = load i32, ptr %21, align 8, !tbaa !16
  %23 = getelementptr inbounds i8, ptr %14, i64 152
  store i32 %22, ptr %23, align 8, !tbaa !17
  %24 = getelementptr inbounds i8, ptr %0, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !18
  %.not63 = icmp eq ptr %25, null
  br i1 %.not63, label %38, label %26

26:                                               ; preds = %19
  %27 = getelementptr inbounds i8, ptr %0, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !19
  %.not64 = icmp eq ptr %28, null
  br i1 %.not64, label %38, label %29

29:                                               ; preds = %26
  %30 = getelementptr inbounds i8, ptr %0, i64 32
  %31 = load ptr, ptr %30, align 8, !tbaa !20
  %.not65 = icmp eq ptr %31, null
  br i1 %.not65, label %38, label %32

32:                                               ; preds = %29
  %33 = getelementptr inbounds i8, ptr %14, i64 128
  store ptr %25, ptr %33, align 8, !tbaa !21
  %34 = getelementptr inbounds i8, ptr %14, i64 120
  store ptr %28, ptr %34, align 8, !tbaa !22
  %35 = getelementptr inbounds i8, ptr %14, i64 136
  store ptr %31, ptr %35, align 8, !tbaa !23
  %36 = getelementptr inbounds i8, ptr %0, i64 40
  %37 = load ptr, ptr %36, align 8, !tbaa !24
  br label %54

38:                                               ; preds = %29, %26, %19
  %39 = getelementptr inbounds i8, ptr %0, i64 8
  %40 = load ptr, ptr %39, align 8, !tbaa !25
  %.not66 = icmp eq ptr %40, null
  br i1 %.not66, label %41, label %49

41:                                               ; preds = %38
  %42 = getelementptr inbounds i8, ptr %14, i64 40
  %43 = tail call i32 @pthread_rwlock_init(ptr noundef nonnull %42, ptr noundef null) #4
  %44 = icmp slt i32 %43, 0
  br i1 %44, label %45, label %49

45:                                               ; preds = %41
  %46 = tail call ptr @__errno_location() #5
  %47 = load i32, ptr %46, align 4, !tbaa !11
  %48 = tail call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %47) #4
  br label %76

49:                                               ; preds = %41, %38
  %.sink = phi ptr [ %40, %38 ], [ %42, %41 ]
  %50 = getelementptr inbounds i8, ptr %14, i64 32
  store ptr %.sink, ptr %50, align 8, !tbaa !26
  %51 = getelementptr inbounds i8, ptr %14, i64 128
  store ptr @_wlock, ptr %51, align 8, !tbaa !21
  %52 = getelementptr inbounds i8, ptr %14, i64 120
  store ptr @_rlock, ptr %52, align 8, !tbaa !22
  %53 = getelementptr inbounds i8, ptr %14, i64 136
  store ptr @_unlock, ptr %53, align 8, !tbaa !23
  br label %54

54:                                               ; preds = %49, %32
  %.sink73 = phi ptr [ %14, %49 ], [ %37, %32 ]
  %55 = getelementptr inbounds i8, ptr %14, i64 144
  store ptr %.sink73, ptr %55, align 8, !tbaa !27
  %56 = load ptr, ptr %0, align 8, !tbaa !5
  %57 = tail call ptr @iwpool_strdup2(ptr noundef nonnull %8, ptr noundef %56) #4
  %58 = getelementptr inbounds i8, ptr %14, i64 16
  store ptr %57, ptr %58, align 8, !tbaa !28
  %.not67 = icmp eq ptr %57, null
  br i1 %.not67, label %59, label %63

59:                                               ; preds = %54
  %60 = tail call ptr @__errno_location() #5
  %61 = load i32, ptr %60, align 4, !tbaa !11
  %62 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %61) #4
  br label %76

63:                                               ; preds = %54
  %64 = load ptr, ptr %0, align 8, !tbaa !5
  %65 = tail call ptr (ptr, ptr, ...) @iwpool_printf(ptr noundef nonnull %8, ptr noundef nonnull @.str, ptr noundef %64) #4
  %66 = getelementptr inbounds i8, ptr %14, i64 24
  store ptr %65, ptr %66, align 8, !tbaa !29
  %.not68 = icmp eq ptr %65, null
  br i1 %.not68, label %67, label %71

67:                                               ; preds = %63
  %68 = tail call ptr @__errno_location() #5
  %69 = load i32, ptr %68, align 4, !tbaa !11
  %70 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %69) #4
  br label %76

71:                                               ; preds = %63
  %72 = tail call i64 @_load(ptr noundef nonnull %14)
  %.not69 = icmp eq i64 %72, 70004
  br i1 %.not69, label %73, label %76

73:                                               ; preds = %71
  %74 = getelementptr inbounds i8, ptr %14, i64 8
  %75 = tail call i64 @jbn_from_json(ptr noundef nonnull @.str.1, ptr noundef nonnull %74, ptr noundef null) #4
  br label %76

76:                                               ; preds = %73, %71, %67, %59, %45, %15, %9
  %.053 = phi i64 [ %72, %71 ], [ %75, %73 ], [ %70, %67 ], [ %62, %59 ], [ %48, %45 ], [ %18, %15 ], [ %12, %9 ]
  %.0 = phi ptr [ %14, %71 ], [ %14, %73 ], [ %14, %67 ], [ %14, %59 ], [ %14, %45 ], [ null, %15 ], [ null, %9 ]
  %.not70 = icmp eq i64 %.053, 0
  br i1 %.not70, label %83, label %77

77:                                               ; preds = %76
  %.not71 = icmp eq ptr %.0, null
  br i1 %.not71, label %81, label %78

78:                                               ; preds = %77
  %79 = getelementptr inbounds i8, ptr %.0, i64 96
  %80 = tail call zeroext i1 @iwref_unref(ptr noundef nonnull %79)
  br label %84

81:                                               ; preds = %77
  %82 = tail call zeroext i1 @iwpool_destroy(ptr noundef %8) #4
  br label %84

83:                                               ; preds = %76
  store ptr %.0, ptr %1, align 8, !tbaa !30
  br label %84

84:                                               ; preds = %83, %81, %78, %2, %3
  %.052 = phi i64 [ 70017, %3 ], [ 70017, %2 ], [ %.053, %78 ], [ %.053, %81 ], [ 0, %83 ]
  ret i64 %.052
}

declare ptr @iwpool_create_empty() local_unnamed_addr #1

declare i64 @iwrc_set_errno(i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #2

declare ptr @iwpool_calloc(i64 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @iwref_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @_destroy(ptr noundef) #0

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

; Function Attrs: nounwind uwtable
declare hidden i64 @_wlock(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @_rlock(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i64 @_unlock(ptr noundef) #0

declare ptr @iwpool_strdup2(ptr noundef, ptr noundef) local_unnamed_addr #1

declare ptr @iwpool_printf(ptr noundef, ptr noundef, ...) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i64 @_load(ptr noundef) local_unnamed_addr #0

declare i64 @jbn_from_json(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @iwref_unref(ptr noundef) local_unnamed_addr #0

declare zeroext i1 @iwpool_destroy(ptr noundef) local_unnamed_addr #1

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 = { "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 nofree nosync nounwind willreturn memory(none) "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 "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(none) }

!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 = !{!"iwjsreg_spec", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!10, !10, i64 0}
!12 = !{!13, !7, i64 0}
!13 = !{!"iwjsreg", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !8, i64 40, !14, i64 96, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !10, i64 152, !15, i64 156}
!14 = !{!"iwref_holder", !7, i64 0, !8, i64 8, !7, i64 16}
!15 = !{!"_Bool", !8, i64 0}
!16 = !{!6, !10, i64 48}
!17 = !{!13, !10, i64 152}
!18 = !{!6, !7, i64 16}
!19 = !{!6, !7, i64 24}
!20 = !{!6, !7, i64 32}
!21 = !{!13, !7, i64 128}
!22 = !{!13, !7, i64 120}
!23 = !{!13, !7, i64 136}
!24 = !{!6, !7, i64 40}
!25 = !{!6, !7, i64 8}
!26 = !{!13, !7, i64 32}
!27 = !{!13, !7, i64 144}
!28 = !{!13, !7, i64 16}
!29 = !{!13, !7, i64 24}
!30 = !{!7, !7, i64 0}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass