#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 */
int /*<<< orphan*/ printf(char *, int, int, int, double);
void pdms(double deg) {
  int sign = '+';
  int g, m;
  double s;
  if (deg < 0) {
    sign = '-';
    deg = -deg;
  }
  g = (int)(deg);
  m = (int)((deg - g) * 60);
  s = ((deg - g) * 3600 - m * 60);
  printf("%c%.2d %.2d %6.3f", sign, g, m, s);
}


x86 assembly (clang, -O0):
<pdms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movl   $0x2b,-0xc(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    115a <pdms+0x4a>
movl   $0x2d,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  0xe90(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x10(%rbp),%xmm1
subsd  %xmm1,%xmm0
imul   $0x3c,-0x14(%rbp),%eax
cvtsi2sd %eax,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe48(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
movsd  -0x20(%rbp),%xmm0
lea    0xe36(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pdms>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    0x2b(%rax,%rax,1),%esi
jbe    112b <pdms+0x1b>
xorpd  0xed5(%rip),%xmm0
cvttsd2si %xmm0,%edx
cvttpd2dq %xmm0,%xmm1
cvtdq2pd %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  0xecd(%rip),%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%ecx
imul   $0x3c,%ecx,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xebb(%rip),%xmm0
subsd  %xmm1,%xmm0
lea    0xeb8(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%c%.2d %.2d %6.3f\00"
define void @pdms(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store double %0, double* %2
store i32 43, i32* %3
%7 = load double, double* %2
%8 = fcmp olt double %7, 0.000000e+00
br i1 %8, label %9, label %12
9: ; preds = %1
store i32 45, i32* %3
%10 = load double, double* %2
%11 = fneg double %10
store double %11, double* %2
br label %12
12: ; preds = %9, %1
%13 = load double, double* %2
%14 = fptosi double %13 to i32
store i32 %14, i32* %4
%15 = load double, double* %2
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = fsub double %15, %17
%19 = fmul double %18, 6.000000e+01
%20 = fptosi double %19 to i32
store i32 %20, i32* %5
%21 = load double, double* %2
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to double
%24 = fsub double %21, %23
%25 = load i32, i32* %5
%26 = mul nsw i32 %25, 60
%27 = sitofp i32 %26 to double
%28 = fneg double %27
%29 = call double @llvm.fmuladd.f64(double %24, double 3.600000e+03, double %28)
store double %29, double* %6
%30 = load i32, i32* %3
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = load double, double* %6
%34 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %30, i32 %31, i32 %32, double %33)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%c%.2d %.2d %6.3f\00"
define void @pdms(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, i32 45, i32 43
%5 = select i1 %2, double %3, double %0
%6 = fptosi double %5 to i32
%7 = sitofp i32 %6 to double
%8 = fsub double %5, %7
%9 = fmul double %8, 6.000000e+01
%10 = fptosi double %9 to i32
%11 = mul nsw i32 %10, 60
%12 = sitofp i32 %11 to double
%13 = fneg double %12
%14 = tail call double @llvm.fmuladd.f64(double %8, double 3.600000e+03, double %13)
%15 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 %10, double %14)
ret void
}