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

; 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_pdb = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, float, float, float, float, float, float, [83 x i8], [500 x i8], float, float, float, i32, i32 }
%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 }

@stdout = external global ptr, align 8
@.str.20 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [19 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
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
define dso_local void @rpdb_print(ptr noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  %4 = load ptr, ptr @stdout, align 8, !tbaa !5
  %5 = load ptr, ptr %2, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.s_pdb, ptr %5, i32 0, i32 21
  %7 = getelementptr inbounds [500 x i8], ptr %6, i64 0, i64 0
  %8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef @.str.20, ptr noundef %7) #3
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.s_pdb, ptr %10, i32 0, i32 10
  %12 = load i32, ptr %11, align 4, !tbaa !9
  %13 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef @.str.21, i32 noundef %12) #3
  %14 = load ptr, ptr @stdout, align 8, !tbaa !5
  %15 = load ptr, ptr %2, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.s_pdb, ptr %15, i32 0, i32 11
  %17 = load i32, ptr %16, align 8, !tbaa !13
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef @.str.22, i32 noundef %17) #3
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = load ptr, ptr %2, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.s_pdb, ptr %20, i32 0, i32 12
  %22 = load i32, ptr %21, align 4, !tbaa !14
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str.23, i32 noundef %22) #3
  store i32 0, ptr %3, align 4, !tbaa !15
  br label %24

24:                                               ; preds = %68, %1
  %25 = load i32, ptr %3, align 4, !tbaa !15
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.s_pdb, ptr %26, i32 0, i32 10
  %28 = load i32, ptr %27, align 4, !tbaa !9
  %29 = icmp slt i32 %25, %28
  br i1 %29, label %30, label %71

30:                                               ; preds = %24
  %31 = load ptr, ptr @stdout, align 8, !tbaa !5
  %32 = load ptr, ptr %2, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.s_pdb, ptr %32, i32 0, i32 2
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = load i32, ptr %3, align 4, !tbaa !15
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds %struct.s_atm, ptr %34, i64 %36
  %38 = getelementptr inbounds %struct.s_atm, ptr %37, i32 0, i32 14
  %39 = load i32, ptr %38, align 8, !tbaa !17
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.s_pdb, ptr %40, i32 0, i32 2
  %42 = load ptr, ptr %41, align 8, !tbaa !16
  %43 = load i32, ptr %3, align 4, !tbaa !15
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds %struct.s_atm, ptr %42, i64 %44
  %46 = getelementptr inbounds %struct.s_atm, ptr %45, i32 0, i32 5
  %47 = load float, ptr %46, align 4, !tbaa !20
  %48 = fpext float %47 to double
  %49 = load ptr, ptr %2, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.s_pdb, ptr %49, i32 0, i32 2
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  %52 = load i32, ptr %3, align 4, !tbaa !15
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds %struct.s_atm, ptr %51, i64 %53
  %55 = getelementptr inbounds %struct.s_atm, ptr %54, i32 0, i32 6
  %56 = load float, ptr %55, align 8, !tbaa !21
  %57 = fpext float %56 to double
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.s_pdb, ptr %58, i32 0, i32 2
  %60 = load ptr, ptr %59, align 8, !tbaa !16
  %61 = load i32, ptr %3, align 4, !tbaa !15
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds %struct.s_atm, ptr %60, i64 %62
  %64 = getelementptr inbounds %struct.s_atm, ptr %63, i32 0, i32 7
  %65 = load float, ptr %64, align 4, !tbaa !22
  %66 = fpext float %65 to double
  %67 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %31, ptr noundef @.str.24, i32 noundef %39, double noundef %48, double noundef %57, double noundef %66) #3
  br label %68

68:                                               ; preds = %30
  %69 = load i32, ptr %3, align 4, !tbaa !15
  %70 = add nsw i32 %69, 1
  store i32 %70, ptr %3, align 4, !tbaa !15
  br label %24, !llvm.loop !23

71:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  ret void
}

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

@stdout = external local_unnamed_addr global ptr, align 8
@.str.20 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [29 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [19 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @rpdb_print(ptr noundef %0) local_unnamed_addr #1 {
  %2 = load ptr, ptr @stdout, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %0, i64 199
  %4 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %2, ptr noundef nonnull @.str.20, ptr noundef nonnull %3) #2
  %5 = load ptr, ptr @stdout, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 76
  %7 = load i32, ptr %6, align 4, !tbaa !9
  %8 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.21, i32 noundef %7) #2
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 80
  %11 = load i32, ptr %10, align 8, !tbaa !13
  %12 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.22, i32 noundef %11) #2
  %13 = load ptr, ptr @stdout, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %0, i64 84
  %15 = load i32, ptr %14, align 4, !tbaa !14
  %16 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.23, i32 noundef %15) #2
  %17 = load i32, ptr %6, align 4, !tbaa !9
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  br label %20

20:                                               ; preds = %.lr.ph, %20
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %20 ]
  %21 = load ptr, ptr @stdout, align 8, !tbaa !5
  %22 = load ptr, ptr %19, align 8, !tbaa !15
  %23 = getelementptr inbounds %struct.s_atm, ptr %22, i64 %indvars.iv
  %24 = getelementptr inbounds i8, ptr %23, i64 88
  %25 = load i32, ptr %24, align 8, !tbaa !16
  %26 = getelementptr inbounds i8, ptr %23, i64 20
  %27 = load float, ptr %26, align 4, !tbaa !19
  %28 = fpext float %27 to double
  %29 = getelementptr inbounds i8, ptr %23, i64 24
  %30 = load float, ptr %29, align 8, !tbaa !20
  %31 = fpext float %30 to double
  %32 = getelementptr inbounds i8, ptr %23, i64 28
  %33 = load float, ptr %32, align 4, !tbaa !21
  %34 = fpext float %33 to double
  %35 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.24, i32 noundef %25, double noundef %28, double noundef %31, double noundef %34) #2
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %36 = load i32, ptr %6, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next, %37
  br i1 %38, label %20, label %._crit_edge, !llvm.loop !22

._crit_edge:                                      ; preds = %20, %1
  ret void
}

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


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