#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_clr_dp(int);
int /*<<< orphan*/ led_set_code(int, unsigned char);
int /*<<< orphan*/ led_set_dp(int);
unsigned char lt_timer_get_date();
unsigned char lt_timer_get_hour();
scalar_t__ lt_timer_get_hour_12();
unsigned char lt_timer_get_min();
unsigned char lt_timer_get_month();
unsigned char lt_timer_get_sec();
unsigned char lt_timer_get_year();
void update_time(unsigned char what) {
  unsigned char year, mon, date, hour, min, sec;
  if (what == 3 || what == 4 || what == 5) {
    year = lt_timer_get_year();
    mon = lt_timer_get_month();
    date = lt_timer_get_date();
    led_set_dp(2);
    led_set_dp(4);
    ;
    if ((year / 10) != 0) {
      led_set_code(5, (year / 10) + 0x30);
    } else {
      led_set_code(5, 0xFF);
    }
    led_set_code(4, (year % 10) + 0x30);
    led_set_code(3, (mon / 10) + 0x30);
    led_set_code(2, (mon % 10) + 0x30);
    led_set_code(1, (date / 10) + 0x30);
    led_set_code(0, (date % 10) + 0x30);
  } else {
    hour = lt_timer_get_hour();
    min = lt_timer_get_min();
    sec = lt_timer_get_sec();
    led_set_dp(1);
    led_set_dp(2);
    led_set_dp(3);
    led_set_dp(4);
    if (lt_timer_get_hour_12() && hour > 12) {
      led_set_dp(5);
      hour -= 12;
    } else if (lt_timer_get_hour_12() && hour == 12) {
      led_set_dp(5);
    } else {
      led_clr_dp(5);
    };
    if ((hour / 10) != 0) {
      led_set_code(5, (hour / 10) + 0x30);
    } else {
      led_set_code(5, 0xFF);
    }
    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_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0x3,%eax
je     11d5 <update_time+0x35>
movzbl -0x1(%rbp),%eax
cmp    $0x4,%eax
je     11d5 <update_time+0x35>
movzbl -0x1(%rbp),%eax
cmp    $0x5,%eax
jne    12e0 <update_time+0x140>
mov    $0x0,%al
call   1060 <lt_timer_get_year@plt>
mov    %al,-0x2(%rbp)
mov    $0x0,%al
call   1070 <lt_timer_get_month@plt>
mov    %al,-0x3(%rbp)
mov    $0x0,%al
call   1040 <lt_timer_get_date@plt>
mov    %al,-0x4(%rbp)
mov    $0x2,%edi
call   1050 <led_set_dp@plt>
mov    $0x4,%edi
call   1050 <led_set_dp@plt>
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     123d <update_time+0x9d>
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x5,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
jmp    124c <update_time+0xac>
mov    $0x5,%edi
mov    $0xff,%esi
call   1090 <led_set_code@plt>
movzbl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    $0x4,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x3(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x3,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x3(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    $0x2,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x1,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
xor    %edi,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
jmp    146d <update_time+0x2cd>
mov    $0x0,%al
call   1030 <lt_timer_get_hour@plt>
mov    %al,-0x5(%rbp)
mov    $0x0,%al
call   1080 <lt_timer_get_min@plt>
mov    %al,-0x6(%rbp)
mov    $0x0,%al
call   10a0 <lt_timer_get_sec@plt>
mov    %al,-0x7(%rbp)
mov    $0x1,%edi
call   1050 <led_set_dp@plt>
mov    $0x2,%edi
call   1050 <led_set_dp@plt>
mov    $0x3,%edi
call   1050 <led_set_dp@plt>
mov    $0x4,%edi
call   1050 <led_set_dp@plt>
mov    $0x0,%al
call   10b0 <lt_timer_get_hour_12@plt>
cmp    $0x0,%rax
je     135d <update_time+0x1bd>
movzbl -0x5(%rbp),%eax
cmp    $0xc,%eax
jle    135d <update_time+0x1bd>
mov    $0x5,%edi
call   1050 <led_set_dp@plt>
movzbl -0x5(%rbp),%eax
sub    $0xc,%eax
mov    %al,-0x5(%rbp)
jmp    1399 <update_time+0x1f9>
mov    $0x0,%al
call   10b0 <lt_timer_get_hour_12@plt>
cmp    $0x0,%rax
je     138a <update_time+0x1ea>
movzbl -0x5(%rbp),%eax
cmp    $0xc,%eax
jne    138a <update_time+0x1ea>
mov    $0x5,%edi
call   1050 <led_set_dp@plt>
jmp    1394 <update_time+0x1f4>
mov    $0x5,%edi
call   10c0 <led_clr_dp@plt>
jmp    1399 <update_time+0x1f9>
movzbl -0x5(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     13cf <update_time+0x22f>
movzbl -0x5(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x5,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
jmp    13de <update_time+0x23e>
mov    $0x5,%edi
mov    $0xff,%esi
call   1090 <led_set_code@plt>
movzbl -0x5(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    $0x4,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x6(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x3,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x6(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    $0x2,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x7(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    $0x1,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
movzbl -0x7(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
xor    %edi,%edi
movzbl %al,%esi
call   1090 <led_set_code@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<update_time>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
add    $0xfd,%dil
xor    %eax,%eax
cmp    $0x2,%dil
ja     11e7 <update_time+0x47>
call   1060 <lt_timer_get_year@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1070 <lt_timer_get_month@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1040 <lt_timer_get_date@plt>
mov    %eax,%r15d
mov    $0x2,%edi
call   1050 <led_set_dp@plt>
mov    $0x4,%edi
call   1050 <led_set_dp@plt>
jmp    1273 <update_time+0xd3>
call   1030 <lt_timer_get_hour@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1080 <lt_timer_get_min@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   10a0 <lt_timer_get_sec@plt>
mov    %eax,%r15d
mov    $0x1,%edi
call   1050 <led_set_dp@plt>
mov    $0x2,%edi
call   1050 <led_set_dp@plt>
mov    $0x3,%edi
call   1050 <led_set_dp@plt>
mov    $0x4,%edi
call   1050 <led_set_dp@plt>
xor    %eax,%eax
call   10b0 <lt_timer_get_hour_12@plt>
test   %rax,%rax
je     124a <update_time+0xaa>
cmp    $0xd,%bl
jb     124a <update_time+0xaa>
mov    $0x5,%edi
call   1050 <led_set_dp@plt>
add    $0xf4,%bl
jmp    1273 <update_time+0xd3>
xor    %eax,%eax
call   10b0 <lt_timer_get_hour_12@plt>
test   %rax,%rax
je     1269 <update_time+0xc9>
cmp    $0xc,%bl
jne    1269 <update_time+0xc9>
mov    $0x5,%edi
call   1050 <led_set_dp@plt>
mov    $0xc,%bl
jmp    127a <update_time+0xda>
mov    $0x5,%edi
call   10c0 <led_clr_dp@plt>
mov    $0xff,%al
cmp    $0xa,%bl
jb     1288 <update_time+0xe8>
movzbl %bl,%eax
imul   $0xcd,%eax,%eax
shr    $0xb,%eax
add    $0x30,%al
movzbl %al,%esi
mov    $0x5,%edi
call   1090 <led_set_code@plt>
movzbl %bl,%eax
imul   $0xcd,%eax,%ecx
shr    $0xa,%ecx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
or     $0x30,%al
movzbl %al,%esi
mov    $0x4,%edi
call   1090 <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   1090 <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   1090 <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   1090 <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    1090 <led_set_code@plt>

LLVM IR (-O0):
define void @update_time(i8 zeroext %0) {
%2 = alloca i8
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8
store i8 %0, i8* %2
%9 = load i8, i8* %2
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 3
br i1 %11, label %20, label %12
12: ; preds = %1
%13 = load i8, i8* %2
%14 = zext i8 %13 to i32
%15 = icmp eq i32 %14, 4
br i1 %15, label %20, label %16
16: ; preds = %12
%17 = load i8, i8* %2
%18 = zext i8 %17 to i32
%19 = icmp eq i32 %18, 5
br i1 %19, label %20, label %70
20: ; preds = %16, %12, %1
%21 = call zeroext i8 (...) @lt_timer_get_year()
store i8 %21, i8* %3
%22 = call zeroext i8 (...) @lt_timer_get_month()
store i8 %22, i8* %4
%23 = call zeroext i8 (...) @lt_timer_get_date()
store i8 %23, i8* %5
%24 = call i32 @led_set_dp(i32 2)
%25 = call i32 @led_set_dp(i32 4)
%26 = load i8, i8* %3
%27 = zext i8 %26 to i32
%28 = sdiv i32 %27, 10
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %37
30: ; preds = %20
%31 = load i8, i8* %3
%32 = zext i8 %31 to i32
%33 = sdiv i32 %32, 10
%34 = add nsw i32 %33, 48
%35 = trunc i32 %34 to i8
%36 = call i32 @led_set_code(i32 5, i8 zeroext %35)
br label %39
37: ; preds = %20
%38 = call i32 @led_set_code(i32 5, i8 zeroext -1)
br label %39
39: ; preds = %37, %30
%40 = load i8, i8* %3
%41 = zext i8 %40 to i32
%42 = srem i32 %41, 10
%43 = add nsw i32 %42, 48
%44 = trunc i32 %43 to i8
%45 = call i32 @led_set_code(i32 4, i8 zeroext %44)
%46 = load i8, i8* %4
%47 = zext i8 %46 to i32
%48 = sdiv i32 %47, 10
%49 = add nsw i32 %48, 48
%50 = trunc i32 %49 to i8
%51 = call i32 @led_set_code(i32 3, i8 zeroext %50)
%52 = load i8, i8* %4
%53 = zext i8 %52 to i32
%54 = srem i32 %53, 10
%55 = add nsw i32 %54, 48
%56 = trunc i32 %55 to i8
%57 = call i32 @led_set_code(i32 2, i8 zeroext %56)
%58 = load i8, i8* %5
%59 = zext i8 %58 to i32
%60 = sdiv i32 %59, 10
%61 = add nsw i32 %60, 48
%62 = trunc i32 %61 to i8
%63 = call i32 @led_set_code(i32 1, i8 zeroext %62)
%64 = load i8, i8* %5
%65 = zext i8 %64 to i32
%66 = srem i32 %65, 10
%67 = add nsw i32 %66, 48
%68 = trunc i32 %67 to i8
%69 = call i32 @led_set_code(i32 0, i8 zeroext %68)
br label %147
70: ; preds = %16
%71 = call zeroext i8 (...) @lt_timer_get_hour()
store i8 %71, i8* %6
%72 = call zeroext i8 (...) @lt_timer_get_min()
store i8 %72, i8* %7
%73 = call zeroext i8 (...) @lt_timer_get_sec()
store i8 %73, i8* %8
%74 = call i32 @led_set_dp(i32 1)
%75 = call i32 @led_set_dp(i32 2)
%76 = call i32 @led_set_dp(i32 3)
%77 = call i32 @led_set_dp(i32 4)
%78 = call i64 (...) @lt_timer_get_hour_12()
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %90
80: ; preds = %70
%81 = load i8, i8* %6
%82 = zext i8 %81 to i32
%83 = icmp sgt i32 %82, 12
br i1 %83, label %84, label %90
84: ; preds = %80
%85 = call i32 @led_set_dp(i32 5)
%86 = load i8, i8* %6
%87 = zext i8 %86 to i32
%88 = sub nsw i32 %87, 12
%89 = trunc i32 %88 to i8
store i8 %89, i8* %6
br label %102
90: ; preds = %80, %70
%91 = call i64 (...) @lt_timer_get_hour_12()
%92 = icmp ne i64 %91, 0
br i1 %92, label %93, label %99
93: ; preds = %90
%94 = load i8, i8* %6
%95 = zext i8 %94 to i32
%96 = icmp eq i32 %95, 12
br i1 %96, label %97, label %99
97: ; preds = %93
%98 = call i32 @led_set_dp(i32 5)
br label %101
99: ; preds = %93, %90
%100 = call i32 @led_clr_dp(i32 5)
br label %101
101: ; preds = %99, %97
br label %102
102: ; preds = %101, %84
%103 = load i8, i8* %6
%104 = zext i8 %103 to i32
%105 = sdiv i32 %104, 10
%106 = icmp ne i32 %105, 0
br i1 %106, label %107, label %114
107: ; preds = %102
%108 = load i8, i8* %6
%109 = zext i8 %108 to i32
%110 = sdiv i32 %109, 10
%111 = add nsw i32 %110, 48
%112 = trunc i32 %111 to i8
%113 = call i32 @led_set_code(i32 5, i8 zeroext %112)
br label %116
114: ; preds = %102
%115 = call i32 @led_set_code(i32 5, i8 zeroext -1)
br label %116
116: ; preds = %114, %107
%117 = load i8, i8* %6
%118 = zext i8 %117 to i32
%119 = srem i32 %118, 10
%120 = add nsw i32 %119, 48
%121 = trunc i32 %120 to i8
%122 = call i32 @led_set_code(i32 4, i8 zeroext %121)
%123 = load i8, i8* %7
%124 = zext i8 %123 to i32
%125 = sdiv i32 %124, 10
%126 = add nsw i32 %125, 48
%127 = trunc i32 %126 to i8
%128 = call i32 @led_set_code(i32 3, i8 zeroext %127)
%129 = load i8, i8* %7
%130 = zext i8 %129 to i32
%131 = srem i32 %130, 10
%132 = add nsw i32 %131, 48
%133 = trunc i32 %132 to i8
%134 = call i32 @led_set_code(i32 2, i8 zeroext %133)
%135 = load i8, i8* %8
%136 = zext i8 %135 to i32
%137 = sdiv i32 %136, 10
%138 = add nsw i32 %137, 48
%139 = trunc i32 %138 to i8
%140 = call i32 @led_set_code(i32 1, i8 zeroext %139)
%141 = load i8, i8* %8
%142 = zext i8 %141 to i32
%143 = srem i32 %142, 10
%144 = add nsw i32 %143, 48
%145 = trunc i32 %144 to i8
%146 = call i32 @led_set_code(i32 0, i8 zeroext %145)
br label %147
147: ; preds = %116, %39
ret void
}

LLVM IR (-O2):
define void @update_time(i8 zeroext %0) {
%2 = add i8 %0, -3
%3 = icmp ult i8 %2, 3
br i1 %3, label %4, label %14
4: ; preds = %1
%5 = tail call zeroext i8 (...) @lt_timer_get_year()
%6 = tail call zeroext i8 (...) @lt_timer_get_month()
%7 = tail call zeroext i8 (...) @lt_timer_get_date()
%8 = tail call i32 @led_set_dp(i32 2)
%9 = tail call i32 @led_set_dp(i32 4)
%10 = icmp ult i8 %5, 10
br i1 %10, label %45, label %11
11: ; preds = %4
%12 = udiv i8 %5, 10
%13 = add nuw nsw i8 %12, 48
br label %45
14: ; preds = %1
%15 = tail call zeroext i8 (...) @lt_timer_get_hour()
%16 = tail call zeroext i8 (...) @lt_timer_get_min()
%17 = tail call zeroext i8 (...) @lt_timer_get_sec()
%18 = tail call i32 @led_set_dp(i32 1)
%19 = tail call i32 @led_set_dp(i32 2)
%20 = tail call i32 @led_set_dp(i32 3)
%21 = tail call i32 @led_set_dp(i32 4)
%22 = tail call i64 (...) @lt_timer_get_hour_12()
%23 = icmp ne i64 %22, 0
%24 = icmp ugt i8 %15, 12
%25 = select i1 %23, i1 %24, i1 false
br i1 %25, label %26, label %29
26: ; preds = %14
%27 = tail call i32 @led_set_dp(i32 5)
%28 = add i8 %15, -12
br label %38
29: ; preds = %14
%30 = tail call i64 (...) @lt_timer_get_hour_12()
%31 = icmp ne i64 %30, 0
%32 = icmp eq i8 %15, 12
%33 = select i1 %31, i1 %32, i1 false
br i1 %33, label %34, label %36
34: ; preds = %29
%35 = tail call i32 @led_set_dp(i32 5)
br label %41
36: ; preds = %29
%37 = tail call i32 @led_clr_dp(i32 5)
br label %38
38: ; preds = %36, %26
%39 = phi i8 [ %28, %26 ], [ %15, %36 ]
%40 = icmp ult i8 %39, 10
br i1 %40, label %45, label %41
41: ; preds = %34, %38
%42 = phi i8 [ 12, %34 ], [ %39, %38 ]
%43 = udiv i8 %42, 10
%44 = add nuw nsw i8 %43, 48
br label %45
45: ; preds = %41, %38, %11, %4
%46 = phi i8 [ %13, %11 ], [ -1, %4 ], [ %44, %41 ], [ -1, %38 ]
%47 = phi i8 [ %5, %11 ], [ %5, %4 ], [ %42, %41 ], [ %39, %38 ]
%48 = phi i8 [ %6, %11 ], [ %6, %4 ], [ %16, %41 ], [ %16, %38 ]
%49 = phi i8 [ %7, %11 ], [ %7, %4 ], [ %17, %41 ], [ %17, %38 ]
%50 = tail call i32 @led_set_code(i32 5, i8 zeroext %46)
%51 = urem i8 %47, 10
%52 = or i8 %51, 48
%53 = tail call i32 @led_set_code(i32 4, i8 zeroext %52)
%54 = udiv i8 %48, 10
%55 = add nuw nsw i8 %54, 48
%56 = tail call i32 @led_set_code(i32 3, i8 zeroext %55)
%57 = urem i8 %48, 10
%58 = or i8 %57, 48
%59 = tail call i32 @led_set_code(i32 2, i8 zeroext %58)
%60 = udiv i8 %49, 10
%61 = add nuw nsw i8 %60, 48
%62 = tail call i32 @led_set_code(i32 1, i8 zeroext %61)
%63 = urem i8 %49, 10
%64 = or i8 %63, 48
%65 = tail call i32 @led_set_code(i32 0, i8 zeroext %64)
ret void
}