#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 floor(double);
void decimal2degree(double x, int *d, int *m, int *s) {
  *d = floor(x);
  x -= *d;
  x *= 3600;
  *s = (int)x % 60;
  *m = (int)x / 60;
}


x86 assembly (clang, -O0):
<decimal2degree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
cvtsi2sdl (%rax),%xmm1
movsd  -0x8(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xea7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    -0x20(%rbp),%rax
mov    %edx,(%rax)
cvttsd2si -0x8(%rbp),%eax
mov    $0x3c,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decimal2degree>:
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>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xeba(%rip),%xmm1
cvttsd2si %xmm1,%ecx
mov    %eax,(%rbx)
movslq %ecx,%rax
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x5,%ecx
add    %edx,%ecx
imul   $0x3c,%ecx,%edx
sub    %edx,%eax
mov    %eax,(%r14)
mov    %ecx,(%r15)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

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