#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 */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int, double, char, int, int,
                           double);
char *eqstrn(double dra, double ddec) {
  char *eqcoor;
  char decp;
  int rah, irm, decd, decm;
  double xpos, ypos, xp, yp, ras, decs;
  xpos = dra / 15.0;
  rah = (int)xpos;
  xp = (double)60.0 * (xpos - (double)rah);
  irm = (int)xp;
  ras = (double)60.0 * (xp - (double)irm);
  if (ddec < 0) {
    ypos = -ddec;
    decp = '-';
  } else {
    decp = '+';
    ypos = ddec;
  }
  decd = (int)ypos;
  yp = (double)60.0 * (ypos - (double)decd);
  decm = (int)yp;
  decs = (double)60.0 * (yp - (double)decm);
  eqcoor = malloc(32);
  (void)sprintf(eqcoor, "%02d:%02d:%06.3f %c%02d:%02d:%05.2f", rah, irm, ras,
                decp, decd, decm, decs);
  if (eqcoor[6] == ' ')
    eqcoor[6] = '0';
  if (eqcoor[20] == ' ')
    eqcoor[20] = '0';
  return (eqcoor);
}


x86 assembly (clang, -O0):
<eqstrn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xec9(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cvttsd2si -0x38(%rbp),%eax
mov    %eax,-0x20(%rbp)
movsd  -0x38(%rbp),%xmm1
cvtsi2sdl -0x20(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe9a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
cvttsd2si -0x48(%rbp),%eax
mov    %eax,-0x24(%rbp)
movsd  -0x48(%rbp),%xmm1
cvtsi2sdl -0x24(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe73(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11ce <eqstrn+0xae>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
movb   $0x2d,-0x19(%rbp)
jmp    11dc <eqstrn+0xbc>
movb   $0x2b,-0x19(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
cvttsd2si -0x40(%rbp),%eax
mov    %eax,-0x28(%rbp)
movsd  -0x40(%rbp),%xmm1
cvtsi2sdl -0x28(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe06(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
cvttsd2si -0x50(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movsd  -0x50(%rbp),%xmm1
cvtsi2sdl -0x2c(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0xddf(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
movsd  -0x58(%rbp),%xmm0
mov    -0x19(%rbp),%r8b
mov    -0x28(%rbp),%r9d
mov    -0x2c(%rbp),%eax
movsd  -0x60(%rbp),%xmm1
lea    0xdb2(%rip),%rsi
movsbl %r8b,%r8d
mov    %eax,(%rsp)
call   1040 <sprintf@plt>
mov    -0x18(%rbp),%rax
movsbl 0x6(%rax),%eax
cmp    $0x20,%eax
jne    1283 <eqstrn+0x163>
mov    -0x18(%rbp),%rax
movb   $0x30,0x6(%rax)
mov    -0x18(%rbp),%rax
movsbl 0x14(%rax),%eax
cmp    $0x20,%eax
jne    129c <eqstrn+0x17c>
mov    -0x18(%rbp),%rax
movb   $0x30,0x14(%rax)
mov    -0x18(%rbp),%rax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eqstrn>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
divsd  0xeca(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,0xc(%rsp)
cvttpd2dq %xmm0,%xmm2
cvtdq2pd %xmm2,%xmm2
subsd  %xmm2,%xmm0
movsd  0xeb6(%rip),%xmm2
mulsd  %xmm2,%xmm0
cvttsd2si %xmm0,%r15d
cvttpd2dq %xmm0,%xmm3
cvtdq2pd %xmm3,%xmm3
subsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm0,0x20(%rsp)
xorpd  %xmm0,%xmm0
xor    %ebx,%ebx
ucomisd %xmm1,%xmm0
seta   %r13b
jbe    1189 <eqstrn+0x69>
xorpd  0xe87(%rip),%xmm1
cvttsd2si %xmm1,%r12d
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
cvttsd2si %xmm1,%r14d
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
subsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,0x10(%rsp)
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,(%rsp)
mov    %r13b,%bl
lea    (%rbx,%rbx,1),%r8d
add    $0x2b,%r8d
lea    0xe44(%rip),%rsi
mov    %rax,%rdi
mov    0xc(%rsp),%edx
mov    %r15d,%ecx
movaps 0x20(%rsp),%xmm0
mov    %r12d,%r9d
movaps 0x10(%rsp),%xmm1
call   1040 <sprintf@plt>
cmpb   $0x20,0x6(%rbp)
jne    1202 <eqstrn+0xe2>
movb   $0x30,0x6(%rbp)
cmpb   $0x20,0x14(%rbp)
jne    120c <eqstrn+0xec>
movb   $0x30,0x14(%rbp)
mov    %rbp,%rax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [36 x i8] c"%02d:%02d:%06.3f %c%02d:%02d:%05.2f\00"
define i8* @eqstrn(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i8*
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double %0, double* %3
store double %1, double* %4
%17 = load double, double* %3
%18 = fdiv double %17, 1.500000e+01
store double %18, double* %11
%19 = load double, double* %11
%20 = fptosi double %19 to i32
store i32 %20, i32* %7
%21 = load double, double* %11
%22 = load i32, i32* %7
%23 = sitofp i32 %22 to double
%24 = fsub double %21, %23
%25 = fmul double 6.000000e+01, %24
store double %25, double* %13
%26 = load double, double* %13
%27 = fptosi double %26 to i32
store i32 %27, i32* %8
%28 = load double, double* %13
%29 = load i32, i32* %8
%30 = sitofp i32 %29 to double
%31 = fsub double %28, %30
%32 = fmul double 6.000000e+01, %31
store double %32, double* %15
%33 = load double, double* %4
%34 = fcmp olt double %33, 0.000000e+00
br i1 %34, label %35, label %38
35: ; preds = %2
%36 = load double, double* %4
%37 = fneg double %36
store double %37, double* %12
store i8 45, i8* %6
br label %40
38: ; preds = %2
store i8 43, i8* %6
%39 = load double, double* %4
store double %39, double* %12
br label %40
40: ; preds = %38, %35
%41 = load double, double* %12
%42 = fptosi double %41 to i32
store i32 %42, i32* %9
%43 = load double, double* %12
%44 = load i32, i32* %9
%45 = sitofp i32 %44 to double
%46 = fsub double %43, %45
%47 = fmul double 6.000000e+01, %46
store double %47, double* %14
%48 = load double, double* %14
%49 = fptosi double %48 to i32
store i32 %49, i32* %10
%50 = load double, double* %14
%51 = load i32, i32* %10
%52 = sitofp i32 %51 to double
%53 = fsub double %50, %52
%54 = fmul double 6.000000e+01, %53
store double %54, double* %16
%55 = call i8* @malloc(i32 32)
store i8* %55, i8** %5
%56 = load i8*, i8** %5
%57 = load i32, i32* %7
%58 = load i32, i32* %8
%59 = load double, double* %15
%60 = load i8, i8* %6
%61 = load i32, i32* %9
%62 = load i32, i32* %10
%63 = load double, double* %16
%64 = call i32 @sprintf(i8* %56, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %57, i32 %58, double %59, i8 signext %60, i32 %61, i32 %62, double %63)
%65 = load i8*, i8** %5
%66 = getelementptr inbounds i8, i8* %65, i64 6
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %68, 32
br i1 %69, label %70, label %73
70: ; preds = %40
%71 = load i8*, i8** %5
%72 = getelementptr inbounds i8, i8* %71, i64 6
store i8 48, i8* %72
br label %73
73: ; preds = %70, %40
%74 = load i8*, i8** %5
%75 = getelementptr inbounds i8, i8* %74, i64 20
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = icmp eq i32 %77, 32
br i1 %78, label %79, label %82
79: ; preds = %73
%80 = load i8*, i8** %5
%81 = getelementptr inbounds i8, i8* %80, i64 20
store i8 48, i8* %81
br label %82
82: ; preds = %79, %73
%83 = load i8*, i8** %5
ret i8* %83
}

LLVM IR (-O2):
@.str = [36 x i8] c"%02d:%02d:%06.3f %c%02d:%02d:%05.2f\00"
define noalias i8* @eqstrn(double %0, double %1) {
%3 = fdiv double %0, 1.500000e+01
%4 = fptosi double %3 to i32
%5 = sitofp i32 %4 to double
%6 = fsub double %3, %5
%7 = fmul double %6, 6.000000e+01
%8 = fptosi double %7 to i32
%9 = sitofp i32 %8 to double
%10 = fsub double %7, %9
%11 = fmul double %10, 6.000000e+01
%12 = fcmp olt double %1, 0.000000e+00
%13 = fneg double %1
%14 = select i1 %12, double %13, double %1
%15 = select i1 %12, i8 45, i8 43
%16 = fptosi double %14 to i32
%17 = sitofp i32 %16 to double
%18 = fsub double %14, %17
%19 = fmul double %18, 6.000000e+01
%20 = fptosi double %19 to i32
%21 = sitofp i32 %20 to double
%22 = fsub double %19, %21
%23 = fmul double %22, 6.000000e+01
%24 = tail call dereferenceable_or_null(32) i8* @malloc(i32 32)
%25 = tail call i32 @sprintf(i8* dereferenceable(1) %24, i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %8, double %11, i8 signext %15, i32 %16, i32 %20, double %23)
%26 = getelementptr inbounds i8, i8* %24, i64 6
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 32
br i1 %28, label %29, label %30
29: ; preds = %2
store i8 48, i8* %26
br label %30
30: ; preds = %29, %2
%31 = getelementptr inbounds i8, i8* %24, i64 20
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 32
br i1 %33, label %34, label %35
34: ; preds = %30
store i8 48, i8* %31
br label %35
35: ; preds = %34, %30
ret i8* %24
}