; LLVM IR from kalininalab/rinminer :: rinminer (rinminer)

; 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.subgraph_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i32, ptr }
%struct.database_t = type { ptr, i32, i32, i32 }

@.str.19 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external global ptr, align 8

; 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_result(i32 noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #1 {
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 %0, ptr %7, align 4, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !5
  store ptr %2, ptr %9, align 8, !tbaa !9
  store i32 %3, ptr %10, align 4, !tbaa !5
  store ptr %4, ptr %11, align 8, !tbaa !9
  store ptr %5, ptr %12, align 8, !tbaa !9
  %15 = load i32, ptr %8, align 4, !tbaa !5
  %16 = icmp ule i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %6
  br label %78

18:                                               ; preds = %6
  %19 = load i32, ptr %7, align 4, !tbaa !5
  %20 = icmp eq i32 %19, 1
  br i1 %20, label %21, label %25

21:                                               ; preds = %18
  %22 = call i32 (ptr, ...) @printf(ptr noundef @.str.19)
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.45)
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.46)
  br label %25

25:                                               ; preds = %21, %18
  %26 = load i32, ptr %7, align 4, !tbaa !5
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = load ptr, ptr %9, align 8, !tbaa !9
  %29 = getelementptr inbounds i32, ptr %28, i64 0
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = load ptr, ptr %9, align 8, !tbaa !9
  %32 = getelementptr inbounds i32, ptr %31, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = load ptr, ptr %9, align 8, !tbaa !9
  %35 = getelementptr inbounds i32, ptr %34, i64 2
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = load i32, ptr %10, align 4, !tbaa !5
  %38 = load ptr, ptr %11, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.subgraph_t, ptr %38, i32 0, i32 11
  %40 = load i32, ptr %39, align 4, !tbaa !11
  %41 = load ptr, ptr %11, align 8, !tbaa !9
  %42 = getelementptr inbounds %struct.subgraph_t, ptr %41, i32 0, i32 8
  %43 = load i32, ptr %42, align 8, !tbaa !14
  %44 = load ptr, ptr %11, align 8, !tbaa !9
  %45 = getelementptr inbounds %struct.subgraph_t, ptr %44, i32 0, i32 10
  %46 = load i32, ptr %45, align 8, !tbaa !15
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.47, i32 noundef %26, i32 noundef %27, i32 noundef %30, i32 noundef %33, i32 noundef %36, i32 noundef %37, i32 noundef %40, i32 noundef %43, i32 noundef %46)
  %48 = load ptr, ptr %12, align 8, !tbaa !9
  %49 = icmp ne ptr %48, null
  br i1 %49, label %50, label %74

50:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %51 = load ptr, ptr %12, align 8, !tbaa !9
  %52 = getelementptr inbounds %struct.database_t, ptr %51, i32 0, i32 1
  %53 = load i32, ptr %52, align 8, !tbaa !16
  %54 = load ptr, ptr %12, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.database_t, ptr %54, i32 0, i32 2
  %56 = load i32, ptr %55, align 4, !tbaa !18
  %57 = sub i32 %53, %56
  store i32 %57, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %58 = load ptr, ptr %11, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.subgraph_t, ptr %58, i32 0, i32 16
  %60 = load i32, ptr %59, align 8, !tbaa !19
  %61 = load ptr, ptr %11, align 8, !tbaa !9
  %62 = getelementptr inbounds %struct.subgraph_t, ptr %61, i32 0, i32 17
  %63 = load i32, ptr %62, align 4, !tbaa !20
  %64 = sub i32 %60, %63
  store i32 %64, ptr %14, align 4, !tbaa !5
  %65 = load ptr, ptr %11, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.subgraph_t, ptr %65, i32 0, i32 17
  %67 = load i32, ptr %66, align 4, !tbaa !20
  %68 = load ptr, ptr %12, align 8, !tbaa !9
  %69 = getelementptr inbounds %struct.database_t, ptr %68, i32 0, i32 2
  %70 = load i32, ptr %69, align 4, !tbaa !18
  %71 = load i32, ptr %14, align 4, !tbaa !5
  %72 = load i32, ptr %13, align 4, !tbaa !5
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.48, i32 noundef %67, i32 noundef %70, i32 noundef %71, i32 noundef %72)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  br label %74

74:                                               ; preds = %50, %25
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.49)
  %76 = load ptr, ptr @stdout, align 8, !tbaa !9
  %77 = call i32 @fflush(ptr noundef %76)
  br label %78

78:                                               ; preds = %74, %17
  ret void
}

declare i32 @printf(ptr noundef, ...) #2

declare i32 @fflush(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 = { "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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 76}
!12 = !{!"subgraph_t", !10, i64 0, !10, i64 8, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !6, i64 84, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !13, i64 104, !6, i64 108, !10, i64 112}
!13 = !{!"short", !7, i64 0}
!14 = !{!12, !6, i64 64}
!15 = !{!12, !6, i64 72}
!16 = !{!17, !6, i64 8}
!17 = !{!"database_t", !10, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!18 = !{!17, !6, i64 12}
!19 = !{!12, !6, i64 96}
!20 = !{!12, !6, i64 100}


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

@.str.19 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [72 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [44 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.49 = external hidden unnamed_addr constant [3 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_result(i32 noundef %0, i32 noundef %1, ptr nocapture noundef readonly %2, i32 noundef %3, ptr nocapture noundef readonly %4, ptr noundef readonly %5) local_unnamed_addr #0 {
  %7 = icmp eq i32 %1, 0
  br i1 %7, label %43, label %8

8:                                                ; preds = %6
  %9 = icmp eq i32 %0, 1
  br i1 %9, label %10, label %14

10:                                               ; preds = %8
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.45)
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.46)
  br label %14

14:                                               ; preds = %10, %8
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %2, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %2, i64 8
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %4, i64 76
  %21 = load i32, ptr %20, align 4, !tbaa !9
  %22 = getelementptr inbounds i8, ptr %4, i64 64
  %23 = load i32, ptr %22, align 8, !tbaa !13
  %24 = getelementptr inbounds i8, ptr %4, i64 72
  %25 = load i32, ptr %24, align 8, !tbaa !14
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.47, i32 noundef %0, i32 noundef %1, i32 noundef %15, i32 noundef %17, i32 noundef %19, i32 noundef %3, i32 noundef %21, i32 noundef %23, i32 noundef %25)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %39, label %27

27:                                               ; preds = %14
  %28 = getelementptr inbounds i8, ptr %5, i64 8
  %29 = load i32, ptr %28, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %5, i64 12
  %31 = load i32, ptr %30, align 4, !tbaa !17
  %32 = sub i32 %29, %31
  %33 = getelementptr inbounds i8, ptr %4, i64 96
  %34 = load i32, ptr %33, align 8, !tbaa !18
  %35 = getelementptr inbounds i8, ptr %4, i64 100
  %36 = load i32, ptr %35, align 4, !tbaa !19
  %37 = sub i32 %34, %36
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.48, i32 noundef %36, i32 noundef %31, i32 noundef %37, i32 noundef %32)
  br label %39

39:                                               ; preds = %27, %14
  %40 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.49)
  %41 = load ptr, ptr @stdout, align 8, !tbaa !20
  %42 = tail call i32 @fflush(ptr noundef %41)
  br label %43

43:                                               ; preds = %6, %39
  ret void
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) 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" }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 76}
!10 = !{!"subgraph_t", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !6, i64 64, !6, i64 68, !6, i64 72, !6, i64 76, !6, i64 80, !6, i64 84, !6, i64 88, !6, i64 92, !6, i64 96, !6, i64 100, !12, i64 104, !6, i64 108, !11, i64 112}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!"short", !7, i64 0}
!13 = !{!10, !6, i64 64}
!14 = !{!10, !6, i64 72}
!15 = !{!16, !6, i64 8}
!16 = !{!"database_t", !11, i64 0, !6, i64 8, !6, i64 12, !6, i64 16}
!17 = !{!16, !6, i64 12}
!18 = !{!10, !6, i64 96}
!19 = !{!10, !6, i64 100}
!20 = !{!11, !11, i64 0}


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