#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*/ vram_adr(unsigned int);
int /*<<< orphan*/ vram_put(int);
void put_num(unsigned int adr, unsigned int num, unsigned char len) {
  vram_adr(adr);
  if (len > 2)
    vram_put(0xB0 + (num / 100) % 10);
  if (len > 1)
    vram_put(0xB0 + (num / 10) % 10);
  vram_put(0xB0 + (num % 10));
}


x86 assembly (clang, -O0):
<put_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dl,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <vram_adr@plt>
movzbl -0x9(%rbp),%eax
cmp    $0x2,%eax
jle    116a <put_num+0x4a>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
add    $0xb0,%edi
call   1030 <vram_put@plt>
movzbl -0x9(%rbp),%eax
cmp    $0x1,%eax
jle    1199 <put_num+0x79>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
add    $0xb0,%edi
call   1030 <vram_put@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%edi
add    $0xb0,%edi
call   1030 <vram_put@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_num>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebp
mov    %esi,%ebx
call   1040 <vram_adr@plt>
mov    %ebx,%r14d
cmp    $0x3,%bpl
jb     1162 <put_num+0x42>
imul   $0x51eb851f,%r14,%rdi
shr    $0x25,%rdi
mov    $0xcccccccd,%eax
imul   %rdi,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
or     $0xb0,%edi
call   1030 <vram_put@plt>
jmp    1168 <put_num+0x48>
cmp    $0x2,%bpl
jne    1195 <put_num+0x75>
mov    $0xcccccccd,%eax
mov    %r14,%rdi
imul   %rax,%rdi
shr    $0x23,%rdi
mov    %rdi,%rcx
imul   %rax,%rcx
shr    $0x23,%rcx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%eax
sub    %eax,%edi
or     $0xb0,%edi
call   1030 <vram_put@plt>
mov    $0xcccccccd,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
or     $0xb0,%ebx
mov    %ebx,%edi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <vram_put@plt>

LLVM IR (-O0):
define void @put_num(i32 %0, i32 %1, i8 zeroext %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8 %2, i8* %6
%7 = load i32, i32* %4
%8 = call i32 @vram_adr(i32 %7)
%9 = load i8, i8* %6
%10 = zext i8 %9 to i32
%11 = icmp sgt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %3
%13 = load i32, i32* %5
%14 = udiv i32 %13, 100
%15 = urem i32 %14, 10
%16 = add i32 176, %15
%17 = call i32 @vram_put(i32 %16)
br label %18
18: ; preds = %12, %3
%19 = load i8, i8* %6
%20 = zext i8 %19 to i32
%21 = icmp sgt i32 %20, 1
br i1 %21, label %22, label %28
22: ; preds = %18
%23 = load i32, i32* %5
%24 = udiv i32 %23, 10
%25 = urem i32 %24, 10
%26 = add i32 176, %25
%27 = call i32 @vram_put(i32 %26)
br label %28
28: ; preds = %22, %18
%29 = load i32, i32* %5
%30 = urem i32 %29, 10
%31 = add i32 176, %30
%32 = call i32 @vram_put(i32 %31)
ret void
}

LLVM IR (-O2):
define void @put_num(i32 %0, i32 %1, i8 zeroext %2) {
%4 = tail call i32 @vram_adr(i32 %0)
%5 = icmp ugt i8 %2, 2
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = udiv i32 %1, 100
%8 = urem i32 %7, 10
%9 = or i32 %8, 176
%10 = tail call i32 @vram_put(i32 %9)
br label %13
11: ; preds = %3
%12 = icmp eq i8 %2, 2
br i1 %12, label %13, label %18
13: ; preds = %6, %11
%14 = udiv i32 %1, 10
%15 = urem i32 %14, 10
%16 = or i32 %15, 176
%17 = tail call i32 @vram_put(i32 %16)
br label %18
18: ; preds = %13, %11
%19 = urem i32 %1, 10
%20 = or i32 %19, 176
%21 = tail call i32 @vram_put(i32 %20)
ret void
}