#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*/ Nokia5110_OutChar(unsigned short);
int /*<<< orphan*/ Nokia5110_OutString(char *);
void Nokia5110_OutUDec(unsigned short 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    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0xa,%eax
jge    115c <Nokia5110_OutUDec+0x3c>
lea    0xebd(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
movzwl -0x2(%rbp),%eax
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    1387 <Nokia5110_OutUDec+0x267>
movzwl -0x2(%rbp),%eax
cmp    $0x64,%eax
jge    11ab <Nokia5110_OutUDec+0x8b>
lea    0xe91(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dx,%ax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    1382 <Nokia5110_OutUDec+0x262>
movzwl -0x2(%rbp),%eax
cmp    $0x3e8,%eax
jge    1226 <Nokia5110_OutUDec+0x106>
lea    0xe41(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
movzwl -0x2(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dx,%ax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    137d <Nokia5110_OutUDec+0x25d>
movzwl -0x2(%rbp),%eax
cmp    $0x2710,%eax
jge    12c9 <Nokia5110_OutUDec+0x1a9>
mov    $0x20,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dx,%ax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    1378 <Nokia5110_OutUDec+0x258>
movzwl -0x2(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %dx,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
movzwl -0x2(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dx,%ax
movzwl %ax,%edi
call   1040 <Nokia5110_OutChar@plt>
jmp    137d <Nokia5110_OutUDec+0x25d>
jmp    1382 <Nokia5110_OutUDec+0x262>
jmp    1387 <Nokia5110_OutUDec+0x267>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Nokia5110_OutUDec>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
cmp    $0x9,%bx
ja     1140 <Nokia5110_OutUDec+0x20>
lea    0xecd(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
add    $0x30,%ebx
jmp    1295 <Nokia5110_OutUDec+0x175>
cmp    $0x63,%bx
ja     1178 <Nokia5110_OutUDec+0x58>
lea    0xeb4(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
movzbl %bl,%eax
imul   $0xcd,%eax,%r14d
shr    $0xb,%r14d
lea    0x30(%r14),%eax
movzbl %al,%edi
call   1040 <Nokia5110_OutChar@plt>
add    %r14d,%r14d
lea    (%r14,%r14,4),%eax
jmp    128d <Nokia5110_OutUDec+0x16d>
movzwl %bx,%ebp
cmp    $0x3e7,%ebp
ja     11db <Nokia5110_OutUDec+0xbb>
lea    0xe78(%rip),%rdi
call   1030 <Nokia5110_OutString@plt>
mov    %ebp,%eax
shr    $0x2,%eax
imul   $0x147b,%eax,%r14d
shr    $0x11,%r14d
lea    0x30(%r14),%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x64,%r14d,%eax
sub    %eax,%ebp
imul   $0xcd,%ebp,%eax
movzwl %ax,%ebx
shr    $0xb,%ebx
mov    %ebx,%eax
or     $0x30,%al
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    1295 <Nokia5110_OutUDec+0x175>
cmp    $0x270f,%ebp
ja     1210 <Nokia5110_OutUDec+0xf0>
mov    $0x20,%edi
call   1040 <Nokia5110_OutChar@plt>
mov    %ebp,%eax
shr    $0x3,%eax
imul   $0x20c5,%eax,%ebx
shr    $0x14,%ebx
lea    0x30(%rbx),%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x3e8,%ebx,%eax
sub    %eax,%ebp
movzwl %bp,%ebx
jmp    1252 <Nokia5110_OutUDec+0x132>
mov    %ebp,%eax
shr    $0x4,%eax
imul   $0x347,%eax,%ebx
shr    $0x13,%ebx
lea    0x30(%rbx),%edi
call   1040 <Nokia5110_OutChar@plt>
imul   $0x2710,%ebx,%eax
sub    %eax,%ebp
movzwl %bp,%ebx
mov    %ebx,%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
movzwl %bx,%edi
pop    %rbx
pop    %r14
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(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = icmp slt i32 %4, 10
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%8 = load i16, i16* %2
%9 = zext i16 %8 to i32
%10 = add nsw i32 %9, 48
%11 = trunc i32 %10 to i16
%12 = call i32 @Nokia5110_OutChar(i16 zeroext %11)
br label %143
13: ; preds = %1
%14 = load i16, i16* %2
%15 = zext i16 %14 to i32
%16 = icmp slt i32 %15, 100
br i1 %16, label %17, label %31
17: ; preds = %13
%18 = call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%19 = load i16, i16* %2
%20 = zext i16 %19 to i32
%21 = sdiv i32 %20, 10
%22 = add nsw i32 %21, 48
%23 = trunc i32 %22 to i16
%24 = call i32 @Nokia5110_OutChar(i16 zeroext %23)
%25 = load i16, i16* %2
%26 = zext i16 %25 to i32
%27 = srem i32 %26, 10
%28 = add nsw i32 %27, 48
%29 = trunc i32 %28 to i16
%30 = call i32 @Nokia5110_OutChar(i16 zeroext %29)
br label %142
31: ; preds = %13
%32 = load i16, i16* %2
%33 = zext i16 %32 to i32
%34 = icmp slt i32 %33, 1000
br i1 %34, label %35, label %59
35: ; preds = %31
%36 = call i32 @Nokia5110_OutString(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%37 = load i16, i16* %2
%38 = zext i16 %37 to i32
%39 = sdiv i32 %38, 100
%40 = add nsw i32 %39, 48
%41 = trunc i32 %40 to i16
%42 = call i32 @Nokia5110_OutChar(i16 zeroext %41)
%43 = load i16, i16* %2
%44 = zext i16 %43 to i32
%45 = srem i32 %44, 100
%46 = trunc i32 %45 to i16
store i16 %46, i16* %2
%47 = load i16, i16* %2
%48 = zext i16 %47 to i32
%49 = sdiv i32 %48, 10
%50 = add nsw i32 %49, 48
%51 = trunc i32 %50 to i16
%52 = call i32 @Nokia5110_OutChar(i16 zeroext %51)
%53 = load i16, i16* %2
%54 = zext i16 %53 to i32
%55 = srem i32 %54, 10
%56 = add nsw i32 %55, 48
%57 = trunc i32 %56 to i16
%58 = call i32 @Nokia5110_OutChar(i16 zeroext %57)
br label %141
59: ; preds = %31
%60 = load i16, i16* %2
%61 = zext i16 %60 to i32
%62 = icmp slt i32 %61, 10000
br i1 %62, label %63, label %97
63: ; preds = %59
%64 = call i32 @Nokia5110_OutChar(i16 zeroext 32)
%65 = load i16, i16* %2
%66 = zext i16 %65 to i32
%67 = sdiv i32 %66, 1000
%68 = add nsw i32 %67, 48
%69 = trunc i32 %68 to i16
%70 = call i32 @Nokia5110_OutChar(i16 zeroext %69)
%71 = load i16, i16* %2
%72 = zext i16 %71 to i32
%73 = srem i32 %72, 1000
%74 = trunc i32 %73 to i16
store i16 %74, i16* %2
%75 = load i16, i16* %2
%76 = zext i16 %75 to i32
%77 = sdiv i32 %76, 100
%78 = add nsw i32 %77, 48
%79 = trunc i32 %78 to i16
%80 = call i32 @Nokia5110_OutChar(i16 zeroext %79)
%81 = load i16, i16* %2
%82 = zext i16 %81 to i32
%83 = srem i32 %82, 100
%84 = trunc i32 %83 to i16
store i16 %84, i16* %2
%85 = load i16, i16* %2
%86 = zext i16 %85 to i32
%87 = sdiv i32 %86, 10
%88 = add nsw i32 %87, 48
%89 = trunc i32 %88 to i16
%90 = call i32 @Nokia5110_OutChar(i16 zeroext %89)
%91 = load i16, i16* %2
%92 = zext i16 %91 to i32
%93 = srem i32 %92, 10
%94 = add nsw i32 %93, 48
%95 = trunc i32 %94 to i16
%96 = call i32 @Nokia5110_OutChar(i16 zeroext %95)
br label %140
97: ; preds = %59
%98 = load i16, i16* %2
%99 = zext i16 %98 to i32
%100 = sdiv i32 %99, 10000
%101 = add nsw i32 %100, 48
%102 = trunc i32 %101 to i16
%103 = call i32 @Nokia5110_OutChar(i16 zeroext %102)
%104 = load i16, i16* %2
%105 = zext i16 %104 to i32
%106 = srem i32 %105, 10000
%107 = trunc i32 %106 to i16
store i16 %107, i16* %2
%108 = load i16, i16* %2
%109 = zext i16 %108 to i32
%110 = sdiv i32 %109, 1000
%111 = add nsw i32 %110, 48
%112 = trunc i32 %111 to i16
%113 = call i32 @Nokia5110_OutChar(i16 zeroext %112)
%114 = load i16, i16* %2
%115 = zext i16 %114 to i32
%116 = srem i32 %115, 1000
%117 = trunc i32 %116 to i16
store i16 %117, i16* %2
%118 = load i16, i16* %2
%119 = zext i16 %118 to i32
%120 = sdiv i32 %119, 100
%121 = add nsw i32 %120, 48
%122 = trunc i32 %121 to i16
%123 = call i32 @Nokia5110_OutChar(i16 zeroext %122)
%124 = load i16, i16* %2
%125 = zext i16 %124 to i32
%126 = srem i32 %125, 100
%127 = trunc i32 %126 to i16
store i16 %127, i16* %2
%128 = load i16, i16* %2
%129 = zext i16 %128 to i32
%130 = sdiv i32 %129, 10
%131 = add nsw i32 %130, 48
%132 = trunc i32 %131 to i16
%133 = call i32 @Nokia5110_OutChar(i16 zeroext %132)
%134 = load i16, i16* %2
%135 = zext i16 %134 to i32
%136 = srem i32 %135, 10
%137 = add nsw i32 %136, 48
%138 = trunc i32 %137 to i16
%139 = call i32 @Nokia5110_OutChar(i16 zeroext %138)
br label %140
140: ; preds = %97, %63
br label %141
141: ; preds = %140, %35
br label %142
142: ; preds = %141, %17
br label %143
143: ; preds = %142, %6
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(i16 zeroext %0) {
%2 = icmp ult i16 %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 nuw nsw i16 %0, 48
br label %75
6: ; preds = %1
%7 = icmp ult i16 %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 i16 %0 to i8
%11 = udiv i8 %10, 10
%12 = add nuw nsw i8 %11, 48
%13 = zext i8 %12 to i16
%14 = tail call i32 @Nokia5110_OutChar(i16 zeroext %13)
%15 = urem i8 %10, 10
%16 = or i8 %15, 48
%17 = zext i8 %16 to i16
br label %75
18: ; preds = %6
%19 = icmp ult i16 %0, 1000
br i1 %19, label %20, label %34
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 = udiv i16 %0, 100
%23 = add nuw nsw i16 %22, 48
%24 = tail call i32 @Nokia5110_OutChar(i16 zeroext %23)
%25 = urem i16 %0, 100
%26 = trunc i16 %25 to i8
%27 = udiv i8 %26, 10
%28 = or i8 %27, 48
%29 = zext i8 %28 to i16
%30 = tail call i32 @Nokia5110_OutChar(i16 zeroext %29)
%31 = urem i8 %26, 10
%32 = or i8 %31, 48
%33 = zext i8 %32 to i16
br label %75
34: ; preds = %18
%35 = icmp ult i16 %0, 10000
br i1 %35, label %36, label %54
36: ; preds = %34
%37 = tail call i32 @Nokia5110_OutChar(i16 zeroext 32)
%38 = udiv i16 %0, 1000
%39 = add nuw nsw i16 %38, 48
%40 = tail call i32 @Nokia5110_OutChar(i16 zeroext %39)
%41 = urem i16 %0, 1000
%42 = udiv i16 %41, 100
%43 = or i16 %42, 48
%44 = tail call i32 @Nokia5110_OutChar(i16 zeroext %43)
%45 = urem i16 %41, 100
%46 = trunc i16 %45 to i8
%47 = udiv i8 %46, 10
%48 = or i8 %47, 48
%49 = zext i8 %48 to i16
%50 = tail call i32 @Nokia5110_OutChar(i16 zeroext %49)
%51 = urem i8 %46, 10
%52 = or i8 %51, 48
%53 = zext i8 %52 to i16
br label %75
54: ; preds = %34
%55 = udiv i16 %0, 10000
%56 = or i16 %55, 48
%57 = tail call i32 @Nokia5110_OutChar(i16 zeroext %56)
%58 = urem i16 %0, 10000
%59 = udiv i16 %58, 1000
%60 = add nuw nsw i16 %59, 48
%61 = tail call i32 @Nokia5110_OutChar(i16 zeroext %60)
%62 = urem i16 %58, 1000
%63 = udiv i16 %62, 100
%64 = or i16 %63, 48
%65 = tail call i32 @Nokia5110_OutChar(i16 zeroext %64)
%66 = urem i16 %62, 100
%67 = trunc i16 %66 to i8
%68 = udiv i8 %67, 10
%69 = or i8 %68, 48
%70 = zext i8 %69 to i16
%71 = tail call i32 @Nokia5110_OutChar(i16 zeroext %70)
%72 = urem i8 %67, 10
%73 = or i8 %72, 48
%74 = zext i8 %73 to i16
br label %75
75: ; preds = %8, %36, %54, %20, %3
%76 = phi i16 [ %17, %8 ], [ %53, %36 ], [ %74, %54 ], [ %33, %20 ], [ %5, %3 ]
%77 = tail call i32 @Nokia5110_OutChar(i16 zeroext %76)
ret void
}