; LLVM IR from littlefs-project/littlefs :: bd (lfs_emubd)

; 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.timespec = type { i64, i64 }
%struct.lfs_config = type { ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, i32, i32, i32, i32, i32 }
%struct.lfs_emubd = type { ptr, i64, i64, i64, i32, i32, ptr, ptr, ptr }
%struct.lfs_emubd_config = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, i8, ptr, i64, i64, i64 }
%struct.lfs_emubd_block = type { i32, i32, [0 x i8] }

@.str = external hidden unnamed_addr constant [29 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@__PRETTY_FUNCTION__.lfs_emubd_read = external hidden unnamed_addr constant [90 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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

; 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 i32 @lfs_emubd_read(ptr noundef %0, i32 noundef %1, i32 noundef %2, ptr noundef %3, i32 noundef %4) #3 {
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca %struct.timespec, align 8
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store i32 %2, ptr %9, align 4, !tbaa !9
  store ptr %3, ptr %10, align 8, !tbaa !5
  store i32 %4, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.lfs_config, ptr %17, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  store ptr %19, ptr %12, align 8, !tbaa !5
  %20 = load i32, ptr %8, align 4, !tbaa !9
  %21 = load ptr, ptr %12, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.lfs_emubd, ptr %21, i32 0, i32 8
  %23 = load ptr, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds %struct.lfs_emubd_config, ptr %23, i32 0, i32 3
  %25 = load i32, ptr %24, align 4, !tbaa !16
  %26 = icmp ult i32 %20, %25
  br i1 %26, label %27, label %28

27:                                               ; preds = %5
  br label %29

28:                                               ; preds = %5
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 295, ptr noundef @__PRETTY_FUNCTION__.lfs_emubd_read) #8
  unreachable

29:                                               ; preds = %27
  %30 = load i32, ptr %9, align 4, !tbaa !9
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.lfs_emubd, ptr %31, i32 0, i32 8
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  %34 = getelementptr inbounds %struct.lfs_emubd_config, ptr %33, i32 0, i32 0
  %35 = load i32, ptr %34, align 8, !tbaa !19
  %36 = urem i32 %30, %35
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %39

38:                                               ; preds = %29
  br label %40

39:                                               ; preds = %29
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i32 noundef 296, ptr noundef @__PRETTY_FUNCTION__.lfs_emubd_read) #8
  unreachable

40:                                               ; preds = %38
  %41 = load i32, ptr %11, align 4, !tbaa !9
  %42 = load ptr, ptr %12, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.lfs_emubd, ptr %42, i32 0, i32 8
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = getelementptr inbounds %struct.lfs_emubd_config, ptr %44, i32 0, i32 0
  %46 = load i32, ptr %45, align 8, !tbaa !19
  %47 = urem i32 %41, %46
  %48 = icmp eq i32 %47, 0
  br i1 %48, label %49, label %50

49:                                               ; preds = %40
  br label %51

50:                                               ; preds = %40
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 297, ptr noundef @__PRETTY_FUNCTION__.lfs_emubd_read) #8
  unreachable

51:                                               ; preds = %49
  %52 = load i32, ptr %9, align 4, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = add i32 %52, %53
  %55 = load ptr, ptr %12, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.lfs_emubd, ptr %55, i32 0, i32 8
  %57 = load ptr, ptr %56, align 8, !tbaa !13
  %58 = getelementptr inbounds %struct.lfs_emubd_config, ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 8, !tbaa !20
  %60 = icmp ule i32 %54, %59
  br i1 %60, label %61, label %62

61:                                               ; preds = %51
  br label %63

62:                                               ; preds = %51
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 298, ptr noundef @__PRETTY_FUNCTION__.lfs_emubd_read) #8
  unreachable

63:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %64 = load ptr, ptr %12, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.lfs_emubd, ptr %64, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !21
  %67 = load i32, ptr %8, align 4, !tbaa !9
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds ptr, ptr %66, i64 %68
  %70 = load ptr, ptr %69, align 8, !tbaa !5
  store ptr %70, ptr %13, align 8, !tbaa !5
  %71 = load ptr, ptr %13, align 8, !tbaa !5
  %72 = icmp ne ptr %71, null
  br i1 %72, label %73, label %107

73:                                               ; preds = %63
  %74 = load ptr, ptr %12, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.lfs_emubd, ptr %74, i32 0, i32 8
  %76 = load ptr, ptr %75, align 8, !tbaa !13
  %77 = getelementptr inbounds %struct.lfs_emubd_config, ptr %76, i32 0, i32 5
  %78 = load i32, ptr %77, align 4, !tbaa !22
  %79 = icmp ne i32 %78, 0
  br i1 %79, label %80, label %98

80:                                               ; preds = %73
  %81 = load ptr, ptr %13, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.lfs_emubd_block, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !9
  %84 = load ptr, ptr %12, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.lfs_emubd, ptr %84, i32 0, i32 8
  %86 = load ptr, ptr %85, align 8, !tbaa !13
  %87 = getelementptr inbounds %struct.lfs_emubd_config, ptr %86, i32 0, i32 5
  %88 = load i32, ptr %87, align 4, !tbaa !22
  %89 = icmp uge i32 %83, %88
  br i1 %89, label %90, label %98

90:                                               ; preds = %80
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.lfs_emubd, ptr %91, i32 0, i32 8
  %93 = load ptr, ptr %92, align 8, !tbaa !13
  %94 = getelementptr inbounds %struct.lfs_emubd_config, ptr %93, i32 0, i32 6
  %95 = load i32, ptr %94, align 8, !tbaa !23
  %96 = icmp eq i32 %95, 2
  br i1 %96, label %97, label %98

97:                                               ; preds = %90
  store i32 -84, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %168

98:                                               ; preds = %90, %80, %73
  %99 = load ptr, ptr %10, align 8, !tbaa !5
  %100 = load ptr, ptr %13, align 8, !tbaa !5
  %101 = getelementptr inbounds %struct.lfs_emubd_block, ptr %100, i32 0, i32 2
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = getelementptr inbounds [0 x i8], ptr %101, i64 0, i64 %103
  %105 = load i32, ptr %11, align 4, !tbaa !9
  %106 = zext i32 %105 to i64
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %99, ptr align 1 %104, i64 %106, i1 false)
  br label %127

107:                                              ; preds = %63
  %108 = load ptr, ptr %10, align 8, !tbaa !5
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.lfs_emubd, ptr %109, i32 0, i32 8
  %111 = load ptr, ptr %110, align 8, !tbaa !13
  %112 = getelementptr inbounds %struct.lfs_emubd_config, ptr %111, i32 0, i32 4
  %113 = load i32, ptr %112, align 8, !tbaa !24
  %114 = icmp ne i32 %113, -1
  br i1 %114, label %115, label %121

115:                                              ; preds = %107
  %116 = load ptr, ptr %12, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.lfs_emubd, ptr %116, i32 0, i32 8
  %118 = load ptr, ptr %117, align 8, !tbaa !13
  %119 = getelementptr inbounds %struct.lfs_emubd_config, ptr %118, i32 0, i32 4
  %120 = load i32, ptr %119, align 8, !tbaa !24
  br label %122

121:                                              ; preds = %107
  br label %122

122:                                              ; preds = %121, %115
  %123 = phi i32 [ %120, %115 ], [ 0, %121 ]
  %124 = trunc i32 %123 to i8
  %125 = load i32, ptr %11, align 4, !tbaa !9
  %126 = zext i32 %125 to i64
  call void @llvm.memset.p0.i64(ptr align 1 %108, i8 %124, i64 %126, i1 false)
  br label %127

127:                                              ; preds = %122, %98
  %128 = load i32, ptr %11, align 4, !tbaa !9
  %129 = zext i32 %128 to i64
  %130 = load ptr, ptr %12, align 8, !tbaa !5
  %131 = getelementptr inbounds %struct.lfs_emubd, ptr %130, i32 0, i32 1
  %132 = load i64, ptr %131, align 8, !tbaa !25
  %133 = add i64 %132, %129
  store i64 %133, ptr %131, align 8, !tbaa !25
  %134 = load ptr, ptr %12, align 8, !tbaa !5
  %135 = getelementptr inbounds %struct.lfs_emubd, ptr %134, i32 0, i32 8
  %136 = load ptr, ptr %135, align 8, !tbaa !13
  %137 = getelementptr inbounds %struct.lfs_emubd_config, ptr %136, i32 0, i32 13
  %138 = load i64, ptr %137, align 8, !tbaa !26
  %139 = icmp ne i64 %138, 0
  br i1 %139, label %140, label %167

140:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %141 = getelementptr inbounds %struct.timespec, ptr %16, i32 0, i32 0
  %142 = load ptr, ptr %12, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.lfs_emubd, ptr %142, i32 0, i32 8
  %144 = load ptr, ptr %143, align 8, !tbaa !13
  %145 = getelementptr inbounds %struct.lfs_emubd_config, ptr %144, i32 0, i32 13
  %146 = load i64, ptr %145, align 8, !tbaa !26
  %147 = udiv i64 %146, 1000000000
  store i64 %147, ptr %141, align 8, !tbaa !27
  %148 = getelementptr inbounds %struct.timespec, ptr %16, i32 0, i32 1
  %149 = load ptr, ptr %12, align 8, !tbaa !5
  %150 = getelementptr inbounds %struct.lfs_emubd, ptr %149, i32 0, i32 8
  %151 = load ptr, ptr %150, align 8, !tbaa !13
  %152 = getelementptr inbounds %struct.lfs_emubd_config, ptr %151, i32 0, i32 13
  %153 = load i64, ptr %152, align 8, !tbaa !26
  %154 = urem i64 %153, 1000000000
  store i64 %154, ptr %148, align 8, !tbaa !29
  %155 = call i32 @nanosleep(ptr noundef %16, ptr noundef null)
  store i32 %155, ptr %15, align 4, !tbaa !9
  %156 = load i32, ptr %15, align 4, !tbaa !9
  %157 = icmp ne i32 %156, 0
  br i1 %157, label %158, label %163

158:                                              ; preds = %140
  %159 = call ptr @__errno_location() #9
  %160 = load i32, ptr %159, align 4, !tbaa !9
  %161 = sub nsw i32 0, %160
  store i32 %161, ptr %15, align 4, !tbaa !9
  %162 = load i32, ptr %15, align 4, !tbaa !9
  store i32 %162, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %164

163:                                              ; preds = %140
  store i32 0, ptr %14, align 4
  br label %164

164:                                              ; preds = %163, %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %165 = load i32, ptr %14, align 4
  switch i32 %165, label %168 [
    i32 0, label %166
  ]

166:                                              ; preds = %164
  br label %167

167:                                              ; preds = %166, %127
  store i32 0, ptr %6, align 4
  store i32 1, ptr %14, align 4
  br label %168

168:                                              ; preds = %167, %164, %97
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  %169 = load i32, ptr %6, align 4
  ret i32 %169
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

declare i32 @nanosleep(ptr noundef, ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { 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 = { noreturn 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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }
attributes #9 = { 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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"lfs_config", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !6, i64 72, !6, i64 80, !6, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112}
!13 = !{!14, !6, i64 56}
!14 = !{!"lfs_emubd", !6, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !10, i64 32, !10, i64 36, !6, i64 40, !6, i64 48, !6, i64 56}
!15 = !{!"long", !7, i64 0}
!16 = !{!17, !10, i64 12}
!17 = !{!"lfs_emubd_config", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !6, i64 40, !6, i64 48, !18, i64 56, !6, i64 64, !15, i64 72, !15, i64 80, !15, i64 88}
!18 = !{!"_Bool", !7, i64 0}
!19 = !{!17, !10, i64 0}
!20 = !{!17, !10, i64 8}
!21 = !{!14, !6, i64 0}
!22 = !{!17, !10, i64 20}
!23 = !{!17, !10, i64 24}
!24 = !{!17, !10, i64 16}
!25 = !{!14, !15, i64 8}
!26 = !{!17, !15, i64 72}
!27 = !{!28, !15, i64 0}
!28 = !{!"timespec", !15, i64 0, !15, i64 8}
!29 = !{!28, !15, i64 8}


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

%struct.timespec = type { i64, i64 }

@.str = external hidden unnamed_addr constant [29 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@__PRETTY_FUNCTION__.lfs_emubd_read = external hidden unnamed_addr constant [90 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [31 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [32 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #0

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

; Function Attrs: nounwind uwtable
define dso_local i32 @lfs_emubd_read(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2, ptr nocapture noundef writeonly %3, i32 noundef %4) local_unnamed_addr #2 {
  %6 = alloca %struct.timespec, align 8
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 56
  %9 = load ptr, ptr %8, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %9, i64 12
  %11 = load i32, ptr %10, align 4, !tbaa !14
  %12 = icmp ugt i32 %11, %1
  br i1 %12, label %14, label %13

13:                                               ; preds = %5
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 295, ptr noundef nonnull @__PRETTY_FUNCTION__.lfs_emubd_read) #6
  unreachable

14:                                               ; preds = %5
  %15 = load i32, ptr %9, align 8, !tbaa !17
  %16 = urem i32 %2, %15
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %19, label %18

18:                                               ; preds = %14
  tail call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i32 noundef 296, ptr noundef nonnull @__PRETTY_FUNCTION__.lfs_emubd_read) #6
  unreachable

19:                                               ; preds = %14
  %20 = urem i32 %4, %15
  %21 = icmp eq i32 %20, 0
  br i1 %21, label %23, label %22

22:                                               ; preds = %19
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 297, ptr noundef nonnull @__PRETTY_FUNCTION__.lfs_emubd_read) #6
  unreachable

23:                                               ; preds = %19
  %24 = add i32 %4, %2
  %25 = getelementptr inbounds i8, ptr %9, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !18
  %.not = icmp ugt i32 %24, %26
  br i1 %.not, label %27, label %28

27:                                               ; preds = %23
  tail call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 298, ptr noundef nonnull @__PRETTY_FUNCTION__.lfs_emubd_read) #6
  unreachable

28:                                               ; preds = %23
  %29 = load ptr, ptr %7, align 8, !tbaa !19
  %30 = zext i32 %1 to i64
  %31 = getelementptr inbounds ptr, ptr %29, i64 %30
  %32 = load ptr, ptr %31, align 8, !tbaa !20
  %.not39 = icmp eq ptr %32, null
  br i1 %.not39, label %48, label %33

33:                                               ; preds = %28
  %34 = getelementptr inbounds i8, ptr %9, i64 20
  %35 = load i32, ptr %34, align 4, !tbaa !21
  %.not41 = icmp eq i32 %35, 0
  br i1 %.not41, label %43, label %36

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %32, i64 4
  %38 = load i32, ptr %37, align 4, !tbaa !22
  %.not42 = icmp ult i32 %38, %35
  br i1 %.not42, label %43, label %39

39:                                               ; preds = %36
  %40 = getelementptr inbounds i8, ptr %9, i64 24
  %41 = load i32, ptr %40, align 8, !tbaa !23
  %42 = icmp eq i32 %41, 2
  br i1 %42, label %.thread, label %43

43:                                               ; preds = %39, %36, %33
  %44 = getelementptr inbounds i8, ptr %32, i64 8
  %45 = zext i32 %2 to i64
  %46 = getelementptr inbounds [0 x i8], ptr %44, i64 0, i64 %45
  %47 = zext i32 %4 to i64
  tail call void @llvm.memcpy.p0.p0.i64(ptr align 1 %3, ptr nonnull align 1 %46, i64 %47, i1 false)
  br label %53

48:                                               ; preds = %28
  %49 = getelementptr inbounds i8, ptr %9, i64 16
  %50 = load i32, ptr %49, align 8, !tbaa !24
  %.not40 = icmp eq i32 %50, -1
  %51 = trunc i32 %50 to i8
  %spec.select = select i1 %.not40, i8 0, i8 %51
  %52 = zext i32 %4 to i64
  tail call void @llvm.memset.p0.i64(ptr align 1 %3, i8 %spec.select, i64 %52, i1 false)
  br label %53

53:                                               ; preds = %48, %43
  %.pre-phi = phi i64 [ %52, %48 ], [ %47, %43 ]
  %54 = getelementptr inbounds i8, ptr %7, i64 8
  %55 = load i64, ptr %54, align 8, !tbaa !25
  %56 = add i64 %55, %.pre-phi
  store i64 %56, ptr %54, align 8, !tbaa !25
  %57 = load ptr, ptr %8, align 8, !tbaa !11
  %58 = getelementptr inbounds i8, ptr %57, i64 72
  %59 = load i64, ptr %58, align 8, !tbaa !26
  %.not43 = icmp eq i64 %59, 0
  br i1 %.not43, label %.thread, label %60

60:                                               ; preds = %53
  %61 = udiv i64 %59, 1000000000
  store i64 %61, ptr %6, align 8, !tbaa !27
  %62 = getelementptr inbounds i8, ptr %6, i64 8
  %63 = urem i64 %59, 1000000000
  store i64 %63, ptr %62, align 8, !tbaa !29
  %64 = call i32 @nanosleep(ptr noundef nonnull %6, ptr noundef null) #7
  %.not44 = icmp eq i32 %64, 0
  br i1 %.not44, label %.thread, label %65

65:                                               ; preds = %60
  %66 = tail call ptr @__errno_location() #8
  %67 = load i32, ptr %66, align 4, !tbaa !22
  %68 = sub nsw i32 0, %67
  br label %.thread

.thread:                                          ; preds = %60, %53, %65, %39
  %.1 = phi i32 [ %68, %65 ], [ -84, %39 ], [ 0, %53 ], [ 0, %60 ]
  ret i32 %.1
}

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

declare i32 @nanosleep(ptr noundef, ptr noundef) local_unnamed_addr #5

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 0}
!6 = !{!"lfs_config", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !7, i64 72, !7, i64 80, !7, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 56}
!12 = !{!"lfs_emubd", !7, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !10, i64 32, !10, i64 36, !7, i64 40, !7, i64 48, !7, i64 56}
!13 = !{!"long", !8, i64 0}
!14 = !{!15, !10, i64 12}
!15 = !{!"lfs_emubd_config", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !7, i64 40, !7, i64 48, !16, i64 56, !7, i64 64, !13, i64 72, !13, i64 80, !13, i64 88}
!16 = !{!"_Bool", !8, i64 0}
!17 = !{!15, !10, i64 0}
!18 = !{!15, !10, i64 8}
!19 = !{!12, !7, i64 0}
!20 = !{!7, !7, i64 0}
!21 = !{!15, !10, i64 20}
!22 = !{!10, !10, i64 0}
!23 = !{!15, !10, i64 24}
!24 = !{!15, !10, i64 16}
!25 = !{!12, !13, i64 8}
!26 = !{!15, !13, i64 72}
!27 = !{!28, !13, i64 0}
!28 = !{!"timespec", !13, i64 0, !13, i64 8}
!29 = !{!28, !13, i64 8}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass