#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*/ lcd_char(unsigned char);
void lcd_showvalue(unsigned char num) {
  unsigned char H = 0, T = 0, O = 0;
  H = num / 100;
  T = (num - (H * 100)) / 10;
  O = (num - (H * 100) - (T * 10));
  lcd_char(H + 48);
  lcd_char(T + 48);
  lcd_char(O + 48);
}


x86 assembly (clang, -O0):
<lcd_showvalue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movb   $0x0,-0x2(%rbp)
movb   $0x0,-0x3(%rbp)
movb   $0x0,-0x4(%rbp)
movzbl -0x1(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %al,-0x2(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %al,-0x3(%rbp)
movzbl -0x1(%rbp),%eax
movzbl -0x2(%rbp),%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
movzbl -0x3(%rbp),%ecx
imul   $0xa,%ecx,%ecx
sub    %ecx,%eax
mov    %al,-0x4(%rbp)
movzbl -0x2(%rbp),%eax
add    $0x30,%eax
movzbl %al,%edi
call   1030 <lcd_char@plt>
movzbl -0x3(%rbp),%eax
add    $0x30,%eax
movzbl %al,%edi
call   1030 <lcd_char@plt>
movzbl -0x4(%rbp),%eax
add    $0x30,%eax
movzbl %al,%edi
call   1030 <lcd_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_showvalue>:
push   %rbp
push   %rbx
push   %rax
lea    (%rdi,%rdi,4),%eax
lea    (%rdi,%rax,8),%eax
shr    $0xc,%eax
imul   $0xffffff9c,%eax,%ebp
add    %edi,%ebp
imul   $0x6667,%ebp,%ebx
mov    %ebx,%ecx
shr    $0x1f,%ecx
sar    $0x12,%ebx
add    %ecx,%ebx
lea    (%rbx,%rbx,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%ebp
or     $0x30,%al
movzbl %al,%edi
call   1030 <lcd_char@plt>
add    $0x30,%bl
movzbl %bl,%edi
call   1030 <lcd_char@plt>
add    $0x30,%bpl
movzbl %bpl,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <lcd_char@plt>

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

LLVM IR (-O2):
define void @lcd_showvalue(i8 zeroext %0) {
%2 = zext i8 %0 to i32
%3 = udiv i8 %0, 100
%4 = zext i8 %3 to i32
%5 = mul nsw i32 %4, -100
%6 = add nsw i32 %5, %2
%7 = trunc i32 %6 to i16
%8 = sdiv i16 %7, 10
%9 = and i16 %8, 255
%10 = zext i16 %9 to i32
%11 = mul nsw i32 %10, -10
%12 = add nsw i32 %11, %6
%13 = or i8 %3, 48
%14 = tail call i32 @lcd_char(i8 zeroext %13)
%15 = trunc i16 %8 to i8
%16 = add nsw i8 %15, 48
%17 = tail call i32 @lcd_char(i8 zeroext %16)
%18 = trunc i32 %12 to i8
%19 = add i8 %18, 48
%20 = tail call i32 @lcd_char(i8 zeroext %19)
ret void
}