#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double fabs(double);
double calc(int hour, int minute) {
  double theta1, theta2;
  double ret;
  theta1 = 6.0 * minute;
  theta2 = 30.0 * hour + minute / 2.0;
  ret = fabs(theta1 - theta2);
  if (ret > 180.0)
    return 360.0 - ret;
  return ret;
}


x86 assembly (clang, -O0):
<calc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xf01(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
movsd  0xede(%rip),%xmm2
divsd  %xmm2,%xmm1
movsd  0xeca(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movaps 0xed4(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe8e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1193 <calc+0x93>
movsd  0xe9c(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    119d <calc+0x9d>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc>:
cvtsi2sd %esi,%xmm0
movsd  0xef4(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvtsi2sd %edi,%xmm2
mulsd  0xeec(%rip),%xmm0
mulsd  0xeec(%rip),%xmm2
addsd  %xmm0,%xmm2
subsd  %xmm2,%xmm1
andpd  0xefc(%rip),%xmm1
movsd  0xedc(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  0xed8(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @calc(i32 %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
store i32 %0, i32* %4
store i32 %1, i32* %5
%9 = load i32, i32* %5
%10 = sitofp i32 %9 to double
%11 = fmul double 6.000000e+00, %10
store double %11, double* %6
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = load i32, i32* %5
%15 = sitofp i32 %14 to double
%16 = fdiv double %15, 2.000000e+00
%17 = call double @llvm.fmuladd.f64(double 3.000000e+01, double %13, double %16)
store double %17, double* %7
%18 = load double, double* %6
%19 = load double, double* %7
%20 = fsub double %18, %19
%21 = call double @llvm.fabs.f64(double %20)
store double %21, double* %8
%22 = load double, double* %8
%23 = fcmp ogt double %22, 1.800000e+02
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = load double, double* %8
%26 = fsub double 3.600000e+02, %25
store double %26, double* %3
br label %29
27: ; preds = %2
%28 = load double, double* %8
store double %28, double* %3
br label %29
29: ; preds = %27, %24
%30 = load double, double* %3
ret double %30
}

LLVM IR (-O2):
define double @calc(i32 %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fmul double %3, 6.000000e+00
%5 = sitofp i32 %0 to double
%6 = fmul double %3, 5.000000e-01
%7 = tail call double @llvm.fmuladd.f64(double %5, double 3.000000e+01, double %6)
%8 = fsub double %4, %7
%9 = tail call double @llvm.fabs.f64(double %8)
%10 = fcmp ogt double %9, 1.800000e+02
%11 = fsub double 3.600000e+02, %9
%12 = select i1 %10, double %11, double %9
ret double %12
}