#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 /*<<< orphan*/ led_set_code(int, unsigned char);
int /*<<< orphan*/ led_set_dp(int);
unsigned char timer_get_hour(int /*<<< orphan*/);
unsigned char timer_get_min(int /*<<< orphan*/);
unsigned char timer_get_sec(int /*<<< orphan*/);
void update_hhmmss(void) {
  unsigned char hour, min, sec;
  hour = timer_get_hour(0);
  min = timer_get_min(0);
  sec = timer_get_sec(0);
  led_set_dp(1);
  led_set_dp(2);
  led_set_dp(3);
  led_set_dp(4);
  ;
  led_set_code(5, (hour / 10) + 0x30);
  led_set_code(4, (hour % 10) + 0x30);
  led_set_code(3, (min / 10) + 0x30);
  led_set_code(2, (min % 10) + 0x30);
  led_set_code(1, (sec / 10) + 0x30);
  led_set_code(0, (sec % 10) + 0x30);
}


x86 assembly (clang, -O0):
<update_hhmmss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1070 <timer_get_hour@plt>
mov    %al,-0x1(%rbp)
xor    %edi,%edi
call   1050 <timer_get_min@plt>
mov    %al,-0x2(%rbp)
xor    %edi,%edi
call   1040 <timer_get_sec@plt>
mov    %al,-0x3(%rbp)
mov    $0x1,%edi
call   1030 <led_set_dp@plt>
mov    $0x2,%edi
call   1030 <led_set_dp@plt>
mov    $0x3,%edi
call   1030 <led_set_dp@plt>
mov    $0x4,%edi
call   1030 <led_set_dp@plt>
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x5,%edi
movzbl %al,%esi
call   1060 <led_set_code@plt>
movzbl -0x1(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    $0x4,%edi
movzbl %al,%esi
call   1060 <led_set_code@plt>
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x3,%edi
movzbl %al,%esi
call   1060 <led_set_code@plt>
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    $0x2,%edi
movzbl %al,%esi
call   1060 <led_set_code@plt>
movzbl -0x3(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x1,%edi
movzbl %al,%esi
call   1060 <led_set_code@plt>
movzbl -0x3(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
xor    %edi,%edi
movzbl %al,%esi
call   1060 <led_set_code@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_hhmmss>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %edi,%edi
call   1070 <timer_get_hour@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1050 <timer_get_min@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1040 <timer_get_sec@plt>
mov    %eax,%r15d
mov    $0x1,%edi
call   1030 <led_set_dp@plt>
mov    $0x2,%edi
call   1030 <led_set_dp@plt>
mov    $0x3,%edi
call   1030 <led_set_dp@plt>
mov    $0x4,%edi
call   1030 <led_set_dp@plt>
movzbl %bl,%ebx
imul   $0xcd,%ebx,%ebp
shr    $0xb,%ebp
lea    0x30(%rbp),%eax
movzbl %al,%esi
mov    $0x5,%edi
call   1060 <led_set_code@plt>
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
sub    %al,%bl
or     $0x30,%bl
movzbl %bl,%esi
mov    $0x4,%edi
call   1060 <led_set_code@plt>
movzbl %r14b,%ebx
imul   $0xcd,%ebx,%ebp
shr    $0xb,%ebp
lea    0x30(%rbp),%eax
movzbl %al,%esi
mov    $0x3,%edi
call   1060 <led_set_code@plt>
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
sub    %al,%bl
or     $0x30,%bl
movzbl %bl,%esi
mov    $0x2,%edi
call   1060 <led_set_code@plt>
movzbl %r15b,%ebx
imul   $0xcd,%ebx,%ebp
shr    $0xb,%ebp
lea    0x30(%rbp),%eax
movzbl %al,%esi
mov    $0x1,%edi
call   1060 <led_set_code@plt>
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
sub    %al,%bl
or     $0x30,%bl
movzbl %bl,%esi
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <led_set_code@plt>

LLVM IR (-O0):
define void @update_hhmmss() {
%1 = alloca i8
%2 = alloca i8
%3 = alloca i8
%4 = call zeroext i8 @timer_get_hour(i32 0)
store i8 %4, i8* %1
%5 = call zeroext i8 @timer_get_min(i32 0)
store i8 %5, i8* %2
%6 = call zeroext i8 @timer_get_sec(i32 0)
store i8 %6, i8* %3
%7 = call i32 @led_set_dp(i32 1)
%8 = call i32 @led_set_dp(i32 2)
%9 = call i32 @led_set_dp(i32 3)
%10 = call i32 @led_set_dp(i32 4)
%11 = load i8, i8* %1
%12 = zext i8 %11 to i32
%13 = sdiv i32 %12, 10
%14 = add nsw i32 %13, 48
%15 = trunc i32 %14 to i8
%16 = call i32 @led_set_code(i32 5, i8 zeroext %15)
%17 = load i8, i8* %1
%18 = zext i8 %17 to i32
%19 = srem i32 %18, 10
%20 = add nsw i32 %19, 48
%21 = trunc i32 %20 to i8
%22 = call i32 @led_set_code(i32 4, i8 zeroext %21)
%23 = load i8, i8* %2
%24 = zext i8 %23 to i32
%25 = sdiv i32 %24, 10
%26 = add nsw i32 %25, 48
%27 = trunc i32 %26 to i8
%28 = call i32 @led_set_code(i32 3, i8 zeroext %27)
%29 = load i8, i8* %2
%30 = zext i8 %29 to i32
%31 = srem i32 %30, 10
%32 = add nsw i32 %31, 48
%33 = trunc i32 %32 to i8
%34 = call i32 @led_set_code(i32 2, i8 zeroext %33)
%35 = load i8, i8* %3
%36 = zext i8 %35 to i32
%37 = sdiv i32 %36, 10
%38 = add nsw i32 %37, 48
%39 = trunc i32 %38 to i8
%40 = call i32 @led_set_code(i32 1, i8 zeroext %39)
%41 = load i8, i8* %3
%42 = zext i8 %41 to i32
%43 = srem i32 %42, 10
%44 = add nsw i32 %43, 48
%45 = trunc i32 %44 to i8
%46 = call i32 @led_set_code(i32 0, i8 zeroext %45)
ret void
}

LLVM IR (-O2):
define void @update_hhmmss() {
%1 = tail call zeroext i8 @timer_get_hour(i32 0)
%2 = tail call zeroext i8 @timer_get_min(i32 0)
%3 = tail call zeroext i8 @timer_get_sec(i32 0)
%4 = tail call i32 @led_set_dp(i32 1)
%5 = tail call i32 @led_set_dp(i32 2)
%6 = tail call i32 @led_set_dp(i32 3)
%7 = tail call i32 @led_set_dp(i32 4)
%8 = udiv i8 %1, 10
%9 = add nuw nsw i8 %8, 48
%10 = tail call i32 @led_set_code(i32 5, i8 zeroext %9)
%11 = urem i8 %1, 10
%12 = or i8 %11, 48
%13 = tail call i32 @led_set_code(i32 4, i8 zeroext %12)
%14 = udiv i8 %2, 10
%15 = add nuw nsw i8 %14, 48
%16 = tail call i32 @led_set_code(i32 3, i8 zeroext %15)
%17 = urem i8 %2, 10
%18 = or i8 %17, 48
%19 = tail call i32 @led_set_code(i32 2, i8 zeroext %18)
%20 = udiv i8 %3, 10
%21 = add nuw nsw i8 %20, 48
%22 = tail call i32 @led_set_code(i32 1, i8 zeroext %21)
%23 = urem i8 %3, 10
%24 = or i8 %23, 48
%25 = tail call i32 @led_set_code(i32 0, i8 zeroext %24)
ret void
}