#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 */
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ Nokia5110_OutChar(int);
int /*<<< orphan*/ Nokia5110_OutString(char *);
void Nokia5110_OutUDec(uint16_t n) {
  if (n < 10) {
    Nokia5110_OutString("    ");
    Nokia5110_OutChar(n + '0');
  } else if (n < 100) {
    Nokia5110_OutString("   ");
    Nokia5110_OutChar(n / 10 + '0');
    Nokia5110_OutChar(n % 10 + '0');
  } else if (n < 1000) {
    Nokia5110_OutString("  ");
    Nokia5110_OutChar(n / 100 + '0');
    n = n % 100;
    Nokia5110_OutChar(n / 10 + '0');
    Nokia5110_OutChar(n % 10 + '0');
  } else if (n < 10000) {
    Nokia5110_OutChar(' ');
    Nokia5110_OutChar(n / 1000 + '0');
    n = n % 1000;
    Nokia5110_OutChar(n / 100 + '0');
    n = n % 100;
    Nokia5110_OutChar(n / 10 + '0');
    Nokia5110_OutChar(n % 10 + '0');
  } else {
    Nokia5110_OutChar(n / 10000 + '0');
    n = n % 10000;
    Nokia5110_OutChar(n / 1000 + '0');
    n = n % 1000;
    Nokia5110_OutChar(n / 100 + '0');
    n = n % 100;
    Nokia5110_OutChar(n / 10 + '0');
    Nokia5110_OutChar(n % 10 + '0');
  }
}


x86 assembly (clang, -O0):
<Nokia5110_OutUDec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1151 <Nokia5110_OutUDec+0x31>
lea    0xec4(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
mov    -0x4(%rbp),%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    132f <Nokia5110_OutUDec+0x20f>
cmpl   $0x64,-0x4(%rbp)
jge    1196 <Nokia5110_OutUDec+0x76>
lea    0xe9f(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    132a <Nokia5110_OutUDec+0x20a>
cmpl   $0x3e8,-0x4(%rbp)
jge    1201 <Nokia5110_OutUDec+0xe1>
lea    0xe58(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    1325 <Nokia5110_OutUDec+0x205>
cmpl   $0x2710,-0x4(%rbp)
jge    128d <Nokia5110_OutUDec+0x16d>
mov    $0x20,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    1320 <Nokia5110_OutUDec+0x200>
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    1325 <Nokia5110_OutUDec+0x205>
jmp    132a <Nokia5110_OutUDec+0x20a>
jmp    132f <Nokia5110_OutUDec+0x20f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Nokia5110_OutUDec>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0x9,%edi
jg     113e <Nokia5110_OutUDec+0x1e>
lea    0xecf(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
add    $0x30,%ebx
jmp    1243 <Nokia5110_OutUDec+0x123>
cmp    $0x63,%ebx
ja     117b <Nokia5110_OutUDec+0x5b>
lea    0xeb7(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
movzbl %bl,%ebp
imul   $0xcd,%ebp,%ebx
shr    $0xb,%ebx
lea    0x30(%rbx),%eax
movzbl %al,%edi
call   1040 <Nokia5110_OutChar@plt>
add    %ebx,%ebx
lea    (%rbx,%rbx,4),%eax
sub    %al,%bpl
or     $0x30,%bpl
movzbl %bpl,%ebx
jmp    1243 <Nokia5110_OutUDec+0x123>
cmp    $0x3e7,%ebx
ja     11ab <Nokia5110_OutUDec+0x8b>
lea    0xe78(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
movzwl %bx,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%ebp
shr    $0x11,%ebp
lea    0x30(%rbp),%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x64,%ebp,%eax
jmp    121b <Nokia5110_OutUDec+0xfb>
cmp    $0x270f,%ebx
ja     11bf <Nokia5110_OutUDec+0x9f>
mov    $0x20,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    11de <Nokia5110_OutUDec+0xbe>
mov    %ebx,%eax
mov    $0xd1b71759,%ebp
imul   %rax,%rbp
shr    $0x2d,%rbp
lea    0x30(%rbp),%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x2710,%ebp,%eax
sub    %eax,%ebx
movzwl %bx,%eax
shr    $0x3,%eax
imul   $0x20c5,%eax,%ebp
shr    $0x14,%ebp
lea    0x30(%rbp),%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x3e8,%ebp,%eax
sub    %eax,%ebx
movzwl %bx,%ebx
mov    %ebx,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%ebp
shr    $0x11,%ebp
mov    %ebp,%edi
or     $0x30,%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x64,%ebp,%eax
sub    %eax,%ebx
imul   $0xcd,%ebx,%eax
movzwl %ax,%ebp
shr    $0xb,%ebp
mov    %ebp,%eax
or     $0x30,%al
movzbl %al,%edi
call   1040 <Nokia5110_OutChar@plt>
add    %ebp,%ebp
lea    0x0(%rbp,%rbp,4),%eax
sub    %al,%bl
or     $0x30,%bl
movzbl %bl,%ebx
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <Nokia5110_OutChar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c" \00"
@.str.2 = [3 x i8] c" \00"
define void @Nokia5110_OutUDec(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 10
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 48
%9 = call i32 @Nokia5110_OutChar(i32 %8)
br label %97
10: ; preds = %1
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 100
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 10
%17 = add nsw i32 %16, 48
%18 = call i32 @Nokia5110_OutChar(i32 %17)
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
%21 = add nsw i32 %20, 48
%22 = call i32 @Nokia5110_OutChar(i32 %21)
br label %96
23: ; preds = %10
%24 = load i32, i32* %2
%25 = icmp slt i32 %24, 1000
br i1 %25, label %26, label %42
26: ; preds = %23
%27 = call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* %2
%29 = sdiv i32 %28, 100
%30 = add nsw i32 %29, 48
%31 = call i32 @Nokia5110_OutChar(i32 %30)
%32 = load i32, i32* %2
%33 = srem i32 %32, 100
store i32 %33, i32* %2
%34 = load i32, i32* %2
%35 = sdiv i32 %34, 10
%36 = add nsw i32 %35, 48
%37 = call i32 @Nokia5110_OutChar(i32 %36)
%38 = load i32, i32* %2
%39 = srem i32 %38, 10
%40 = add nsw i32 %39, 48
%41 = call i32 @Nokia5110_OutChar(i32 %40)
br label %95
42: ; preds = %23
%43 = load i32, i32* %2
%44 = icmp slt i32 %43, 10000
br i1 %44, label %45, label %67
45: ; preds = %42
%46 = call i32 @Nokia5110_OutChar(i32 32)
%47 = load i32, i32* %2
%48 = sdiv i32 %47, 1000
%49 = add nsw i32 %48, 48
%50 = call i32 @Nokia5110_OutChar(i32 %49)
%51 = load i32, i32* %2
%52 = srem i32 %51, 1000
store i32 %52, i32* %2
%53 = load i32, i32* %2
%54 = sdiv i32 %53, 100
%55 = add nsw i32 %54, 48
%56 = call i32 @Nokia5110_OutChar(i32 %55)
%57 = load i32, i32* %2
%58 = srem i32 %57, 100
store i32 %58, i32* %2
%59 = load i32, i32* %2
%60 = sdiv i32 %59, 10
%61 = add nsw i32 %60, 48
%62 = call i32 @Nokia5110_OutChar(i32 %61)
%63 = load i32, i32* %2
%64 = srem i32 %63, 10
%65 = add nsw i32 %64, 48
%66 = call i32 @Nokia5110_OutChar(i32 %65)
br label %94
67: ; preds = %42
%68 = load i32, i32* %2
%69 = sdiv i32 %68, 10000
%70 = add nsw i32 %69, 48
%71 = call i32 @Nokia5110_OutChar(i32 %70)
%72 = load i32, i32* %2
%73 = srem i32 %72, 10000
store i32 %73, i32* %2
%74 = load i32, i32* %2
%75 = sdiv i32 %74, 1000
%76 = add nsw i32 %75, 48
%77 = call i32 @Nokia5110_OutChar(i32 %76)
%78 = load i32, i32* %2
%79 = srem i32 %78, 1000
store i32 %79, i32* %2
%80 = load i32, i32* %2
%81 = sdiv i32 %80, 100
%82 = add nsw i32 %81, 48
%83 = call i32 @Nokia5110_OutChar(i32 %82)
%84 = load i32, i32* %2
%85 = srem i32 %84, 100
store i32 %85, i32* %2
%86 = load i32, i32* %2
%87 = sdiv i32 %86, 10
%88 = add nsw i32 %87, 48
%89 = call i32 @Nokia5110_OutChar(i32 %88)
%90 = load i32, i32* %2
%91 = srem i32 %90, 10
%92 = add nsw i32 %91, 48
%93 = call i32 @Nokia5110_OutChar(i32 %92)
br label %94
94: ; preds = %67, %45
br label %95
95: ; preds = %94, %26
br label %96
96: ; preds = %95, %13
br label %97
97: ; preds = %96, %5
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.1 = [4 x i8] c" \00"
@.str.2 = [3 x i8] c" \00"
define void @Nokia5110_OutUDec(i32 %0) {
%2 = icmp slt i32 %0, 10
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = add nsw i32 %0, 48
br label %83
6: ; preds = %1
%7 = icmp ult i32 %0, 100
br i1 %7, label %8, label %18
8: ; preds = %6
%9 = tail call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%10 = trunc i32 %0 to i8
%11 = udiv i8 %10, 10
%12 = add nuw nsw i8 %11, 48
%13 = zext i8 %12 to i32
%14 = tail call i32 @Nokia5110_OutChar(i32 %13)
%15 = urem i8 %10, 10
%16 = or i8 %15, 48
%17 = zext i8 %16 to i32
br label %83
18: ; preds = %6
%19 = icmp ult i32 %0, 1000
br i1 %19, label %20, label %36
20: ; preds = %18
%21 = tail call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%22 = trunc i32 %0 to i16
%23 = udiv i16 %22, 100
%24 = add nuw nsw i16 %23, 48
%25 = zext i16 %24 to i32
%26 = tail call i32 @Nokia5110_OutChar(i32 %25)
%27 = urem i16 %22, 100
%28 = trunc i16 %27 to i8
%29 = udiv i8 %28, 10
%30 = or i8 %29, 48
%31 = zext i8 %30 to i32
%32 = tail call i32 @Nokia5110_OutChar(i32 %31)
%33 = urem i8 %28, 10
%34 = or i8 %33, 48
%35 = zext i8 %34 to i32
br label %83
36: ; preds = %18
%37 = icmp ult i32 %0, 10000
br i1 %37, label %38, label %59
38: ; preds = %36
%39 = tail call i32 @Nokia5110_OutChar(i32 32)
%40 = trunc i32 %0 to i16
%41 = udiv i16 %40, 1000
%42 = add nuw nsw i16 %41, 48
%43 = zext i16 %42 to i32
%44 = tail call i32 @Nokia5110_OutChar(i32 %43)
%45 = urem i16 %40, 1000
%46 = udiv i16 %45, 100
%47 = or i16 %46, 48
%48 = zext i16 %47 to i32
%49 = tail call i32 @Nokia5110_OutChar(i32 %48)
%50 = urem i16 %45, 100
%51 = trunc i16 %50 to i8
%52 = udiv i8 %51, 10
%53 = or i8 %52, 48
%54 = zext i8 %53 to i32
%55 = tail call i32 @Nokia5110_OutChar(i32 %54)
%56 = urem i8 %51, 10
%57 = or i8 %56, 48
%58 = zext i8 %57 to i32
br label %83
59: ; preds = %36
%60 = udiv i32 %0, 10000
%61 = add nuw nsw i32 %60, 48
%62 = tail call i32 @Nokia5110_OutChar(i32 %61)
%63 = urem i32 %0, 10000
%64 = trunc i32 %63 to i16
%65 = udiv i16 %64, 1000
%66 = add nuw nsw i16 %65, 48
%67 = zext i16 %66 to i32
%68 = tail call i32 @Nokia5110_OutChar(i32 %67)
%69 = urem i16 %64, 1000
%70 = udiv i16 %69, 100
%71 = or i16 %70, 48
%72 = zext i16 %71 to i32
%73 = tail call i32 @Nokia5110_OutChar(i32 %72)
%74 = urem i16 %69, 100
%75 = trunc i16 %74 to i8
%76 = udiv i8 %75, 10
%77 = or i8 %76, 48
%78 = zext i8 %77 to i32
%79 = tail call i32 @Nokia5110_OutChar(i32 %78)
%80 = urem i8 %75, 10
%81 = or i8 %80, 48
%82 = zext i8 %81 to i32
br label %83
83: ; preds = %8, %38, %59, %20, %3
%84 = phi i32 [ %17, %8 ], [ %58, %38 ], [ %82, %59 ], [ %35, %20 ], [ %5, %3 ]
%85 = tail call i32 @Nokia5110_OutChar(i32 %84)
ret void
}