; 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.mismatch_matrix_t = type { ptr, i32 }

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [69 x i8], align 1

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

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @parse_mismatch_matrix(i32 noundef %0, ptr noundef %1) #3 {
  %3 = alloca %struct.mismatch_matrix_t, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i8, align 1
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %10 = load ptr, ptr %5, align 8, !tbaa !9
  %11 = call noalias ptr @fopen(ptr noundef %10, ptr noundef @.str)
  store ptr %11, ptr %6, align 8, !tbaa !9
  %12 = load ptr, ptr %6, align 8, !tbaa !9
  %13 = icmp ne ptr %12, null
  br i1 %13, label %18, label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr @stderr, align 8, !tbaa !9
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef @.str.1, ptr noundef %16) #8
  call void @exit(i32 noundef 1) #9
  unreachable

18:                                               ; preds = %2
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = mul i32 %19, %20
  store i32 %21, ptr %7, align 4, !tbaa !5
  %22 = load i32, ptr %4, align 4, !tbaa !5
  %23 = getelementptr inbounds %struct.mismatch_matrix_t, ptr %3, i32 0, i32 1
  store i32 %22, ptr %23, align 8, !tbaa !11
  %24 = load i32, ptr %7, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = mul i64 %25, 4
  %27 = call noalias ptr @malloc(i64 noundef %26) #10
  %28 = getelementptr inbounds %struct.mismatch_matrix_t, ptr %3, i32 0, i32 0
  store ptr %27, ptr %28, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #8
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %76, %18
  %30 = load ptr, ptr %6, align 8, !tbaa !9
  %31 = call i32 @feof(ptr noundef %30) #8
  %32 = icmp ne i32 %31, 0
  %33 = xor i1 %32, true
  br i1 %33, label %34, label %77

34:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #8
  %35 = load ptr, ptr %6, align 8, !tbaa !9
  %36 = call i32 @fgetc(ptr noundef %35)
  %37 = trunc i32 %36 to i8
  store i8 %37, ptr %9, align 1, !tbaa !14
  %38 = load i8, ptr %9, align 1, !tbaa !14
  %39 = sext i8 %38 to i32
  %40 = icmp sge i32 %39, 48
  br i1 %40, label %41, label %45

41:                                               ; preds = %34
  %42 = load i8, ptr %9, align 1, !tbaa !14
  %43 = sext i8 %42 to i32
  %44 = icmp sle i32 %43, 57
  br i1 %44, label %49, label %45

45:                                               ; preds = %41, %34
  %46 = load i8, ptr %9, align 1, !tbaa !14
  %47 = sext i8 %46 to i32
  %48 = icmp eq i32 %47, 46
  br i1 %48, label %49, label %62

49:                                               ; preds = %45, %41
  %50 = load i8, ptr %9, align 1, !tbaa !14
  %51 = sext i8 %50 to i32
  %52 = load ptr, ptr %6, align 8, !tbaa !9
  %53 = call i32 @ungetc(i32 noundef %51, ptr noundef %52)
  %54 = load ptr, ptr %6, align 8, !tbaa !9
  %55 = getelementptr inbounds %struct.mismatch_matrix_t, ptr %3, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = add i32 %57, 1
  store i32 %58, ptr %8, align 4, !tbaa !5
  %59 = zext i32 %57 to i64
  %60 = getelementptr inbounds float, ptr %56, i64 %59
  %61 = call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef %54, ptr noundef @.str.2, ptr noundef %60)
  br label %62

62:                                               ; preds = %49, %45
  %63 = load i32, ptr %8, align 4, !tbaa !5
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = icmp ugt i32 %63, %64
  br i1 %65, label %66, label %76

66:                                               ; preds = %62
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = mul i32 %67, 2
  store i32 %68, ptr %7, align 4, !tbaa !5
  %69 = getelementptr inbounds %struct.mismatch_matrix_t, ptr %3, i32 0, i32 0
  %70 = load ptr, ptr %69, align 8, !tbaa !13
  %71 = load i32, ptr %7, align 4, !tbaa !5
  %72 = zext i32 %71 to i64
  %73 = mul i64 %72, 4
  %74 = call ptr @realloc(ptr noundef %70, i64 noundef %73) #11
  %75 = getelementptr inbounds %struct.mismatch_matrix_t, ptr %3, i32 0, i32 0
  store ptr %74, ptr %75, align 8, !tbaa !13
  br label %76

76:                                               ; preds = %66, %62
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #8
  br label %29, !llvm.loop !15

77:                                               ; preds = %29
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr %7, align 4, !tbaa !5
  %80 = icmp ult i32 %78, %79
  br i1 %80, label %81, label %86

81:                                               ; preds = %77
  %82 = load ptr, ptr @stderr, align 8, !tbaa !9
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = sub i32 %83, 1
  %85 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.3, i32 noundef %84) #8
  call void @exit(i32 noundef 1) #9
  unreachable

86:                                               ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  %87 = load { ptr, i32 }, ptr %3, align 8
  ret { ptr, i32 } %87
}

declare noalias ptr @fopen(ptr noundef, ptr noundef) #4

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

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #6

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #5

declare i32 @fgetc(ptr noundef) #4

declare i32 @ungetc(i32 noundef, ptr noundef) #4

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) #4

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #7

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind allocsize(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 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 = { "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 "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 "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 allocsize(1) "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 #8 = { nounwind }
attributes #9 = { noreturn nounwind }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind allocsize(1) }

!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 8}
!12 = !{!"mismatch_matrix_t", !10, i64 0, !6, i64 8}
!13 = !{!12, !10, i64 0}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@stderr = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [69 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local { ptr, i32 } @parse_mismatch_matrix(i32 noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str)
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %4, label %7

4:                                                ; preds = %2
  %5 = load ptr, ptr @stderr, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.1, ptr noundef %1) #6
  tail call void @exit(i32 noundef 1) #7
  unreachable

7:                                                ; preds = %2
  %8 = mul i32 %0, %0
  %9 = zext i32 %8 to i64
  %10 = shl nuw nsw i64 %9, 2
  %11 = tail call noalias ptr @malloc(i64 noundef %10) #8
  %12 = tail call i32 @feof(ptr noundef nonnull %3) #9
  %.not3132 = icmp eq i32 %12, 0
  br i1 %.not3132, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %7, %30
  %.sroa.0.035 = phi ptr [ %.sroa.0.1, %30 ], [ %11, %7 ]
  %.034 = phi i32 [ %.1, %30 ], [ 0, %7 ]
  %.02833 = phi i32 [ %.129, %30 ], [ %8, %7 ]
  %13 = tail call i32 @fgetc(ptr noundef nonnull %3)
  %sext = shl i32 %13, 24
  %14 = ashr exact i32 %sext, 24
  %15 = add nsw i32 %14, -48
  %or.cond = icmp ult i32 %15, 10
  %16 = icmp eq i32 %sext, 771751936
  %or.cond5 = or i1 %16, %or.cond
  br i1 %or.cond5, label %17, label %23

17:                                               ; preds = %.lr.ph
  %18 = tail call i32 @ungetc(i32 noundef %14, ptr noundef nonnull %3)
  %19 = add i32 %.034, 1
  %20 = zext i32 %.034 to i64
  %21 = getelementptr inbounds float, ptr %.sroa.0.035, i64 %20
  %22 = tail call i32 (ptr, ptr, ...) @__isoc99_fscanf(ptr noundef nonnull %3, ptr noundef nonnull @.str.2, ptr noundef %21) #9
  br label %23

23:                                               ; preds = %.lr.ph, %17
  %.1 = phi i32 [ %19, %17 ], [ %.034, %.lr.ph ]
  %24 = icmp ugt i32 %.1, %.02833
  br i1 %24, label %25, label %30

25:                                               ; preds = %23
  %26 = shl i32 %.02833, 1
  %27 = zext i32 %26 to i64
  %28 = shl nuw nsw i64 %27, 2
  %29 = tail call ptr @realloc(ptr noundef %.sroa.0.035, i64 noundef %28) #10
  br label %30

30:                                               ; preds = %25, %23
  %.129 = phi i32 [ %26, %25 ], [ %.02833, %23 ]
  %.sroa.0.1 = phi ptr [ %29, %25 ], [ %.sroa.0.035, %23 ]
  %31 = tail call i32 @feof(ptr noundef nonnull %3) #9
  %.not31 = icmp eq i32 %31, 0
  br i1 %.not31, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %30, %7
  %.028.lcssa = phi i32 [ %8, %7 ], [ %.129, %30 ]
  %.0.lcssa = phi i32 [ 0, %7 ], [ %.1, %30 ]
  %.sroa.0.0.lcssa = phi ptr [ %11, %7 ], [ %.sroa.0.1, %30 ]
  %32 = icmp ult i32 %.0.lcssa, %.028.lcssa
  br i1 %32, label %33, label %37

33:                                               ; preds = %._crit_edge
  %34 = load ptr, ptr @stderr, align 8, !tbaa !5
  %35 = add i32 %0, -1
  %36 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str.3, i32 noundef %35) #6
  tail call void @exit(i32 noundef 1) #7
  unreachable

37:                                               ; preds = %._crit_edge
  %.fca.0.insert = insertvalue { ptr, i32 } poison, ptr %.sroa.0.0.lcssa, 0
  %.fca.1.insert = insertvalue { ptr, i32 } %.fca.0.insert, i32 %0, 1
  ret { ptr, i32 } %.fca.1.insert
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @feof(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @fgetc(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @ungetc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #2

declare i32 @__isoc99_fscanf(ptr noundef, ptr noundef, ...) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { 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 = { 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 #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 = { "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 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { cold nounwind }
attributes #7 = { noreturn nounwind }
attributes #8 = { nounwind allocsize(0) }
attributes #9 = { nounwind }
attributes #10 = { nounwind allocsize(1) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass