#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*/ sprintf(char *, char *, char, int, int, double);
char *angle_asc(double a, char *lin) {
  char s;
  int d, min;
  double sec;
  if (a >= 0.)
    s = '+';
  else {
    s = '-';
    a = -a;
  }
  d = (int)(a / 3600.);
  min = (int)((a - (double)d * 3600.) / 60.);
  sec = a - (double)d * 3600. - (double)min * 60.;
  d %= 360;
  if (sec > 59.9)
    sec = 59.9;
  sprintf(lin, "%c%02d:%02d:%04.1f", s, d, min, sec);
  return lin;
}


x86 assembly (clang, -O0):
<angle_asc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     113c <angle_asc+0x2c>
movb   $0x2b,-0x11(%rbp)
jmp    1161 <angle_asc+0x51>
movb   $0x2d,-0x11(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xea2(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
cvtsi2sdl -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe6e(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe56(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x8(%rbp),%xmm0
cvtsi2sdl -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xe2a(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
cvtsi2sdl -0x1c(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xdf6(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x168,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xdc6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1251 <angle_asc+0x141>
movsd  0xdb4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x11(%rbp),%al
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
movsd  -0x28(%rbp),%xmm0
lea    0xdad(%rip),%rsi
movsbl %al,%edx
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<angle_asc>:
push   %rbx
mov    %rdi,%rbx
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
setb   %dl
jae    112b <angle_asc+0x1b>
xorpd  0xed5(%rip),%xmm0
movsd  0xedd(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%ecx
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  0xec1(%rip),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
cvttsd2si %xmm2,%r8d
cvttpd2dq %xmm2,%xmm2
cvtdq2pd %xmm2,%xmm2
mulsd  %xmm1,%xmm2
subsd  %xmm2,%xmm0
movsd  0xea4(%rip),%xmm1
minsd  %xmm0,%xmm1
movslq %ecx,%rcx
imul   $0xffffffffb60b60b7,%rcx,%rsi
shr    $0x20,%rsi
add    %ecx,%esi
mov    %esi,%edi
shr    $0x1f,%edi
sar    $0x8,%esi
add    %edi,%esi
imul   $0x168,%esi,%esi
sub    %esi,%ecx
mov    %dl,%al
lea    (%rax,%rax,1),%edx
add    $0x2b,%edx
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
movapd %xmm1,%xmm0
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"%c%02d:%02d:%04.1f\00"
define i8* @angle_asc(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
store double %0, double* %3
store i8* %1, i8** %4
%9 = load double, double* %3
%10 = fcmp oge double %9, 0.000000e+00
br i1 %10, label %11, label %12
11: ; preds = %2
store i8 43, i8* %5
br label %15
12: ; preds = %2
store i8 45, i8* %5
%13 = load double, double* %3
%14 = fneg double %13
store double %14, double* %3
br label %15
15: ; preds = %12, %11
%16 = load double, double* %3
%17 = fdiv double %16, 3.600000e+03
%18 = fptosi double %17 to i32
store i32 %18, i32* %6
%19 = load double, double* %3
%20 = load i32, i32* %6
%21 = sitofp i32 %20 to double
%22 = fneg double %21
%23 = call double @llvm.fmuladd.f64(double %22, double 3.600000e+03, double %19)
%24 = fdiv double %23, 6.000000e+01
%25 = fptosi double %24 to i32
store i32 %25, i32* %7
%26 = load double, double* %3
%27 = load i32, i32* %6
%28 = sitofp i32 %27 to double
%29 = fneg double %28
%30 = call double @llvm.fmuladd.f64(double %29, double 3.600000e+03, double %26)
%31 = load i32, i32* %7
%32 = sitofp i32 %31 to double
%33 = fneg double %32
%34 = call double @llvm.fmuladd.f64(double %33, double 6.000000e+01, double %30)
store double %34, double* %8
%35 = load i32, i32* %6
%36 = srem i32 %35, 360
store i32 %36, i32* %6
%37 = load double, double* %8
%38 = fcmp ogt double %37, 0x404DF33333333333
br i1 %38, label %39, label %40
39: ; preds = %15
store double 0x404DF33333333333, double* %8
br label %40
40: ; preds = %39, %15
%41 = load i8*, i8** %4
%42 = load i8, i8* %5
%43 = load i32, i32* %6
%44 = load i32, i32* %7
%45 = load double, double* %8
%46 = call i32 @sprintf(i8* %41, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 signext %42, i32 %43, i32 %44, double %45)
%47 = load i8*, i8** %4
ret i8* %47
}

LLVM IR (-O2):
@.str = [19 x i8] c"%c%02d:%02d:%04.1f\00"
define i8* @angle_asc(double %0, i8* returned writeonly %1) {
%3 = fcmp ult double %0, 0.000000e+00
%4 = fneg double %0
%5 = select i1 %3, i8 45, i8 43
%6 = select i1 %3, double %4, double %0
%7 = fdiv double %6, 3.600000e+03
%8 = fptosi double %7 to i32
%9 = sitofp i32 %8 to double
%10 = fneg double %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double 3.600000e+03, double %6)
%12 = fdiv double %11, 6.000000e+01
%13 = fptosi double %12 to i32
%14 = sitofp i32 %13 to double
%15 = fneg double %14
%16 = tail call double @llvm.fmuladd.f64(double %15, double 6.000000e+01, double %11)
%17 = fcmp ogt double %16, 0x404DF33333333333
%18 = select i1 %17, double 0x404DF33333333333, double %16
%19 = srem i32 %8, 360
%20 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8 signext %5, i32 %19, i32 %13, double %18)
ret i8* %1
}