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

@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.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: nounwind uwtable
declare hidden zeroext i1 @iwref_unref(ptr noundef) #4

; 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
define dso_local i64 @iwjsreg_sync(ptr noundef %0) #4 {
  %2 = alloca i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = icmp ne ptr %11, null
  br i1 %12, label %14, label %13

13:                                               ; preds = %1
  store i64 70017, ptr %2, align 8
  br label %218

14:                                               ; preds = %1
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.iwjsreg, ptr %15, i32 0, i32 1
  %17 = load ptr, ptr %16, align 8, !tbaa !9
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %25

19:                                               ; preds = %14
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.iwjsreg, ptr %20, i32 0, i32 11
  %22 = load i32, ptr %21, align 8, !tbaa !14
  %23 = and i32 %22, 4
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %26

25:                                               ; preds = %19, %14
  store i64 0, ptr %2, align 8
  br label %218

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

41:                                               ; preds = %26
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.iwjsreg, ptr %42, i32 0, i32 8
  %44 = load ptr, ptr %43, align 8, !tbaa !17
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.iwjsreg, ptr %45, i32 0, i32 10
  %47 = load ptr, ptr %46, align 8, !tbaa !18
  %48 = call i64 %44(ptr noundef %47)
  store i64 %48, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %217

49:                                               ; preds = %26
  %50 = load ptr, ptr %3, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.iwjsreg, ptr %50, i32 0, i32 6
  call void @iwref_ref(ptr noundef %51)
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.iwjsreg, ptr %52, i32 0, i32 12
  %54 = load i8, ptr %53, align 4, !tbaa !19, !range !20, !noundef !21
  %55 = trunc i8 %54 to i1
  br i1 %55, label %68, label %56

56:                                               ; preds = %49
  %57 = load ptr, ptr %3, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.iwjsreg, ptr %57, i32 0, i32 9
  %59 = load ptr, ptr %58, align 8, !tbaa !22
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.iwjsreg, ptr %60, i32 0, i32 10
  %62 = load ptr, ptr %61, align 8, !tbaa !18
  %63 = call i64 %59(ptr noundef %62)
  store i64 %63, ptr %4, align 8, !tbaa !15
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.iwjsreg, ptr %64, i32 0, i32 6
  %66 = call zeroext i1 @iwref_unref(ptr noundef %65)
  %67 = load i64, ptr %4, align 8, !tbaa !15
  store i64 %67, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %217

68:                                               ; preds = %49
  %69 = load ptr, ptr %3, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.iwjsreg, ptr %69, i32 0, i32 3
  %71 = load ptr, ptr %70, align 8, !tbaa !23
  %72 = call noalias ptr @fopen(ptr noundef %71, ptr noundef @.str.2)
  store ptr %72, ptr %6, align 8, !tbaa !5
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = icmp ne ptr %73, null
  br i1 %74, label %79, label %75

75:                                               ; preds = %68
  %76 = call ptr @__errno_location() #7
  %77 = load i32, ptr %76, align 4, !tbaa !24
  %78 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %77)
  store i64 %78, ptr %4, align 8, !tbaa !15
  br label %179

79:                                               ; preds = %68
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.iwjsreg, ptr %80, i32 0, i32 11
  %82 = load i32, ptr %81, align 8, !tbaa !14
  %83 = and i32 %82, 1
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %122

85:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %86 = load ptr, ptr %3, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.iwjsreg, ptr %86, i32 0, i32 1
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = call i64 @jbl_from_node(ptr noundef %5, ptr noundef %88)
  store i64 %89, ptr %4, align 8, !tbaa !15
  %90 = load i64, ptr %4, align 8, !tbaa !15
  %91 = icmp ne i64 %90, 0
  %92 = xor i1 %91, true
  %93 = xor i1 %92, true
  %94 = zext i1 %93 to i32
  %95 = sext i32 %94 to i64
  %96 = call i64 @llvm.expect.i64(i64 %95, i64 0)
  %97 = icmp ne i64 %96, 0
  br i1 %97, label %98, label %99

98:                                               ; preds = %85
  store i32 2, ptr %7, align 4
  br label %119

99:                                               ; preds = %85
  %100 = load ptr, ptr %5, align 8, !tbaa !5
  %101 = call i64 @jbl_as_buf(ptr noundef %100, ptr noundef %8, ptr noundef %9)
  store i64 %101, ptr %4, align 8, !tbaa !15
  %102 = load i64, ptr %4, align 8, !tbaa !15
  %103 = icmp ne i64 %102, 0
  %104 = xor i1 %103, true
  %105 = xor i1 %104, true
  %106 = zext i1 %105 to i32
  %107 = sext i32 %106 to i64
  %108 = call i64 @llvm.expect.i64(i64 %107, i64 0)
  %109 = icmp ne i64 %108, 0
  br i1 %109, label %110, label %111

110:                                              ; preds = %99
  store i32 2, ptr %7, align 4
  br label %119

111:                                              ; preds = %99
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = load i64, ptr %9, align 8, !tbaa !15
  %114 = load ptr, ptr %6, align 8, !tbaa !5
  %115 = call i64 @fwrite(ptr noundef %112, i64 noundef %113, i64 noundef 1, ptr noundef %114)
  %116 = icmp ne i64 %115, 1
  br i1 %116, label %117, label %118

117:                                              ; preds = %111
  store i64 70026, ptr %4, align 8, !tbaa !15
  store i32 2, ptr %7, align 4
  br label %119

118:                                              ; preds = %111
  store i32 0, ptr %7, align 4
  br label %119

119:                                              ; preds = %118, %117, %110, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %120 = load i32, ptr %7, align 4
  switch i32 %120, label %217 [
    i32 0, label %121
    i32 2, label %179
  ]

121:                                              ; preds = %119
  br label %138

122:                                              ; preds = %79
  %123 = load ptr, ptr %3, align 8, !tbaa !5
  %124 = getelementptr inbounds %struct.iwjsreg, ptr %123, i32 0, i32 1
  %125 = load ptr, ptr %124, align 8, !tbaa !9
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = call i64 @jbn_as_json(ptr noundef %125, ptr noundef @jbl_fstream_json_printer, ptr noundef %126, i32 noundef 5)
  store i64 %127, ptr %4, align 8, !tbaa !15
  %128 = load i64, ptr %4, align 8, !tbaa !15
  %129 = icmp ne i64 %128, 0
  %130 = xor i1 %129, true
  %131 = xor i1 %130, true
  %132 = zext i1 %131 to i32
  %133 = sext i32 %132 to i64
  %134 = call i64 @llvm.expect.i64(i64 %133, i64 0)
  %135 = icmp ne i64 %134, 0
  br i1 %135, label %136, label %137

136:                                              ; preds = %122
  br label %179

137:                                              ; preds = %122
  br label %138

138:                                              ; preds = %137, %121
  %139 = load ptr, ptr %6, align 8, !tbaa !5
  %140 = call i32 @fflush(ptr noundef %139)
  %141 = icmp slt i32 %140, 0
  br i1 %141, label %142, label %146

142:                                              ; preds = %138
  %143 = call ptr @__errno_location() #7
  %144 = load i32, ptr %143, align 4, !tbaa !24
  %145 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %144)
  store i64 %145, ptr %4, align 8, !tbaa !15
  br label %179

146:                                              ; preds = %138
  %147 = load ptr, ptr %6, align 8, !tbaa !5
  %148 = call i32 @fileno(ptr noundef %147) #6
  %149 = call i32 @fdatasync(i32 noundef %148)
  %150 = icmp slt i32 %149, 0
  br i1 %150, label %151, label %155

151:                                              ; preds = %146
  %152 = call ptr @__errno_location() #7
  %153 = load i32, ptr %152, align 4, !tbaa !24
  %154 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %153)
  store i64 %154, ptr %4, align 8, !tbaa !15
  br label %179

155:                                              ; preds = %146
  %156 = load ptr, ptr %6, align 8, !tbaa !5
  %157 = call i32 @fclose(ptr noundef %156)
  %158 = icmp slt i32 %157, 0
  br i1 %158, label %159, label %163

159:                                              ; preds = %155
  %160 = call ptr @__errno_location() #7
  %161 = load i32, ptr %160, align 4, !tbaa !24
  %162 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %161)
  store i64 %162, ptr %4, align 8, !tbaa !15
  br label %179

163:                                              ; preds = %155
  store ptr null, ptr %6, align 8, !tbaa !5
  %164 = load ptr, ptr %3, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.iwjsreg, ptr %164, i32 0, i32 3
  %166 = load ptr, ptr %165, align 8, !tbaa !23
  %167 = load ptr, ptr %3, align 8, !tbaa !5
  %168 = getelementptr inbounds %struct.iwjsreg, ptr %167, i32 0, i32 2
  %169 = load ptr, ptr %168, align 8, !tbaa !25
  %170 = call i32 @rename(ptr noundef %166, ptr noundef %169) #6
  %171 = icmp slt i32 %170, 0
  br i1 %171, label %172, label %176

172:                                              ; preds = %163
  %173 = call ptr @__errno_location() #7
  %174 = load i32, ptr %173, align 4, !tbaa !24
  %175 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %174)
  store i64 %175, ptr %4, align 8, !tbaa !15
  br label %179

176:                                              ; preds = %163
  %177 = load ptr, ptr %3, align 8, !tbaa !5
  %178 = getelementptr inbounds %struct.iwjsreg, ptr %177, i32 0, i32 12
  store i8 0, ptr %178, align 4, !tbaa !19
  br label %179

179:                                              ; preds = %176, %172, %159, %151, %142, %136, %119, %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %180 = load ptr, ptr %3, align 8, !tbaa !5
  %181 = getelementptr inbounds %struct.iwjsreg, ptr %180, i32 0, i32 9
  %182 = load ptr, ptr %181, align 8, !tbaa !22
  %183 = load ptr, ptr %3, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.iwjsreg, ptr %183, i32 0, i32 10
  %185 = load ptr, ptr %184, align 8, !tbaa !18
  %186 = call i64 %182(ptr noundef %185)
  store i64 %186, ptr %10, align 8, !tbaa !15
  %187 = load i64, ptr %10, align 8, !tbaa !15
  %188 = icmp ne i64 %187, 0
  br i1 %188, label %189, label %197

189:                                              ; preds = %179
  %190 = load i64, ptr %4, align 8, !tbaa !15
  %191 = icmp ne i64 %190, 0
  br i1 %191, label %194, label %192

192:                                              ; preds = %189
  %193 = load i64, ptr %10, align 8, !tbaa !15
  store i64 %193, ptr %4, align 8, !tbaa !15
  br label %196

194:                                              ; preds = %189
  %195 = load i64, ptr %10, align 8, !tbaa !15
  call void @iwlog3(i32 noundef 0, i64 noundef %195, ptr noundef @.str.3, i32 noundef 210, ptr noundef @.str.4)
  br label %196

196:                                              ; preds = %194, %192
  br label %197

197:                                              ; preds = %196, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %198 = load ptr, ptr %3, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.iwjsreg, ptr %198, i32 0, i32 6
  %200 = call zeroext i1 @iwref_unref(ptr noundef %199)
  %201 = load ptr, ptr %5, align 8, !tbaa !5
  %202 = icmp ne ptr %201, null
  br i1 %202, label %203, label %204

203:                                              ; preds = %197
  call void @jbl_destroy(ptr noundef %5)
  br label %204

204:                                              ; preds = %203, %197
  %205 = load ptr, ptr %6, align 8, !tbaa !5
  %206 = icmp ne ptr %205, null
  br i1 %206, label %207, label %210

207:                                              ; preds = %204
  %208 = load ptr, ptr %6, align 8, !tbaa !5
  %209 = call i32 @fclose(ptr noundef %208)
  br label %210

210:                                              ; preds = %207, %204
  %211 = load i64, ptr %4, align 8, !tbaa !15
  %212 = icmp ne i64 %211, 0
  br i1 %212, label %213, label %215

213:                                              ; preds = %210
  %214 = load i64, ptr %4, align 8, !tbaa !15
  call void @iwlog3(i32 noundef 0, i64 noundef %214, ptr noundef @.str.3, i32 noundef 220, ptr noundef @.str.4)
  br label %215

215:                                              ; preds = %213, %210
  %216 = load i64, ptr %4, align 8, !tbaa !15
  store i64 %216, ptr %2, align 8
  store i32 1, ptr %7, align 4
  br label %217

217:                                              ; preds = %215, %119, %56, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %218

218:                                              ; preds = %217, %25, %13
  %219 = load i64, ptr %2, align 8
  ret i64 %219
}

; Function Attrs: nounwind uwtable
declare hidden void @iwref_ref(ptr noundef) #4

declare noalias ptr @fopen(ptr noundef, ptr noundef) #1

declare i64 @jbl_from_node(ptr noundef, ptr noundef) #1

declare i64 @jbl_as_buf(ptr noundef, ptr noundef, ptr noundef) #1

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #1

declare i64 @jbn_as_json(ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

declare i64 @jbl_fstream_json_printer(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, ptr noundef) #1

declare i32 @fflush(ptr noundef) #1

declare i32 @fdatasync(i32 noundef) #1

; Function Attrs: nounwind
declare i32 @fileno(ptr noundef) #5

declare i32 @fclose(ptr noundef) #1

; Function Attrs: nounwind
declare i32 @rename(ptr noundef, ptr noundef) #5

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

declare void @jbl_destroy(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 "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 }
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, !6, i64 8}
!10 = !{!"iwjsreg", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !7, i64 40, !11, i64 96, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !12, i64 152, !13, i64 156}
!11 = !{!"iwref_holder", !6, i64 0, !7, i64 8, !6, i64 16}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !12, i64 152}
!15 = !{!16, !16, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!10, !6, i64 128}
!18 = !{!10, !6, i64 144}
!19 = !{!10, !13, i64 156}
!20 = !{i8 0, i8 2}
!21 = !{}
!22 = !{!10, !6, i64 136}
!23 = !{!10, !6, i64 24}
!24 = !{!12, !12, i64 0}
!25 = !{!10, !6, i64 16}


; 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.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.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: mustprogress 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) local_unnamed_addr #1

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

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @iwref_unref(ptr 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) #0

; Function Attrs: nounwind uwtable
define dso_local i64 @iwjsreg_sync(ptr noundef %0) local_unnamed_addr #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %108, label %5

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 8
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %.not55 = icmp eq ptr %7, null
  br i1 %.not55, label %108, label %8

8:                                                ; preds = %5
  %9 = getelementptr inbounds i8, ptr %0, i64 152
  %10 = load i32, ptr %9, align 8, !tbaa !13
  %11 = and i32 %10, 4
  %.not56 = icmp eq i32 %11, 0
  br i1 %.not56, label %12, label %108

12:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  store ptr null, ptr %2, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 128
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %0, i64 144
  %16 = load ptr, ptr %15, align 8, !tbaa !16
  %17 = tail call i64 %14(ptr noundef %16) #5
  %.not57 = icmp eq i64 %17, 0
  br i1 %.not57, label %22, label %18, !prof !17

18:                                               ; preds = %12
  %19 = load ptr, ptr %13, align 8, !tbaa !15
  %20 = load ptr, ptr %15, align 8, !tbaa !16
  %21 = tail call i64 %19(ptr noundef %20) #5
  br label %107

22:                                               ; preds = %12
  %23 = getelementptr inbounds i8, ptr %0, i64 96
  tail call void @iwref_ref(ptr noundef nonnull %23)
  %24 = getelementptr inbounds i8, ptr %0, i64 156
  %25 = load i8, ptr %24, align 4, !tbaa !18, !range !19, !noundef !20
  %26 = trunc nuw i8 %25 to i1
  br i1 %26, label %33, label %27

27:                                               ; preds = %22
  %28 = getelementptr inbounds i8, ptr %0, i64 136
  %29 = load ptr, ptr %28, align 8, !tbaa !21
  %30 = load ptr, ptr %15, align 8, !tbaa !16
  %31 = tail call i64 %29(ptr noundef %30) #5
  %32 = tail call zeroext i1 @iwref_unref(ptr noundef nonnull %23)
  br label %107

33:                                               ; preds = %22
  %34 = getelementptr inbounds i8, ptr %0, i64 24
  %35 = load ptr, ptr %34, align 8, !tbaa !22
  %36 = tail call noalias ptr @fopen(ptr noundef %35, ptr noundef nonnull @.str.2)
  %.not58 = icmp eq ptr %36, null
  br i1 %.not58, label %37, label %41

37:                                               ; preds = %33
  %38 = tail call ptr @__errno_location() #6
  %39 = load i32, ptr %38, align 4, !tbaa !23
  %40 = tail call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %39) #5
  br label %91

41:                                               ; preds = %33
  %42 = load i32, ptr %9, align 8, !tbaa !13
  %43 = and i32 %42, 1
  %.not59 = icmp eq i32 %43, 0
  br i1 %.not59, label %55, label %44

44:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call i64 @jbl_from_node(ptr noundef nonnull %2, ptr noundef %45) #5
  %.not61 = icmp eq i64 %46, 0
  br i1 %.not61, label %47, label %.thread, !prof !17

47:                                               ; preds = %44
  %48 = load ptr, ptr %2, align 8, !tbaa !14
  %49 = call i64 @jbl_as_buf(ptr noundef %48, ptr noundef nonnull %3, ptr noundef nonnull %4) #5
  %.not62 = icmp eq i64 %49, 0
  br i1 %.not62, label %50, label %.thread, !prof !17

50:                                               ; preds = %47
  %51 = load ptr, ptr %3, align 8, !tbaa !14
  %52 = load i64, ptr %4, align 8, !tbaa !24
  %53 = call i64 @fwrite(ptr noundef %51, i64 noundef %52, i64 noundef 1, ptr noundef nonnull %36)
  %.not63 = icmp eq i64 %53, 1
  br i1 %.not63, label %54, label %.thread

.thread:                                          ; preds = %44, %47, %50
  %.044.ph = phi i64 [ 70026, %50 ], [ %49, %47 ], [ %46, %44 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %91

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br label %58

55:                                               ; preds = %41
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = tail call i64 @jbn_as_json(ptr noundef %56, ptr noundef nonnull @jbl_fstream_json_printer, ptr noundef nonnull %36, i32 noundef 5) #5
  %.not60 = icmp eq i64 %57, 0
  br i1 %.not60, label %58, label %91, !prof !17

58:                                               ; preds = %54, %55
  %59 = call i32 @fflush(ptr noundef nonnull %36)
  %60 = icmp slt i32 %59, 0
  br i1 %60, label %61, label %65

61:                                               ; preds = %58
  %62 = tail call ptr @__errno_location() #6
  %63 = load i32, ptr %62, align 4, !tbaa !23
  %64 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %63) #5
  br label %91

65:                                               ; preds = %58
  %66 = call i32 @fileno(ptr noundef nonnull %36) #5
  %67 = call i32 @fdatasync(i32 noundef %66) #5
  %68 = icmp slt i32 %67, 0
  br i1 %68, label %69, label %73

69:                                               ; preds = %65
  %70 = tail call ptr @__errno_location() #6
  %71 = load i32, ptr %70, align 4, !tbaa !23
  %72 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %71) #5
  br label %91

73:                                               ; preds = %65
  %74 = call i32 @fclose(ptr noundef nonnull %36)
  %75 = icmp slt i32 %74, 0
  br i1 %75, label %76, label %80

76:                                               ; preds = %73
  %77 = tail call ptr @__errno_location() #6
  %78 = load i32, ptr %77, align 4, !tbaa !23
  %79 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %78) #5
  br label %91

80:                                               ; preds = %73
  %81 = load ptr, ptr %34, align 8, !tbaa !22
  %82 = getelementptr inbounds i8, ptr %0, i64 16
  %83 = load ptr, ptr %82, align 8, !tbaa !26
  %84 = call i32 @rename(ptr noundef %81, ptr noundef %83) #5
  %85 = icmp slt i32 %84, 0
  br i1 %85, label %86, label %90

86:                                               ; preds = %80
  %87 = tail call ptr @__errno_location() #6
  %88 = load i32, ptr %87, align 4, !tbaa !23
  %89 = call i64 @iwrc_set_errno(i64 noundef 70001, i32 noundef %88) #5
  br label %91

90:                                               ; preds = %80
  store i8 0, ptr %24, align 4, !tbaa !18
  br label %91

91:                                               ; preds = %.thread, %55, %90, %86, %76, %69, %61, %37
  %.2 = phi i64 [ %64, %61 ], [ %72, %69 ], [ %79, %76 ], [ %89, %86 ], [ 0, %90 ], [ %57, %55 ], [ %40, %37 ], [ %.044.ph, %.thread ]
  %.043 = phi ptr [ %36, %61 ], [ %36, %69 ], [ %36, %76 ], [ null, %86 ], [ null, %90 ], [ %36, %55 ], [ null, %37 ], [ %36, %.thread ]
  %92 = getelementptr inbounds i8, ptr %0, i64 136
  %93 = load ptr, ptr %92, align 8, !tbaa !21
  %94 = load ptr, ptr %15, align 8, !tbaa !16
  %95 = call i64 %93(ptr noundef %94) #5
  %.not64 = icmp eq i64 %95, 0
  br i1 %.not64, label %98, label %96

96:                                               ; preds = %91
  %.not65 = icmp eq i64 %.2, 0
  br i1 %.not65, label %98, label %97

97:                                               ; preds = %96
  call void @iwlog3(i32 noundef 0, i64 noundef %95, ptr noundef nonnull @.str.3, i32 noundef 210, ptr noundef nonnull @.str.4) #5
  br label %98

98:                                               ; preds = %96, %97, %91
  %.3 = phi i64 [ %.2, %97 ], [ %.2, %91 ], [ %95, %96 ]
  %99 = call zeroext i1 @iwref_unref(ptr noundef nonnull %23)
  %100 = load ptr, ptr %2, align 8, !tbaa !14
  %.not66 = icmp eq ptr %100, null
  br i1 %.not66, label %102, label %101

101:                                              ; preds = %98
  call void @jbl_destroy(ptr noundef nonnull %2) #5
  br label %102

102:                                              ; preds = %101, %98
  %.not67 = icmp eq ptr %.043, null
  br i1 %.not67, label %105, label %103

103:                                              ; preds = %102
  %104 = call i32 @fclose(ptr noundef nonnull %.043)
  br label %105

105:                                              ; preds = %103, %102
  %.not68 = icmp eq i64 %.3, 0
  br i1 %.not68, label %107, label %106

106:                                              ; preds = %105
  call void @iwlog3(i32 noundef 0, i64 noundef %.3, ptr noundef nonnull @.str.3, i32 noundef 220, ptr noundef nonnull @.str.4) #5
  br label %107

107:                                              ; preds = %105, %106, %27, %18
  %.0 = phi i64 [ %21, %18 ], [ %31, %27 ], [ %.3, %106 ], [ 0, %105 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  br label %108

108:                                              ; preds = %5, %8, %1, %107
  %.1 = phi i64 [ %.0, %107 ], [ 70017, %1 ], [ 0, %8 ], [ 0, %5 ]
  ret i64 %.1
}

; Function Attrs: nounwind uwtable
declare hidden void @iwref_ref(ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #4

declare i64 @jbn_as_json(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare i64 @jbl_fstream_json_printer(ptr noundef, i32 noundef, i8 noundef signext, i32 noundef, ptr noundef) #1

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #4

declare i32 @fdatasync(i32 noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fileno(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @rename(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #4

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

declare void @jbl_destroy(ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { 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 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 #4 = { nofree 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 = { nounwind }
attributes #6 = { 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, !11, i64 152}
!14 = !{!7, !7, i64 0}
!15 = !{!6, !7, i64 128}
!16 = !{!6, !7, i64 144}
!17 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!18 = !{!6, !12, i64 156}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!6, !7, i64 136}
!22 = !{!6, !7, i64 24}
!23 = !{!11, !11, i64 0}
!24 = !{!25, !25, i64 0}
!25 = !{!"long", !8, i64 0}
!26 = !{!6, !7, i64 16}


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