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

; 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.jbl_node = type { ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i32, %union.anon.0 }
%union.anon.0 = type { ptr }
%struct.jbl_ptr = type { i64, i32, i32, [1 x ptr] }

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

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

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

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

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

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local i64 @jbl_ptr_alloc(ptr noundef, ptr noundef) #7

; Function Attrs: nounwind uwtable
declare dso_local i64 @jbl_ptr_alloc_pool(ptr noundef, ptr noundef, ptr noundef) #7

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @jbn_merge_patch_create(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr noundef %3) #7 {
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, 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 i32, align 4
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  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
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp eq ptr %18, null
  br i1 %19, label %36, label %20

20:                                               ; preds = %4
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = load i8, ptr %21, align 1, !tbaa !11
  %23 = sext i8 %22 to i32
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %36, label %25

25:                                               ; preds = %20
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = sext i8 %27 to i32
  %29 = icmp eq i32 %28, 47
  br i1 %29, label %30, label %39

30:                                               ; preds = %25
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds i8, ptr %31, i64 1
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %36, label %39

36:                                               ; preds = %30, %20, %4
  %37 = load ptr, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %37, ptr %38, align 8, !tbaa !5
  store i64 0, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %165

39:                                               ; preds = %30, %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store ptr null, ptr %12, align 8, !tbaa !5
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %46

42:                                               ; preds = %39
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = call i64 @jbl_ptr_alloc_pool(ptr noundef %43, ptr noundef %12, ptr noundef %44)
  br label %49

46:                                               ; preds = %39
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = call i64 @jbl_ptr_alloc(ptr noundef %47, ptr noundef %12)
  br label %49

49:                                               ; preds = %46, %42
  %50 = phi i64 [ %45, %42 ], [ %48, %46 ]
  store i64 %50, ptr %10, align 8, !tbaa !9
  %51 = load i64, ptr %10, align 8, !tbaa !9
  %52 = icmp ne i64 %51, 0
  %53 = xor i1 %52, true
  %54 = xor i1 %53, true
  %55 = zext i1 %54 to i32
  %56 = sext i32 %55 to i64
  %57 = call i64 @llvm.expect.i64(i64 %56, i64 0)
  %58 = icmp ne i64 %57, 0
  br i1 %58, label %59, label %60

59:                                               ; preds = %49
  br label %157

60:                                               ; preds = %49
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = icmp ne ptr %61, null
  br i1 %62, label %63, label %66

63:                                               ; preds = %60
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = call ptr @iwpool_calloc(i64 noundef 64, ptr noundef %64)
  br label %68

66:                                               ; preds = %60
  %67 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  br label %68

68:                                               ; preds = %66, %63
  %69 = phi ptr [ %65, %63 ], [ %67, %66 ]
  store ptr %69, ptr %13, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %75, label %71

71:                                               ; preds = %68
  %72 = call ptr @__errno_location() #10
  %73 = load i32, ptr %72, align 4, !tbaa !12
  %74 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %73)
  store i64 %74, ptr %10, align 8, !tbaa !9
  br label %157

75:                                               ; preds = %68
  %76 = load ptr, ptr %13, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.jbl_node, ptr %76, i32 0, i32 8
  store i32 6, ptr %77, align 4, !tbaa !14
  %78 = load ptr, ptr %13, align 8, !tbaa !5
  store ptr %78, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !12
  br label %79

79:                                               ; preds = %149, %75
  %80 = load i32, ptr %15, align 4, !tbaa !12
  %81 = load ptr, ptr %12, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.jbl_ptr, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 8, !tbaa !16
  %84 = icmp slt i32 %80, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %79
  store i32 3, ptr %11, align 4
  br label %152

86:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #8
  %87 = load ptr, ptr %12, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.jbl_ptr, ptr %87, i32 0, i32 3
  %89 = load i32, ptr %15, align 4, !tbaa !12
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1 x ptr], ptr %88, i64 0, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  store ptr %92, ptr %17, align 8, !tbaa !5
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %104

95:                                               ; preds = %86
  %96 = load i32, ptr %15, align 4, !tbaa !12
  %97 = load ptr, ptr %12, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.jbl_ptr, ptr %97, i32 0, i32 1
  %99 = load i32, ptr %98, align 8, !tbaa !16
  %100 = sub nsw i32 %99, 1
  %101 = icmp eq i32 %96, %100
  br i1 %101, label %102, label %104

102:                                              ; preds = %95
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %103, ptr %16, align 8, !tbaa !5
  br label %122

104:                                              ; preds = %95, %86
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = icmp ne ptr %105, null
  br i1 %106, label %107, label %110

107:                                              ; preds = %104
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = call ptr @iwpool_calloc(i64 noundef 64, ptr noundef %108)
  br label %112

110:                                              ; preds = %104
  %111 = call noalias ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  br label %112

112:                                              ; preds = %110, %107
  %113 = phi ptr [ %109, %107 ], [ %111, %110 ]
  store ptr %113, ptr %16, align 8, !tbaa !5
  %114 = icmp ne ptr %113, null
  br i1 %114, label %119, label %115

115:                                              ; preds = %112
  %116 = call ptr @__errno_location() #10
  %117 = load i32, ptr %116, align 4, !tbaa !12
  %118 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %117)
  store i64 %118, ptr %10, align 8, !tbaa !9
  store i32 2, ptr %11, align 4
  br label %146

119:                                              ; preds = %112
  %120 = load ptr, ptr %16, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.jbl_node, ptr %120, i32 0, i32 8
  store i32 6, ptr %121, align 4, !tbaa !14
  br label %122

122:                                              ; preds = %119, %102
  %123 = load ptr, ptr %16, align 8, !tbaa !5
  %124 = load ptr, ptr %14, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.jbl_node, ptr %124, i32 0, i32 6
  store ptr %123, ptr %125, align 8, !tbaa !18
  %126 = load ptr, ptr %14, align 8, !tbaa !5
  %127 = load ptr, ptr %16, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.jbl_node, ptr %127, i32 0, i32 2
  store ptr %126, ptr %128, align 8, !tbaa !19
  %129 = load ptr, ptr %8, align 8, !tbaa !5
  %130 = icmp ne ptr %129, null
  br i1 %130, label %131, label %133

131:                                              ; preds = %122
  %132 = load ptr, ptr %17, align 8, !tbaa !5
  br label %136

133:                                              ; preds = %122
  %134 = load ptr, ptr %17, align 8, !tbaa !5
  %135 = call noalias ptr @strdup(ptr noundef %134) #8
  br label %136

136:                                              ; preds = %133, %131
  %137 = phi ptr [ %132, %131 ], [ %135, %133 ]
  %138 = load ptr, ptr %16, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.jbl_node, ptr %138, i32 0, i32 3
  store ptr %137, ptr %139, align 8, !tbaa !20
  %140 = load ptr, ptr %17, align 8, !tbaa !5
  %141 = call i64 @strlen(ptr noundef %140) #11
  %142 = trunc i64 %141 to i32
  %143 = load ptr, ptr %16, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.jbl_node, ptr %143, i32 0, i32 4
  store i32 %142, ptr %144, align 8, !tbaa !21
  %145 = load ptr, ptr %16, align 8, !tbaa !5
  store ptr %145, ptr %14, align 8, !tbaa !5
  store i32 0, ptr %11, align 4
  br label %146

146:                                              ; preds = %136, %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  %147 = load i32, ptr %11, align 4
  switch i32 %147, label %152 [
    i32 0, label %148
  ]

148:                                              ; preds = %146
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %15, align 4, !tbaa !12
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %15, align 4, !tbaa !12
  br label %79, !llvm.loop !22

152:                                              ; preds = %146, %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %153 = load i32, ptr %11, align 4
  switch i32 %153, label %164 [
    i32 3, label %154
    i32 2, label %157
  ]

154:                                              ; preds = %152
  %155 = load ptr, ptr %13, align 8, !tbaa !5
  %156 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %155, ptr %156, align 8, !tbaa !5
  br label %157

157:                                              ; preds = %154, %152, %71, %59
  %158 = load ptr, ptr %8, align 8, !tbaa !5
  %159 = icmp ne ptr %158, null
  br i1 %159, label %162, label %160

160:                                              ; preds = %157
  %161 = load ptr, ptr %12, align 8, !tbaa !5
  call void @free(ptr noundef %161) #8
  br label %162

162:                                              ; preds = %160, %157
  %163 = load i64, ptr %10, align 8, !tbaa !9
  store i64 %163, ptr %5, align 8
  store i32 1, ptr %11, align 4
  br label %164

164:                                              ; preds = %162, %152
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %165

165:                                              ; preds = %164, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #8
  %166 = load i64, ptr %5, align 8
  ret i64 %166
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind willreturn memory(none) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(none) }
attributes #6 = { nounwind 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 #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { nounwind willreturn memory(read) }

!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 = !{!7, !7, i64 0}
!12 = !{!13, !13, i64 0}
!13 = !{!"int", !7, i64 0}
!14 = !{!15, !13, i64 52}
!15 = !{!"jbl_node", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !13, i64 32, !13, i64 36, !6, i64 40, !13, i64 48, !13, i64 52, !7, i64 56}
!16 = !{!17, !13, i64 8}
!17 = !{!"jbl_ptr", !10, i64 0, !13, i64 8, !13, i64 12, !7, i64 16}
!18 = !{!15, !6, i64 40}
!19 = !{!15, !6, i64 16}
!20 = !{!15, !6, i64 24}
!21 = !{!15, !13, i64 32}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


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

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

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

; 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 #1

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

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() 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 memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: nounwind uwtable
declare dso_local i64 @jbl_ptr_alloc(ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: nounwind uwtable
declare dso_local i64 @jbl_ptr_alloc_pool(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

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

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

; Function Attrs: nounwind uwtable
define dso_local i64 @jbn_merge_patch_create(ptr noundef %0, ptr noundef %1, ptr noundef %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #6 {
  %5 = alloca ptr, align 8
  %6 = icmp eq ptr %0, null
  br i1 %6, label %13, label %7

7:                                                ; preds = %4
  %8 = load i8, ptr %0, align 1, !tbaa !5
  switch i8 %8, label %14 [
    i8 0, label %13
    i8 47, label %9
  ]

9:                                                ; preds = %7
  %10 = getelementptr inbounds i8, ptr %0, i64 1
  %11 = load i8, ptr %10, align 1, !tbaa !5
  %12 = icmp eq i8 %11, 0
  br i1 %12, label %13, label %14

13:                                               ; preds = %7, %9, %4
  store ptr %1, ptr %3, align 8, !tbaa !8
  br label %138

14:                                               ; preds = %7, %9
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store ptr null, ptr %5, align 8, !tbaa !8
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %15, label %.thread

15:                                               ; preds = %14
  %16 = call i64 @jbl_ptr_alloc(ptr noundef nonnull %0, ptr noundef nonnull %5)
  %.not60 = icmp eq i64 %16, 0
  br i1 %.not60, label %19, label %.thread81, !prof !10

.thread:                                          ; preds = %14
  %17 = call i64 @jbl_ptr_alloc_pool(ptr noundef nonnull %0, ptr noundef nonnull %5, ptr noundef nonnull %2)
  %.not6065 = icmp eq i64 %17, 0
  br i1 %.not6065, label %.thread66, label %.thread78, !prof !10

.thread66:                                        ; preds = %.thread
  %18 = call ptr @iwpool_calloc(i64 noundef 64, ptr noundef nonnull %2) #8
  br label %21

19:                                               ; preds = %15
  %20 = call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  br label %21

21:                                               ; preds = %19, %.thread66
  %22 = phi ptr [ %18, %.thread66 ], [ %20, %19 ]
  %.not61 = icmp eq ptr %22, null
  br i1 %.not61, label %23, label %27

23:                                               ; preds = %21
  %24 = tail call ptr @__errno_location() #10
  %25 = load i32, ptr %24, align 4, !tbaa !11
  %26 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %25) #8
  br label %136

27:                                               ; preds = %21
  %28 = getelementptr inbounds i8, ptr %22, i64 52
  store i32 6, ptr %28, align 4, !tbaa !13
  %29 = load ptr, ptr %5, align 8
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !15
  %32 = icmp sgt i32 %31, 0
  br i1 %32, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %27
  %.not62.not = icmp eq ptr %1, null
  br i1 %.not, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph
  %33 = getelementptr inbounds i8, ptr %29, i64 16
  %34 = load ptr, ptr %33, align 8, !tbaa !8
  br i1 %.not62.not, label %.lr.ph.split.us.split.us.preheader, label %.lr.ph.split.us.split.preheader

.lr.ph.split.us.split.preheader:                  ; preds = %.lr.ph.split.us
  %35 = add nsw i32 %31, -1
  %36 = zext nneg i32 %35 to i64
  %37 = icmp eq i32 %35, 0
  br i1 %37, label %42, label %38

38:                                               ; preds = %.lr.ph.split.us.split.preheader
  %39 = call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  %.not63.us.peel = icmp eq ptr %39, null
  br i1 %.not63.us.peel, label %.split.us, label %40

40:                                               ; preds = %38
  %41 = getelementptr inbounds i8, ptr %39, i64 52
  store i32 6, ptr %41, align 4, !tbaa !13
  br label %42

42:                                               ; preds = %40, %.lr.ph.split.us.split.preheader
  %.041.us.peel = phi ptr [ %39, %40 ], [ %1, %.lr.ph.split.us.split.preheader ]
  %43 = getelementptr inbounds i8, ptr %22, i64 40
  store ptr %.041.us.peel, ptr %43, align 8, !tbaa !18
  %44 = getelementptr inbounds i8, ptr %.041.us.peel, i64 16
  store ptr %22, ptr %44, align 8, !tbaa !19
  %45 = call noalias ptr @strdup(ptr noundef %34) #8
  %46 = getelementptr inbounds i8, ptr %.041.us.peel, i64 24
  store ptr %45, ptr %46, align 8, !tbaa !20
  %47 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %34) #11
  %48 = trunc i64 %47 to i32
  %49 = getelementptr inbounds i8, ptr %.041.us.peel, i64 32
  store i32 %48, ptr %49, align 8, !tbaa !21
  %50 = zext nneg i32 %31 to i64
  %.not109 = icmp eq i32 %31, 1
  br i1 %.not109, label %._crit_edge, label %.lr.ph.split.us.split

.lr.ph.split.us.split.us.preheader:               ; preds = %.lr.ph.split.us
  %51 = call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  %.not63.us.us.peel = icmp eq ptr %51, null
  br i1 %.not63.us.us.peel, label %.split.us, label %52

52:                                               ; preds = %.lr.ph.split.us.split.us.preheader
  %53 = getelementptr inbounds i8, ptr %51, i64 52
  store i32 6, ptr %53, align 4, !tbaa !13
  %54 = getelementptr inbounds i8, ptr %22, i64 40
  store ptr %51, ptr %54, align 8, !tbaa !18
  %55 = getelementptr inbounds i8, ptr %51, i64 16
  store ptr %22, ptr %55, align 8, !tbaa !19
  %56 = call noalias ptr @strdup(ptr noundef %34) #8
  %57 = getelementptr inbounds i8, ptr %51, i64 24
  store ptr %56, ptr %57, align 8, !tbaa !20
  %58 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %34) #11
  %59 = trunc i64 %58 to i32
  %60 = getelementptr inbounds i8, ptr %51, i64 32
  store i32 %59, ptr %60, align 8, !tbaa !21
  %61 = zext nneg i32 %31 to i64
  %.not110 = icmp eq i32 %31, 1
  br i1 %.not110, label %._crit_edge, label %.lr.ph.split.us.split.us

.lr.ph.split.us.split.us:                         ; preds = %52, %65
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %65 ], [ 1, %52 ]
  %.04384.us.us = phi ptr [ %64, %65 ], [ %51, %52 ]
  %62 = getelementptr inbounds [1 x ptr], ptr %33, i64 0, i64 %indvars.iv105
  %63 = load ptr, ptr %62, align 8, !tbaa !8
  %64 = call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  %.not63.us.us = icmp eq ptr %64, null
  br i1 %.not63.us.us, label %.split.us, label %65

65:                                               ; preds = %.lr.ph.split.us.split.us
  %66 = getelementptr inbounds i8, ptr %64, i64 52
  store i32 6, ptr %66, align 4, !tbaa !13
  %67 = getelementptr inbounds i8, ptr %.04384.us.us, i64 40
  store ptr %64, ptr %67, align 8, !tbaa !18
  %68 = getelementptr inbounds i8, ptr %64, i64 16
  store ptr %.04384.us.us, ptr %68, align 8, !tbaa !19
  %69 = call noalias ptr @strdup(ptr noundef %63) #8
  %70 = getelementptr inbounds i8, ptr %64, i64 24
  store ptr %69, ptr %70, align 8, !tbaa !20
  %71 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %63) #11
  %72 = trunc i64 %71 to i32
  %73 = getelementptr inbounds i8, ptr %64, i64 32
  store i32 %72, ptr %73, align 8, !tbaa !21
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %74 = icmp ult i64 %indvars.iv.next106, %61
  br i1 %74, label %.lr.ph.split.us.split.us, label %._crit_edge, !llvm.loop !22

.lr.ph.split.us.split:                            ; preds = %42, %82
  %indvars.iv101 = phi i64 [ %indvars.iv.next102, %82 ], [ 1, %42 ]
  %.04384.us = phi ptr [ %.041.us, %82 ], [ %.041.us.peel, %42 ]
  %75 = getelementptr inbounds [1 x ptr], ptr %33, i64 0, i64 %indvars.iv101
  %76 = load ptr, ptr %75, align 8, !tbaa !8
  %77 = icmp eq i64 %indvars.iv101, %36
  br i1 %77, label %82, label %78

78:                                               ; preds = %.lr.ph.split.us.split
  %79 = call noalias dereferenceable_or_null(64) ptr @calloc(i64 noundef 1, i64 noundef 64) #9
  %.not63.us = icmp eq ptr %79, null
  br i1 %.not63.us, label %.split.us, label %80

80:                                               ; preds = %78
  %81 = getelementptr inbounds i8, ptr %79, i64 52
  store i32 6, ptr %81, align 4, !tbaa !13
  br label %82

82:                                               ; preds = %80, %.lr.ph.split.us.split
  %.041.us = phi ptr [ %79, %80 ], [ %1, %.lr.ph.split.us.split ]
  %83 = getelementptr inbounds i8, ptr %.04384.us, i64 40
  store ptr %.041.us, ptr %83, align 8, !tbaa !18
  %84 = getelementptr inbounds i8, ptr %.041.us, i64 16
  store ptr %.04384.us, ptr %84, align 8, !tbaa !19
  %85 = call noalias ptr @strdup(ptr noundef %76) #8
  %86 = getelementptr inbounds i8, ptr %.041.us, i64 24
  store ptr %85, ptr %86, align 8, !tbaa !20
  %87 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %76) #11
  %88 = trunc i64 %87 to i32
  %89 = getelementptr inbounds i8, ptr %.041.us, i64 32
  store i32 %88, ptr %89, align 8, !tbaa !21
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %90 = icmp ult i64 %indvars.iv.next102, %50
  br i1 %90, label %.lr.ph.split.us.split, label %._crit_edge, !llvm.loop !25

.lr.ph.split:                                     ; preds = %.lr.ph
  br i1 %.not62.not, label %.lr.ph.split.split.us, label %.lr.ph.split.split

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split, %96
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %96 ], [ 0, %.lr.ph.split ]
  %91 = phi ptr [ %104, %96 ], [ %29, %.lr.ph.split ]
  %.04384.us87 = phi ptr [ %95, %96 ], [ %22, %.lr.ph.split ]
  %92 = getelementptr inbounds i8, ptr %91, i64 16
  %93 = getelementptr inbounds [1 x ptr], ptr %92, i64 0, i64 %indvars.iv98
  %94 = load ptr, ptr %93, align 8, !tbaa !8
  %95 = call ptr @iwpool_calloc(i64 noundef 64, ptr noundef nonnull %2) #8
  %.not63.us89 = icmp eq ptr %95, null
  br i1 %.not63.us89, label %.split.us, label %96

96:                                               ; preds = %.lr.ph.split.split.us
  %97 = getelementptr inbounds i8, ptr %95, i64 52
  store i32 6, ptr %97, align 4, !tbaa !13
  %98 = getelementptr inbounds i8, ptr %.04384.us87, i64 40
  store ptr %95, ptr %98, align 8, !tbaa !18
  %99 = getelementptr inbounds i8, ptr %95, i64 16
  store ptr %.04384.us87, ptr %99, align 8, !tbaa !19
  %100 = getelementptr inbounds i8, ptr %95, i64 24
  store ptr %94, ptr %100, align 8, !tbaa !20
  %101 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %94) #11
  %102 = trunc i64 %101 to i32
  %103 = getelementptr inbounds i8, ptr %95, i64 32
  store i32 %102, ptr %103, align 8, !tbaa !21
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %104 = load ptr, ptr %5, align 8, !tbaa !8
  %105 = getelementptr inbounds i8, ptr %104, i64 8
  %106 = load i32, ptr %105, align 8, !tbaa !15
  %107 = sext i32 %106 to i64
  %108 = icmp slt i64 %indvars.iv.next99, %107
  br i1 %108, label %.lr.ph.split.split.us, label %._crit_edge, !llvm.loop !26

.lr.ph.split.split:                               ; preds = %.lr.ph.split, %121
  %109 = phi ptr [ %122, %121 ], [ %29, %.lr.ph.split ]
  %indvars.iv = phi i64 [ %indvars.iv.next, %121 ], [ 0, %.lr.ph.split ]
  %110 = phi i32 [ %130, %121 ], [ %31, %.lr.ph.split ]
  %.04384 = phi ptr [ %.041, %121 ], [ %22, %.lr.ph.split ]
  %111 = getelementptr inbounds i8, ptr %109, i64 16
  %112 = getelementptr inbounds [1 x ptr], ptr %111, i64 0, i64 %indvars.iv
  %113 = load ptr, ptr %112, align 8, !tbaa !8
  %114 = add nsw i32 %110, -1
  %115 = zext i32 %114 to i64
  %116 = icmp eq i64 %indvars.iv, %115
  br i1 %116, label %121, label %117

117:                                              ; preds = %.lr.ph.split.split
  %118 = call ptr @iwpool_calloc(i64 noundef 64, ptr noundef nonnull %2) #8
  %.not63 = icmp eq ptr %118, null
  br i1 %.not63, label %.split.us, label %119

119:                                              ; preds = %117
  %120 = getelementptr inbounds i8, ptr %118, i64 52
  store i32 6, ptr %120, align 4, !tbaa !13
  %.pre = load ptr, ptr %5, align 8, !tbaa !8
  br label %121

121:                                              ; preds = %.lr.ph.split.split, %119
  %122 = phi ptr [ %.pre, %119 ], [ %109, %.lr.ph.split.split ]
  %.041 = phi ptr [ %118, %119 ], [ %1, %.lr.ph.split.split ]
  %123 = getelementptr inbounds i8, ptr %.04384, i64 40
  store ptr %.041, ptr %123, align 8, !tbaa !18
  %124 = getelementptr inbounds i8, ptr %.041, i64 16
  store ptr %.04384, ptr %124, align 8, !tbaa !19
  %125 = getelementptr inbounds i8, ptr %.041, i64 24
  store ptr %113, ptr %125, align 8, !tbaa !20
  %126 = call i64 @strlen(ptr noundef nonnull dereferenceable(1) %113) #11
  %127 = trunc i64 %126 to i32
  %128 = getelementptr inbounds i8, ptr %.041, i64 32
  store i32 %127, ptr %128, align 8, !tbaa !21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %129 = getelementptr inbounds i8, ptr %122, i64 8
  %130 = load i32, ptr %129, align 8, !tbaa !15
  %131 = sext i32 %130 to i64
  %132 = icmp slt i64 %indvars.iv.next, %131
  br i1 %132, label %.lr.ph.split.split, label %._crit_edge, !llvm.loop !26

.split.us:                                        ; preds = %117, %.lr.ph.split.split.us, %78, %.lr.ph.split.us.split.us, %38, %.lr.ph.split.us.split.us.preheader
  %133 = tail call ptr @__errno_location() #10
  %134 = load i32, ptr %133, align 4, !tbaa !11
  %135 = call i64 @iwrc_set_errno(i64 noundef 70013, i32 noundef %134) #8
  br label %136

._crit_edge:                                      ; preds = %121, %96, %82, %65, %42, %52, %27
  store ptr %22, ptr %3, align 8, !tbaa !8
  br label %136

136:                                              ; preds = %.split.us, %._crit_edge, %23
  %.3 = phi i64 [ %135, %.split.us ], [ 0, %._crit_edge ], [ %26, %23 ]
  br i1 %.not, label %.thread81, label %.thread78

.thread81:                                        ; preds = %15, %136
  %.383 = phi i64 [ %.3, %136 ], [ %16, %15 ]
  %137 = load ptr, ptr %5, align 8, !tbaa !8
  call void @free(ptr noundef %137) #8
  br label %.thread78

.thread78:                                        ; preds = %.thread, %136, %.thread81
  %.380 = phi i64 [ %.3, %136 ], [ %.383, %.thread81 ], [ %17, %.thread ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  br label %138

138:                                              ; preds = %.thread78, %13
  %.1 = phi i64 [ 0, %13 ], [ %.380, %.thread78 ]
  ret i64 %.1
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #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 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 #6 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { nounwind allocsize(0,1) }
attributes #10 = { nounwind willreturn memory(none) }
attributes #11 = { nounwind willreturn memory(read) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !6, i64 0}
!10 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !6, i64 0}
!13 = !{!14, !12, i64 52}
!14 = !{!"jbl_node", !9, i64 0, !9, i64 8, !9, i64 16, !9, i64 24, !12, i64 32, !12, i64 36, !9, i64 40, !12, i64 48, !12, i64 52, !6, i64 56}
!15 = !{!16, !12, i64 8}
!16 = !{!"jbl_ptr", !17, i64 0, !12, i64 8, !12, i64 12, !6, i64 16}
!17 = !{!"long", !6, i64 0}
!18 = !{!14, !9, i64 40}
!19 = !{!14, !9, i64 16}
!20 = !{!14, !9, i64 24}
!21 = !{!14, !12, i64 32}
!22 = distinct !{!22, !23, !24}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!"llvm.loop.peeled.count", i32 1}
!25 = distinct !{!25, !23, !24}
!26 = distinct !{!26, !23}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass