void tod(string, deci) double *deci;
char *string;
{
  int sign;
  double dd, s = 0., h = 0., m = 0.;
  char minus = '-', *ps;
  if (*string == '-' || *string == '+') {
    ps = string;
    while (*(++ps) == ' ')
      ;
    if (ps - 1 != string) {
      *(ps - 1) = *string;
      *string = ' ';
    }
  }
  sign = 1;
  if (strchr(string, minus))
    sign = -1;
  sscanf(string, "%lf%lf%lf", &h, &m, &s);
  dd = (s / 60. + m) / 60.;
  if (sign < 0)
    *deci = h - dd;
  else
    *deci = h + dd;
  return;
}


x86 assembly (clang, -O0):
<tod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movb   $0x2d,-0x39(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
je     116c <tod+0x4c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    11c0 <tod+0xa0>
mov    -0x8(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x48(%rbp)
movsbl 0x1(%rax),%eax
cmp    $0x20,%eax
jne    1195 <tod+0x75>
jmp    1174 <tod+0x54>
mov    -0x48(%rbp),%rax
add    $0xffffffffffffffff,%rax
cmp    -0x8(%rbp),%rax
je     11bb <tod+0x9b>
mov    -0x8(%rbp),%rax
mov    (%rax),%cl
mov    -0x48(%rbp),%rax
mov    %cl,-0x1(%rax)
mov    -0x8(%rbp),%rax
movb   $0x20,(%rax)
jmp    11c0 <tod+0xa0>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x39(%rbp),%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11e5 <tod+0xc5>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe18(%rip),%rsi
lea    -0x30(%rbp),%rdx
lea    -0x38(%rbp),%rcx
lea    -0x28(%rbp),%r8
mov    $0x0,%al
call   1040 <sscanf@plt>
movsd  -0x28(%rbp),%xmm0
movsd  0xdf0(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  0xddf(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    124b <tod+0x12b>
movsd  -0x30(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    125d <tod+0x13d>
movsd  -0x30(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tod>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    (%rdi),%al
cmp    $0x2d,%al
je     1154 <tod+0x34>
cmp    $0x2b,%al
jne    1176 <tod+0x56>
mov    $0xffffffffffffffff,%rcx
nopl   0x0(%rax,%rax,1)
cmpb   $0x20,0x2(%rbx,%rcx,1)
lea    0x1(%rcx),%rcx
je     1160 <tod+0x40>
test   %rcx,%rcx
je     1176 <tod+0x56>
mov    %al,(%rbx,%rcx,1)
movb   $0x20,(%rbx)
mov    %rbx,%rdi
mov    $0x2d,%esi
call   1030 <strchr@plt>
mov    %rax,%r15
lea    0xe93(%rip),%rsi
lea    0x10(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0x18(%rsp),%r8
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sscanf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0xe4c(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  0x8(%rsp),%xmm0
divsd  %xmm1,%xmm0
test   %r15,%r15
je     11cf <tod+0xaf>
xorpd  0xe41(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%r14)
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%lf%lf%lf\00"
define void @tod(i8* %0, double* %1) {
%3 = alloca i8*
%4 = alloca double*
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca i8
%11 = alloca i8*
store i8* %0, i8** %3
store double* %1, double** %4
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %9
store i8 45, i8* %10
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp eq i32 %14, 45
br i1 %15, label %21, label %16
16: ; preds = %2
%17 = load i8*, i8** %3
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 43
br i1 %20, label %21, label %42
21: ; preds = %16, %2
%22 = load i8*, i8** %3
store i8* %22, i8** %11
br label %23
23: ; preds = %29, %21
%24 = load i8*, i8** %11
%25 = getelementptr inbounds i8, i8* %24, i32 1
store i8* %25, i8** %11
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 32
br i1 %28, label %29, label %30
29: ; preds = %23
br label %23
30: ; preds = %23
%31 = load i8*, i8** %11
%32 = getelementptr inbounds i8, i8* %31, i64 -1
%33 = load i8*, i8** %3
%34 = icmp ne i8* %32, %33
br i1 %34, label %35, label %41
35: ; preds = %30
%36 = load i8*, i8** %3
%37 = load i8, i8* %36
%38 = load i8*, i8** %11
%39 = getelementptr inbounds i8, i8* %38, i64 -1
store i8 %37, i8* %39
%40 = load i8*, i8** %3
store i8 32, i8* %40
br label %41
41: ; preds = %35, %30
br label %42
42: ; preds = %41, %16
store i32 1, i32* %5
%43 = load i8*, i8** %3
%44 = load i8, i8* %10
%45 = sext i8 %44 to i32
%46 = call i8* @strchr(i8* %43, i32 %45)
%47 = icmp ne i8* %46, null
br i1 %47, label %48, label %49
48: ; preds = %42
store i32 -1, i32* %5
br label %49
49: ; preds = %48, %42
%50 = load i8*, i8** %3
%51 = call i32 (i8*, i8*, ...) @sscanf(i8* %50, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double* %8, double* %9, double* %7)
%52 = load double, double* %7
%53 = fdiv double %52, 6.000000e+01
%54 = load double, double* %9
%55 = fadd double %53, %54
%56 = fdiv double %55, 6.000000e+01
store double %56, double* %6
%57 = load i32, i32* %5
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %49
%60 = load double, double* %8
%61 = load double, double* %6
%62 = fsub double %60, %61
%63 = load double*, double** %4
store double %62, double* %63
br label %69
64: ; preds = %49
%65 = load double, double* %8
%66 = load double, double* %6
%67 = fadd double %65, %66
%68 = load double*, double** %4
store double %67, double* %68
br label %69
69: ; preds = %64, %59
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%lf%lf%lf\00"
define void @tod(i8* %0, double* nocapture writeonly %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%7 = bitcast double* %4 to i8*
store double 0.000000e+00, double* %4
%8 = bitcast double* %5 to i8*
store double 0.000000e+00, double* %5
%9 = load i8, i8* %0
switch i8 %9, label %19 [
i8 45, label %10
i8 43, label %10
]
10: ; preds = %2, %2
br label %11
11: ; preds = %10, %11
%12 = phi i8* [ %13, %11 ], [ %0, %10 ]
%13 = getelementptr inbounds i8, i8* %12, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 32
br i1 %15, label %11, label %16
16: ; preds = %11
%17 = icmp eq i8* %12, %0
br i1 %17, label %19, label %18
18: ; preds = %16
store i8 %9, i8* %12
store i8 32, i8* %0
br label %19
19: ; preds = %2, %16, %18
%20 = tail call i8* @strchr(i8* %0, i32 45)
%21 = icmp eq i8* %20, null
%22 = call i32 (i8*, i8*, ...) @sscanf(i8* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double* %4, double* %5, double* %3)
%23 = load double, double* %3
%24 = fdiv double %23, 6.000000e+01
%25 = load double, double* %5
%26 = fadd double %24, %25
%27 = fdiv double %26, 6.000000e+01
%28 = load double, double* %4
%29 = fneg double %27
%30 = select i1 %21, double %27, double %29
%31 = fadd double %28, %30
store double %31, double* %1
ret void
}