program main

  implicit none
  real(8) :: a,b,h,m
  real(8), parameter :: pi = 4.0d0*atan(1.0d0)
  real(8) :: t1,t2,c
  read(*,*) a,b,h,m

  t1 = pi/6.0d0*h + pi/360.0d0*m
  t2 = pi/30.0d0*m
  t2 = max(t1,t2)-min(t1,t2)
  
  c = sqrt(a**2 + b**2 -2.0d0*a*b*cos(t2))
  write(*,'(f0.10)')c

end program main
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QQcl.908b83cdf733e4088de468aaabf826b1 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_1381/source.f\00"
@_QQcl.2866302E313029 = linkonce constant [7 x i8] c"(f0.10)"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca double, align 8
  %2 = alloca double, align 8
  %3 = alloca double, align 8
  %4 = alloca double, align 8
  %5 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.908b83cdf733e4088de468aaabf826b1, i32 7)
  %6 = call i1 @_FortranAioInputReal64(ptr %5, ptr nonnull %1)
  %7 = call i1 @_FortranAioInputReal64(ptr %5, ptr nonnull %2)
  %8 = call i1 @_FortranAioInputReal64(ptr %5, ptr nonnull %3)
  %9 = call i1 @_FortranAioInputReal64(ptr %5, ptr nonnull %4)
  %10 = call i32 @_FortranAioEndIoStatement(ptr %5)
  %11 = load double, ptr %3, align 8, !tbaa !3
  %12 = fmul contract double %11, 0x3FE0C152382D7365
  %13 = load double, ptr %4, align 8, !tbaa !3
  %14 = fmul contract double %13, 0x3F81DF46A2529D39
  %15 = fadd contract double %12, %14
  %16 = fmul contract double %13, 0x3FBACEE9F37BEBD5
  %17 = fcmp ogt double %15, %16
  %18 = select i1 %17, double %15, double %16
  %19 = fcmp olt double %15, %16
  %20 = select i1 %19, double %15, double %16
  %21 = fsub contract double %18, %20
  %22 = load double, ptr %1, align 8, !tbaa !3
  %23 = fmul double %22, %22
  %24 = load double, ptr %2, align 8, !tbaa !3
  %25 = fmul double %24, %24
  %26 = fadd contract double %23, %25
  %27 = fmul contract double %22, 2.000000e+00
  %28 = fmul contract double %27, %24
  %29 = call contract double @llvm.cos.f64(double %21)
  %30 = fmul contract double %28, %29
  %31 = fsub contract double %26, %30
  %32 = call contract double @llvm.sqrt.f64(double %31)
  %33 = call ptr @_FortranAioBeginExternalFormattedOutput(ptr nonnull @_QQcl.2866302E313029, i64 7, ptr null, i32 -1, ptr nonnull @_QQcl.908b83cdf733e4088de468aaabf826b1, i32 14)
  %34 = call i1 @_FortranAioOutputReal64(ptr %33, double %32)
  %35 = call i32 @_FortranAioEndIoStatement(ptr %33)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputReal64(ptr, ptr) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare ptr @_FortranAioBeginExternalFormattedOutput(ptr, i64, ptr, i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputReal64(ptr, double) local_unnamed_addr

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.cos.f64(double) #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.sqrt.f64(double) #0

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
