#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, unsigned int *);
int main(int argc, const char *argv[]) {
  unsigned int n;
  scanf("%d", &n);
  unsigned int n2 = n, len = 0;
  while (n2 > 0) {
    n2 = n2 / 10;
    len++;
  }
  if (len > 5) {
    printf("Input number is too large.\n");
    return 1;
  }
  printf("length=%d\n", len);
  int digits[5] = {}, p = 0, n3 = n;
  while (n3 > 0) {
    digits[p++] = n3 % 10;
    n3 = n3 / 10;
  }
  printf("ASC digit=");
  for (int i = len - 1; i >= 0; --i)
    printf("%d ", digits[i]);
  printf("\n");
  printf("DEC digit=");
  for (int i = 0; i < len; ++i)
    printf("%d ", digits[i]);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x18(%rbp)
jbe    118a <main+0x5a>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1163 <main+0x33>
cmpl   $0x5,-0x1c(%rbp)
jbe    11ae <main+0x7e>
lea    0xe68(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12c2 <main+0x192>
mov    -0x1c(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1040 <memset@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x38(%rbp)
cmpl   $0x0,-0x38(%rbp)
jle    1215 <main+0xe5>
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x34(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x34(%rbp)
cltq
mov    %edx,-0x30(%rbp,%rax,4)
mov    -0x38(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x38(%rbp)
jmp    11dc <main+0xac>
lea    0xe0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
jl     125a <main+0x12a>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x3c(%rbp)
jmp    122c <main+0xfc>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xdca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jae    12ad <main+0x17d>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xd9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    127d <main+0x14d>
lea    0xd69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xeaf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
mov    0xc(%rsp),%eax
xor    %r15d,%r15d
test   %eax,%eax
je     11a2 <main+0x62>
mov    $0xcccccccd,%ecx
nopl   0x0(%rax,%rax,1)
mov    %eax,%edx
imul   %rcx,%rdx
shr    $0x23,%rdx
add    $0x1,%r15d
cmp    $0x9,%eax
mov    %edx,%eax
ja     1170 <main+0x30>
cmp    $0x6,%r15d
jb     11a2 <main+0x62>
lea    0xe96(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r14d
jmp    12a1 <main+0x161>
lea    0xe5a(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x20(%rsp)
mov    0xc(%rsp),%ebp
test   %ebp,%ebp
jle    1201 <main+0xc1>
lea    0x10(%rsp),%rcx
mov    $0xcccccccd,%edx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebp,%esi
imul   %rdx,%rsi
shr    $0x23,%rsi
lea    (%rsi,%rsi,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %ebp,%eax
sub    %edi,%eax
mov    %eax,(%rcx)
add    $0x4,%rcx
cmp    $0x9,%ebp
mov    %esi,%ebp
ja     11e0 <main+0xa0>
lea    0xe06(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r15d,%eax
add    $0xffffffff,%eax
js     1248 <main+0x108>
mov    %eax,%eax
lea    (%rsp,%rax,4),%rbp
add    $0x10,%rbp
lea    0xdf1(%rip),%r14
mov    %r15d,%ebx
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebx
add    $0xfffffffffffffffc,%rbp
test   %ebx,%ebx
jg     1230 <main+0xf0>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xdc4(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <printf@plt>
test   %r15d,%r15d
je     1297 <main+0x157>
mov    %r15d,%ebp
lea    0xda7(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x10(%rsp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1280 <main+0x140>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r14d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [28 x i8] c"Input number is too large.\0A\00"
@.str.2 = [11 x i8] c"length=%d\0A\00"
@.str.3 = [11 x i8] c"ASC digit=\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
@.str.6 = [11 x i8] c"DEC digit=\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [5 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
store i32 %15, i32* %7
store i32 0, i32* %8
br label %16
16: ; preds = %19, %2
%17 = load i32, i32* %7
%18 = icmp ugt i32 %17, 0
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* %7
%21 = udiv i32 %20, 10
store i32 %21, i32* %7
%22 = load i32, i32* %8
%23 = add i32 %22, 1
store i32 %23, i32* %8
br label %16
24: ; preds = %16
%25 = load i32, i32* %8
%26 = icmp ugt i32 %25, 5
br i1 %26, label %27, label %29
27: ; preds = %24
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %80
29: ; preds = %24
%30 = load i32, i32* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = bitcast [5 x i32]* %9 to i8*
store i32 0, i32* %10
%33 = load i32, i32* %6
store i32 %33, i32* %11
br label %34
34: ; preds = %37, %29
%35 = load i32, i32* %11
%36 = icmp sgt i32 %35, 0
br i1 %36, label %37, label %46
37: ; preds = %34
%38 = load i32, i32* %11
%39 = srem i32 %38, 10
%40 = load i32, i32* %10
%41 = add nsw i32 %40, 1
store i32 %41, i32* %10
%42 = sext i32 %40 to i64
%43 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 %42
store i32 %39, i32* %43
%44 = load i32, i32* %11
%45 = sdiv i32 %44, 10
store i32 %45, i32* %11
br label %34
46: ; preds = %34
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%48 = load i32, i32* %8
%49 = sub i32 %48, 1
store i32 %49, i32* %12
br label %50
50: ; preds = %59, %46
%51 = load i32, i32* %12
%52 = icmp sge i32 %51, 0
br i1 %52, label %53, label %62
53: ; preds = %50
%54 = load i32, i32* %12
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 %55
%57 = load i32, i32* %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %57)
br label %59
59: ; preds = %53
%60 = load i32, i32* %12
%61 = add nsw i32 %60, -1
store i32 %61, i32* %12
br label %50
62: ; preds = %50
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %13
br label %65
65: ; preds = %75, %62
%66 = load i32, i32* %13
%67 = load i32, i32* %8
%68 = icmp ult i32 %66, %67
br i1 %68, label %69, label %78
69: ; preds = %65
%70 = load i32, i32* %13
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [5 x i32], [5 x i32]* %9, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %73)
br label %75
75: ; preds = %69
%76 = load i32, i32* %13
%77 = add nsw i32 %76, 1
store i32 %77, i32* %13
br label %65
78: ; preds = %65
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32 0, i32* %3
br label %80
80: ; preds = %78, %27
%81 = load i32, i32* %3
ret i32 %81
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [11 x i8] c"length=%d\0A\00"
@.str.3 = [11 x i8] c"ASC digit=\00"
@.str.4 = [4 x i8] c"%d \00"
@.str.6 = [11 x i8] c"DEC digit=\00"
@str = [27 x i8] c"Input number is too large.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [5 x i32]
%5 = bitcast i32* %3 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %19, label %9
9: ; preds = %2, %9
%10 = phi i32 [ %13, %9 ], [ 0, %2 ]
%11 = phi i32 [ %12, %9 ], [ %7, %2 ]
%12 = udiv i32 %11, 10
%13 = add i32 %10, 1
%14 = icmp ult i32 %11, 10
br i1 %14, label %15, label %9
15: ; preds = %9
%16 = icmp ugt i32 %13, 5
br i1 %16, label %17, label %19
17: ; preds = %15
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
br label %60
19: ; preds = %2, %15
%20 = phi i32 [ %13, %15 ], [ 0, %2 ]
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = bitcast [5 x i32]* %4 to i8*
%23 = load i32, i32* %3
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %33
25: ; preds = %19, %25
%26 = phi i64 [ %29, %25 ], [ 0, %19 ]
%27 = phi i32 [ %31, %25 ], [ %23, %19 ]
%28 = urem i32 %27, 10
%29 = add nuw i64 %26, 1
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %26
store i32 %28, i32* %30
%31 = udiv i32 %27, 10
%32 = icmp ult i32 %27, 10
br i1 %32, label %33, label %25
33: ; preds = %25, %19
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%35 = add i32 %20, -1
%36 = icmp sgt i32 %35, -1
br i1 %36, label %43, label %37
37: ; preds = %43, %33
%38 = call i32 @putchar(i32 10)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%40 = icmp eq i32 %20, 0
br i1 %40, label %51, label %41
41: ; preds = %37
%42 = zext i32 %20 to i64
br label %53
43: ; preds = %33, %43
%44 = phi i32 [ %49, %43 ], [ %35, %33 ]
%45 = zext i32 %44 to i64
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %47)
%49 = add nsw i32 %44, -1
%50 = icmp sgt i32 %44, 0
br i1 %50, label %43, label %37
51: ; preds = %53, %37
%52 = call i32 @putchar(i32 10)
br label %60
53: ; preds = %41, %53
%54 = phi i64 [ 0, %41 ], [ %58, %53 ]
%55 = getelementptr inbounds [5 x i32], [5 x i32]* %4, i64 0, i64 %54
%56 = load i32, i32* %55
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %56)
%58 = add nuw nsw i64 %54, 1
%59 = icmp eq i64 %58, %42
br i1 %59, label %51, label %53
60: ; preds = %51, %17
%61 = phi i32 [ 1, %17 ], [ 0, %51 ]
ret i32 %61
}