; 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 uwtable
define dso_local i64 @iwjsreg_set_str(ptr noundef %0, ptr noundef %1, ptr noundef %2) #4 {
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  store i64 0, ptr %8, align 8, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %28

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

22:                                               ; preds = %17
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = icmp ne ptr %23, null
  br i1 %24, label %25, label %28

25:                                               ; preds = %22
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = icmp ne ptr %26, null
  br i1 %27, label %29, label %28

28:                                               ; preds = %25, %22, %17, %3
  store i64 70017, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %207

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

44:                                               ; preds = %29
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.iwjsreg, ptr %45, i32 0, i32 8
  %47 = load ptr, ptr %46, align 8, !tbaa !16
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.iwjsreg, ptr %48, i32 0, i32 10
  %50 = load ptr, ptr %49, align 8, !tbaa !17
  %51 = call i64 %47(ptr noundef %50)
  store i64 %51, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %206

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

58:                                               ; preds = %81, %52
  %59 = load ptr, ptr %13, align 8, !tbaa !5
  %60 = icmp ne ptr %59, null
  br i1 %60, label %62, label %61

61:                                               ; preds = %58
  store i32 2, ptr %9, align 4
  br label %85

62:                                               ; preds = %58
  %63 = load ptr, ptr %13, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.jbl_node, ptr %63, i32 0, i32 3
  %65 = load ptr, ptr %64, align 8, !tbaa !20
  %66 = icmp ne ptr %65, null
  br i1 %66, label %67, label %80

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

78:                                               ; preds = %67
  %79 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %79, ptr %10, align 8, !tbaa !5
  store i32 2, ptr %9, align 4
  br label %85

80:                                               ; preds = %67, %62
  br label %81

81:                                               ; preds = %80
  %82 = load ptr, ptr %13, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.jbl_node, ptr %82, i32 0, i32 0
  %84 = load ptr, ptr %83, align 8, !tbaa !22
  store ptr %84, ptr %13, align 8, !tbaa !5
  br label %58, !llvm.loop !23

85:                                               ; preds = %78, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %86

86:                                               ; preds = %85
  %87 = load ptr, ptr %10, align 8, !tbaa !5
  %88 = icmp ne ptr %87, null
  br i1 %88, label %115, label %89

89:                                               ; preds = %86
  %90 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 64) #10
  store ptr %90, ptr %10, align 8, !tbaa !5
  %91 = icmp ne ptr %90, null
  br i1 %91, label %96, label %92

92:                                               ; preds = %89
  %93 = call ptr @__errno_location() #11
  %94 = load i32, ptr %93, align 4, !tbaa !25
  %95 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %94)
  store i64 %95, ptr %8, align 8, !tbaa !9
  br label %139

96:                                               ; preds = %89
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.jbl_node, ptr %97, i32 0, i32 8
  store i32 5, ptr %98, align 4, !tbaa !26
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = call noalias ptr @strdup(ptr noundef %99) #8
  store ptr %100, ptr %11, align 8, !tbaa !5
  %101 = icmp ne ptr %100, null
  br i1 %101, label %106, label %102

102:                                              ; preds = %96
  %103 = call ptr @__errno_location() #11
  %104 = load i32, ptr %103, align 4, !tbaa !25
  %105 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %104)
  store i64 %105, ptr %8, align 8, !tbaa !9
  br label %139

106:                                              ; preds = %96
  %107 = load ptr, ptr %7, align 8, !tbaa !5
  %108 = call noalias ptr @strdup(ptr noundef %107) #8
  store ptr %108, ptr %12, align 8, !tbaa !5
  %109 = icmp ne ptr %108, null
  br i1 %109, label %114, label %110

110:                                              ; preds = %106
  %111 = call ptr @__errno_location() #11
  %112 = load i32, ptr %111, align 4, !tbaa !25
  %113 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %112)
  store i64 %113, ptr %8, align 8, !tbaa !9
  br label %139

114:                                              ; preds = %106
  br label %136

115:                                              ; preds = %86
  %116 = load ptr, ptr %10, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.jbl_node, ptr %116, i32 0, i32 8
  %118 = load i32, ptr %117, align 4, !tbaa !26
  %119 = icmp eq i32 %118, 5
  br i1 %119, label %120, label %124

120:                                              ; preds = %115
  %121 = load ptr, ptr %10, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.jbl_node, ptr %121, i32 0, i32 9
  %123 = load ptr, ptr %122, align 8, !tbaa !27
  call void @free(ptr noundef %123) #8
  br label %127

124:                                              ; preds = %115
  %125 = load ptr, ptr %10, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.jbl_node, ptr %125, i32 0, i32 8
  store i32 5, ptr %126, align 4, !tbaa !26
  br label %127

127:                                              ; preds = %124, %120
  %128 = load ptr, ptr %7, align 8, !tbaa !5
  %129 = call noalias ptr @strdup(ptr noundef %128) #8
  store ptr %129, ptr %12, align 8, !tbaa !5
  %130 = icmp ne ptr %129, null
  br i1 %130, label %135, label %131

131:                                              ; preds = %127
  %132 = call ptr @__errno_location() #11
  %133 = load i32, ptr %132, align 4, !tbaa !25
  %134 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %133)
  store i64 %134, ptr %8, align 8, !tbaa !9
  br label %139

135:                                              ; preds = %127
  br label %136

136:                                              ; preds = %135, %114
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.iwjsreg, ptr %137, i32 0, i32 12
  store i8 1, ptr %138, align 4, !tbaa !28
  br label %139

139:                                              ; preds = %136, %131, %110, %102, %92
  %140 = load i64, ptr %8, align 8, !tbaa !9
  %141 = icmp ne i64 %140, 0
  br i1 %141, label %142, label %145

142:                                              ; preds = %139
  %143 = load ptr, ptr %11, align 8, !tbaa !5
  call void @free(ptr noundef %143) #8
  %144 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %144) #8
  br label %174

145:                                              ; preds = %139
  %146 = load ptr, ptr %12, align 8, !tbaa !5
  %147 = load ptr, ptr %10, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.jbl_node, ptr %147, i32 0, i32 9
  store ptr %146, ptr %148, align 8, !tbaa !27
  %149 = load ptr, ptr %10, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.jbl_node, ptr %149, i32 0, i32 9
  %151 = load ptr, ptr %150, align 8, !tbaa !27
  %152 = call i64 @strlen(ptr noundef %151) #9
  %153 = trunc i64 %152 to i32
  %154 = load ptr, ptr %10, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.jbl_node, ptr %154, i32 0, i32 7
  store i32 %153, ptr %155, align 8, !tbaa !29
  %156 = load ptr, ptr %11, align 8, !tbaa !5
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %173

158:                                              ; preds = %145
  %159 = load ptr, ptr %11, align 8, !tbaa !5
  %160 = load ptr, ptr %10, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.jbl_node, ptr %160, i32 0, i32 3
  store ptr %159, ptr %161, align 8, !tbaa !20
  %162 = load ptr, ptr %10, align 8, !tbaa !5
  %163 = getelementptr inbounds %struct.jbl_node, ptr %162, i32 0, i32 3
  %164 = load ptr, ptr %163, align 8, !tbaa !20
  %165 = call i64 @strlen(ptr noundef %164) #9
  %166 = trunc i64 %165 to i32
  %167 = load ptr, ptr %10, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.jbl_node, ptr %167, i32 0, i32 4
  store i32 %166, ptr %168, align 8, !tbaa !21
  %169 = load ptr, ptr %5, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.iwjsreg, ptr %169, i32 0, i32 1
  %171 = load ptr, ptr %170, align 8, !tbaa !11
  %172 = load ptr, ptr %10, align 8, !tbaa !5
  call void @jbn_add_item(ptr noundef %171, ptr noundef %172)
  br label %173

173:                                              ; preds = %158, %145
  br label %174

174:                                              ; preds = %173, %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.iwjsreg, ptr %175, i32 0, i32 9
  %177 = load ptr, ptr %176, align 8, !tbaa !30
  %178 = load ptr, ptr %5, align 8, !tbaa !5
  %179 = getelementptr inbounds %struct.iwjsreg, ptr %178, i32 0, i32 10
  %180 = load ptr, ptr %179, align 8, !tbaa !17
  %181 = call i64 %177(ptr noundef %180)
  store i64 %181, ptr %14, align 8, !tbaa !9
  %182 = load i64, ptr %14, align 8, !tbaa !9
  %183 = icmp ne i64 %182, 0
  br i1 %183, label %184, label %192

184:                                              ; preds = %174
  %185 = load i64, ptr %8, align 8, !tbaa !9
  %186 = icmp ne i64 %185, 0
  br i1 %186, label %189, label %187

187:                                              ; preds = %184
  %188 = load i64, ptr %14, align 8, !tbaa !9
  store i64 %188, ptr %8, align 8, !tbaa !9
  br label %191

189:                                              ; preds = %184
  %190 = load i64, ptr %14, align 8, !tbaa !9
  call void @iwlog3(i32 noundef 0, i64 noundef %190, ptr noundef @.str.3, i32 noundef 305, ptr noundef @.str.4)
  br label %191

191:                                              ; preds = %189, %187
  br label %192

192:                                              ; preds = %191, %174
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  %193 = load i64, ptr %8, align 8, !tbaa !9
  %194 = icmp ne i64 %193, 0
  br i1 %194, label %204, label %195

195:                                              ; preds = %192
  %196 = load ptr, ptr %5, align 8, !tbaa !5
  %197 = getelementptr inbounds %struct.iwjsreg, ptr %196, i32 0, i32 11
  %198 = load i32, ptr %197, align 8, !tbaa !31
  %199 = and i32 %198, 2
  %200 = icmp ne i32 %199, 0
  br i1 %200, label %201, label %204

201:                                              ; preds = %195
  %202 = load ptr, ptr %5, align 8, !tbaa !5
  %203 = call i64 @iwjsreg_sync(ptr noundef %202)
  store i64 %203, ptr %8, align 8, !tbaa !9
  br label %204

204:                                              ; preds = %201, %195, %192
  %205 = load i64, ptr %8, align 8, !tbaa !9
  store i64 %205, ptr %4, align 8
  store i32 1, ptr %9, align 4
  br label %206

206:                                              ; preds = %204, %44
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  br label %207

207:                                              ; preds = %206, %28
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  %208 = load i64, ptr %4, align 8
  ret i64 %208
}

; 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

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 = !{!19, !14, i64 48}
!30 = !{!12, !6, i64 136}
!31 = !{!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: nounwind uwtable
define dso_local i64 @iwjsreg_set_str(ptr noundef %0, ptr noundef readonly %1, ptr noundef readonly %2) local_unnamed_addr #2 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %76, label %4

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

10:                                               ; preds = %4
  %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) #8
  %.not75 = icmp eq i64 %15, 0
  br i1 %.not75, 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) #8
  br label %76

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

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

25:                                               ; preds = %.lr.ph
  %26 = getelementptr inbounds i8, ptr %.052106, 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) #9
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %38, label %31

31:                                               ; preds = %.lr.ph, %25
  %.052 = load ptr, ptr %.052106, align 8, !tbaa !16
  %.not76 = icmp eq ptr %.052, null
  br i1 %.not76, 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) #10
  %.not79 = icmp eq ptr %32, null
  br i1 %.not79, label %53, label %33

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

36:                                               ; preds = %33
  %37 = tail call noalias ptr @strdup(ptr noundef nonnull %2) #8
  %.not81 = icmp eq ptr %37, null
  br i1 %.not81, label %53, label %.thread90

38:                                               ; preds = %25
  %39 = getelementptr inbounds i8, ptr %.052106, i64 52
  %40 = load i32, ptr %39, align 4, !tbaa !22
  %41 = icmp eq i32 %40, 5
  br i1 %41, label %42, label %45

42:                                               ; preds = %38
  %43 = getelementptr inbounds i8, ptr %.052106, i64 56
  %44 = load ptr, ptr %43, align 8, !tbaa !23
  tail call void @free(ptr noundef %44) #8
  br label %46

45:                                               ; preds = %38
  store i32 5, ptr %39, align 4, !tbaa !22
  br label %46

46:                                               ; preds = %45, %42
  %47 = tail call noalias ptr @strdup(ptr noundef nonnull %2) #8
  %.not82 = icmp eq ptr %47, null
  br i1 %.not82, label %53, label %.thread90

.thread90:                                        ; preds = %36, %46
  %.158 = phi ptr [ %.052106, %46 ], [ %32, %36 ]
  %.055 = phi ptr [ null, %46 ], [ %35, %36 ]
  %.053 = phi ptr [ %47, %46 ], [ %37, %36 ]
  %48 = getelementptr inbounds i8, ptr %0, i64 156
  store i8 1, ptr %48, align 4, !tbaa !24
  %49 = getelementptr inbounds i8, ptr %.158, i64 56
  store ptr %.053, ptr %49, align 8, !tbaa !23
  %50 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.053) #9
  %51 = trunc i64 %50 to i32
  %52 = getelementptr inbounds i8, ptr %.158, i64 48
  store i32 %51, ptr %52, align 8, !tbaa !25
  %.not84 = icmp eq ptr %.055, null
  br i1 %.not84, label %63, label %57

53:                                               ; preds = %46, %36, %33, %._crit_edge
  %.156 = phi ptr [ null, %._crit_edge ], [ null, %33 ], [ %35, %36 ], [ null, %46 ]
  %54 = tail call ptr @__errno_location() #11
  %55 = load i32, ptr %54, align 4, !tbaa !26
  %56 = tail call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %55) #8
  %.not83 = icmp ne i64 %56, 0
  tail call void @llvm.assume(i1 %.not83)
  tail call void @free(ptr noundef %.156) #8
  br label %63

57:                                               ; preds = %.thread90
  %58 = getelementptr inbounds i8, ptr %.158, i64 24
  store ptr %.055, ptr %58, align 8, !tbaa !17
  %59 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %.055) #9
  %60 = trunc i64 %59 to i32
  %61 = getelementptr inbounds i8, ptr %.158, i64 32
  store i32 %60, ptr %61, align 8, !tbaa !19
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  tail call void @jbn_add_item(ptr noundef %62, ptr noundef nonnull %.158) #8
  br label %63

63:                                               ; preds = %.thread90, %57, %53
  %.not83101 = phi i1 [ true, %.thread90 ], [ true, %57 ], [ false, %53 ]
  %.05996 = phi i64 [ 0, %.thread90 ], [ 0, %57 ], [ %56, %53 ]
  %64 = getelementptr inbounds i8, ptr %0, i64 136
  %65 = load ptr, ptr %64, align 8, !tbaa !27
  %66 = load ptr, ptr %13, align 8, !tbaa !14
  %67 = tail call i64 %65(ptr noundef %66) #8
  %.not85 = icmp eq i64 %67, 0
  %brmerge = or i1 %.not83101, %.not85
  %.059.mux = select i1 %.not85, i64 %.05996, i64 %67
  br i1 %brmerge, label %69, label %68

68:                                               ; preds = %63
  tail call void @iwlog3(i32 noundef 0, i64 noundef %67, ptr noundef nonnull @.str.3, i32 noundef 305, ptr noundef nonnull @.str.4) #8
  br label %69

69:                                               ; preds = %63, %68
  %.160 = phi i64 [ %.05996, %68 ], [ %.059.mux, %63 ]
  %.not86 = icmp eq i64 %.160, 0
  br i1 %.not86, label %70, label %76

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

74:                                               ; preds = %70
  %75 = tail call i64 @iwjsreg_sync(ptr noundef nonnull %0)
  br label %76

76:                                               ; preds = %16, %74, %70, %69, %3, %4
  %.1 = phi i64 [ 70017, %4 ], [ 70017, %3 ], [ %19, %16 ], [ %.160, %69 ], [ %75, %74 ], [ 0, %70 ]
  ret i64 %.1
}

; 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: nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write)
declare void @llvm.assume(i1 noundef) #7

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 = { nocallback nofree nosync nounwind willreturn memory(inaccessiblemem: write) }
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, !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 = !{!6, !12, i64 156}
!25 = !{!18, !11, i64 48}
!26 = !{!11, !11, i64 0}
!27 = !{!6, !7, i64 136}
!28 = !{!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