void __kern_rtc_tset(char h, char m, char s) {
  char ch, cm, cs;
  unsigned char *reg = (unsigned char *)0x1020;
  ch = (((h / 10) & 0x03) << 4) | ((h % 10) & 0x0f);
  cm = (((m / 10) & 0x07) << 4) | ((m % 10) & 0x0f);
  cs = (((s / 10) & 0x07) << 4) | ((s % 10) & 0x0f);
  *(reg + 0x04) = ch;
  *(reg + 0x02) = cm;
  *(reg + 0x00) = cs;
}


x86 assembly (clang, -O0):
<__kern_rtc_tset>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %dil,%dl
mov    %dl,-0x1(%rbp)
mov    %cl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    $0x1020,%eax
mov    %rax,-0x10(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
and    $0x3,%eax
shl    $0x4,%eax
mov    %eax,-0x1c(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%eax
and    $0xf,%edx
or     %edx,%eax
mov    %al,-0x4(%rbp)
movsbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
and    $0x7,%eax
shl    $0x4,%eax
mov    %eax,-0x18(%rbp)
movsbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x18(%rbp),%eax
and    $0xf,%edx
or     %edx,%eax
mov    %al,-0x5(%rbp)
movsbl -0x3(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
and    $0x7,%eax
shl    $0x4,%eax
mov    %eax,-0x14(%rbp)
movsbl -0x3(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
and    $0xf,%edx
or     %edx,%eax
mov    %al,-0x6(%rbp)
mov    -0x4(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x4(%rax)
mov    -0x5(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x6(%rbp),%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__kern_rtc_tset>:
imul   $0x67,%edi,%eax
movzwl %ax,%ecx
shr    $0xa,%eax
shr    $0xf,%ecx
add    %al,%cl
movzbl %cl,%eax
shl    $0x4,%cl
and    $0x30,%cl
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%dil
and    $0xf,%dil
or     %cl,%dil
imul   $0x67,%esi,%eax
movzwl %ax,%ecx
shr    $0xa,%eax
shr    $0xf,%ecx
add    %al,%cl
movzbl %cl,%eax
shl    $0x4,%cl
and    $0x70,%cl
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%sil
and    $0xf,%sil
or     %cl,%sil
imul   $0x67,%edx,%eax
movzwl %ax,%ecx
shr    $0xa,%eax
shr    $0xf,%ecx
add    %al,%cl
movzbl %cl,%eax
shl    $0x4,%cl
and    $0x70,%cl
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %al,%dl
and    $0xf,%dl
or     %cl,%dl
mov    %dil,0x1024
mov    %sil,0x1022
mov    %dl,0x1020
ret

LLVM IR (-O0):
define void @__kern_rtc_tset(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
%9 = alloca i8
%10 = 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** %10
%11 = load i8, i8* %4
%12 = sext i8 %11 to i32
%13 = sdiv i32 %12, 10
%14 = and i32 %13, 3
%15 = shl i32 %14, 4
%16 = load i8, i8* %4
%17 = sext i8 %16 to i32
%18 = srem i32 %17, 10
%19 = and i32 %18, 15
%20 = or i32 %15, %19
%21 = trunc i32 %20 to i8
store i8 %21, i8* %7
%22 = load i8, i8* %5
%23 = sext i8 %22 to i32
%24 = sdiv i32 %23, 10
%25 = and i32 %24, 7
%26 = shl i32 %25, 4
%27 = load i8, i8* %5
%28 = sext i8 %27 to i32
%29 = srem i32 %28, 10
%30 = and i32 %29, 15
%31 = or i32 %26, %30
%32 = trunc i32 %31 to i8
store i8 %32, i8* %8
%33 = load i8, i8* %6
%34 = sext i8 %33 to i32
%35 = sdiv i32 %34, 10
%36 = and i32 %35, 7
%37 = shl i32 %36, 4
%38 = load i8, i8* %6
%39 = sext i8 %38 to i32
%40 = srem i32 %39, 10
%41 = and i32 %40, 15
%42 = or i32 %37, %41
%43 = trunc i32 %42 to i8
store i8 %43, i8* %9
%44 = load i8, i8* %7
%45 = load i8*, i8** %10
%46 = getelementptr inbounds i8, i8* %45, i64 4
store i8 %44, i8* %46
%47 = load i8, i8* %8
%48 = load i8*, i8** %10
%49 = getelementptr inbounds i8, i8* %48, i64 2
store i8 %47, i8* %49
%50 = load i8, i8* %9
%51 = load i8*, i8** %10
%52 = getelementptr inbounds i8, i8* %51, i64 0
store i8 %50, i8* %52
ret void
}

LLVM IR (-O2):
define void @__kern_rtc_tset(i8 signext %0, i8 signext %1, i8 signext %2) {
%4 = sdiv i8 %0, 10
%5 = shl i8 %4, 4
%6 = and i8 %5, 48
%7 = srem i8 %0, 10
%8 = and i8 %7, 15
%9 = or i8 %6, %8
%10 = sdiv i8 %1, 10
%11 = shl i8 %10, 4
%12 = and i8 %11, 112
%13 = srem i8 %1, 10
%14 = and i8 %13, 15
%15 = or i8 %12, %14
%16 = sdiv i8 %2, 10
%17 = shl i8 %16, 4
%18 = and i8 %17, 112
%19 = srem i8 %2, 10
%20 = and i8 %19, 15
%21 = or i8 %18, %20
store i8 %9, i8* inttoptr (i64 4132 to i8*)
store i8 %15, i8* inttoptr (i64 4130 to i8*)
store i8 %21, i8* inttoptr (i64 4128 to i8*)
ret void
}