#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 floor(double);
void DEM_cvt_dbl2dms(double loc, int *d, int *m, int *s) {
  double partial;
  int secs;
  *d = (int)floor(loc);
  partial = loc - floor(loc);
  secs = (int)floor(3600.0 * partial);
  *m = secs / 60;
  *s = secs % 60;
  return;
}


x86 assembly (clang, -O0):
<DEM_cvt_dbl2dms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
cvttsd2si %xmm0,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <floor@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe96(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
call   1030 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x2c(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DEM_cvt_dbl2dms>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
call   1030 <floor@plt>
cvttsd2si %xmm0,%eax
mov    %eax,(%rbx)
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xebb(%rip),%xmm1
movapd %xmm1,%xmm0
call   1030 <floor@plt>
cvttsd2si %xmm0,%eax
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
mov    %ecx,(%r15)
imul   $0x3c,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @DEM_cvt_dbl2dms(double %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca double
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca double
%10 = alloca i32
store double %0, double* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%11 = load double, double* %5
%12 = call double @llvm.floor.f64(double %11)
%13 = fptosi double %12 to i32
%14 = load i32*, i32** %6
store i32 %13, i32* %14
%15 = load double, double* %5
%16 = load double, double* %5
%17 = call double @llvm.floor.f64(double %16)
%18 = fsub double %15, %17
store double %18, double* %9
%19 = load double, double* %9
%20 = fmul double 3.600000e+03, %19
%21 = call double @llvm.floor.f64(double %20)
%22 = fptosi double %21 to i32
store i32 %22, i32* %10
%23 = load i32, i32* %10
%24 = sdiv i32 %23, 60
%25 = load i32*, i32** %7
store i32 %24, i32* %25
%26 = load i32, i32* %10
%27 = srem i32 %26, 60
%28 = load i32*, i32** %8
store i32 %27, i32* %28
ret void
}

LLVM IR (-O2):
define void @DEM_cvt_dbl2dms(double %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call double @llvm.floor.f64(double %0)
%6 = fptosi double %5 to i32
store i32 %6, i32* %1
%7 = fsub double %0, %5
%8 = fmul double %7, 3.600000e+03
%9 = tail call double @llvm.floor.f64(double %8)
%10 = fptosi double %9 to i32
%11 = sdiv i32 %10, 60
store i32 %11, i32* %2
%12 = srem i32 %10, 60
store i32 %12, i32* %3
ret void
}