void dec2dms(double dec, char *decch, char *decst) {
  double temp;
  int d, m, itemp, i, recog;
  float s;
  char sign[2] = " ", minus[2] = "-";
  char rectypes[8][5] = {"RA  ", "GLON", "ELON", "LL  ",
                         "DEC ", "GLAT", "ELAT", "MM  "};
  temp = dec;
  if (temp < 0.0)
    temp = -temp;
  itemp = (int)temp;
  d = itemp;
  temp = temp - (double)itemp;
  temp = temp * 60.0;
  itemp = (int)temp;
  m = itemp;
  temp = temp - (double)itemp;
  temp = temp * 60.0;
  s = (float)temp;
  if (dec < 0.0)
    sign[0] = minus[0];
  for (i = 0; i < 4; i++)
    decst[i] = ' ';
  decst[4] = 0;
  for (i = 0; i < 4; i++) {
    if (decch[i] == minus[0])
      break;
    decst[i] = decch[i];
  }
  recog = 0;
  for (i = 0; i < 8; i++)
    recog = recog || (!strcmp(decst, rectypes[i]));
  if (recog)
    sprintf(&decst[4], "%1s%2.2d %2.2d %6.3f", sign, d, m, s);
  else
    sprintf(&decst[4], "%13.6lg", dec);
}


x86 assembly (clang, -O0):
<dec2dms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    0xeb9(%rip),%ax
mov    %ax,-0x3a(%rbp)
mov    0xeb0(%rip),%ax
mov    %ax,-0x3c(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    11ac <dec2dms+0x7c>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x24(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe2b(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cvttsd2si -0x20(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdf8(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1234 <dec2dms+0x104>
mov    -0x3c(%rbp),%al
mov    %al,-0x3a(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x4,-0x30(%rbp)
jge    125f <dec2dms+0x12f>
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    123b <dec2dms+0x10b>
mov    -0x18(%rbp),%rax
movb   $0x0,0x4(%rax)
movl   $0x0,-0x30(%rbp)
cmpl   $0x4,-0x30(%rbp)
jge    12b9 <dec2dms+0x189>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
movsbl -0x3c(%rbp),%ecx
cmp    %ecx,%eax
jne    1295 <dec2dms+0x165>
jmp    12b9 <dec2dms+0x189>
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x18(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    126e <dec2dms+0x13e>
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x30(%rbp)
cmpl   $0x8,-0x30(%rbp)
jge    131c <dec2dms+0x1ec>
mov    $0x1,%al
cmpl   $0x0,-0x34(%rbp)
mov    %al,-0x71(%rbp)
jne    1303 <dec2dms+0x1d3>
mov    -0x18(%rbp),%rdi
movslq -0x30(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x5,%rax,%rax
add    %rax,%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x71(%rbp)
mov    -0x71(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    12c7 <dec2dms+0x197>
cmpl   $0x0,-0x34(%rbp)
je     1355 <dec2dms+0x225>
mov    -0x18(%rbp),%rdi
add    $0x4,%rdi
lea    -0x3a(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x28(%rbp),%r8d
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xcc3(%rip),%rsi
mov    $0x1,%al
call   1050 <sprintf@plt>
jmp    1370 <dec2dms+0x240>
mov    -0x18(%rbp),%rdi
add    $0x4,%rdi
movsd  -0x8(%rbp),%xmm0
lea    0xcb8(%rip),%rsi
mov    $0x1,%al
call   1050 <sprintf@plt>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec2dms>:
push   %r14
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbx
movw   $0x20,0xe(%rsp)
xorpd  %xmm1,%xmm1
movapd %xmm0,0x10(%rsp)
ucomisd %xmm0,%xmm1
jbe    1146 <dec2dms+0x26>
movb   $0x2d,0xe(%rsp)
movl   $0x20202020,(%rbx)
movb   $0x0,0x4(%rbx)
mov    (%rdi),%al
cmp    $0x2d,%al
je     1176 <dec2dms+0x56>
mov    %al,(%rbx)
mov    0x1(%rdi),%al
cmp    $0x2d,%al
je     1176 <dec2dms+0x56>
mov    %al,0x1(%rbx)
mov    0x2(%rdi),%al
cmp    $0x2d,%al
je     1176 <dec2dms+0x56>
mov    %al,0x2(%rbx)
mov    0x3(%rdi),%al
cmp    $0x2d,%al
je     1176 <dec2dms+0x56>
mov    %al,0x3(%rbx)
lea    0x4(%rbx),%r14
lea    0xe9f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe8d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe7b(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe6d(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe5f(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe51(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe43(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe35(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1237 <dec2dms+0x117>
lea    0xe3c(%rip),%rsi
mov    %r14,%rdi
movaps 0x10(%rsp),%xmm0
mov    $0x1,%al
add    $0x28,%rsp
pop    %rbx
pop    %r14
jmp    1040 <sprintf@plt>
movapd 0xdc1(%rip),%xmm0
movapd 0x10(%rsp),%xmm2
xorpd  %xmm2,%xmm0
movapd %xmm2,%xmm1
cmpltsd 0xdc2(%rip),%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm2,%xmm1
orpd   %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm0
cvtdq2pd %xmm0,%xmm0
cvttsd2si %xmm1,%ecx
subsd  %xmm0,%xmm1
movsd  0xd96(%rip),%xmm0
mulsd  %xmm0,%xmm1
cvttpd2dq %xmm1,%xmm2
cvtdq2pd %xmm2,%xmm2
cvttsd2si %xmm1,%r8d
subsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtsd2ss %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xda3(%rip),%rsi
lea    0xe(%rsp),%rdx
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <sprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.dec2dms.sign = [2 x i8] c" \00"
@__const.dec2dms.minus = [2 x i8] c"-\00"
@__const.dec2dms.rectypes = [8 x [5 x i8]] [[5 x i8] c"RA \00", [5 x i8] c"GLON\00", [5 x i8] c"ELON\00", [5 x i8] c"LL \00", [5 x i8] c"DEC \00", [5 x i8] c"GLAT\00", [5 x i8] c"ELAT\00", [5 x i8] c"MM \00"]
@.str = [21 x i8] c"%1s%2.2d %2.2d %6.3f\00"
@.str.1 = [8 x i8] c"%13.6lg\00"
define void @dec2dms(double %0, i8* %1, i8* %2) {
%4 = alloca double
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca double
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca float
%14 = alloca [2 x i8]
%15 = alloca [2 x i8]
%16 = alloca [8 x [5 x i8]]
store double %0, double* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%17 = bitcast [2 x i8]* %14 to i8*
%18 = bitcast [2 x i8]* %15 to i8*
%19 = bitcast [8 x [5 x i8]]* %16 to i8*
%20 = load double, double* %4
store double %20, double* %7
%21 = load double, double* %7
%22 = fcmp olt double %21, 0.000000e+00
br i1 %22, label %23, label %26
23: ; preds = %3
%24 = load double, double* %7
%25 = fneg double %24
store double %25, double* %7
br label %26
26: ; preds = %23, %3
%27 = load double, double* %7
%28 = fptosi double %27 to i32
store i32 %28, i32* %10
%29 = load i32, i32* %10
store i32 %29, i32* %8
%30 = load double, double* %7
%31 = load i32, i32* %10
%32 = sitofp i32 %31 to double
%33 = fsub double %30, %32
store double %33, double* %7
%34 = load double, double* %7
%35 = fmul double %34, 6.000000e+01
store double %35, double* %7
%36 = load double, double* %7
%37 = fptosi double %36 to i32
store i32 %37, i32* %10
%38 = load i32, i32* %10
store i32 %38, i32* %9
%39 = load double, double* %7
%40 = load i32, i32* %10
%41 = sitofp i32 %40 to double
%42 = fsub double %39, %41
store double %42, double* %7
%43 = load double, double* %7
%44 = fmul double %43, 6.000000e+01
store double %44, double* %7
%45 = load double, double* %7
%46 = fptrunc double %45 to float
store float %46, float* %13
%47 = load double, double* %4
%48 = fcmp olt double %47, 0.000000e+00
br i1 %48, label %49, label %53
49: ; preds = %26
%50 = getelementptr inbounds [2 x i8], [2 x i8]* %15, i64 0, i64 0
%51 = load i8, i8* %50
%52 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 0
store i8 %51, i8* %52
br label %53
53: ; preds = %49, %26
store i32 0, i32* %11
br label %54
54: ; preds = %62, %53
%55 = load i32, i32* %11
%56 = icmp slt i32 %55, 4
br i1 %56, label %57, label %65
57: ; preds = %54
%58 = load i8*, i8** %6
%59 = load i32, i32* %11
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i8, i8* %58, i64 %60
store i8 32, i8* %61
br label %62
62: ; preds = %57
%63 = load i32, i32* %11
%64 = add nsw i32 %63, 1
store i32 %64, i32* %11
br label %54
65: ; preds = %54
%66 = load i8*, i8** %6
%67 = getelementptr inbounds i8, i8* %66, i64 4
store i8 0, i8* %67
store i32 0, i32* %11
br label %68
68: ; preds = %93, %65
%69 = load i32, i32* %11
%70 = icmp slt i32 %69, 4
br i1 %70, label %71, label %96
71: ; preds = %68
%72 = load i8*, i8** %5
%73 = load i32, i32* %11
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8, i8* %72, i64 %74
%76 = load i8, i8* %75
%77 = sext i8 %76 to i32
%78 = getelementptr inbounds [2 x i8], [2 x i8]* %15, i64 0, i64 0
%79 = load i8, i8* %78
%80 = sext i8 %79 to i32
%81 = icmp eq i32 %77, %80
br i1 %81, label %82, label %83
82: ; preds = %71
br label %96
83: ; preds = %71
%84 = load i8*, i8** %5
%85 = load i32, i32* %11
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %84, i64 %86
%88 = load i8, i8* %87
%89 = load i8*, i8** %6
%90 = load i32, i32* %11
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %89, i64 %91
store i8 %88, i8* %92
br label %93
93: ; preds = %83
%94 = load i32, i32* %11
%95 = add nsw i32 %94, 1
store i32 %95, i32* %11
br label %68
96: ; preds = %82, %68
store i32 0, i32* %12
store i32 0, i32* %11
br label %97
97: ; preds = %115, %96
%98 = load i32, i32* %11
%99 = icmp slt i32 %98, 8
br i1 %99, label %100, label %118
100: ; preds = %97
%101 = load i32, i32* %12
%102 = icmp ne i32 %101, 0
br i1 %102, label %112, label %103
103: ; preds = %100
%104 = load i8*, i8** %6
%105 = load i32, i32* %11
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [8 x [5 x i8]], [8 x [5 x i8]]* %16, i64 0, i64 %106
%108 = getelementptr inbounds [5 x i8], [5 x i8]* %107, i64 0, i64 0
%109 = call i32 @strcmp(i8* %104, i8* %108)
%110 = icmp ne i32 %109, 0
%111 = xor i1 %110, true
br label %112
112: ; preds = %103, %100
%113 = phi i1 [ true, %100 ], [ %111, %103 ]
%114 = zext i1 %113 to i32
store i32 %114, i32* %12
br label %115
115: ; preds = %112
%116 = load i32, i32* %11
%117 = add nsw i32 %116, 1
store i32 %117, i32* %11
br label %97
118: ; preds = %97
%119 = load i32, i32* %12
%120 = icmp ne i32 %119, 0
br i1 %120, label %121, label %130
121: ; preds = %118
%122 = load i8*, i8** %6
%123 = getelementptr inbounds i8, i8* %122, i64 4
%124 = getelementptr inbounds [2 x i8], [2 x i8]* %14, i64 0, i64 0
%125 = load i32, i32* %8
%126 = load i32, i32* %9
%127 = load float, float* %13
%128 = fpext float %127 to double
%129 = call i32 (i8*, i8*, ...) @sprintf(i8* %123, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %124, i32 %125, i32 %126, double %128)
br label %135
130: ; preds = %118
%131 = load i8*, i8** %6
%132 = getelementptr inbounds i8, i8* %131, i64 4
%133 = load double, double* %4
%134 = call i32 (i8*, i8*, ...) @sprintf(i8* %132, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %133)
br label %135
135: ; preds = %130, %121
ret void
}

LLVM IR (-O2):
@__const.dec2dms.rectypes = [8 x [5 x i8]] [[5 x i8] c"RA \00", [5 x i8] c"GLON\00", [5 x i8] c"ELON\00", [5 x i8] c"LL \00", [5 x i8] c"DEC \00", [5 x i8] c"GLAT\00", [5 x i8] c"ELAT\00", [5 x i8] c"MM \00"]
@.str = [21 x i8] c"%1s%2.2d %2.2d %6.3f\00"
@.str.1 = [8 x i8] c"%13.6lg\00"
define void @dec2dms(double %0, i8* nocapture %1, i8* nocapture %2) {
%4 = alloca i16
%5 = bitcast i16* %4 to i8*
store i16 32, i16* %4
%6 = fcmp olt double %0, 0.000000e+00
%7 = fneg double %0
%8 = select i1 %6, double %7, double %0
%9 = fptosi double %8 to i32
%10 = sitofp i32 %9 to double
%11 = fsub double %8, %10
%12 = fmul double %11, 6.000000e+01
%13 = fptosi double %12 to i32
%14 = sitofp i32 %13 to double
%15 = fsub double %12, %14
%16 = fmul double %15, 6.000000e+01
%17 = fptrunc double %16 to float
br i1 %6, label %18, label %19
18: ; preds = %3
store i8 45, i8* %5
br label %19
19: ; preds = %18, %3
%20 = bitcast i8* %2 to i32*
store i32 538976288, i32* %20
%21 = getelementptr inbounds i8, i8* %2, i64 4
store i8 0, i8* %21
%22 = load i8, i8* %1
%23 = icmp eq i8 %22, 45
br i1 %23, label %40, label %24
24: ; preds = %19
store i8 %22, i8* %2
%25 = getelementptr inbounds i8, i8* %1, i64 1
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 45
br i1 %27, label %40, label %28
28: ; preds = %24
%29 = getelementptr inbounds i8, i8* %2, i64 1
store i8 %26, i8* %29
%30 = getelementptr inbounds i8, i8* %1, i64 2
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 45
br i1 %32, label %40, label %33
33: ; preds = %28
%34 = getelementptr inbounds i8, i8* %2, i64 2
store i8 %31, i8* %34
%35 = getelementptr inbounds i8, i8* %1, i64 3
%36 = load i8, i8* %35
%37 = icmp eq i8 %36, 45
br i1 %37, label %40, label %38
38: ; preds = %33
%39 = getelementptr inbounds i8, i8* %2, i64 3
store i8 %36, i8* %39
br label %40
40: ; preds = %38, %33, %28, %24, %19
%41 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 0, i64 0))
%42 = icmp eq i32 %41, 0
br i1 %42, label %64, label %43
43: ; preds = %40
%44 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 1, i64 0))
%45 = icmp eq i32 %44, 0
br i1 %45, label %64, label %46
46: ; preds = %43
%47 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 2, i64 0))
%48 = icmp eq i32 %47, 0
br i1 %48, label %64, label %49
49: ; preds = %46
%50 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 3, i64 0))
%51 = icmp eq i32 %50, 0
br i1 %51, label %64, label %52
52: ; preds = %49
%53 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 4, i64 0))
%54 = icmp eq i32 %53, 0
br i1 %54, label %64, label %55
55: ; preds = %52
%56 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 5, i64 0))
%57 = icmp eq i32 %56, 0
br i1 %57, label %64, label %58
58: ; preds = %55
%59 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 6, i64 0))
%60 = icmp eq i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %58
%62 = tail call i32 @strcmp(i8* dereferenceable(1) %2, i8* getelementptr inbounds ([8 x [5 x i8]], [8 x [5 x i8]]* @__const.dec2dms.rectypes, i64 0, i64 7, i64 0))
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %40, %43, %46, %49, %52, %55, %58, %61
%65 = fpext float %17 to double
%66 = call i32 (i8*, i8*, ...) @sprintf(i8* %21, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i16* %4, i32 %9, i32 %13, double %65)
br label %69
67: ; preds = %61
%68 = tail call i32 (i8*, i8*, ...) @sprintf(i8* %21, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), double %0)
br label %69
69: ; preds = %67, %64
ret void
}