void __kern_rtc_tget(char *h, char *m, char *s) {
  unsigned char val;
  unsigned char *reg = (unsigned char *)0x1020;
  unsigned char ctl;
  ctl = *(reg + 0x0e);
  *(reg + 0x0e) |= 0x08;
  val = *(reg + 0x04);
  *h = 10 * ((val & 0x30) >> 4) + (val & 0x0f);
  val = *(reg + 0x02);
  *m = 10 * ((val & 0x70) >> 4) + (val & 0x0f);
  val = *(reg + 0x00);
  *s = 10 * ((val & 0x70) >> 4) + (val & 0x0f);
  *(reg + 0x0e) = ctl;
}


x86 assembly (clang, -O0):
<__kern_rtc_tget>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x1020,%eax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0xe(%rax),%al
mov    %al,-0x29(%rbp)
mov    -0x28(%rbp),%rax
movzbl 0xe(%rax),%ecx
or     $0x8,%ecx
mov    %cl,0xe(%rax)
mov    -0x28(%rbp),%rax
mov    0x4(%rax),%al
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
and    $0x30,%eax
sar    $0x4,%eax
imul   $0xa,%eax,%eax
movzbl -0x19(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
mov    0x2(%rax),%al
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
and    $0x70,%eax
sar    $0x4,%eax
imul   $0xa,%eax,%eax
movzbl -0x19(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x28(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%eax
and    $0x70,%eax
sar    $0x4,%eax
imul   $0xa,%eax,%eax
movzbl -0x19(%rbp),%ecx
and    $0xf,%ecx
add    %ecx,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0x29(%rbp),%cl
mov    -0x28(%rbp),%rax
mov    %cl,0xe(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__kern_rtc_tget>:
mov    0x102e,%r8b
mov    %r8d,%ecx
or     $0x8,%cl
mov    %cl,0x102e
mov    0x1024,%al
mov    %eax,%ecx
shr    $0x4,%cl
and    $0x3,%cl
movzbl %cl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
and    $0xf,%al
add    %cl,%al
mov    %al,(%rdi)
mov    0x1022,%al
mov    %eax,%ecx
shr    $0x4,%cl
and    $0x7,%cl
movzbl %cl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
and    $0xf,%al
add    %cl,%al
mov    %al,(%rsi)
mov    0x1020,%al
mov    %eax,%ecx
shr    $0x4,%cl
and    $0x7,%cl
movzbl %cl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
and    $0xf,%al
add    %cl,%al
mov    %al,(%rdx)
mov    %r8b,0x102e
ret

LLVM IR (-O0):
define void @__kern_rtc_tget(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i8*
%9 = alloca i8
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* inttoptr (i64 4128 to i8*), i8** %8
%10 = load i8*, i8** %8
%11 = getelementptr inbounds i8, i8* %10, i64 14
%12 = load i8, i8* %11
store i8 %12, i8* %9
%13 = load i8*, i8** %8
%14 = getelementptr inbounds i8, i8* %13, i64 14
%15 = load i8, i8* %14
%16 = zext i8 %15 to i32
%17 = or i32 %16, 8
%18 = trunc i32 %17 to i8
store i8 %18, i8* %14
%19 = load i8*, i8** %8
%20 = getelementptr inbounds i8, i8* %19, i64 4
%21 = load i8, i8* %20
store i8 %21, i8* %7
%22 = load i8, i8* %7
%23 = zext i8 %22 to i32
%24 = and i32 %23, 48
%25 = ashr i32 %24, 4
%26 = mul nsw i32 10, %25
%27 = load i8, i8* %7
%28 = zext i8 %27 to i32
%29 = and i32 %28, 15
%30 = add nsw i32 %26, %29
%31 = trunc i32 %30 to i8
%32 = load i8*, i8** %4
store i8 %31, i8* %32
%33 = load i8*, i8** %8
%34 = getelementptr inbounds i8, i8* %33, i64 2
%35 = load i8, i8* %34
store i8 %35, i8* %7
%36 = load i8, i8* %7
%37 = zext i8 %36 to i32
%38 = and i32 %37, 112
%39 = ashr i32 %38, 4
%40 = mul nsw i32 10, %39
%41 = load i8, i8* %7
%42 = zext i8 %41 to i32
%43 = and i32 %42, 15
%44 = add nsw i32 %40, %43
%45 = trunc i32 %44 to i8
%46 = load i8*, i8** %5
store i8 %45, i8* %46
%47 = load i8*, i8** %8
%48 = getelementptr inbounds i8, i8* %47, i64 0
%49 = load i8, i8* %48
store i8 %49, i8* %7
%50 = load i8, i8* %7
%51 = zext i8 %50 to i32
%52 = and i32 %51, 112
%53 = ashr i32 %52, 4
%54 = mul nsw i32 10, %53
%55 = load i8, i8* %7
%56 = zext i8 %55 to i32
%57 = and i32 %56, 15
%58 = add nsw i32 %54, %57
%59 = trunc i32 %58 to i8
%60 = load i8*, i8** %6
store i8 %59, i8* %60
%61 = load i8, i8* %9
%62 = load i8*, i8** %8
%63 = getelementptr inbounds i8, i8* %62, i64 14
store i8 %61, i8* %63
ret void
}

LLVM IR (-O2):
define void @__kern_rtc_tget(i8* nocapture writeonly %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = load i8, i8* inttoptr (i64 4142 to i8*)
%5 = or i8 %4, 8
store i8 %5, i8* inttoptr (i64 4142 to i8*)
%6 = load i8, i8* inttoptr (i64 4132 to i8*)
%7 = lshr i8 %6, 4
%8 = and i8 %7, 3
%9 = mul nuw nsw i8 %8, 10
%10 = and i8 %6, 15
%11 = add nuw nsw i8 %9, %10
store i8 %11, i8* %0
%12 = load i8, i8* inttoptr (i64 4130 to i8*)
%13 = lshr i8 %12, 4
%14 = and i8 %13, 7
%15 = mul nuw nsw i8 %14, 10
%16 = and i8 %12, 15
%17 = add nuw nsw i8 %15, %16
store i8 %17, i8* %1
%18 = load i8, i8* inttoptr (i64 4128 to i8*)
%19 = lshr i8 %18, 4
%20 = and i8 %19, 7
%21 = mul nuw nsw i8 %20, 10
%22 = and i8 %18, 15
%23 = add nuw nsw i8 %21, %22
store i8 %23, i8* %2
store i8 %4, i8* inttoptr (i64 4142 to i8*)
ret void
}