; LLVM IR from Discngine/fpocket :: src (atom)

; 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.s_atm = type { i32, float, float, float, float, float, float, float, [5 x i8], [7 x i8], [16 x i8], [16 x i8], [3 x i8], [8 x i8], i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, i8, i8, float, float, float, float, i16, ptr, i32 }

@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [45 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 nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local void @print_atoms(ptr noundef %0, ptr noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !9
  br label %9

9:                                                ; preds = %78, %3
  %10 = load i32, ptr %8, align 4, !tbaa !9
  %11 = load i32, ptr %6, align 4, !tbaa !9
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %13, label %81

13:                                               ; preds = %9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load i32, ptr %8, align 4, !tbaa !9
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds %struct.s_atm, ptr %14, i64 %16
  store ptr %17, ptr %7, align 8, !tbaa !5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = load ptr, ptr %7, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.s_atm, ptr %19, i32 0, i32 8
  %21 = getelementptr inbounds [5 x i8], ptr %20, i64 0, i64 0
  %22 = load ptr, ptr %7, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.s_atm, ptr %22, i32 0, i32 14
  %24 = load i32, ptr %23, align 8, !tbaa !11
  %25 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str, ptr noundef %21, i32 noundef %24) #3
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.s_atm, ptr %27, i32 0, i32 9
  %29 = getelementptr inbounds [7 x i8], ptr %28, i64 0, i64 0
  %30 = load ptr, ptr %7, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.s_atm, ptr %30, i32 0, i32 13
  %32 = getelementptr inbounds [8 x i8], ptr %31, i64 0, i64 0
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.s_atm, ptr %33, i32 0, i32 16
  %35 = load i32, ptr %34, align 8, !tbaa !15
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.s_atm, ptr %36, i32 0, i32 10
  %38 = getelementptr inbounds [16 x i8], ptr %37, i64 0, i64 0
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %26, ptr noundef @.str.1, ptr noundef %29, ptr noundef %32, i32 noundef %35, ptr noundef %38) #3
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.s_atm, ptr %41, i32 0, i32 5
  %43 = load float, ptr %42, align 4, !tbaa !16
  %44 = fpext float %43 to double
  %45 = load ptr, ptr %7, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.s_atm, ptr %45, i32 0, i32 6
  %47 = load float, ptr %46, align 8, !tbaa !17
  %48 = fpext float %47 to double
  %49 = load ptr, ptr %7, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.s_atm, ptr %49, i32 0, i32 7
  %51 = load float, ptr %50, align 4, !tbaa !18
  %52 = fpext float %51 to double
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.s_atm, ptr %53, i32 0, i32 23
  %55 = load float, ptr %54, align 4, !tbaa !19
  %56 = fpext float %55 to double
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.s_atm, ptr %57, i32 0, i32 24
  %59 = load float, ptr %58, align 8, !tbaa !20
  %60 = fpext float %59 to double
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %40, ptr noundef @.str.2, double noundef %44, double noundef %48, double noundef %52, double noundef %56, double noundef %60) #3
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  %63 = load ptr, ptr %7, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.s_atm, ptr %63, i32 0, i32 12
  %65 = getelementptr inbounds [3 x i8], ptr %64, i64 0, i64 0
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.s_atm, ptr %66, i32 0, i32 19
  %68 = load i32, ptr %67, align 4, !tbaa !21
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.s_atm, ptr %69, i32 0, i32 21
  %71 = load float, ptr %70, align 4, !tbaa !22
  %72 = fpext float %71 to double
  %73 = load ptr, ptr %7, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.s_atm, ptr %73, i32 0, i32 3
  %75 = load float, ptr %74, align 4, !tbaa !23
  %76 = fpext float %75 to double
  %77 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %62, ptr noundef @.str.3, ptr noundef %65, i32 noundef %68, double noundef %72, double noundef %76) #3
  br label %78

78:                                               ; preds = %13
  %79 = load i32, ptr %8, align 4, !tbaa !9
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %8, align 4, !tbaa !9
  br label %9, !llvm.loop !24

81:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 = !{!12, !10, i64 88}
!12 = !{!"s_atm", !10, i64 0, !13, i64 4, !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20, !13, i64 24, !13, i64 28, !7, i64 32, !7, i64 37, !7, i64 44, !7, i64 60, !7, i64 76, !7, i64 79, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !13, i64 116, !13, i64 120, !13, i64 124, !13, i64 128, !13, i64 132, !13, i64 136, !13, i64 140, !7, i64 144, !7, i64 145, !13, i64 148, !13, i64 152, !13, i64 156, !13, i64 160, !14, i64 164, !6, i64 168, !10, i64 176}
!13 = !{!"float", !7, i64 0}
!14 = !{!"short", !7, i64 0}
!15 = !{!12, !10, i64 96}
!16 = !{!12, !13, i64 20}
!17 = !{!12, !13, i64 24}
!18 = !{!12, !13, i64 28}
!19 = !{!12, !13, i64 124}
!20 = !{!12, !13, i64 128}
!21 = !{!12, !10, i64 108}
!22 = !{!12, !13, i64 116}
!23 = !{!12, !13, i64 12}
!24 = distinct !{!24, !25}
!25 = !{!"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"

%struct.s_atm = type { i32, float, float, float, float, float, float, float, [5 x i8], [7 x i8], [16 x i8], [16 x i8], [3 x i8], [8 x i8], i32, i32, i32, i32, i32, i32, i32, float, float, float, float, float, float, float, i8, i8, float, float, float, float, i16, ptr, i32 }

@.str = external hidden unnamed_addr constant [32 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_atoms(ptr nocapture noundef %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = icmp sgt i32 %2, 0
  br i1 %4, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %3
  %wide.trip.count = zext nneg i32 %2 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %5 = getelementptr inbounds %struct.s_atm, ptr %1, i64 %indvars.iv
  %6 = getelementptr inbounds i8, ptr %5, i64 32
  %7 = getelementptr inbounds i8, ptr %5, i64 88
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str, ptr noundef nonnull %6, i32 noundef %8) #2
  %10 = getelementptr inbounds i8, ptr %5, i64 37
  %11 = getelementptr inbounds i8, ptr %5, i64 79
  %12 = getelementptr inbounds i8, ptr %5, i64 96
  %13 = load i32, ptr %12, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %5, i64 44
  %15 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.1, ptr noundef nonnull %10, ptr noundef nonnull %11, i32 noundef %13, ptr noundef nonnull %14) #2
  %16 = getelementptr inbounds i8, ptr %5, i64 20
  %17 = load float, ptr %16, align 4, !tbaa !14
  %18 = fpext float %17 to double
  %19 = getelementptr inbounds i8, ptr %5, i64 24
  %20 = load float, ptr %19, align 8, !tbaa !15
  %21 = fpext float %20 to double
  %22 = getelementptr inbounds i8, ptr %5, i64 28
  %23 = load float, ptr %22, align 4, !tbaa !16
  %24 = fpext float %23 to double
  %25 = getelementptr inbounds i8, ptr %5, i64 124
  %26 = load float, ptr %25, align 4, !tbaa !17
  %27 = fpext float %26 to double
  %28 = getelementptr inbounds i8, ptr %5, i64 128
  %29 = load float, ptr %28, align 8, !tbaa !18
  %30 = fpext float %29 to double
  %31 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.2, double noundef %18, double noundef %21, double noundef %24, double noundef %27, double noundef %30) #2
  %32 = getelementptr inbounds i8, ptr %5, i64 76
  %33 = getelementptr inbounds i8, ptr %5, i64 108
  %34 = load i32, ptr %33, align 4, !tbaa !19
  %35 = getelementptr inbounds i8, ptr %5, i64 116
  %36 = load float, ptr %35, align 4, !tbaa !20
  %37 = fpext float %36 to double
  %38 = getelementptr inbounds i8, ptr %5, i64 12
  %39 = load float, ptr %38, align 4, !tbaa !21
  %40 = fpext float %39 to double
  %41 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %0, ptr noundef nonnull @.str.3, ptr noundef nonnull %32, i32 noundef %34, double noundef %37, double noundef %40) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !22

._crit_edge:                                      ; preds = %.lr.ph, %3
  ret void
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

attributes #0 = { nofree 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 = { 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 #2 = { 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 88}
!6 = !{!"s_atm", !7, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !8, i64 32, !8, i64 37, !8, i64 44, !8, i64 60, !8, i64 76, !8, i64 79, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !10, i64 136, !10, i64 140, !8, i64 144, !8, i64 145, !10, i64 148, !10, i64 152, !10, i64 156, !10, i64 160, !11, i64 164, !12, i64 168, !7, i64 176}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!"short", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!6, !7, i64 96}
!14 = !{!6, !10, i64 20}
!15 = !{!6, !10, i64 24}
!16 = !{!6, !10, i64 28}
!17 = !{!6, !10, i64 124}
!18 = !{!6, !10, i64 128}
!19 = !{!6, !7, i64 108}
!20 = !{!6, !10, i64 116}
!21 = !{!6, !10, i64 12}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass