; 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 = 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 }
%struct.jbl_node = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, %union.anon }
%union.anon = type { ptr }

@.str.3 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 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 i64 @iwrc_set_errno(i64 noundef, i32 noundef) #1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @iwjsreg_sync(ptr noundef) #4

declare void @iwlog3(i32 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #6

; Function Attrs: nounwind allocsize(0,1)
declare noalias ptr @calloc(i64 noundef, i64 noundef) #7

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #6

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

declare void @jbn_add_item(ptr noundef, ptr noundef) #1

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

18:                                               ; preds = %4
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.iwjsreg, ptr %19, i32 0, i32 1
  %21 = load ptr, ptr %20, align 8, !tbaa !11
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %26

23:                                               ; preds = %18
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %23, %18, %4
  store i64 70017, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %197

27:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store ptr null, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store ptr null, ptr %13, align 8, !tbaa !5
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.iwjsreg, ptr %28, i32 0, i32 8
  %30 = load ptr, ptr %29, align 8, !tbaa !16
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.iwjsreg, ptr %31, i32 0, i32 10
  %33 = load ptr, ptr %32, align 8, !tbaa !17
  %34 = call i64 %30(ptr noundef %33)
  %35 = icmp ne i64 %34, 0
  %36 = xor i1 %35, true
  %37 = xor i1 %36, true
  %38 = zext i1 %37 to i32
  %39 = sext i32 %38 to i64
  %40 = call i64 @llvm.expect.i64(i64 %39, i64 0)
  %41 = icmp ne i64 %40, 0
  br i1 %41, label %42, label %50

42:                                               ; preds = %27
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.iwjsreg, ptr %43, i32 0, i32 8
  %45 = load ptr, ptr %44, align 8, !tbaa !16
  %46 = load ptr, ptr %6, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.iwjsreg, ptr %46, i32 0, i32 10
  %48 = load ptr, ptr %47, align 8, !tbaa !17
  %49 = call i64 %45(ptr noundef %48)
  store i64 %49, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %196

50:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %51 = load ptr, ptr %6, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.iwjsreg, ptr %51, i32 0, i32 1
  %53 = load ptr, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds %struct.jbl_node, ptr %53, i32 0, i32 6
  %55 = load ptr, ptr %54, align 8, !tbaa !18
  store ptr %55, ptr %14, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %79, %50
  %57 = load ptr, ptr %14, align 8, !tbaa !5
  %58 = icmp ne ptr %57, null
  br i1 %58, label %60, label %59

59:                                               ; preds = %56
  store i32 2, ptr %11, align 4
  br label %83

60:                                               ; preds = %56
  %61 = load ptr, ptr %14, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.jbl_node, ptr %61, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !20
  %64 = icmp ne ptr %63, null
  br i1 %64, label %65, label %78

65:                                               ; preds = %60
  %66 = load ptr, ptr %14, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.jbl_node, ptr %66, i32 0, i32 3
  %68 = load ptr, ptr %67, align 8, !tbaa !20
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = load ptr, ptr %14, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.jbl_node, ptr %70, i32 0, i32 4
  %72 = load i32, ptr %71, align 8, !tbaa !21
  %73 = sext i32 %72 to i64
  %74 = call i32 @strncmp(ptr noundef %68, ptr noundef %69, i64 noundef %73) #9
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %78

76:                                               ; preds = %65
  %77 = load ptr, ptr %14, align 8, !tbaa !5
  store ptr %77, ptr %12, align 8, !tbaa !5
  store i32 2, ptr %11, align 4
  br label %83

78:                                               ; preds = %65, %60
  br label %79

79:                                               ; preds = %78
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.jbl_node, ptr %80, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !22
  store ptr %82, ptr %14, align 8, !tbaa !5
  br label %56, !llvm.loop !23

83:                                               ; preds = %76, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %84

84:                                               ; preds = %83
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = icmp ne ptr %85, null
  br i1 %86, label %105, label %87

87:                                               ; preds = %84
  %88 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 64) #10
  store ptr %88, ptr %12, align 8, !tbaa !5
  %89 = icmp ne ptr %88, null
  br i1 %89, label %94, label %90

90:                                               ; preds = %87
  %91 = call ptr @__errno_location() #11
  %92 = load i32, ptr %91, align 4, !tbaa !25
  %93 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %92)
  store i64 %93, ptr %10, align 8, !tbaa !9
  br label %142

94:                                               ; preds = %87
  %95 = load ptr, ptr %12, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.jbl_node, ptr %95, i32 0, i32 8
  store i32 3, ptr %96, align 4, !tbaa !26
  %97 = load ptr, ptr %7, align 8, !tbaa !5
  %98 = call noalias ptr @strdup(ptr noundef %97) #8
  store ptr %98, ptr %13, align 8, !tbaa !5
  %99 = icmp ne ptr %98, null
  br i1 %99, label %104, label %100

100:                                              ; preds = %94
  %101 = call ptr @__errno_location() #11
  %102 = load i32, ptr %101, align 4, !tbaa !25
  %103 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %102)
  store i64 %103, ptr %10, align 8, !tbaa !9
  br label %142

104:                                              ; preds = %94
  br label %125

105:                                              ; preds = %84
  %106 = load ptr, ptr %12, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.jbl_node, ptr %106, i32 0, i32 8
  %108 = load i32, ptr %107, align 4, !tbaa !26
  %109 = icmp eq i32 %108, 5
  br i1 %109, label %110, label %114

110:                                              ; preds = %105
  %111 = load ptr, ptr %12, align 8, !tbaa !5
  %112 = getelementptr inbounds %struct.jbl_node, ptr %111, i32 0, i32 9
  %113 = load ptr, ptr %112, align 8, !tbaa !27
  call void @free(ptr noundef %113) #8
  br label %114

114:                                              ; preds = %110, %105
  %115 = load ptr, ptr %12, align 8, !tbaa !5
  %116 = getelementptr inbounds %struct.jbl_node, ptr %115, i32 0, i32 8
  %117 = load i32, ptr %116, align 4, !tbaa !26
  %118 = icmp ne i32 %117, 3
  br i1 %118, label %119, label %122

119:                                              ; preds = %114
  %120 = load ptr, ptr %12, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.jbl_node, ptr %120, i32 0, i32 9
  store i64 0, ptr %121, align 8, !tbaa !27
  br label %122

122:                                              ; preds = %119, %114
  %123 = load ptr, ptr %12, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.jbl_node, ptr %123, i32 0, i32 8
  store i32 3, ptr %124, align 4, !tbaa !26
  br label %125

125:                                              ; preds = %122, %104
  %126 = load i64, ptr %8, align 8, !tbaa !9
  %127 = load ptr, ptr %12, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.jbl_node, ptr %127, i32 0, i32 9
  %129 = load i64, ptr %128, align 8, !tbaa !27
  %130 = add nsw i64 %129, %126
  store i64 %130, ptr %128, align 8, !tbaa !27
  %131 = load ptr, ptr %9, align 8, !tbaa !5
  %132 = load i64, ptr %131, align 8, !tbaa !9
  %133 = icmp ne i64 %132, 0
  br i1 %133, label %134, label %139

134:                                              ; preds = %125
  %135 = load ptr, ptr %12, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.jbl_node, ptr %135, i32 0, i32 9
  %137 = load i64, ptr %136, align 8, !tbaa !27
  %138 = load ptr, ptr %9, align 8, !tbaa !5
  store i64 %137, ptr %138, align 8, !tbaa !9
  br label %139

139:                                              ; preds = %134, %125
  %140 = load ptr, ptr %6, align 8, !tbaa !5
  %141 = getelementptr inbounds %struct.iwjsreg, ptr %140, i32 0, i32 12
  store i8 1, ptr %141, align 4, !tbaa !28
  br label %142

142:                                              ; preds = %139, %100, %90
  %143 = load i64, ptr %10, align 8, !tbaa !9
  %144 = icmp ne i64 %143, 0
  br i1 %144, label %145, label %147

145:                                              ; preds = %142
  %146 = load ptr, ptr %13, align 8, !tbaa !5
  call void @free(ptr noundef %146) #8
  br label %164

147:                                              ; preds = %142
  %148 = load ptr, ptr %13, align 8, !tbaa !5
  %149 = icmp ne ptr %148, null
  br i1 %149, label %150, label %163

150:                                              ; preds = %147
  %151 = load ptr, ptr %13, align 8, !tbaa !5
  %152 = load ptr, ptr %12, align 8, !tbaa !5
  %153 = getelementptr inbounds %struct.jbl_node, ptr %152, i32 0, i32 3
  store ptr %151, ptr %153, align 8, !tbaa !20
  %154 = load ptr, ptr %13, align 8, !tbaa !5
  %155 = call i64 @strlen(ptr noundef %154) #9
  %156 = trunc i64 %155 to i32
  %157 = load ptr, ptr %12, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.jbl_node, ptr %157, i32 0, i32 4
  store i32 %156, ptr %158, align 8, !tbaa !21
  %159 = load ptr, ptr %6, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.iwjsreg, ptr %159, i32 0, i32 1
  %161 = load ptr, ptr %160, align 8, !tbaa !11
  %162 = load ptr, ptr %12, align 8, !tbaa !5
  call void @jbn_add_item(ptr noundef %161, ptr noundef %162)
  br label %163

163:                                              ; preds = %150, %147
  br label %164

164:                                              ; preds = %163, %145
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %165 = load ptr, ptr %6, align 8, !tbaa !5
  %166 = getelementptr inbounds %struct.iwjsreg, ptr %165, i32 0, i32 9
  %167 = load ptr, ptr %166, align 8, !tbaa !29
  %168 = load ptr, ptr %6, align 8, !tbaa !5
  %169 = getelementptr inbounds %struct.iwjsreg, ptr %168, i32 0, i32 10
  %170 = load ptr, ptr %169, align 8, !tbaa !17
  %171 = call i64 %167(ptr noundef %170)
  store i64 %171, ptr %15, align 8, !tbaa !9
  %172 = load i64, ptr %15, align 8, !tbaa !9
  %173 = icmp ne i64 %172, 0
  br i1 %173, label %174, label %182

174:                                              ; preds = %164
  %175 = load i64, ptr %10, align 8, !tbaa !9
  %176 = icmp ne i64 %175, 0
  br i1 %176, label %179, label %177

177:                                              ; preds = %174
  %178 = load i64, ptr %15, align 8, !tbaa !9
  store i64 %178, ptr %10, align 8, !tbaa !9
  br label %181

179:                                              ; preds = %174
  %180 = load i64, ptr %15, align 8, !tbaa !9
  call void @iwlog3(i32 noundef 0, i64 noundef %180, ptr noundef @.str.3, i32 noundef 632, ptr noundef @.str.4)
  br label %181

181:                                              ; preds = %179, %177
  br label %182

182:                                              ; preds = %181, %164
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  %183 = load i64, ptr %10, align 8, !tbaa !9
  %184 = icmp ne i64 %183, 0
  br i1 %184, label %194, label %185

185:                                              ; preds = %182
  %186 = load ptr, ptr %6, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.iwjsreg, ptr %186, i32 0, i32 11
  %188 = load i32, ptr %187, align 8, !tbaa !30
  %189 = and i32 %188, 2
  %190 = icmp ne i32 %189, 0
  br i1 %190, label %191, label %194

191:                                              ; preds = %185
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = call i64 @iwjsreg_sync(ptr noundef %192)
  store i64 %193, ptr %10, align 8, !tbaa !9
  br label %194

194:                                              ; preds = %191, %185, %182
  %195 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %195, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %196

196:                                              ; preds = %194, %42
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %197

197:                                              ; preds = %196, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %198 = load i64, ptr %5, align 8
  ret i64 %198
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #4 = { 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 #5 = { 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 #6 = { 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 #7 = { nounwind allocsize(0,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 #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }
attributes #10 = { nounwind allocsize(0,1) }
attributes #11 = { 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 8}
!12 = !{!"iwjsreg", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !13, i64 96, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !14, i64 152, !15, i64 156}
!13 = !{!"iwref_holder", !6, i64 0, !7, i64 8, !6, i64 16}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_Bool", !7, i64 0}
!16 = !{!12, !6, i64 128}
!17 = !{!12, !6, i64 144}
!18 = !{!19, !6, i64 40}
!19 = !{!"jbl_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !14, i64 32, !14, i64 36, !6, i64 40, !14, i64 48, !14, i64 52, !7, i64 56}
!20 = !{!19, !6, i64 24}
!21 = !{!19, !14, i64 32}
!22 = !{!19, !6, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!14, !14, i64 0}
!26 = !{!19, !14, i64 52}
!27 = !{!7, !7, i64 0}
!28 = !{!12, !15, i64 156}
!29 = !{!12, !6, i64 136}
!30 = !{!12, !14, i64 152}


; 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.3 = external hidden unnamed_addr constant [70 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [1 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @iwjsreg_sync(ptr noundef) local_unnamed_addr #2

declare void @iwlog3(i32 noundef, i64 noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @calloc(i64 noundef, i64 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #6

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

declare void @jbn_add_item(ptr noundef, ptr noundef) local_unnamed_addr #0

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

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  %9 = icmp ne ptr %1, null
  %or.cond = and i1 %9, %8
  br i1 %or.cond, label %10, label %78

10:                                               ; preds = %5
  %11 = getelementptr inbounds i8, ptr %0, i64 128
  %12 = load ptr, ptr %11, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %0, i64 144
  %14 = load ptr, ptr %13, align 8, !tbaa !14
  %15 = tail call i64 %12(ptr noundef %14) #7
  %.not65 = icmp eq i64 %15, 0
  br i1 %.not65, label %20, label %16, !prof !15

16:                                               ; preds = %10
  %17 = load ptr, ptr %11, align 8, !tbaa !13
  %18 = load ptr, ptr %13, align 8, !tbaa !14
  %19 = tail call i64 %17(ptr noundef %18) #7
  br label %78

20:                                               ; preds = %10
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 40
  %.04999 = load ptr, ptr %22, align 8, !tbaa !16
  %.not66100 = icmp eq ptr %.04999, null
  br i1 %.not66100, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %20, %31
  %.049101 = phi ptr [ %.049, %31 ], [ %.04999, %20 ]
  %23 = getelementptr inbounds i8, ptr %.049101, i64 24
  %24 = load ptr, ptr %23, align 8, !tbaa !17
  %.not67 = icmp eq ptr %24, null
  br i1 %.not67, label %31, label %25

25:                                               ; preds = %.lr.ph
  %26 = getelementptr inbounds i8, ptr %.049101, i64 32
  %27 = load i32, ptr %26, align 8, !tbaa !19
  %28 = sext i32 %27 to i64
  %29 = tail call i32 @strncmp(ptr noundef nonnull %24, ptr noundef nonnull %1, i64 noundef %28) #8
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %36, label %31

31:                                               ; preds = %.lr.ph, %25
  %.049 = load ptr, ptr %.049101, align 8, !tbaa !16
  %.not66 = icmp eq ptr %.049, null
  br i1 %.not66, label %._crit_edge, label %.lr.ph, !llvm.loop !20

._crit_edge:                                      ; preds = %31, %20
  %32 = tail call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  %.not69 = icmp eq ptr %32, null
  br i1 %.not69, label %54, label %33

33:                                               ; preds = %._crit_edge
  %34 = getelementptr inbounds i8, ptr %32, i64 52
  store i32 3, ptr %34, align 4, !tbaa !22
  %35 = tail call noalias ptr @strdup(ptr noundef nonnull %1) #7
  %.not70 = icmp eq ptr %35, null
  br i1 %.not70, label %54, label %48

36:                                               ; preds = %25
  %37 = getelementptr inbounds i8, ptr %.049101, i64 52
  %38 = load i32, ptr %37, align 4, !tbaa !22
  %39 = icmp eq i32 %38, 5
  br i1 %39, label %40, label %43

40:                                               ; preds = %36
  %41 = getelementptr inbounds i8, ptr %.049101, i64 56
  %42 = load ptr, ptr %41, align 8, !tbaa !23
  tail call void @free(ptr noundef %42) #7
  %.pr = load i32, ptr %37, align 4, !tbaa !22
  br label %43

43:                                               ; preds = %40, %36
  %44 = phi i32 [ %.pr, %40 ], [ %38, %36 ]
  %.not71 = icmp eq i32 %44, 3
  br i1 %.not71, label %47, label %45

45:                                               ; preds = %43
  %46 = getelementptr inbounds i8, ptr %.049101, i64 56
  store i64 0, ptr %46, align 8, !tbaa !23
  br label %47

47:                                               ; preds = %45, %43
  store i32 3, ptr %37, align 4, !tbaa !22
  br label %48

48:                                               ; preds = %33, %47
  %.153 = phi ptr [ %.049101, %47 ], [ %32, %33 ]
  %.050 = phi ptr [ null, %47 ], [ %35, %33 ]
  %49 = getelementptr inbounds i8, ptr %.153, i64 56
  %50 = load i64, ptr %49, align 8, !tbaa !23
  %51 = add nsw i64 %50, %2
  store i64 %51, ptr %49, align 8, !tbaa !23
  %52 = load i64, ptr %3, align 8, !tbaa !24
  %.not72 = icmp eq i64 %52, 0
  br i1 %.not72, label %58, label %53

53:                                               ; preds = %48
  store i64 %51, ptr %3, align 8, !tbaa !24
  br label %58

54:                                               ; preds = %33, %._crit_edge
  %55 = tail call ptr @__errno_location() #10
  %56 = load i32, ptr %55, align 4, !tbaa !26
  %57 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %56) #7
  %.not73 = icmp eq i64 %57, 0
  br label %.thread91

58:                                               ; preds = %48, %53
  %59 = getelementptr inbounds i8, ptr %0, i64 156
  store i8 1, ptr %59, align 4, !tbaa !27
  %.not74 = icmp eq ptr %.050, null
  br i1 %.not74, label %.thread91, label %60

60:                                               ; preds = %58
  %61 = getelementptr inbounds i8, ptr %.153, i64 24
  store ptr %.050, ptr %61, align 8, !tbaa !17
  %62 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.050) #8
  %63 = trunc i64 %62 to i32
  %64 = getelementptr inbounds i8, ptr %.153, i64 32
  store i32 %63, ptr %64, align 8, !tbaa !19
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  tail call void @jbn_add_item(ptr noundef %65, ptr noundef nonnull %.153) #7
  br label %.thread91

.thread91:                                        ; preds = %54, %58, %60
  %.not7389 = phi i1 [ true, %58 ], [ true, %60 ], [ %.not73, %54 ]
  %.05485 = phi i64 [ 0, %58 ], [ 0, %60 ], [ %57, %54 ]
  %66 = getelementptr inbounds i8, ptr %0, i64 136
  %67 = load ptr, ptr %66, align 8, !tbaa !28
  %68 = load ptr, ptr %13, align 8, !tbaa !14
  %69 = tail call i64 %67(ptr noundef %68) #7
  %.not75 = icmp eq i64 %69, 0
  %brmerge = or i1 %.not7389, %.not75
  %.054.mux = select i1 %.not75, i64 %.05485, i64 %69
  br i1 %brmerge, label %71, label %70

70:                                               ; preds = %.thread91
  tail call void @iwlog3(i32 noundef 0, i64 noundef %69, ptr noundef nonnull @.str.3, i32 noundef 632, ptr noundef nonnull @.str.4) #7
  br label %71

71:                                               ; preds = %.thread91, %70
  %.155 = phi i64 [ %.05485, %70 ], [ %.054.mux, %.thread91 ]
  %.not76 = icmp eq i64 %.155, 0
  br i1 %.not76, label %72, label %78

72:                                               ; preds = %71
  %73 = getelementptr inbounds i8, ptr %0, i64 152
  %74 = load i32, ptr %73, align 8, !tbaa !29
  %75 = and i32 %74, 2
  %.not77 = icmp eq i32 %75, 0
  br i1 %.not77, label %78, label %76

76:                                               ; preds = %72
  %77 = tail call i64 @iwjsreg_sync(ptr noundef nonnull %0)
  br label %78

78:                                               ; preds = %16, %76, %72, %71, %4, %5
  %.1 = phi i64 [ 70017, %5 ], [ 70017, %4 ], [ %19, %16 ], [ %.155, %71 ], [ %77, %76 ], [ 0, %72 ]
  ret i64 %.1
}

attributes #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 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 #2 = { 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 #3 = { mustprogress nofree nounwind willreturn memory(argmem: read) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn allockind("alloc,zeroed") allocsize(0,1) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 }
attributes #8 = { nounwind willreturn memory(read) }
attributes #9 = { nounwind allocsize(0,1) }
attributes #10 = { 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 8}
!6 = !{!"iwjsreg", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !8, i64 40, !10, i64 96, !7, i64 120, !7, i64 128, !7, i64 136, !7, i64 144, !11, i64 152, !12, i64 156}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"iwref_holder", !7, i64 0, !8, i64 8, !7, i64 16}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_Bool", !8, i64 0}
!13 = !{!6, !7, i64 128}
!14 = !{!6, !7, i64 144}
!15 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !7, i64 24}
!18 = !{!"jbl_node", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !11, i64 32, !11, i64 36, !7, i64 40, !11, i64 48, !11, i64 52, !8, i64 56}
!19 = !{!18, !11, i64 32}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!18, !11, i64 52}
!23 = !{!8, !8, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"long", !8, i64 0}
!26 = !{!11, !11, i64 0}
!27 = !{!6, !12, i64 156}
!28 = !{!6, !7, i64 136}
!29 = !{!6, !11, i64 152}


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