#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 modf(double, double *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, double);
char const *strdup(char *);
const char *ln_get_humanr_location(double location) {
  char buf[32];
  double deg, min, sec;
  sec = fabs(60.0 * (modf(location, &deg)));
  sec = 60.0 * (modf(sec, &min));
  sprintf(buf, "%+dº%d'%.2f\"", (int)deg, (int)min, sec);
  return strdup(buf);
}


x86 assembly (clang, -O0):
<ln_get_humanr_location>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x38(%rbp),%rdi
call   1030 <modf@plt>
movaps %xmm0,%xmm1
movsd  0xeaa(%rip),%xmm0
mulsd  %xmm1,%xmm0
movaps 0xeaf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
lea    -0x40(%rbp),%rdi
call   1030 <modf@plt>
movaps %xmm0,%xmm1
movsd  0xe7d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x30(%rbp),%rdi
cvttsd2si -0x38(%rbp),%edx
cvttsd2si -0x40(%rbp),%ecx
movsd  -0x48(%rbp),%xmm0
lea    0xe7a(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x30(%rbp),%rdi
call   1050 <strdup@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ln_get_humanr_location>:
push   %rbx
sub    $0x30,%rsp
lea    0x8(%rsp),%rdi
call   1030 <modf@plt>
mulsd  0xeb9(%rip),%xmm0
andpd  0xec1(%rip),%xmm0
mov    %rsp,%rdi
call   1030 <modf@plt>
cvttsd2si 0x8(%rsp),%edx
mulsd  0xe9b(%rip),%xmm0
cvttsd2si (%rsp),%ecx
lea    0xeaf(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <strdup@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"%+d\C2\BA%d'%.2f\22\00"
define i8* @ln_get_humanr_location(double %0) {
%2 = alloca double
%3 = alloca [32 x i8]
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %2
%7 = load double, double* %2
%8 = call double @modf(double %7, double* %4)
%9 = fmul double 6.000000e+01, %8
%10 = call double @llvm.fabs.f64(double %9)
store double %10, double* %6
%11 = load double, double* %6
%12 = call double @modf(double %11, double* %5)
%13 = fmul double 6.000000e+01, %12
store double %13, double* %6
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%15 = load double, double* %4
%16 = fptosi double %15 to i32
%17 = load double, double* %5
%18 = fptosi double %17 to i32
%19 = load double, double* %6
%20 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %18, double %19)
%21 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%22 = call i8* @strdup(i8* %21)
ret i8* %22
}

LLVM IR (-O2):
@.str = [14 x i8] c"%+d\C2\BA%d'%.2f\22\00"
define noalias i8* @ln_get_humanr_location(double %0) {
%2 = alloca [32 x i8]
%3 = alloca double
%4 = alloca double
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%6 = bitcast double* %3 to i8*
%7 = bitcast double* %4 to i8*
%8 = call double @modf(double %0, double* %3)
%9 = fmul double %8, 6.000000e+01
%10 = tail call double @llvm.fabs.f64(double %9)
%11 = call double @modf(double %10, double* %4)
%12 = fmul double %11, 6.000000e+01
%13 = load double, double* %3
%14 = fptosi double %13 to i32
%15 = load double, double* %4
%16 = fptosi double %15 to i32
%17 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, double %12)
%18 = call i8* @strdup(i8* %5)
ret i8* %18
}