; LLVM IR from alexzheng42/sDMD :: src (DataSave)

; 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.FileStr = type { i32, [256 x i8], ptr }

@__const.InitializeFiles.defaultName = external hidden unnamed_addr constant [15 x [256 x i8]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @InitializeFiles(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca [15 x [256 x i8]], align 16
  %6 = alloca [20 x i8], align 16
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 3840, ptr %5) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %5, ptr align 16 @__const.InitializeFiles.defaultName, i64 3840, i1 false)
  call void @llvm.lifetime.start.p0(i64 20, ptr %6) #5
  call void @llvm.memset.p0.i64(ptr align 16 %6, i8 0, i64 20, i1 false)
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %14

10:                                               ; preds = %2
  %11 = getelementptr inbounds [20 x i8], ptr %6, i64 0, i64 0
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %11, ptr noundef @.str, ptr noundef %12) #5
  br label %14

14:                                               ; preds = %10, %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %15

15:                                               ; preds = %31, %14
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %17 = icmp slt i32 %16, 15
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %34

19:                                               ; preds = %15
  %20 = load i32, ptr %7, align 4, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [15 x [256 x i8]], ptr %5, i64 0, i64 %21
  %23 = getelementptr inbounds [256 x i8], ptr %22, i64 0, i64 0
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load i32, ptr %7, align 4, !tbaa !9
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds %struct.FileStr, ptr %24, i64 %26
  %28 = getelementptr inbounds %struct.FileStr, ptr %27, i32 0, i32 1
  %29 = getelementptr inbounds [256 x i8], ptr %28, i64 0, i64 0
  %30 = getelementptr inbounds [20 x i8], ptr %6, i64 0, i64 0
  call void @AssignName(ptr noundef %23, ptr noundef %29, ptr noundef %30)
  br label %31

31:                                               ; preds = %19
  %32 = load i32, ptr %7, align 4, !tbaa !9
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %7, align 4, !tbaa !9
  br label %15, !llvm.loop !11

34:                                               ; preds = %18
  %35 = load ptr, ptr %4, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.FileStr, ptr %35, i64 0
  %37 = getelementptr inbounds %struct.FileStr, ptr %36, i32 0, i32 0
  store i32 1, ptr %37, align 8, !tbaa !13
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.FileStr, ptr %38, i64 4
  %40 = getelementptr inbounds %struct.FileStr, ptr %39, i32 0, i32 0
  store i32 1, ptr %40, align 8, !tbaa !13
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.FileStr, ptr %41, i64 13
  %43 = getelementptr inbounds %struct.FileStr, ptr %42, i32 0, i32 0
  store i32 1, ptr %43, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 20, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 3840, ptr %5) #5
  ret void
}

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

; 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) #2

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

; Function Attrs: nounwind
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: nounwind uwtable
declare dso_local void @AssignName(ptr noundef, ptr noundef, ptr noundef) #0

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

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = { nounwind }

!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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !10, i64 0}
!14 = !{!"FileStr", !10, i64 0, !7, i64 4, !6, i64 264}


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

@__const.InitializeFiles.defaultName = external hidden unnamed_addr constant [15 x [256 x i8]], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @InitializeFiles(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca [15 x [256 x i8]], align 16
  %4 = alloca [20 x i8], align 16
  call void @llvm.lifetime.start.p0(i64 3840, ptr nonnull %3) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(3840) %3, ptr noundef nonnull align 16 dereferenceable(3840) @__const.InitializeFiles.defaultName, i64 3840, i1 false)
  call void @llvm.lifetime.start.p0(i64 20, ptr nonnull %4) #5
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(20) %4, i8 0, i64 20, i1 false)
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %7, label %5

5:                                                ; preds = %2
  %6 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %4, ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %0) #5
  br label %7

7:                                                ; preds = %5, %2
  %8 = getelementptr inbounds i8, ptr %1, i64 4
  call void @AssignName(ptr noundef nonnull %3, ptr noundef nonnull %8, ptr noundef nonnull %4)
  %9 = getelementptr inbounds i8, ptr %3, i64 256
  %10 = getelementptr inbounds i8, ptr %1, i64 276
  call void @AssignName(ptr noundef nonnull %9, ptr noundef nonnull %10, ptr noundef nonnull %4)
  %11 = getelementptr inbounds i8, ptr %3, i64 512
  %12 = getelementptr inbounds i8, ptr %1, i64 548
  call void @AssignName(ptr noundef nonnull %11, ptr noundef nonnull %12, ptr noundef nonnull %4)
  %13 = getelementptr inbounds i8, ptr %3, i64 768
  %14 = getelementptr inbounds i8, ptr %1, i64 820
  call void @AssignName(ptr noundef nonnull %13, ptr noundef nonnull %14, ptr noundef nonnull %4)
  %15 = getelementptr inbounds i8, ptr %3, i64 1024
  %16 = getelementptr inbounds i8, ptr %1, i64 1092
  call void @AssignName(ptr noundef nonnull %15, ptr noundef nonnull %16, ptr noundef nonnull %4)
  %17 = getelementptr inbounds i8, ptr %3, i64 1280
  %18 = getelementptr inbounds i8, ptr %1, i64 1364
  call void @AssignName(ptr noundef nonnull %17, ptr noundef nonnull %18, ptr noundef nonnull %4)
  %19 = getelementptr inbounds i8, ptr %3, i64 1536
  %20 = getelementptr inbounds i8, ptr %1, i64 1636
  call void @AssignName(ptr noundef nonnull %19, ptr noundef nonnull %20, ptr noundef nonnull %4)
  %21 = getelementptr inbounds i8, ptr %3, i64 1792
  %22 = getelementptr inbounds i8, ptr %1, i64 1908
  call void @AssignName(ptr noundef nonnull %21, ptr noundef nonnull %22, ptr noundef nonnull %4)
  %23 = getelementptr inbounds i8, ptr %3, i64 2048
  %24 = getelementptr inbounds i8, ptr %1, i64 2180
  call void @AssignName(ptr noundef nonnull %23, ptr noundef nonnull %24, ptr noundef nonnull %4)
  %25 = getelementptr inbounds i8, ptr %3, i64 2304
  %26 = getelementptr inbounds i8, ptr %1, i64 2452
  call void @AssignName(ptr noundef nonnull %25, ptr noundef nonnull %26, ptr noundef nonnull %4)
  %27 = getelementptr inbounds i8, ptr %3, i64 2560
  %28 = getelementptr inbounds i8, ptr %1, i64 2724
  call void @AssignName(ptr noundef nonnull %27, ptr noundef nonnull %28, ptr noundef nonnull %4)
  %29 = getelementptr inbounds i8, ptr %3, i64 2816
  %30 = getelementptr inbounds i8, ptr %1, i64 2996
  call void @AssignName(ptr noundef nonnull %29, ptr noundef nonnull %30, ptr noundef nonnull %4)
  %31 = getelementptr inbounds i8, ptr %3, i64 3072
  %32 = getelementptr inbounds i8, ptr %1, i64 3268
  call void @AssignName(ptr noundef nonnull %31, ptr noundef nonnull %32, ptr noundef nonnull %4)
  %33 = getelementptr inbounds i8, ptr %3, i64 3328
  %34 = getelementptr inbounds i8, ptr %1, i64 3540
  call void @AssignName(ptr noundef nonnull %33, ptr noundef nonnull %34, ptr noundef nonnull %4)
  %35 = getelementptr inbounds i8, ptr %3, i64 3584
  %36 = getelementptr inbounds i8, ptr %1, i64 3812
  call void @AssignName(ptr noundef nonnull %35, ptr noundef nonnull %36, ptr noundef nonnull %4)
  store i32 1, ptr %1, align 8, !tbaa !5
  %37 = getelementptr inbounds i8, ptr %1, i64 1088
  store i32 1, ptr %37, align 8, !tbaa !5
  %38 = getelementptr inbounds i8, ptr %1, i64 3536
  store i32 1, ptr %38, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 20, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 3840, ptr nonnull %3) #5
  ret void
}

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

; 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) #2

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

; Function Attrs: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local void @AssignName(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
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 }

!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 = !{!"FileStr", !7, i64 0, !8, i64 4, !10, i64 264}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass