; LLVM IR from DionysiosB/CodeForces :: 0800-0899 (868B-RaceAgainstTime)

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

@.str = external hidden unnamed_addr constant [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  %6 = alloca double, align 8
  %7 = alloca double, align 8
  %8 = alloca double, align 8
  %9 = alloca double, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca i8, align 1
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2, ptr noundef %3, ptr noundef %4, ptr noundef %5, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %15 = load double, ptr %4, align 8, !tbaa !5
  %16 = fmul double 6.000000e+00, %15
  store double %16, ptr %7, align 8, !tbaa !5
  %17 = load double, ptr %7, align 8, !tbaa !5
  %18 = fcmp ogt double %17, 3.600000e+02
  br i1 %18, label %19, label %22

19:                                               ; preds = %0
  %20 = load double, ptr %7, align 8, !tbaa !5
  %21 = fsub double %20, 3.600000e+02
  store double %21, ptr %7, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %19, %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %23 = load double, ptr %3, align 8, !tbaa !5
  %24 = load double, ptr %4, align 8, !tbaa !5
  %25 = fdiv double %24, 6.000000e+01
  %26 = fadd double %23, %25
  %27 = fmul double 6.000000e+00, %26
  store double %27, ptr %8, align 8, !tbaa !5
  %28 = load double, ptr %8, align 8, !tbaa !5
  %29 = fcmp ogt double %28, 3.600000e+02
  br i1 %29, label %30, label %33

30:                                               ; preds = %22
  %31 = load double, ptr %7, align 8, !tbaa !5
  %32 = fsub double %31, 3.600000e+02
  store double %32, ptr %7, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %30, %22
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %34 = load double, ptr %2, align 8, !tbaa !5
  %35 = load double, ptr %3, align 8, !tbaa !5
  %36 = fdiv double %35, 6.000000e+01
  %37 = fadd double %34, %36
  %38 = load double, ptr %4, align 8, !tbaa !5
  %39 = fdiv double %38, 3.600000e+03
  %40 = fadd double %37, %39
  %41 = fmul double 3.000000e+01, %40
  store double %41, ptr %9, align 8, !tbaa !5
  %42 = load double, ptr %9, align 8, !tbaa !5
  %43 = fcmp ogt double %42, 3.600000e+02
  br i1 %43, label %44, label %47

44:                                               ; preds = %33
  %45 = load double, ptr %9, align 8, !tbaa !5
  %46 = fsub double %45, 3.600000e+02
  store double %46, ptr %9, align 8, !tbaa !5
  br label %47

47:                                               ; preds = %44, %33
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %48 = load double, ptr %5, align 8, !tbaa !5
  %49 = fmul double 3.000000e+01, %48
  store double %49, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %50 = load double, ptr %6, align 8, !tbaa !5
  %51 = fmul double 3.000000e+01, %50
  store double %51, ptr %11, align 8, !tbaa !5
  %52 = load double, ptr %11, align 8, !tbaa !5
  %53 = load double, ptr %10, align 8, !tbaa !5
  %54 = fcmp olt double %52, %53
  br i1 %54, label %55, label %59

55:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %56 = load double, ptr %10, align 8, !tbaa !5
  store double %56, ptr %12, align 8, !tbaa !5
  %57 = load double, ptr %11, align 8, !tbaa !5
  store double %57, ptr %10, align 8, !tbaa !5
  %58 = load double, ptr %12, align 8, !tbaa !5
  store double %58, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  br label %59

59:                                               ; preds = %55, %47
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #3
  store i8 0, ptr %13, align 1, !tbaa !9
  %60 = load double, ptr %10, align 8, !tbaa !5
  %61 = load double, ptr %7, align 8, !tbaa !5
  %62 = fcmp olt double %60, %61
  br i1 %62, label %63, label %84

63:                                               ; preds = %59
  %64 = load double, ptr %7, align 8, !tbaa !5
  %65 = load double, ptr %11, align 8, !tbaa !5
  %66 = fcmp olt double %64, %65
  br i1 %66, label %67, label %84

67:                                               ; preds = %63
  %68 = load double, ptr %10, align 8, !tbaa !5
  %69 = load double, ptr %8, align 8, !tbaa !5
  %70 = fcmp olt double %68, %69
  br i1 %70, label %71, label %84

71:                                               ; preds = %67
  %72 = load double, ptr %8, align 8, !tbaa !5
  %73 = load double, ptr %11, align 8, !tbaa !5
  %74 = fcmp olt double %72, %73
  br i1 %74, label %75, label %84

75:                                               ; preds = %71
  %76 = load double, ptr %10, align 8, !tbaa !5
  %77 = load double, ptr %9, align 8, !tbaa !5
  %78 = fcmp olt double %76, %77
  br i1 %78, label %79, label %84

79:                                               ; preds = %75
  %80 = load double, ptr %9, align 8, !tbaa !5
  %81 = load double, ptr %11, align 8, !tbaa !5
  %82 = fcmp olt double %80, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %79
  store i8 1, ptr %13, align 1, !tbaa !9
  br label %84

84:                                               ; preds = %83, %79, %75, %71, %67, %63, %59
  %85 = load double, ptr %10, align 8, !tbaa !5
  %86 = load double, ptr %7, align 8, !tbaa !5
  %87 = fcmp olt double %85, %86
  br i1 %87, label %88, label %92

88:                                               ; preds = %84
  %89 = load double, ptr %7, align 8, !tbaa !5
  %90 = load double, ptr %11, align 8, !tbaa !5
  %91 = fcmp olt double %89, %90
  br i1 %91, label %109, label %92

92:                                               ; preds = %88, %84
  %93 = load double, ptr %10, align 8, !tbaa !5
  %94 = load double, ptr %8, align 8, !tbaa !5
  %95 = fcmp olt double %93, %94
  br i1 %95, label %96, label %100

96:                                               ; preds = %92
  %97 = load double, ptr %8, align 8, !tbaa !5
  %98 = load double, ptr %11, align 8, !tbaa !5
  %99 = fcmp olt double %97, %98
  br i1 %99, label %109, label %100

100:                                              ; preds = %96, %92
  %101 = load double, ptr %10, align 8, !tbaa !5
  %102 = load double, ptr %9, align 8, !tbaa !5
  %103 = fcmp olt double %101, %102
  br i1 %103, label %104, label %108

104:                                              ; preds = %100
  %105 = load double, ptr %9, align 8, !tbaa !5
  %106 = load double, ptr %11, align 8, !tbaa !5
  %107 = fcmp olt double %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104, %100
  store i8 1, ptr %13, align 1, !tbaa !9
  br label %109

109:                                              ; preds = %108, %104, %96, %88
  %110 = load i8, ptr %13, align 1, !tbaa !9, !range !11, !noundef !12
  %111 = trunc i8 %110 to i1
  %112 = zext i1 %111 to i64
  %113 = select i1 %111, ptr @.str.1, ptr @.str.2
  %114 = call i32 @puts(ptr noundef %113)
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #3
  ret i32 0
}

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

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

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

declare i32 @puts(ptr noundef) #2

attributes #0 = { mustprogress norecurse 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 = { "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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; 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 [20 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %7 = load double, ptr %3, align 8, !tbaa !5
  %8 = fmul double %7, 6.000000e+00
  %9 = fcmp ogt double %8, 3.600000e+02
  %10 = fadd double %8, -3.600000e+02
  %.035 = select i1 %9, double %10, double %8
  %11 = load double, ptr %2, align 8, !tbaa !5
  %12 = fdiv double %7, 6.000000e+01
  %13 = fadd double %11, %12
  %14 = fmul double %13, 6.000000e+00
  %15 = fcmp ogt double %14, 3.600000e+02
  %16 = fadd double %.035, -3.600000e+02
  %.136 = select i1 %15, double %16, double %.035
  %17 = load double, ptr %1, align 8, !tbaa !5
  %18 = insertelement <2 x double> poison, double %7, i64 0
  %19 = insertelement <2 x double> %18, double %11, i64 1
  %20 = fdiv <2 x double> %19, <double 3.600000e+03, double 6.000000e+01>
  %21 = extractelement <2 x double> %20, i64 1
  %22 = fadd double %17, %21
  %23 = extractelement <2 x double> %20, i64 0
  %24 = fadd double %23, %22
  %25 = fmul double %24, 3.000000e+01
  %26 = fcmp ogt double %25, 3.600000e+02
  %27 = fadd double %25, -3.600000e+02
  %.039 = select i1 %26, double %27, double %25
  %28 = load double, ptr %4, align 8, !tbaa !5
  %29 = fmul double %28, 3.000000e+01
  %30 = load double, ptr %5, align 8, !tbaa !5
  %31 = fmul double %30, 3.000000e+01
  %32 = fcmp olt double %31, %29
  %.038 = select i1 %32, double %31, double %29
  %.037 = select i1 %32, double %29, double %31
  %33 = fcmp olt double %.038, %.136
  %34 = fcmp olt double %.136, %.037
  %or.cond = and i1 %33, %34
  %35 = fcmp olt double %.038, %14
  %or.cond50 = and i1 %35, %or.cond
  %36 = fcmp olt double %14, %.037
  %or.cond51 = and i1 %36, %or.cond50
  %37 = fcmp olt double %.038, %.039
  %38 = fcmp olt double %.039, %.037
  %39 = and i1 %37, %38
  %or.cond53 = select i1 %or.cond51, i1 %39, i1 false
  %or.cond55 = and i1 %35, %36
  %or.cond57 = select i1 %or.cond, i1 true, i1 %or.cond55
  %40 = select i1 %or.cond57, i1 true, i1 %39
  %not. = xor i1 %40, true
  %narrow = select i1 %not., i1 true, i1 %or.cond53
  %41 = select i1 %narrow, ptr @.str.1, ptr @.str.2
  %42 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %41)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #3
  ret i32 0
}

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

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

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

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

attributes #0 = { mustprogress nofree norecurse 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 = { 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 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass