#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 EOF;
int getchar();
int /*<<< orphan*/ printf(char *, unsigned long, unsigned long);
int decode(void) {
  int c;
  unsigned long u;
  unsigned long seconds = 0;
  unsigned long nanoseconds = 0;
  while ((c = getchar()) != EOF) {
    u = c - '0';
    if (u >= 10) {
      u = c - 'a';
      if (u >= 6)
        break;
      u += 10;
    }
    seconds <<= 4;
    seconds += nanoseconds >> 28;
    nanoseconds &= 0xfffffff;
    nanoseconds <<= 4;
    nanoseconds += u;
  }
  seconds -= 4611686018427387914ULL;
  printf("%lu.%lu ", seconds, nanoseconds);
  return c;
}


x86 assembly (clang, -O0):
<decode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x4(%rbp)
mov    0x2e9f(%rip),%rcx
cmp    (%rcx),%eax
je     11d7 <decode+0xb7>
mov    -0x4(%rbp),%eax
sub    $0x30,%eax
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0xa,-0x10(%rbp)
jb     1190 <decode+0x70>
mov    -0x4(%rbp),%eax
sub    $0x61,%eax
cltq
mov    %rax,-0x10(%rbp)
cmpq   $0x6,-0x10(%rbp)
jb     1184 <decode+0x64>
jmp    11d7 <decode+0xb7>
mov    -0x10(%rbp),%rax
add    $0xa,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x4,%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
shr    $0x1c,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
and    $0xfffffff,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
shl    $0x4,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1138 <decode+0x18>
mov    -0x18(%rbp),%rax
movabs $0x400000000000000a,%rcx
sub    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xe05(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r15d,%r15d
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%r14d
mov    0x2eac(%rip),%r12
cmp    (%r12),%eax
jne    116f <decode+0x4f>
xor    %ebx,%ebx
movabs $0xbffffffffffffff6,%rsi
ff ff bf
add    %r15,%rsi
lea    0xea8(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
xor    %ebx,%ebx
xor    %r15d,%r15d
jmp    11a6 <decode+0x86>
cs nopw 0x0(%rax,%rax,1)
cltq
shl    $0x4,%r15
mov    %rbx,%rcx
shr    $0x1c,%rcx
add    %rcx,%r15
shl    $0x4,%ebx
add    %rax,%rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%r14d
cmp    (%r12),%eax
je     1144 <decode+0x24>
lea    -0x30(%r14),%eax
cmp    $0xa,%eax
jb     1180 <decode+0x60>
lea    -0x67(%r14),%eax
cmp    $0xfffffffa,%eax
jb     1144 <decode+0x24>
mov    %r14d,%eax
add    $0xffffffffffffffa9,%rax
jmp    1182 <decode+0x62>

LLVM IR (-O0):
@EOF = global i32 0
@.str = [9 x i8] c"%lu.%lu \00"
define i32 @decode() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 0, i64* %3
store i64 0, i64* %4
br label %5
5: ; preds = %25, %0
%6 = call i32 (...) @getchar()
store i32 %6, i32* %1
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %39
9: ; preds = %5
%10 = load i32, i32* %1
%11 = sub nsw i32 %10, 48
%12 = sext i32 %11 to i64
store i64 %12, i64* %2
%13 = load i64, i64* %2
%14 = icmp uge i64 %13, 10
br i1 %14, label %15, label %25
15: ; preds = %9
%16 = load i32, i32* %1
%17 = sub nsw i32 %16, 97
%18 = sext i32 %17 to i64
store i64 %18, i64* %2
%19 = load i64, i64* %2
%20 = icmp uge i64 %19, 6
br i1 %20, label %21, label %22
21: ; preds = %15
br label %39
22: ; preds = %15
%23 = load i64, i64* %2
%24 = add i64 %23, 10
store i64 %24, i64* %2
br label %25
25: ; preds = %22, %9
%26 = load i64, i64* %3
%27 = shl i64 %26, 4
store i64 %27, i64* %3
%28 = load i64, i64* %4
%29 = lshr i64 %28, 28
%30 = load i64, i64* %3
%31 = add i64 %30, %29
store i64 %31, i64* %3
%32 = load i64, i64* %4
%33 = and i64 %32, 268435455
store i64 %33, i64* %4
%34 = load i64, i64* %4
%35 = shl i64 %34, 4
store i64 %35, i64* %4
%36 = load i64, i64* %2
%37 = load i64, i64* %4
%38 = add i64 %37, %36
store i64 %38, i64* %4
br label %5
39: ; preds = %21, %5
%40 = load i64, i64* %3
%41 = sub i64 %40, 4611686018427387914
store i64 %41, i64* %3
%42 = load i64, i64* %3
%43 = load i64, i64* %4
%44 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %42, i64 %43)
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@EOF = global i32 0
@.str = [9 x i8] c"%lu.%lu \00"
define i32 @decode() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %28, label %4
4: ; preds = %0, %17
%5 = phi i32 [ %25, %17 ], [ %1, %0 ]
%6 = phi i64 [ %24, %17 ], [ 0, %0 ]
%7 = phi i64 [ %21, %17 ], [ 0, %0 ]
%8 = add nsw i32 %5, -48
%9 = sext i32 %8 to i64
%10 = icmp ugt i32 %8, 9
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = add i32 %5, -103
%13 = icmp ult i32 %12, -6
br i1 %13, label %28, label %14
14: ; preds = %11
%15 = zext i32 %5 to i64
%16 = add nsw i64 %15, -87
br label %17
17: ; preds = %14, %4
%18 = phi i64 [ %16, %14 ], [ %9, %4 ]
%19 = shl i64 %7, 4
%20 = lshr i64 %6, 28
%21 = add i64 %20, %19
%22 = shl nsw i64 %6, 4
%23 = and i64 %22, 4294967280
%24 = add nsw i64 %18, %23
%25 = tail call i32 (...) @getchar()
%26 = load i32, i32* @EOF
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %4
28: ; preds = %17, %11, %0
%29 = phi i64 [ 0, %0 ], [ %7, %11 ], [ %21, %17 ]
%30 = phi i64 [ 0, %0 ], [ %6, %11 ], [ %24, %17 ]
%31 = phi i32 [ %1, %0 ], [ %5, %11 ], [ %25, %17 ]
%32 = add i64 %29, -4611686018427387914
%33 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %32, i64 %30)
ret i32 %31
}