#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 *, int *);
int showh(int);
int showl(int);
int showt(int);
int showx(int);
int showy(int);
int main() {
  int ax, bx, cx, dx, ix, px;
  printf("Enter a number. E.g. 1380 : ");
  scanf("%d", &ix);
  if (ix != 3001) {
    ax = ix % 10;
    ix = ix / 10;
    bx = ix % 10;
    ix = ix / 10;
    cx = ix % 10;
    ix = ix / 10;
    dx = ix % 10;
    px = showt(dx);
    px = showh(cx);
    if (bx != 1) {
      px = showy(bx);
      px = showx(ax);
    }
    if (bx == 1)
      px = showl(ax);
  } else
    printf("This is greater than the required maximum value of 3000.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
call   1050 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1090 <scanf@plt>
cmpl   $0xbb9,-0x18(%rbp)
je     125a <main+0xea>
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <showt@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%edi
call   1070 <showh@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1240 <main+0xd0>
mov    -0xc(%rbp),%edi
call   1030 <showy@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
call   1080 <showx@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x1,-0xc(%rbp)
jne    1255 <main+0xe5>
mov    -0x8(%rbp),%edi
call   1060 <showl@plt>
mov    %eax,-0x1c(%rbp)
jmp    1266 <main+0xf6>
lea    0xdbf(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe71(%rip),%rdi
call   1060 <printf@plt>
lea    0xe82(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0xc(%rsp),%ebp
cmp    $0xbb9,%ebp
jne    11c2 <main+0x42>
lea    0xe68(%rip),%rdi
call   1040 <puts@plt>
jmp    1292 <main+0x112>
movslq %ebp,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%ebp
movslq %ecx,%r14
imul   $0x66666667,%r14,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%r14d
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
movslq %ecx,%rbx
imul   $0x66666667,%rbx,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%ebx
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
mov    %eax,0xc(%rsp)
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%edi
call   1050 <showt@plt>
mov    %ebx,%edi
call   1080 <showh@plt>
cmp    $0x1,%r14d
jne    1283 <main+0x103>
mov    %ebp,%edi
call   1070 <showl@plt>
jmp    1292 <main+0x112>
mov    %r14d,%edi
call   1030 <showy@plt>
mov    %ebp,%edi
call   1090 <showx@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Enter a number. E.g. 1380 : \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [58 x i8] c"This is greater than the required maximum value of 3000.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 3001
br i1 %11, label %12, label %45
12: ; preds = %0
%13 = load i32, i32* %6
%14 = srem i32 %13, 10
store i32 %14, i32* %2
%15 = load i32, i32* %6
%16 = sdiv i32 %15, 10
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = srem i32 %17, 10
store i32 %18, i32* %3
%19 = load i32, i32* %6
%20 = sdiv i32 %19, 10
store i32 %20, i32* %6
%21 = load i32, i32* %6
%22 = srem i32 %21, 10
store i32 %22, i32* %4
%23 = load i32, i32* %6
%24 = sdiv i32 %23, 10
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = srem i32 %25, 10
store i32 %26, i32* %5
%27 = load i32, i32* %5
%28 = call i32 @showt(i32 %27)
store i32 %28, i32* %7
%29 = load i32, i32* %4
%30 = call i32 @showh(i32 %29)
store i32 %30, i32* %7
%31 = load i32, i32* %3
%32 = icmp ne i32 %31, 1
br i1 %32, label %33, label %38
33: ; preds = %12
%34 = load i32, i32* %3
%35 = call i32 @showy(i32 %34)
store i32 %35, i32* %7
%36 = load i32, i32* %2
%37 = call i32 @showx(i32 %36)
store i32 %37, i32* %7
br label %38
38: ; preds = %33, %12
%39 = load i32, i32* %3
%40 = icmp eq i32 %39, 1
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %2
%43 = call i32 @showl(i32 %42)
store i32 %43, i32* %7
br label %44
44: ; preds = %41, %38
br label %47
45: ; preds = %0
%46 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.2, i64 0, i64 0))
br label %47
47: ; preds = %45, %44
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Enter a number. E.g. 1380 : \00"
@.str.1 = [3 x i8] c"%d\00"
@str = [57 x i8] c"This is greater than the required maximum value of 3000.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 3001
br i1 %6, label %23, label %7
7: ; preds = %0
%8 = srem i32 %5, 10
%9 = sdiv i32 %5, 10
%10 = srem i32 %9, 10
%11 = sdiv i32 %5, 100
%12 = srem i32 %11, 10
%13 = sdiv i32 %5, 1000
store i32 %13, i32* %1
%14 = srem i32 %13, 10
%15 = call i32 @showt(i32 %14)
%16 = call i32 @showh(i32 %12)
%17 = icmp eq i32 %10, 1
br i1 %17, label %21, label %18
18: ; preds = %7
%19 = call i32 @showy(i32 %10)
%20 = call i32 @showx(i32 %8)
br label %25
21: ; preds = %7
%22 = call i32 @showl(i32 %8)
br label %25
23: ; preds = %0
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str, i64 0, i64 0))
br label %25
25: ; preds = %18, %21, %23
ret i32 0
}